hello, Is there any examples to write beacon properties like uuid major and minor in flash memory when i edit the values from mobile app i want to advertise those values. in nrf52840 using sdk 14.1
hello, Is there any examples to write beacon properties like uuid major and minor in flash memory when i edit the values from mobile app i want to advertise those values. in nrf52840 using sdk 14.1
Hi,
It's not implemented. You need to implement your own application code to do so. You need to write code to handle the write command from the phone. And then write that value down into flash. Then write some code to check the value in the flash and if it's not 0xFFFF or the default one, you read the value and use it in your beacon advertising packet.
To learn how to write to flash have a look at the fds example here and the library documentation here.
hi humg bui, i have written code for read and write by myself.. my doubt is with out writing the received code to flash. after the on_write() function in GATT_WRITE is made can i make stop_advertising(), and generate new advertisement packet using new values and advertise again. am i correct? or i want to write in flash
If you don't want to retain the value after the device get reset then you don't need to write to flash.
If you want to update advertising packet, you simply set the new value using sd_ble_gap_adv_data_set(), you don't need to stop and start advertising. I assume you advertising at the same time as having a connection ?
hi hung, for me i dont want to write the value in flash. no issues i dont want to retain the value after the device gets reset. i am having a doubt. i have created service for uuid major and minor to read and write. where i want to place the sd_ble_gap_adv_data_set. can i make in the beacon .c file or can i do it in main.c file in my beacon_write_handler function.
It doesn't matter where you leave the code, it's important that you catch the write event and execute sd_ble_gap_adv_data_set (). I would suggest you to study how it works with ble_app_uart or ble_app_blinky.