File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -451,6 +451,19 @@ void NimBLEAdvertisementData::addData(const std::string &data) {
451451} // addData
452452
453453
454+ /* *
455+ * @brief Add data to the payload to be advertised.
456+ * @param [in] data The data to be added to the payload.
457+ * @param [in] length The size of data to be added to the payload.
458+ */
459+ void NimBLEAdvertisementData::addData (char * data, size_t length){
460+ if ((m_payload.length () + length) > BLE_HS_ADV_MAX_SZ) {
461+ return ;
462+ }
463+ m_payload.append (data,length);
464+ } // addData
465+
466+
454467/* *
455468 * @brief Set the appearance.
456469 * @param [in] appearance The appearance code value.
Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ class NimBLEAdvertisementData {
5757 void setServiceData (const NimBLEUUID &uuid, const std::string &data);
5858 void setShortName (const std::string &name);
5959 void addData (const std::string &data); // Add data to the payload.
60+ void addData (char * data, size_t length);
6061 std::string getPayload (); // Retrieve the current advert payload.
6162
6263private:
You can’t perform that action at this time.
0 commit comments