I try to send digital value to iphone with Bluetooth when pio 0 input value change.
And I try to store data to NVRAM when transmission fail, and the stored all data will be sent when transmission success again.
I can send digital data to iphone, but I have no idea about NVRAM programming.
I use BCM20737 and debug with Light Blue app.
I would like to ask 3 questions.
1, When I check if data successfully can be written, I plug off Vcc jumper wire and plug again for power cycling. After power cycling I can't start the service. It doesn't appear on a list like figure 1. Please let me know how to check if data can be written and keep it in NVRAM after power cycling. I should use another app or ?
2, I can change characteristic's data on iphone screen when pio 0's value change with following code which is refer to hello _sensor. When I watch value of writeNVRAM in bellow code with teraterm, it doesn't change and it's always 1. Please let me know to write value of sum in bellow code into NVRAM. sum's value is count up every change of pio 0's value.
3, I try to store data when transmission fail. There is any command to get callback when transmission fail?
I will really appreciate your help .
//UINT8 res = gpio_getPinInput(0,0);
UINT8 data = 0;
res[count] = gpio_getPinInput(0,0);
ble_trace1("count = %d\n",count);
ble_trace2("res[%d] = %d\n", count, res[count]);
sum = sum+res[count];
ble_trace1("sum = %d\n", sum);
// If client has not registered for indication or notification, do not need to do anything
if (hello_sensor_hostinfo.characteristic_client_configuration == 0)
// Read value of the characteristic to send from the GATT DB.
db_pdu.pdu[0x00] = (UINT8)sum;
ble_tracen((char *)db_pdu.pdu, db_pdu.len);
writeNVRAM = bleprofile_WriteNVRAM(VS_BLE_HOST_LIST-10, sizeof(sum), (UINT8 *)&sum);
writeNVRAM = bleprofile_ReadNVRAM(VS_BLE_HOST_LIST-10, sizeof(sum), (UINT8 *)&sum);
ble_trace1("second NVRAM read:%04d\n", writeNVRAM);
figure1.PNG 36.1 K