adding use of consts for GAP related apis

This commit is contained in:
Rohit Grover 2014-05-22 15:02:40 +01:00
parent abfb51ae4b
commit c4e1f43b1a
6 changed files with 21 additions and 21 deletions

View file

@ -213,7 +213,7 @@ void GapAdvertisingData::clear(void)
\returns A pointer to the payload
*/
/**************************************************************************/
uint8_t *GapAdvertisingData::getPayload(void)
const uint8_t *GapAdvertisingData::getPayload(void) const
{
return (_payloadLen > 0) ? _payload : NULL;
}
@ -225,7 +225,7 @@ uint8_t *GapAdvertisingData::getPayload(void)
\returns The payload length in bytes
*/
/**************************************************************************/
uint8_t GapAdvertisingData::getPayloadLen(void)
uint8_t GapAdvertisingData::getPayloadLen(void) const
{
return _payloadLen;
}
@ -237,7 +237,7 @@ uint8_t GapAdvertisingData::getPayloadLen(void)
\returns The 16-bit appearance value
*/
/**************************************************************************/
uint16_t GapAdvertisingData::getAppearance(void)
uint16_t GapAdvertisingData::getAppearance(void) const
{
return (uint16_t)_appearance;
}

View file

@ -355,9 +355,9 @@ public:
ble_error_t addFlags(Flags flag = LE_GENERAL_DISCOVERABLE);
ble_error_t addTxPower(int8_t txPower);
void clear(void);
uint8_t *getPayload(void);
uint8_t getPayloadLen(void);
uint16_t getAppearance(void);
const uint8_t *getPayload(void) const;
uint8_t getPayloadLen(void) const;
uint16_t getAppearance(void) const;
private:
uint8_t _payload[GAP_ADVERTISING_DATA_MAX_PAYLOAD];

View file

@ -133,7 +133,7 @@ GapAdvertisingParams::~GapAdvertisingParams(void)
\brief returns the current Advertising Type value
*/
/**************************************************************************/
GapAdvertisingParams::AdvertisingType GapAdvertisingParams::getAdvertisingType(void)
GapAdvertisingParams::AdvertisingType GapAdvertisingParams::getAdvertisingType(void) const
{
return _advType;
}
@ -143,7 +143,7 @@ GapAdvertisingParams::AdvertisingType GapAdvertisingParams::getAdvertisingType(v
\brief returns the current Advertising Delay (in units of 0.625ms)
*/
/**************************************************************************/
uint16_t GapAdvertisingParams::getInterval(void)
uint16_t GapAdvertisingParams::getInterval(void) const
{
return _interval;
}
@ -153,7 +153,7 @@ uint16_t GapAdvertisingParams::getInterval(void)
\brief returns the current Advertising Timeout (in seconds)
*/
/**************************************************************************/
uint16_t GapAdvertisingParams::getTimeout(void)
uint16_t GapAdvertisingParams::getTimeout(void) const
{
return _timeout;
}

View file

@ -84,9 +84,9 @@ public:
uint16_t timeout = 0);
virtual ~GapAdvertisingParams(void);
virtual AdvertisingType getAdvertisingType(void);
virtual uint16_t getInterval(void);
virtual uint16_t getTimeout(void);
virtual AdvertisingType getAdvertisingType(void) const;
virtual uint16_t getInterval(void) const;
virtual uint16_t getTimeout(void) const;
private:
AdvertisingType _advType;

View file

@ -43,9 +43,9 @@ public:
*/
ble_error_t setAddress(Gap::addr_type_t type, const uint8_t address[6]);
ble_error_t setAdvertisingData(GapAdvertisingData &ADStructures,
GapAdvertisingData &scanResponse);
ble_error_t setAdvertisingData(GapAdvertisingData &ADStructures);
ble_error_t setAdvertisingData(const GapAdvertisingData &ADStructures,
const GapAdvertisingData &scanResponse);
ble_error_t setAdvertisingData(const GapAdvertisingData &ADStructures);
ble_error_t startAdvertising(GapAdvertisingParams &advParams);
ble_error_t stopAdvertising(void);
ble_error_t disconnect(void);
@ -61,13 +61,13 @@ BLEDevice::setAddress(Gap::addr_type_t type, const uint8_t address[6]) {
}
inline ble_error_t
BLEDevice::setAdvertisingData(GapAdvertisingData &ADStructures,
GapAdvertisingData &scanResponse) {
BLEDevice::setAdvertisingData(const GapAdvertisingData &ADStructures,
const GapAdvertisingData &scanResponse) {
return getGap().setAdvertisingData(ADStructures, scanResponse);
}
inline ble_error_t
BLEDevice::setAdvertisingData(GapAdvertisingData &ADStructures) {
BLEDevice::setAdvertisingData(const GapAdvertisingData &ADStructures) {
GapAdvertisingData scanResponse;
return getGap().setAdvertisingData(ADStructures, scanResponse);
}

View file

@ -45,9 +45,9 @@ public:
/* These functions must be defined in the sub-class */
virtual ble_error_t setAddress(addr_type_t type, const uint8_t address[6]) = 0;
virtual ble_error_t setAdvertisingData(GapAdvertisingData &,
GapAdvertisingData &) = 0;
virtual ble_error_t startAdvertising(GapAdvertisingParams &) = 0;
virtual ble_error_t setAdvertisingData(const GapAdvertisingData &,
const GapAdvertisingData &) = 0;
virtual ble_error_t startAdvertising(const GapAdvertisingParams &) = 0;
virtual ble_error_t stopAdvertising(void) = 0;
virtual ble_error_t disconnect(void) = 0;