brief Callback function usr_mcps_data_ind param SrcAddrSpec Pointer to

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/**
* @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 */
}