/**
* @brief Callback function usr_mcps_data_ind
*
* @param SrcAddrSpec Pointer to source address specification
* @param DstAddrSpec Pointer to destination address specification
* @param msduLength Number of octets contained in MSDU
* @param msdu Pointer to MSDU
* @param mpduLinkQuality LQI measured during reception of the MPDU
* @param DSN DSN of the received data frame.
* @param Timestamp The time, in symbols, at which the data were received
* (only if timestamping is enabled).
*/
void usr_mcps_data_ind(wpan_addr_spec_t *SrcAddrSpec,
wpan_addr_spec_t *DstAddrSpec,
uint8_t msduLength,
uint8_t *msdu,
uint8_t mpduLinkQuality,
#ifdef ENABLE_TSTAMP
uint8_t DSN,
uint32_t Timestamp)
#else
uint8_t DSN)
#endif /* ENABLE_TSTAMP */
{
uint8_t payload_type;
if (msduLength > 1){
payload_type = (uint8_t)*msdu;
msdu++;
if (payload_type == 1) {
printf("BPM: ");
printf("%d\r\n",(uint8_t)*msdu);
}
if (payload_type == 2) {
printf("OXY: ");
printf("%d\r\n",(uint8_t)*msdu);
}
if (payload_type == 3) {
uint8_t temph = (uint8_t)*msdu;
msdu++;
uint8_t templ = (uint8_t)*msdu;
printf("temp: %d.%d\r\n", temph, templ);
}
}
else printf("%d\r\n",*msdu);
pal_led(LED_DATA, LED_ON);
// Start a timer switching off the LED
pal_timer_start(TIMER_LED_OFF,
500000,
TIMEOUT_RELATIVE,
(FUNC_PTR)data_exchange_led_off_cb,
NULL);
/* Keep compiler happy. */
SrcAddrSpec = SrcAddrSpec;
DstAddrSpec = DstAddrSpec;
msduLength = msduLength;
msdu = msdu;
mpduLinkQuality = mpduLinkQuality;
DSN = DSN;
#ifdef ENABLE_TSTAMP
Timestamp = Timestamp;
#endif /* ENABLE_TSTAMP */
}