This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Include time data to the advertising packet.

Hi, I am trying to add timer information to the sending packet. We created some space(manuf_data) to store data. However, the problem is we do not know how to put actual-time data into space.

following is the code we wrote

static uint8_array_t timestamp_data(void)
{
uint8_array_t timestampArray;
timestampArray.size = 4;

//Create a timestamp here && typecast it as an array of 8 bits
uint32_t timestampV = app_timer_cnt_get();
*(uint32_t *)timestampArray.p_data = timestampV;
return timestampArray;
}

/**Instantiate ble_advdata_manuf_data_t
-by Martin
*/
static ble_advdata_manuf_data_t * manuf_data(void)
{
uint16_t companyName = BLE_GAP_ADV_INTERVAL_MAX;
uint8_array_t *timestamp_data_inst = timestamp_data();

ble_advdata_manuf_data_t manuf_data_1;
manuf_data_1.company_identifier = companyName;
manuf_data_1.data = *timestamp_data_inst.;
//return &manuf_data_1;
}

we want to know how to put uint32 timestamp to uint8 array. The solution we thought was break down 32bit data to 4 8bit uint and put them to uint8 array, but we cannot figure out how to do it. Plus we want to see those time data, but until now, the only thing we can see is bf which is the array address I think. therefore, we want to know the way to see the stored data in the array not the address information through the wireshark.

Please help us thank you!. 

Related