Bill Schilit / BLE_API

Fork of BLE_API by Bluetooth Low Energy

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers BLEDevice.h Source File

BLEDevice.h

00001 /* mbed Microcontroller Library
00002  * Copyright (c) 2006-2013 ARM Limited
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef __BLE_DEVICE__
00018 #define __BLE_DEVICE__
00019 
00020 #include "blecommon.h"
00021 #include "Gap.h"
00022 #include "GattServer.h"
00023 #include "BLEDeviceInstanceBase.h"
00024 
00025 /**
00026  * The base class used to abstract away BLE capable radio transceivers or SOCs,
00027  * to enable this BLE API to work with any radio transparently.
00028  */
00029 class BLEDevice
00030 {
00031 public:
00032     /**
00033      * Initialize the BLE controller. This should be called before using
00034      * anything else in the BLE_API.
00035      */
00036     ble_error_t init();
00037     ble_error_t reset(void);
00038 
00039     /**
00040      * Purge the BLE stack of GATT and GAP state. init() must be called afterwards to re-instate services and GAP state.
00041      */
00042     ble_error_t shutdown(void);
00043 
00044     /* GAP specific APIs */
00045 public:
00046     /**
00047      * Set the BTLE MAC address and type.
00048      * @return BLE_ERROR_NONE on success.
00049      */
00050     ble_error_t setAddress(Gap::addr_type_t type, const Gap::address_t address);
00051 
00052     /**
00053      * Fetch the BTLE MAC address and type.
00054      * @return BLE_ERROR_NONE on success.
00055      */
00056     ble_error_t getAddress(Gap::addr_type_t *typeP, Gap::address_t address);
00057 
00058     /**
00059      * @param[in] advType
00060      *              The GAP advertising mode to use for this device. Valid
00061      *              values are defined in AdvertisingType:
00062      *
00063      *              \par ADV_NON_CONNECTABLE_UNDIRECTED
00064      *              All connections to the peripheral device will be refused.
00065      *
00066      *              \par ADV_CONNECTABLE_DIRECTED
00067      *              Only connections from a pre-defined central device will be
00068      *              accepted.
00069      *
00070      *              \par ADV_CONNECTABLE_UNDIRECTED
00071      *              Any central device can connect to this peripheral.
00072      *
00073      *              \par ADV_SCANNABLE_UNDIRECTED
00074      *              Any central device can connect to this peripheral, and
00075      *              the secondary Scan Response payload will be included or
00076      *              available to central devices.
00077      *
00078      *              \par
00079      *              See Bluetooth Core Specification 4.0 (Vol. 3), Part C,
00080      *              Section 9.3 and Core Specification 4.0 (Vol. 6), Part B,
00081      *              Section 2.3.1 for further information on GAP connection
00082      *              modes
00083      */
00084     void        setAdvertisingType (GapAdvertisingParams::AdvertisingType);
00085 
00086     /**
00087      * @param[in] interval
00088      *              Advertising interval between 0x0020 and 0x4000 in 0.625ms
00089      *              units (20ms to 10.24s).  If using non-connectable mode
00090      *              (ADV_NON_CONNECTABLE_UNDIRECTED) this min value is
00091      *              0x00A0 (100ms). To reduce the likelihood of collisions, the
00092      *              link layer perturbs this interval by a pseudo-random delay
00093      *              with a range of 0 ms to 10 ms for each advertising event.
00094      *
00095      *              \par
00096      *              Decreasing this value will allow central devices to detect
00097      *              your peripheral faster at the expense of more power being
00098      *              used by the radio due to the higher data transmit rate.
00099      *
00100      *              \par
00101      *              This field must be set to 0 if connectionMode is equal
00102      *              to ADV_CONNECTABLE_DIRECTED
00103      *
00104      *              \par
00105      *              See Bluetooth Core Specification, Vol 3., Part C,
00106      *              Appendix A for suggested advertising intervals.
00107      */
00108     void        setAdvertisingInterval (uint16_t interval);
00109 
00110     /**
00111      * @param[in] timeout
00112      *              Advertising timeout between 0x1 and 0x3FFF (1 and 16383)
00113      *              in seconds.  Enter 0 to disable the advertising timeout.
00114      */
00115     void        setAdvertisingTimeout (uint16_t timeout);
00116 
00117     /**
00118      * Please refer to the APIs above.
00119      */
00120     void        setAdvertisingParams(const GapAdvertisingParams &advParams);
00121 
00122     /**
00123      * This API is typically used as an internal helper to udpate the transport
00124      * backend with advertising data before starting to advertise. It may also
00125      * be explicity used to dynamically reset the accumulated advertising
00126      * payload and scanResponse; to do this, the application can clear and re-
00127      * accumulate a new advertising payload (and scanResponse) before using this
00128      * API.
00129      */
00130     ble_error_t setAdvertisingPayload(void);
00131 
00132     /**
00133      * Reset any advertising payload prepared from prior calls to
00134      * accumulateAdvertisingPayload().
00135      */
00136     void        clearAdvertisingPayload(void);
00137 
00138     /**
00139      * Accumulate an AD structure in the advertising payload. Please note that
00140      * the payload is limited to 31 bytes. The SCAN_RESPONSE message may be used
00141      * as an additional 31 bytes if the advertising payload proves to be too
00142      * small.
00143      *
00144      * @param  flags
00145      *         The flags to be added. Multiple flags may be specified in
00146      *         combination.
00147      */
00148     ble_error_t accumulateAdvertisingPayload(uint8_t flags);
00149 
00150     /**
00151      * Accumulate an AD structure in the advertising payload. Please note that
00152      * the payload is limited to 31 bytes. The SCAN_RESPONSE message may be used
00153      * as an additional 31 bytes if the advertising payload proves to be too
00154      * small.
00155      *
00156      * @param  app
00157      *         The appearance of the peripheral.
00158      */
00159     ble_error_t accumulateAdvertisingPayload(GapAdvertisingData::Appearance app);
00160 
00161     /**
00162      * Accumulate an AD structure in the advertising payload. Please note that
00163      * the payload is limited to 31 bytes. The SCAN_RESPONSE message may be used
00164      * as an additional 31 bytes if the advertising payload proves to be too
00165      * small.
00166      *
00167      * @param  app
00168      *         The max transmit power to be used by the controller. This is
00169      *         only a hint.
00170      */
00171     ble_error_t accumulateAdvertisingPayloadTxPower(int8_t power);
00172 
00173     /**
00174      * Accumulate a variable length byte-stream as an AD structure in the
00175      * advertising payload. Please note that the payload is limited to 31 bytes.
00176      * The SCAN_RESPONSE message may be used as an additional 31 bytes if the
00177      * advertising payload proves to be too small.
00178      *
00179      * @param  type The type which describes the variable length data.
00180      * @param  data data bytes.
00181      * @param  len  length of data.
00182      */
00183     ble_error_t accumulateAdvertisingPayload(GapAdvertisingData::DataType type, const uint8_t *data, uint8_t len);
00184 
00185     /**
00186      * Accumulate a variable length byte-stream as an AD structure in the
00187      * scanResponse payload.
00188      *
00189      * @param  type The type which describes the variable length data.
00190      * @param  data data bytes.
00191      * @param  len  length of data.
00192      */
00193     ble_error_t accumulateScanResponse(GapAdvertisingData::DataType type, const uint8_t *data, uint8_t len);
00194 
00195     /**
00196      * Start advertising (GAP Discoverable, Connectable modes, Broadcast
00197      * Procedure).
00198      */
00199     ble_error_t startAdvertising(void);
00200 
00201     /**
00202      * Stop advertising (GAP Discoverable, Connectable modes, Broadcast
00203      * Procedure).
00204      */
00205     ble_error_t stopAdvertising(void);
00206 
00207     ble_error_t disconnect(Gap::DisconnectionReason_t reason);
00208 
00209     /* APIs to set GAP callbacks. */
00210     void onTimeout(Gap::EventCallback_t timeoutCallback);
00211 
00212     void onConnection(Gap::ConnectionEventCallback_t connectionCallback);
00213     /**
00214      * Used to setup a callback for GAP disconnection.
00215      */
00216     void onDisconnection(Gap::DisconnectionEventCallback_t disconnectionCallback);
00217 
00218     /**
00219      * Append to a chain of callbacks to be invoked upon disconnection; these
00220      * callbacks receive no context and are therefore different from the
00221      * onDisconnection callback.
00222      */
00223     template<typename T>
00224     void addToDisconnectionCallChain(T *tptr, void (T::*mptr)(void));
00225 
00226     /**
00227      * Setup a callback for the GATT event DATA_SENT.
00228      */
00229     void onDataSent(GattServer::ServerEventCallbackWithCount_t callback);
00230 
00231     /**
00232      * Setup a callback for when a characteristic has its value updated by a
00233      * client.
00234      *
00235      * @Note: it is possible to chain together multiple onDataWritten callbacks
00236      * (potentially from different modules of an application) to receive updates
00237      * to characteristics. Many services, such as DFU and UART add their own
00238      * onDataWritten callbacks behind the scenes to trap interesting events.
00239      *
00240      * @Note: it is also possible to setup a callback into a member function of
00241      * some object.
00242      */
00243     void onDataWritten(void (*callback)(const GattCharacteristicWriteCBParams *eventDataP));
00244     template <typename T> void onDataWritten(T * objPtr, void (T::*memberPtr)(const GattCharacteristicWriteCBParams *context));
00245 
00246     void onUpdatesEnabled(GattServer::EventCallback_t callback);
00247     void onUpdatesDisabled(GattServer::EventCallback_t callback);
00248     void onConfirmationReceived(GattServer::EventCallback_t callback);
00249 
00250     /**
00251      * Add a service declaration to the local server ATT table. Also add the
00252      * characteristics contained within.
00253      */
00254     ble_error_t addService(GattService &service);
00255 
00256     Gap::GapState_t getGapState(void) const;
00257 
00258     /**
00259      * @param[in/out]  lengthP
00260      *     input:  Length in bytes to be read,
00261      *     output: Total length of attribute value upon successful return.
00262      */
00263     ble_error_t readCharacteristicValue (uint16_t handle, uint8_t *const buffer, uint16_t *const lengthP);
00264 
00265     /**
00266      * @param  localOnly
00267      *         Only update the characteristic locally regardless of notify/indicate flags in the CCCD.
00268      */
00269     ble_error_t updateCharacteristicValue (uint16_t handle, const uint8_t *value, uint16_t size, bool localOnly = false);
00270 
00271     /**
00272      * Yield control to the BLE stack or to other tasks waiting for events. This
00273      * is a sleep function which will return when there is an application
00274      * specific interrupt, but the MCU might wake up several times before
00275      * returning (to service the stack). This is not always interchangeable with
00276      * WFE().
00277      */
00278     void waitForEvent(void);
00279 
00280     ble_error_t getPreferredConnectionParams(Gap::ConnectionParams_t *params);
00281     ble_error_t setPreferredConnectionParams(const Gap::ConnectionParams_t *params);
00282     ble_error_t updateConnectionParams(Gap::Handle_t handle, const Gap::ConnectionParams_t *params);
00283 
00284     /**
00285      * This call allows the application to get the BLE stack version information.
00286      *
00287      * @return  A pointer to a const string representing the version.
00288      *          Note: The string is owned by the BLE_API.
00289      */
00290     const char *getVersion(void);
00291 
00292     /**
00293      * Set the device name characteristic in the GAP service.
00294      * @param  deviceName The new value for the device-name. This is a UTF-8 encoded, <b>NULL-terminated</b> string.
00295      */
00296     ble_error_t setDeviceName(const uint8_t *deviceName);
00297 
00298     /**
00299      * Get the value of the device name characteristic in the GAP service.
00300      * @param[out]    deviceName Pointer to an empty buffer where the UTF-8 *non NULL-
00301      *                           terminated* string will be placed. Set this
00302      *                           value to NULL in order to obtain the deviceName-length
00303      *                           from the 'length' parameter.
00304      *
00305      * @param[in/out] lengthP    (on input) Length of the buffer pointed to by deviceName;
00306      *                           (on output) the complete device name length (without the
00307      *                           null terminator).
00308      *
00309      * @note          If the device name is longer than the size of the supplied buffer,
00310      *                length will return the complete device name length,
00311      *                and not the number of bytes actually returned in deviceName.
00312      *                The application may use this information to retry with a suitable buffer size.
00313      *
00314      * Sample use:
00315      *     uint8_t deviceName[20];
00316      *     unsigned length = sizeof(deviceName);
00317      *     ble.getDeviceName(deviceName, &length);
00318      *     if (length < sizeof(deviceName)) {
00319      *         deviceName[length] = 0;
00320      *     }
00321      *     DEBUG("length: %u, deviceName: %s\r\n", length, deviceName);
00322      */
00323     ble_error_t getDeviceName(uint8_t *deviceName, unsigned *lengthP);
00324 
00325     /**
00326      * Set the appearance characteristic in the GAP service.
00327      * @param[in]  appearance The new value for the device-appearance.
00328      */
00329     ble_error_t setAppearance(uint16_t appearance);
00330 
00331     /**
00332      * Set the appearance characteristic in the GAP service.
00333      * @param[out]  appearance The new value for the device-appearance.
00334      */
00335     ble_error_t getAppearance(uint16_t *appearanceP);
00336 
00337     /**
00338      * Set the radio's transmit power.
00339      * @param[in] txPower Radio transmit power in dBm.
00340      */
00341     ble_error_t setTxPower(int8_t txPower);
00342 
00343 public:
00344     BLEDevice() : transport(createBLEDeviceInstance()), advParams(), advPayload(), scanResponse(), needToSetAdvPayload(true) {
00345         advPayload.clear();
00346         scanResponse.clear();
00347     }
00348 
00349 private:
00350     BLEDeviceInstanceBase *const transport; /* the device specific backend */
00351 
00352     GapAdvertisingParams advParams;
00353     GapAdvertisingData   advPayload;
00354     GapAdvertisingData   scanResponse;
00355 
00356     /* Accumulation of AD structures in the advertisement payload should
00357      * eventually result in a call to the target's setAdvertisingData() before
00358      * the server begins advertising. This flag marks the status of the pending update.*/
00359     bool                 needToSetAdvPayload;
00360 
00361     /**
00362      * DEPRECATED
00363      */
00364 public:
00365     ble_error_t setAdvertisingData(const GapAdvertisingData &ADStructures, const GapAdvertisingData &scanResponse);
00366     ble_error_t setAdvertisingData(const GapAdvertisingData &ADStructures);
00367 
00368     ble_error_t startAdvertising(const GapAdvertisingParams &advParams);
00369 };
00370 
00371 /* BLEDevice methods. Most of these simply forward the calls to the underlying
00372  * transport.*/
00373 
00374 inline ble_error_t
00375 BLEDevice::reset(void)
00376 {
00377     return transport->reset();
00378 }
00379 
00380 inline ble_error_t
00381 BLEDevice::shutdown(void)
00382 {
00383     clearAdvertisingPayload();
00384     return transport->shutdown();
00385 }
00386 
00387 inline ble_error_t
00388 BLEDevice::setAddress(Gap::addr_type_t type, const Gap::address_t address)
00389 {
00390     return transport->getGap().setAddress(type, address);
00391 }
00392 
00393 inline ble_error_t
00394 BLEDevice::getAddress(Gap::addr_type_t *typeP, Gap::address_t address)
00395 {
00396     return transport->getGap().getAddress(typeP, address);
00397 }
00398 
00399 inline void
00400 BLEDevice::setAdvertisingType (GapAdvertisingParams::AdvertisingType advType)
00401 {
00402     advParams.setAdvertisingType(advType);
00403 }
00404 
00405 inline void
00406 BLEDevice::setAdvertisingInterval (uint16_t interval)
00407 {
00408     advParams.setInterval(interval);
00409 }
00410 
00411 inline void
00412 BLEDevice::setAdvertisingTimeout (uint16_t timeout)
00413 {
00414     advParams.setTimeout(timeout);
00415 }
00416 
00417 inline void
00418 BLEDevice::setAdvertisingParams(const GapAdvertisingParams &newAdvParams)
00419 {
00420     advParams = newAdvParams;
00421 }
00422 
00423 inline void
00424 BLEDevice::clearAdvertisingPayload(void)
00425 {
00426     needToSetAdvPayload = true;
00427     advPayload.clear();
00428 }
00429 
00430 inline ble_error_t
00431 BLEDevice::accumulateAdvertisingPayload(uint8_t flags)
00432 {
00433     needToSetAdvPayload = true;
00434     return advPayload.addFlags(flags);
00435 }
00436 
00437 inline ble_error_t
00438 BLEDevice::accumulateAdvertisingPayload(GapAdvertisingData::Appearance app)
00439 {
00440     needToSetAdvPayload = true;
00441     transport->getGap().setAppearance(app);
00442     return advPayload.addAppearance(app);
00443 }
00444 
00445 inline ble_error_t
00446 BLEDevice::accumulateAdvertisingPayloadTxPower(int8_t txPower)
00447 {
00448     needToSetAdvPayload = true;
00449     return advPayload.addTxPower(txPower);
00450 }
00451 
00452 inline ble_error_t
00453 BLEDevice::accumulateAdvertisingPayload(GapAdvertisingData::DataType type, const uint8_t *data, uint8_t len)
00454 {
00455     needToSetAdvPayload = true;
00456     if (type == GapAdvertisingData::COMPLETE_LOCAL_NAME) {
00457         transport->getGap().setDeviceName(data);
00458     }
00459     return advPayload.addData(type, data, len);
00460 }
00461 
00462 inline ble_error_t
00463 BLEDevice::accumulateScanResponse(GapAdvertisingData::DataType type, const uint8_t *data, uint8_t len)
00464 {
00465     needToSetAdvPayload = true;
00466     return scanResponse.addData(type, data, len);
00467 }
00468 
00469 inline ble_error_t
00470 BLEDevice::setAdvertisingPayload(void) {
00471     needToSetAdvPayload = false;
00472     return transport->getGap().setAdvertisingData(advPayload, scanResponse);
00473 }
00474 
00475 inline ble_error_t
00476 BLEDevice::startAdvertising(void)
00477 {
00478     ble_error_t rc;
00479     if ((rc = transport->getGattServer().initializeGATTDatabase()) != BLE_ERROR_NONE) {
00480         return rc;
00481     }
00482     if (needToSetAdvPayload) {
00483         if ((rc = setAdvertisingPayload()) != BLE_ERROR_NONE) {
00484             return rc;
00485         }
00486     }
00487 
00488     return transport->getGap().startAdvertising(advParams);
00489 }
00490 
00491 inline ble_error_t
00492 BLEDevice::stopAdvertising(void)
00493 {
00494     return transport->getGap().stopAdvertising();
00495 }
00496 
00497 inline ble_error_t
00498 BLEDevice::disconnect(Gap::DisconnectionReason_t reason)
00499 {
00500     return transport->getGap().disconnect(reason);
00501 }
00502 
00503 inline void
00504 BLEDevice::onTimeout(Gap::EventCallback_t timeoutCallback)
00505 {
00506     transport->getGap().setOnTimeout(timeoutCallback);
00507 }
00508 
00509 inline void
00510 BLEDevice::onConnection(Gap::ConnectionEventCallback_t connectionCallback)
00511 {
00512     transport->getGap().setOnConnection(connectionCallback);
00513 }
00514 
00515 inline void
00516 BLEDevice::onDisconnection(Gap::DisconnectionEventCallback_t disconnectionCallback)
00517 {
00518     transport->getGap().setOnDisconnection(disconnectionCallback);
00519 }
00520 
00521 template<typename T>
00522 inline void
00523 BLEDevice::addToDisconnectionCallChain(T *tptr, void (T::*mptr)(void)) {
00524     transport->getGap().addToDisconnectionCallChain(tptr, mptr);
00525 }
00526 
00527 inline void
00528 BLEDevice::onDataSent(GattServer::ServerEventCallbackWithCount_t callback)
00529 {
00530     transport->getGattServer().setOnDataSent(callback);
00531 }
00532 
00533 inline void
00534 BLEDevice::onDataWritten(void (*callback)(const GattCharacteristicWriteCBParams *eventDataP)) {
00535     transport->getGattServer().setOnDataWritten(callback);
00536 }
00537 
00538 template <typename T> inline void
00539 BLEDevice::onDataWritten(T *objPtr, void (T::*memberPtr)(const GattCharacteristicWriteCBParams *context)) {
00540     transport->getGattServer().setOnDataWritten(objPtr, memberPtr);
00541 }
00542 
00543 inline void
00544 BLEDevice::onUpdatesEnabled(GattServer::EventCallback_t callback)
00545 {
00546     transport->getGattServer().setOnUpdatesEnabled(callback);
00547 }
00548 
00549 inline void
00550 BLEDevice::onUpdatesDisabled(GattServer::EventCallback_t callback)
00551 {
00552     transport->getGattServer().setOnUpdatesDisabled(callback);
00553 }
00554 
00555 inline void
00556 BLEDevice::onConfirmationReceived(GattServer::EventCallback_t callback)
00557 {
00558     transport->getGattServer().setOnConfirmationReceived(callback);
00559 }
00560 
00561 inline ble_error_t
00562 BLEDevice::addService(GattService &service)
00563 {
00564     return transport->getGattServer().addService(service);
00565 }
00566 
00567 inline Gap::GapState_t
00568 BLEDevice::getGapState(void) const
00569 {
00570     return transport->getGap().getState();
00571 }
00572 
00573 inline ble_error_t BLEDevice::readCharacteristicValue (uint16_t handle, uint8_t *const buffer, uint16_t *const lengthP)
00574 {
00575     return transport->getGattServer().readValue(handle, buffer, lengthP);
00576 }
00577 
00578 inline ble_error_t
00579 BLEDevice::updateCharacteristicValue (uint16_t handle, const uint8_t *value, uint16_t size, bool localOnly)
00580 {
00581     return transport->getGattServer().updateValue(handle, const_cast<uint8_t *>(value), size, localOnly);
00582 }
00583 
00584 inline void
00585 BLEDevice::waitForEvent(void)
00586 {
00587     transport->waitForEvent();
00588 }
00589 
00590 inline ble_error_t
00591 BLEDevice::getPreferredConnectionParams(Gap::ConnectionParams_t *params)
00592 {
00593     return transport->getGap().getPreferredConnectionParams(params);
00594 }
00595 
00596 inline ble_error_t
00597 BLEDevice::setPreferredConnectionParams(const Gap::ConnectionParams_t *params)
00598 {
00599     return transport->getGap().setPreferredConnectionParams(params);
00600 }
00601 
00602 inline ble_error_t
00603 BLEDevice::updateConnectionParams(Gap::Handle_t handle, const Gap::ConnectionParams_t *params) {
00604     return transport->getGap().updateConnectionParams(handle, params);
00605 }
00606 
00607 inline const char *
00608 BLEDevice::getVersion(void)
00609 {
00610     return transport->getVersion();
00611 }
00612 
00613 inline ble_error_t
00614 BLEDevice::setDeviceName(const uint8_t *deviceName)
00615 {
00616     return transport->getGap().setDeviceName(deviceName);
00617 }
00618 
00619 inline ble_error_t
00620 BLEDevice::getDeviceName(uint8_t *deviceName, unsigned *lengthP)
00621 {
00622     return transport->getGap().getDeviceName(deviceName, lengthP);
00623 }
00624 
00625 inline ble_error_t
00626 BLEDevice::setAppearance(uint16_t appearance)
00627 {
00628     return transport->getGap().setAppearance(appearance);
00629 }
00630 
00631 inline ble_error_t
00632 BLEDevice::getAppearance(uint16_t *appearanceP)
00633 {
00634     return transport->getGap().getAppearance(appearanceP);
00635 }
00636 
00637 inline ble_error_t
00638 BLEDevice::setTxPower(int8_t txPower)
00639 {
00640     return transport->setTxPower(txPower);
00641 }
00642 
00643 /*
00644  * ALL OF THE FOLLOWING METHODS ARE DEPRECATED
00645  */
00646 
00647 inline ble_error_t
00648 BLEDevice::setAdvertisingData(const GapAdvertisingData &ADStructures, const GapAdvertisingData &scanResponse)
00649 {
00650     needToSetAdvPayload = false;
00651     return transport->getGap().setAdvertisingData(ADStructures, scanResponse);
00652 }
00653 
00654 inline ble_error_t
00655 BLEDevice::setAdvertisingData(const GapAdvertisingData &ADStructures)
00656 {
00657     GapAdvertisingData scanResponse;
00658 
00659     needToSetAdvPayload = false;
00660     return transport->getGap().setAdvertisingData(ADStructures, scanResponse);
00661 }
00662 
00663 inline ble_error_t
00664 BLEDevice::startAdvertising(const GapAdvertisingParams &_advParams)
00665 {
00666     return transport->getGap().startAdvertising(_advParams);
00667 }
00668 
00669 #endif // ifndef __BLE_DEVICE__