Skip to content

Commit f80ce69

Browse files
author
Rohit Grover
committed
add comment headers to the commonly used functions of BLE_API
1 parent 906d8cc commit f80ce69

File tree

1 file changed

+79
-3
lines changed

1 file changed

+79
-3
lines changed

hw/BLEDevice.h

Lines changed: 79 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ extern BLEDeviceInstanceBase *createBLEDeviceInstance(void);
4141
class BLEDevice
4242
{
4343
public:
44+
/**
45+
* Initialize the BLE controller. This should be called before using
46+
* anything else in the BLE_API.
47+
*/
4448
ble_error_t init();
4549
ble_error_t reset(void);
4650

@@ -116,29 +120,102 @@ class BLEDevice
116120
*/
117121
void setAdvertisingParams(const GapAdvertisingParams &advParams);
118122

123+
/**
124+
* Reset any advertising payload prepared from prior calls to
125+
* accumulateAdvertisingPayload().
126+
*/
119127
void clearAdvertisingPayload(void);
128+
129+
/**
130+
* Accumulate an AD structure in the advertising payload. Please note that
131+
* the payload is limited to 31 bytes. The SCAN_RESPONSE message may be used
132+
* as an additional 31 bytes if the advertising payload proves to be too
133+
* small.
134+
*
135+
* @param flags
136+
* The flag to be added.
137+
*/
120138
ble_error_t accumulateAdvertisingPayload(GapAdvertisingData::Flags flags);
139+
140+
/**
141+
* Accumulate an AD structure in the advertising payload. Please note that
142+
* the payload is limited to 31 bytes. The SCAN_RESPONSE message may be used
143+
* as an additional 31 bytes if the advertising payload proves to be too
144+
* small.
145+
*
146+
* @param app
147+
* The appearance of the peripheral.
148+
*/
121149
ble_error_t accumulateAdvertisingPayload(GapAdvertisingData::Appearance app);
150+
151+
/**
152+
* Accumulate an AD structure in the advertising payload. Please note that
153+
* the payload is limited to 31 bytes. The SCAN_RESPONSE message may be used
154+
* as an additional 31 bytes if the advertising payload proves to be too
155+
* small.
156+
*
157+
* @param app
158+
* The max transmit power to be used by the controller. This is
159+
* only a hint.
160+
*/
122161
ble_error_t accumulateAdvertisingPayloadTxPower(int8_t power);
162+
163+
/**
164+
* @param app
165+
* The appearance of the peripheral.
166+
*/
167+
/**
168+
* Accumulate a variable length byte-stream as an AD structure in the
169+
* advertising payload. Please note that the payload is limited to 31 bytes.
170+
* The SCAN_RESPONSE message may be used as an additional 31 bytes if the
171+
* advertising payload proves to be too small.
172+
*
173+
* @param type The type which describes the variable length data.
174+
* @param data data bytes.
175+
* @param len length of data.
176+
*/
123177
ble_error_t accumulateAdvertisingPayload(GapAdvertisingData::DataType type, const uint8_t *data, uint8_t len);
124178

179+
/**
180+
* Start advertising (GAP Discoverable, Connectable modes, Broadcast
181+
* Procedure).
182+
*/
125183
ble_error_t startAdvertising(void);
184+
185+
/**
186+
* Stop advertising (GAP Discoverable, Connectable modes, Broadcast
187+
* Procedure).
188+
*/
126189
ble_error_t stopAdvertising(void);
127190

128191
ble_error_t disconnect(void);
129192

130193
/* APIs to set GAP callbacks. */
131194
void onTimeout(Gap::EventCallback_t timeoutCallback);
132195
void onConnection(Gap::EventCallback_t connectionCallback);
196+
/**
197+
* Used to setup a callback for GAP disconnection.
198+
*/
133199
void onDisconnection(Gap::EventCallback_t disconnectionCallback);
134200

135-
/* APIs to set GATT server callbacks */
201+
/**
202+
* Setup a callback for the GATT event DATA_SENT.
203+
*/
136204
void onDataSent(GattServer::EventCallback_t callback);
205+
206+
/**
207+
* Setup a callback for when a characteristic has its value updated by a
208+
* client.
209+
*/
137210
void onDataWritten(GattServer::EventCallback_t callback);
138211
void onUpdatesEnabled(GattServer::EventCallback_t callback);
139212
void onUpdatesDisabled(GattServer::EventCallback_t callback);
140213
void onConfirmationReceived(GattServer::EventCallback_t callback);
141214

215+
/**
216+
* Add a service declaration to the local server ATT table. Also add the
217+
* characteristics contained within.
218+
*/
142219
ble_error_t addService(GattService &service);
143220

144221
Gap::GapState_t getGapState(void) const;
@@ -177,8 +254,7 @@ class BLEDevice
177254

178255
/* Accumulation of AD structures in the advertisement payload should
179256
* eventually result in a call to the target's setAdvertisingData() before
180-
* the server begins advertising. This flag marks the status of the pending
181-
* update.*/
257+
* the server begins advertising. This flag marks the status of the pending update.*/
182258
bool needToUpdateAdvData;
183259

184260
/**

0 commit comments

Comments
 (0)