blob: acd9169b6ca6a9df9870d4909493fe821e63888a [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
Jakub Pawlowski6ecdb8c2016-07-13 11:53:55 -070017#ifndef ANDROID_INCLUDE_BLE_ADVERTISER_H
18#define ANDROID_INCLUDE_BLE_ADVERTISER_H
19
Jakub Pawlowski4a635282016-10-06 16:53:23 -070020#include <base/callback_forward.h>
Jakub Pawlowski6ecdb8c2016-07-13 11:53:55 -070021#include <stdint.h>
22#include <vector>
Jakub Pawlowski6ecdb8c2016-07-13 11:53:55 -070023#include "bt_common_types.h"
Jakub Pawlowski4a635282016-10-06 16:53:23 -070024#include "bt_gatt_types.h"
Jakub Pawlowski6ecdb8c2016-07-13 11:53:55 -070025
26using std::vector;
27
Jakub Pawlowski4a635282016-10-06 16:53:23 -070028/** Callback invoked when multi-adv operation has completed */
29using BleAdvertiserCb = base::Callback<void(uint8_t /* status */)>;
Jakub Pawlowski6ecdb8c2016-07-13 11:53:55 -070030
Jakub Pawlowski4a635282016-10-06 16:53:23 -070031class BleAdvertiserInterface {
32 public:
33 virtual ~BleAdvertiserInterface() = default;
Jakub Pawlowski6ecdb8c2016-07-13 11:53:55 -070034
Jakub Pawlowski4a635282016-10-06 16:53:23 -070035 /** Registers an advertiser with the stack */
36 virtual void RegisterAdvertiser(
37 base::Callback<void(uint8_t /* advertiser_id */, uint8_t /* status */)>) = 0;
Jakub Pawlowski6ecdb8c2016-07-13 11:53:55 -070038
Jakub Pawlowski4a635282016-10-06 16:53:23 -070039 /* This function disable a Multi-ADV instance */
40 virtual void Unregister(uint8_t advertiser_id) = 0;
Jakub Pawlowski6ecdb8c2016-07-13 11:53:55 -070041
Jakub Pawlowski4a635282016-10-06 16:53:23 -070042 /** Set the advertising data or scan response data */
43 virtual void SetData(int advertiser_id, bool set_scan_rsp, bool include_name,
44 bool include_txpower, int min_interval, int max_interval,
45 int appearance, vector<uint8_t> manufacturer_data,
46 vector<uint8_t> service_data,
47 vector<uint8_t> service_uuid) = 0;
Jakub Pawlowski6ecdb8c2016-07-13 11:53:55 -070048
Jakub Pawlowski4a635282016-10-06 16:53:23 -070049 /* Set the parameters as per spec, user manual specified values */
50 virtual void MultiAdvSetParameters(int advertiser_id, int min_interval,
51 int max_interval, int adv_type,
52 int chnl_map, int tx_power,
53 BleAdvertiserCb cb) = 0;
Jakub Pawlowski6ecdb8c2016-07-13 11:53:55 -070054
Jakub Pawlowski4a635282016-10-06 16:53:23 -070055 /* Setup the data for the specified instance */
56 virtual void MultiAdvSetInstData(int advertiser_id, bool set_scan_rsp,
57 bool include_name, bool incl_txpower,
58 int appearance,
59 vector<uint8_t> manufacturer_data,
60 vector<uint8_t> service_data,
61 vector<uint8_t> service_uuid,
62 BleAdvertiserCb cb) = 0;
Jakub Pawlowski6ecdb8c2016-07-13 11:53:55 -070063
Jakub Pawlowski4a635282016-10-06 16:53:23 -070064 /* Enable the advertising instance as per spec */
65 virtual void MultiAdvEnable(uint8_t advertiser_id, bool enable,
66 BleAdvertiserCb cb, int timeout_s,
67 BleAdvertiserCb timeout_cb) = 0;
68};
Jakub Pawlowski6ecdb8c2016-07-13 11:53:55 -070069
70#endif /* ANDROID_INCLUDE_BLE_ADVERTISER_H */