blob: 389bdbb4c95f6edca2fa44b5fe26b46769ecb48f [file] [log] [blame]
Jakub Pawlowski6ecdb8c2016-07-13 11:53:55 -07001/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17
18#ifndef ANDROID_INCLUDE_BLE_ADVERTISER_H
19#define ANDROID_INCLUDE_BLE_ADVERTISER_H
20
21#include <stdint.h>
22#include <vector>
23#include "bt_gatt_types.h"
24#include "bt_common_types.h"
25
26using std::vector;
27
28__BEGIN_DECLS
29
30/** Callback invoked in response to register_advertiser */
31typedef void (*register_advertiser_callback)(int status, int advertiser_id,
32 bt_uuid_t *uuid);
33
Jakub Pawlowskibb84c862016-08-23 07:17:28 -070034/** Callback invoked when multi-adv param set_params operation has completed */
35typedef void (*multi_adv_set_params_callback)(int advertiser_id, int status);
Jakub Pawlowski6ecdb8c2016-07-13 11:53:55 -070036
37/** Callback invoked when multi-adv instance data set operation has completed */
38typedef void (*multi_adv_data_callback)(int advertiser_id, int status);
39
Jakub Pawlowskibb84c862016-08-23 07:17:28 -070040/** Callback invoked when multi-adv enable operation has completed */
41typedef void (*multi_adv_enable_callback)(int advertiser_id, int status, bool enable);
Jakub Pawlowski6ecdb8c2016-07-13 11:53:55 -070042
43typedef struct {
44 register_advertiser_callback register_advertiser_cb;
Jakub Pawlowskibb84c862016-08-23 07:17:28 -070045 multi_adv_set_params_callback multi_adv_set_params_cb;
Jakub Pawlowski6ecdb8c2016-07-13 11:53:55 -070046 multi_adv_data_callback multi_adv_data_cb;
Jakub Pawlowskibb84c862016-08-23 07:17:28 -070047 multi_adv_enable_callback multi_adv_enable_cb;
Jakub Pawlowski6ecdb8c2016-07-13 11:53:55 -070048} ble_advertiser_callbacks_t;
49
50typedef struct {
51 /** Registers an advertiser with the stack */
52 bt_status_t (*register_advertiser)(bt_uuid_t *uuid);
53
54 /** Unregister a advertiser from the stack */
55 bt_status_t (*unregister_advertiser)(int advertiser_id);
56
57 /** Set the advertising data or scan response data */
58 bt_status_t (*set_adv_data)(int advertiser_id, bool set_scan_rsp, bool include_name,
59 bool include_txpower, int min_interval, int max_interval, int appearance,
60 vector<uint8_t> manufacturer_data,
61 vector<uint8_t> service_data,
62 vector<uint8_t> service_uuid);
63
Jakub Pawlowskibb84c862016-08-23 07:17:28 -070064 /* Set the parameters as per spec, user manual specified values */
65 bt_status_t (*multi_adv_set_params)(int advertiser_id, int min_interval,int max_interval,int adv_type,
66 int chnl_map, int tx_power);
Jakub Pawlowski6ecdb8c2016-07-13 11:53:55 -070067
Jakub Pawlowski6ecdb8c2016-07-13 11:53:55 -070068
69 /* Setup the data for the specified instance */
70 bt_status_t (*multi_adv_set_inst_data)(int advertiser_id, bool set_scan_rsp, bool include_name,
71 bool incl_txpower, int appearance, vector<uint8_t> manufacturer_data,
72 vector<uint8_t> service_data, vector<uint8_t> service_uuid);
73
Jakub Pawlowskibb84c862016-08-23 07:17:28 -070074 /* Enable the advertising instance as per spec */
75 bt_status_t (*multi_adv_enable)(int advertiser_id, bool enable, int timeout_s);
Jakub Pawlowski6ecdb8c2016-07-13 11:53:55 -070076
77} ble_advertiser_interface_t;
78
79__END_DECLS
80
81#endif /* ANDROID_INCLUDE_BLE_ADVERTISER_H */