blob: e7c169cec29a78841ae9801070041f2c3e522e86 [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
34/** Callback invoked when multi-adv enable operation has completed */
35typedef void (*multi_adv_enable_callback)(int advertiser_id, int status);
36
37/** Callback invoked when multi-adv param update operation has completed */
38typedef void (*multi_adv_update_callback)(int advertiser_id, int status);
39
40/** Callback invoked when multi-adv instance data set operation has completed */
41typedef void (*multi_adv_data_callback)(int advertiser_id, int status);
42
43/** Callback invoked when multi-adv disable operation has completed */
44typedef void (*multi_adv_disable_callback)(int advertiser_id, int status);
45
46typedef struct {
47 register_advertiser_callback register_advertiser_cb;
48 multi_adv_enable_callback multi_adv_enable_cb;
49 multi_adv_update_callback multi_adv_update_cb;
50 multi_adv_data_callback multi_adv_data_cb;
51 multi_adv_disable_callback multi_adv_disable_cb;
52} ble_advertiser_callbacks_t;
53
54typedef struct {
55 /** Registers an advertiser with the stack */
56 bt_status_t (*register_advertiser)(bt_uuid_t *uuid);
57
58 /** Unregister a advertiser from the stack */
59 bt_status_t (*unregister_advertiser)(int advertiser_id);
60
61 /** Set the advertising data or scan response data */
62 bt_status_t (*set_adv_data)(int advertiser_id, bool set_scan_rsp, bool include_name,
63 bool include_txpower, int min_interval, int max_interval, int appearance,
64 vector<uint8_t> manufacturer_data,
65 vector<uint8_t> service_data,
66 vector<uint8_t> service_uuid);
67
68 /* Set up the parameters as per spec, user manual specified values and enable multi ADV */
69 bt_status_t (*multi_adv_enable)(int advertiser_id, int min_interval,int max_interval,int adv_type,
70 int chnl_map, int tx_power, int timeout_s);
71
72 /* Update the parameters as per spec, user manual specified values and restart multi ADV */
73 bt_status_t (*multi_adv_update)(int advertiser_id, int min_interval,int max_interval,int adv_type,
74 int chnl_map, int tx_power, int timeout_s);
75
76 /* Setup the data for the specified instance */
77 bt_status_t (*multi_adv_set_inst_data)(int advertiser_id, bool set_scan_rsp, bool include_name,
78 bool incl_txpower, int appearance, vector<uint8_t> manufacturer_data,
79 vector<uint8_t> service_data, vector<uint8_t> service_uuid);
80
81 /* Disable the multi adv instance */
82 bt_status_t (*multi_adv_disable)(int advertiser_id);
83
84} ble_advertiser_interface_t;
85
86__END_DECLS
87
88#endif /* ANDROID_INCLUDE_BLE_ADVERTISER_H */