I am using a custom Bluetooth service to write Device Information Service attributes like device name and serial number from a smartphone to our connected IoT product. When I restart the device, the values are gone, so I need to store them in flash and set the attributes on every startup:
CyBle_DissSetCharacteristicValue(CYBLE_DIS_SERIAL_NUMBER, sizeof(serial_number), (uint8_t *)serial_number); CyBle_GasSetCharacteristicValue(CYBLE_GAS_DEVICE_NAME, sizeof(device_name), (uint8_t *)device_name); CyBle_GapSetLocalName(device_name); CyBle_GapUpdateAdvData(cyBle_discoveryModeInfo.advData, cyBle_discoveryModeInfo.scanRspData);
Is there any way to save that storage space and set the device name and serial number permanently at the time of receive? I wasn't able to find anything in the BLE CSD component's datasheet.
You can use the CyBle_StoreAppData API or few other flash APIs to write data to flash. There are example projects available on the creator that demonstrates how to use the Flash.
- Madhu Sudhan