Advertisement data set by the programmer to be published by the BLE server.  
 More...
#include <BLEAdvertising.hpp>
Advertisement data set by the programmer to be published by the BLE server. 
◆ addData()
      
        
          | void BLEAdvertisementData::addData | ( | std::string | data | ) |  | 
      
 
Add data to the payload to be advertised. 
- Parameters
- 
  
    | [in] | data | The data to be added to the payload. |  
 
   75     if ((m_payload.length() + data.length()) > MAX_LEN) {
 
   78     m_payload.append(data);
 
 
 
 
◆ getPayload()
      
        
          | std::string BLEAdvertisementData::getPayload | ( |  | ) |  | 
      
 
Retrieve the payload that is to be advertised. 
- Returns
- The payload that is to be advertised. 
 
 
◆ setAppearance()
      
        
          | void BLEAdvertisementData::setAppearance | ( | uint16_t | appearance | ) |  | 
      
 
 
◆ setCompleteServices()
      
        
          | void BLEAdvertisementData::setCompleteServices | ( | BLEUUID | uuid | ) |  | 
      
 
Set the complete services. 
- Parameters
- 
  
    | [in] | uuid | The single service to advertise. |  
 
  107             cdata[1] = BLE_AD_TYPE_16SRV_CMPL;  
 
  108             addData(std::string(cdata, 2) + std::string((
char*) &uuid.raw16, 2));
 
  115             cdata[1] = BLE_AD_TYPE_32SRV_CMPL;  
 
  116             addData(std::string(cdata, 2) + std::string((
char*) &uuid.raw32, 4));
 
  123             cdata[1] = BLE_AD_TYPE_128SRV_CMPL;  
 
  124             addData(std::string(cdata, 2) + std::string((
char*) uuid.raw128, 16));
 
 
 
 
◆ setFlags()
      
        
          | void BLEAdvertisementData::setFlags | ( | uint8_t | flag | ) |  | 
      
 
Set the advertisement flags. 
- Parameters
- 
  
    | [in] | The | flags to be set in the advertisement. |  
 
- BLE_ADV_FLAG_LIMIT_DISC
- BLE_ADV_FLAG_GEN_DISC
- BLE_ADV_FLAG_BREDR_NOT_SPT
- BLE_ADV_FLAG_DMT_CONTROLLER_SPT
- BLE_ADV_FLAG_DMT_HOST_SPT
- BLE_ADV_FLAG_NON_LIMIT_DISC 
  148     cdata[1] = BLE_AD_TYPE_FLAG;  
 
  150     addData(std::string(cdata, 3));
 
 
 
 
◆ setManufacturerData()
      
        
          | void BLEAdvertisementData::setManufacturerData | ( | std::string | data | ) |  | 
      
 
Set manufacturer specific data. 
- Parameters
- 
  
    | [in] | data | Manufacturer data. |  
 
  160     _debug_print(
"BLEAdvertisementData", 
">> setManufacturerData");
 
  162     cdata[0] = data.length() + 1;
 
  163     cdata[1] = BLE_AD_TYPE_MANUFACTURER_SPECIFIC;  
 
  164     addData(std::string(cdata, 2) + data);
 
  165     _debug_print(
"BLEAdvertisementData", 
"<< setManufacturerData");
 
 
 
 
◆ setName()
      
        
          | void BLEAdvertisementData::setName | ( | std::string | name | ) |  | 
      
 
Set the name. 
- Parameters
- 
  
    | [in] | The | complete name of the device. |  
 
  174     _debug_print_s(
"BLEAdvertisementData", 
">> setName", name.c_str());
 
  176     cdata[0] = name.length() + 1;
 
  177     cdata[1] = BLE_AD_TYPE_NAME_CMPL;  
 
  178     addData(std::string(cdata, 2) + name);
 
  179     _debug_print(
"BLEAdvertisementData", 
"<< setName");
 
 
 
 
◆ setPartialServices()
      
        
          | void BLEAdvertisementData::setPartialServices | ( | BLEUUID | uuid | ) |  | 
      
 
Set the partial services. 
- Parameters
- 
  
    | [in] | uuid | The single service to advertise. |  
 
  193             cdata[1] = BLE_AD_TYPE_16SRV_PART;  
 
  194             addData(std::string(cdata, 2) + std::string((
char *) &uuid.raw16, 2));
 
  201             cdata[1] = BLE_AD_TYPE_32SRV_PART; 
 
  202             addData(std::string(cdata, 2) + std::string((
char *) &uuid.raw32, 4));
 
  209             cdata[1] = BLE_AD_TYPE_128SRV_PART;  
 
  210             addData(std::string(cdata, 2) + std::string((
char *) uuid.raw128, 16));
 
 
 
 
◆ setServiceData()
      
        
          | void BLEAdvertisementData::setServiceData | ( | BLEUUID | uuid, | 
        
          |  |  | std::string | data | 
        
          |  | ) |  |  | 
      
 
Set the service data (UUID + data) 
- Parameters
- 
  
    | [in] | uuid | The UUID to set with the service data. Size of UUID will be used. |  | [in] | data | The data to be associated with the service data advert. |  
 
  230             cdata[0] = data.length() + 3;
 
  231             cdata[1] = BLE_AD_TYPE_SERVICE_DATA;  
 
  232             addData(std::string(cdata, 2) + std::string((
char*) &uuid.raw16, 2) + data);
 
  238             cdata[0] = data.length() + 5;
 
  239             cdata[1] = BLE_AD_TYPE_32SERVICE_DATA; 
 
  240             addData(std::string(cdata, 2) + std::string((
char*) &uuid.raw32, 4) + data);
 
  246             cdata[0] = data.length() + 17;
 
  247             cdata[1] = BLE_AD_TYPE_128SERVICE_DATA;  
 
  248             addData(std::string(cdata, 2) + std::string((
char*) uuid.raw128, 16) + data);
 
 
 
 
◆ setShortName()
      
        
          | void BLEAdvertisementData::setShortName | ( | std::string | name | ) |  | 
      
 
Set the short name. 
- Parameters
- 
  
    | [in] | The | short name of the device. |  
 
  263     _debug_print_s(
"BLEAdvertisementData", 
">> setShortName", name.c_str());
 
  265     cdata[0] = name.length() + 1;
 
  266     cdata[1] = BLE_AD_TYPE_NAME_SHORT;  
 
  267     addData(std::string(cdata, 2) + name);
 
  268     _debug_print(
"BLEAdvertisementData", 
"<< setShortName");
 
 
 
 
The documentation for this class was generated from the following files: