danimasa opened a new issue, #1363:
URL: https://github.com/apache/mynewt-nimble/issues/1363

   How can I create `ble_gatt_chr_def` dynamically at runtime?
   
   All the examples show a static array of `ble_gatt_svc_def` already with the 
characteristics. In my case I'll only kwown the caractheristics information at 
runtime. I've tried to change the characteristics pointer to a different array 
after creating a static global variable but the characteristics was not listed 
in BLE Service.
   
   I'm doing like that:
   ```c
   static struct ble_gatt_svc_def gatt_svr_svcs[] = {...};
   
   void start()
   {
       struct ble_gatt_chr_def chrs[chr_count];
       for(int i = 0; i < chr_count; i++)
       {
           struct ble_gatt_chr_def chr = {...};
           chrs[i] = chr;
       }
       gatt_svr_svcs[0].characteristics = chrs;
   
       ble_gatts_count_cfg(gatt_svr_svcs);
       ble_gatts_add_svcs(gatt_svr_svcs);
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to