Demo HCI Implementation for WiMOD-LR Devices  V2.0.3
WiMOD_SAP_RadioLink_IDs.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
31 //------------------------------------------------------------------------------
32 
33 
34 /*
35  * THIS IS AN EXAMPLE IMPLEMENTATION ACCORDING THE THE HCI SPEC: V1.10
36  * FOR FIRMWARE: LR-BASE
37  *
38  * SEE FILE: WiMOD_LR_Base_HCI_Spec_V1_10.pdf for detailed information
39  */
40 
41 
42 #ifndef ARDUINO_SAP_WIMOD_SAP_RADIOLINK_IDS_H_
43 #define ARDUINO_SAP_WIMOD_SAP_RADIOLINK_IDS_H_
44 
45 //------------------------------------------------------------------------------
46 //
47 // Section Includes Files
48 //
49 //------------------------------------------------------------------------------
50 
51 #include "utils/WMDefs.h"
52 
53 //------------------------------------------------------------------------------
54 //
55 // Service Access Point Identifier
56 //
57 //------------------------------------------------------------------------------
58 
60 #define RADIOLINK_SAP_ID 0x03
61 
62 
63 
64 //------------------------------------------------------------------------------
65 //
66 // Radio Link Services Identifier
67 //
68 //------------------------------------------------------------------------------
70 #define RADIOLINK_MSG_SEND_U_DATA_REQ 0x01
71 #define RADIOLINK_MSG_SEND_U_DATA_RSP 0x02
72 #define RADIOLINK_MSG_U_DATA_RX_IND 0x04
73 #define RADIOLINK_MSG_U_DATA_TX_IND 0x06
74 #define RADIOLINK_MSG_RAW_DATA_RX_IND 0x08
75 #define RADIOLINK_MSG_SEND_C_DATA_REQ 0x09
76 #define RADIOLINK_MSG_SEND_C_DATA_RSP 0x0A
77 #define RADIOLINK_MSG_C_DATA_RX_IND 0x0C
78 #define RADIOLINK_MSG_C_DATA_TX_IND 0x0E
79 #define RADIOLINK_MSG_ACK_RX_IND 0x10
80 #define RADIOLINK_MSG_ACK_TIMEOUT_IND 0x12
81 #define RADIOLINK_MSG_ACK_TX_IND 0x14
82 #define RADIOLINK_MSG_SET_ACK_DATA_REQ 0x15
83 #define RADIOLINK_MSG_SET_ACK_DATA_RSP 0x16
84 
86 //------------------------------------------------------------------------------
87 //
88 // Radio Link Status Codes
89 //
90 //------------------------------------------------------------------------------
92 
93 #define RADIOLINK_STATUS_OK 0x00
94 #define RADIOLINK_STATUS_ERROR 0x01
95 #define RADIOLINK_STATUS_CMD_NOT_SUPPORTED 0x02
96 #define RADIOLINK_STATUS_WRONG_PARAMETER 0x03
97 #define RADIOLINK_STATUS_WRONG_RADIO_MODE 0x04
98 #define RADIOLINK_STATUS_MEDIA_BUSY 0x05
99 #define RADIOLINK_STATUS_BUFFER_FULL 0x07
100 #define RADIOLINK_STATUS_LENGTH_ERROR 0x08
101 
103 //------------------------------------------------------------------------------
104 //
105 // Format / Status Field defines
106 //
107 //------------------------------------------------------------------------------
109 #define RADIOLINK_FORMAT_EXTENDED_OUTPUT (1 << 0) // bit field
110 #define RADIOLINK_FORMAT_DECRYPTED_DATA (1 << 5) // bit field
111 #define RADIOLINK_FORMAT_DECRYPTION_ERROR (1 << 6) // bit field
112 #define RADIOLINK_FORMAT_ENCRYPTED_DATA (1 << 7) // bit field
113 //------------------------------------------------------------------------------
115 //
116 // Misc. Defines
117 //
118 //------------------------------------------------------------------------------
120 #define RADIOLINK_BROADCAST_GROUP_ADR 0xFF
121 #define RADIOLINK_BROADCAST_DEVICE_ADR 0xFFFF
122 
124 /*
125  * Number of payload bytes for a user defined message
126  *
127  * Notes:
128  *
129  * 1) the actual number of payload bytes can be less, if the air frame
130  * contains a list of MAC commands.
131  *
132  * 2) The value of the WiMODLRBASE_APP_PAYLOAD_LEN taken here is a tradeoff.
133  * The actual size of the payload is mostly bigger than 100 and depends on the
134  * settings of the radio and its firmware itself. Please consult the according
135  * firmware HCI documentation to figure out the exact value possible.
136  * But the amount of memory must be reserved on the host MCU system, too. Some
137  * memory contrained Arduino boards (e.g.) the UNO have got only ~2kB of memory.
138  * So the default message size has been reduced here. If you want to use the
139  * maximal payload size possible you can change this define here.
140  */
142 #define WiMODLRBASE_APP_PAYLOAD_LEN 100
143 
144 #define RADIOLINK_HEADER_SIZE (1+1+2+1+2+2+1+4)
145 //------------------------------------------------------------------------------
147 //
148 // structures
149 //
150 //------------------------------------------------------------------------------
152 #define WIMOD_RADIOLINK_PAYLOAD_LEN (WiMODLRBASE_APP_PAYLOAD_LEN - RADIOLINK_HEADER_SIZE)
153 
154 #define WIMOD_RADIOLINK_ACK_DATA_LEN ( 0x08 )
155 
160 typedef struct
161 {
162  // only for RX
163  UINT8 StatusFormat;
165  // RX + TX
169  //only for RX
173  // RX + TX
174  UINT8 Length;
175  UINT8 Payload[WIMOD_RADIOLINK_PAYLOAD_LEN];
176  // note: in case of encrypted data the sequence number and MIC
177  // is included in this payload field. The user must check the
178  // StatusFormat field
179 
181  // optional fields; only for RX
182  INT16 RSSI;
183  INT8 SNR;
184  INT32 RxTime;
186  //optional: only if decryption error occurred
187  INT16 MIC;
189 
190 
191 
193 
197 typedef struct
198 {
199  // only for RX
200  UINT8 StatusFormat;
201  UINT8 RadioCtrlField; /*1> Radio Control Field (low level) */
202  UINT8 DestinationGroupAddress;
203  UINT16 DestinationDeviceAddress;
204  UINT8 SourceGroupAddress;
205  UINT16 SourceDeviceAddress;
206  UINT16 RadioStackField;
207  UINT8 Length;
208  UINT8 Payload[WIMOD_RADIOLINK_PAYLOAD_LEN];
210  bool OptionalInfoAvaiable;
211  INT16 RSSI;
212  INT8 SNR;
213  INT32 RxTime;
214 } TWiMODLR_RadioLink_RawMsg;
216 
217 
221 typedef struct
222 {
223  UINT8 Status;
224  UINT16 TxEventCounter;
225  UINT32 AirTime;
227 
228 
232 typedef struct
233 {
234  UINT8 Status;
235  UINT16 TxEventCounter;
236  UINT32 AirTime;
238 
239 
243 typedef struct
244 {
245  UINT8 Status;
247 // UINT16 TxEventCounter; /*!< TX event counter value */
248 // UINT32 AirTime; /*!< Air time of last transmission in ms (new SpeV 1V10 */
250 
251 #endif /* ARDUINO_SAP_WIMOD_SAP_RADIOLINK_IDS_H_ */
TWiMODLR_AckTxInd_Msg::Status
UINT8 Status
Definition: WiMOD_SAP_RadioLink_IDs.h:245
TWiMODLR_AckTxInd_Msg
Structure containing information about an acknowledgment transmission.
Definition: WiMOD_SAP_RadioLink_IDs.h:243