blob: 4547d2c4b737c83bde89d647c688aedfbdb58257 [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
Jakub Pawlowski4a635282016-10-06 16:53:23 -070026class BleAdvertiserInterface {
27 public:
28 virtual ~BleAdvertiserInterface() = default;
Jakub Pawlowski6ecdb8c2016-07-13 11:53:55 -070029
Jakub Pawlowski555b8ae2016-11-04 12:05:37 -070030 /** Callback invoked when multi-adv operation has completed */
31 using Callback = base::Callback<void(uint8_t /* status */)>;
32
Jakub Pawlowski4a635282016-10-06 16:53:23 -070033 /** Registers an advertiser with the stack */
34 virtual void RegisterAdvertiser(
Jakub Pawlowski555b8ae2016-11-04 12:05:37 -070035 base::Callback<void(uint8_t /* advertiser_id */,
36 uint8_t /* status */)>) = 0;
Jakub Pawlowskif82a2492016-10-31 11:14:05 -070037
Jakub Pawlowski4a635282016-10-06 16:53:23 -070038 /* Set the parameters as per spec, user manual specified values */
Jakub Pawlowski555b8ae2016-11-04 12:05:37 -070039 virtual void SetParameters(int advertiser_id, int min_interval,
40 int max_interval, int adv_type, int chnl_map,
41 int tx_power, Callback cb) = 0;
Jakub Pawlowski6ecdb8c2016-07-13 11:53:55 -070042
Jakub Pawlowski555b8ae2016-11-04 12:05:37 -070043 /* Setup the data */
44 virtual void SetData(int advertiser_id, bool set_scan_rsp,
45 std::vector<uint8_t> data, Callback cb) = 0;
Jakub Pawlowski6ecdb8c2016-07-13 11:53:55 -070046
Jakub Pawlowski555b8ae2016-11-04 12:05:37 -070047 /* Enable the advertising instance */
48 virtual void Enable(uint8_t advertiser_id, bool enable, Callback cb,
49 int timeout_s, Callback timeout_cb) = 0;
50
51 /* Unregisters an advertiser */
52 virtual void Unregister(uint8_t advertiser_id) = 0;
Jakub Pawlowski4a635282016-10-06 16:53:23 -070053};
Jakub Pawlowski6ecdb8c2016-07-13 11:53:55 -070054
55#endif /* ANDROID_INCLUDE_BLE_ADVERTISER_H */