HT32SX Monarch Scan
Monarch Scan application for HT32SX
addon_sigfox_rf_protocol_api.h
Go to the documentation of this file.
1 
31 /* ######################################################################################### */
32 
33 /* -------------------------------------------------------------------------------------------------------------------------------------
34  IMPORTANT NOTE on ERROR CODES
35  -------------------------------------------------------------------------------------------------------------------------------------
36 
37  ALL ADDON_SIGFOX_RF_PROTOCOL_API_xxx functions returns an error type sfx_error_t
38 
39  The sfx_error_t is composed of the following :
40  \verbatim
41  MSB_____________________________________________LSB
42  15 8|7 0
43  | | |
44  | MANUF_ERROR_CODE | SIGFOX_ERROR_CODE |
45  |_______________________|______________________|
46 
47  \endverbatim
48  MANUF_ERROR_CODE :
49  - Represents the error codes for MCU_API_xx, RF_API_xx, SE_API_xx, REPEATER_API_xx
50  - All MCU_API_xx, RF_API_xx, SE_API_xx, REPEATER_API_xx have to return SFX_ERR_NONE when no error
51  - Minimum set of error codes are defined into the mcu_api.h, rf_api.h, se_api.h and repeater_api.h : Manufacturer can define more error codes !
52 
53  SIGFOX_ERROR_CODE :
54  - Represents the error codes of the SIGFOX API, internal functions or Sigfox RF and Protocol Application functions.
55  - All the SIGFOX API and internal functions error codes can be found in the sigfox_api.h.
56  - All the SIGFOX RF and PROTOCOL application error codes can be found in this file.
57 
58  ------------------------------------------------------------------------------------------------------------------------------------- */
59 
60 #include "sigfox_types.h"
61 
62 /* ---------------------------------------------------------------- */
63 /* Bytes reserved for SIGFOX ERROR CODES : From 0x10 to 0xBF */
64 /* ---------------------------------------------------------------- */
65 
66 /* They are defined in sigfox_api.h */
67 
68 /* ----------------------------------------------------------------------------- */
69 /* Bytes reserved for SIGFOX RF and PROTOCOL APP ERROR CODES : From 0xC0 to 0xDF */
70 /* ----------------------------------------------------------------------------- */
71 #define SFX_RF_PROTOCOL_ERR_API_TIMER_START (sfx_u8)(0xC0)
72 #define SFX_RF_PROTOCOL_ERR_API_REPORT_TEST (sfx_u8)(0xC1)
73 #define SFX_RF_PROTOCOL_ERR_API_SLEEP_SEND_BIT_1 (sfx_u8)(0xC2)
74 #define SFX_RF_PROTOCOL_ERR_API_SLEEP_SEND_BIT_2 (sfx_u8)(0xC3)
75 #define SFX_RF_PROTOCOL_ERR_API_SLEEP_SEND_OUTOFBAND (sfx_u8)(0xC4)
76 #define SFX_RF_PROTOCOL_ERR_API_SLEEP_SEND_REPEATER_STATUS (sfx_u8)(0xC5)
77 #define SFX_RF_PROTOCOL_ERR_API_SLEEP_SEND_FRAME (sfx_u8)(0xC6)
78 #define SFX_RF_PROTOCOL_ERR_API_TX_DBPSK (sfx_u8)(0xC7)
79 #define SFX_RF_PROTOCOL_ERR_API_DELAY_SENSI (sfx_u8)(0xC8)
80 #define SFX_RF_PROTOCOL_ERR_API_DELAY_TX_SYNTH (sfx_u8)(0xC9)
81 #define SFX_RF_PROTOCOL_ERR_API_WRONG_RC_ENUM (sfx_u8)(0xCA)
82 #define SFX_RF_PROTOCOL_ERR_API_GET_PAYLOAD_ENCRYPTION_FLAG (sfx_u8)(0xCB)
83 #define SFX_RF_PROTOCOL_ERR_API_TEST_MODE_UNKNOWN (sfx_u8)(0xCC)
84 #define SFX_RF_PROTOCOL_ERR_API_SLEEP_SEND_RC_SYNC (sfx_u8)(0xCD)
85 #define SFX_RF_PROTOCOL_ERR_API_MONARCH (sfx_u8)(0xCE)
86 #define SFX_RF_PROTOCOL_ERR_API_NOT_A_MONARCH_TEST_MODE (sfx_u8)(0xCF)
87 #define SFX_RF_PROTOCOL_ERR_API_NVM (sfx_u8)(0xD0)
88 
89 
90 typedef enum
91 {
92  SFX_RC1 = 0,
93  SFX_RC2 = 1,
94  SFX_RC3A = 2,
95  SFX_RC3C = 3,
96  SFX_RC4 = 4,
97  SFX_RC5 = 5,
98  SFX_RC6 = 6,
99  SFX_RC101 = 7,
101  /* Keep this enum at the end so that is counts the number of supported RC */
103 } sfx_rc_enum_t;
104 
105 
106 typedef enum
107 {
123 
124 /*!******************************************************************
125  * \fn sfx_error_t ADDON_SIGFOX_RF_PROTOCOL_API_get_version ( sfx_u8 **version, sfx_u8 *size )
126  * \brief This function allows to get the version of the Addon
127  *
128  * \param[out] sfx_u8 **version Pointer to Byte array (ASCII format) containing library version
129  * \param[out] sfx_u8 *size Size of the byte array pointed by *version
130  *
131  * \retval The sfx_error_t is composed of the following :
132  *
133  * \verbatim
134  * MSB_____________________________________________LSB
135  * | | |
136  * | MANUF_ERROR_CODE | SIGFOX_ERROR_CODE |
137  * |_______________________|______________________|
138  * \endverbatim
139  *
140  *******************************************************************/
141 sfx_error_t ADDON_SIGFOX_RF_PROTOCOL_API_get_version ( sfx_u8 **version, sfx_u8 *size );
142 
143 /*!******************************************************************
144  * \fn sfx_error_t ADDON_SIGFOX_RF_PROTOCOL_API_test_mode(sfx_rc_enum_t rc_enum, sfx_test_mode_t test_mode)
145  * \brief This function executes the test modes needed for the Sigfox RF and Protocol Tests.
146  *
147  * ______________________________________________________________________________________________
148  *
149  * - <B>If test_mode = SFX_TEST_MODE_TX_BPSK (TEST_MODE 0).</B><BR>
150  * This test consists in sending 3 Sigfox Frames of 26 bytes with specific data @ central frequency.<BR>
151  * ______________________________________________________________________________________________
152  *
153  * - <B>If test_mode = SFX_TEST_MODE_TX_PROTOCOL (TEST_MODE 1).</B><BR>
154  * This test consists in calling SIGFOX_API_send_xxx functions to test the complete protocol in Uplink only.
155  * for all size of frames w/ Data = 0x40 to 0x4B
156  * ______________________________________________________________________________________________
157  *
158  * - <B>If test_mode = SFX_TEST_MODE_RX_PROTOCOL (TEST_MODE 2).</B><BR>
159  * This test consists in calling SIGFOX_API_send_xxx functions to test the
160  * complete protocol in Downlink only, w/ Uplink Data = 0x40 to 0x4B
161  * At the end of the test, a send bit message is sent to indicate if the downlink payload decoded by the device
162  * matches with the payload sent by the test tool.<BR>
163  * ______________________________________________________________________________________________
164  *
165  * - <B>If test_mode = SFX_TEST_MODE_RX_GFSK (TEST_MODE 3).</B><BR>
166  * This test consists in receiving constant GFSK frames @ constant frequency.<BR>
167  * The pattern used for test is : <B>AA AA B2 27 1F 20 41 84 32 68 C5 BA 53 AE 79 E7 F6 DD 9B</B>
168  * with <B>AA AA B2 27</B> configured in RF chip<BR>.
169  * The test is executed during 30s.
170  * ______________________________________________________________________________________________
171  *
172  * - <B>If test_mode = SFX_TEST_MODE_RX_SENSI (TEST_MODE 4).</B><BR>
173  * This test is specific to SIGFOX's test equipments & softwares.<BR>
174  * It is mandatory to measure the real sensitivity of device.<BR>
175  * This test execute a kind of "ping-pong" loop that starts with a frame sent by the device
176  * and then a response sent by the equipment ( downlink frame ) that has to be received by the device.
177  * Internal counters are incremented to count the number of received frames.
178  * Report of the current status ( received or not ) is done through the MCU_API_report_test_result function
179  * ______________________________________________________________________________________________
180  *
181  * - <B>If test_mode = SFX_TEST_MODE_TX_SYNTH (TEST_MODE 5).</B><BR>
182  * This test consists in sending 9 SIGFOX frames with 4Bytes payload ( containing the programmed frequency )
183  * starting with the central frequency and then spaced with 100 Hz.
184  * ______________________________________________________________________________________________
185  *
186  * - <B>If test_mode = SFX_TEST_MODE_TX_FREQ_DISTRIBUTION (TEST_MODE 6).</B><BR>
187  * This test consists in calling SIGFOX_API_send_xxx functions to test the
188  * complete protocol in Uplink only, w/ Uplink Data = 0x40 to 0x4B<BR>.
189  * There are several occurences of the loop to ensure the full Sigfox band is covered
190  * ______________________________________________________________________________________________
191  *
192  * - <B>If test_mode = SFX_TEST_MODE_TX_BIT (TEST_MODE 11).</B><BR>
193  * This test consists in calling SIGFOX_API_send_bit function twice to test
194  * part of the protocol in Uplink only and LBT .
195  * ______________________________________________________________________________________________
196  *
197  * - <B>If test_mode = SFX_TEST_MODE_PUBLIC_KEY (TEST_MODE 12).</B><BR>
198  * This test consists in calling SIGFOX_API_send_frame function with the PUBLIC KEY activated<BR>.
199  * The device returns to PRIVATE KEY at the end of this test.
200  * ______________________________________________________________________________________________
201  *
202  * - <B>If test_mode = SFX_TEST_MODE_NVM (TEST_MODE 13).</B><BR>
203  * This test consists in calling SIGFOX_API_send_frame functions once with the PN of the NVM data
204  * as the payload.
205  * ______________________________________________________________________________________________
206  * \param[in] sfx_rc_t Radio Configuration pointer
207  * \param[in] sfx_test_mode_t test_mode Test mode to be executed
208  *
209  * \retval The sfx_error_t is composed of the following :
210  *
211  * \verbatim
212  * MSB_____________________________________________LSB
213  * | | |
214  * | MANUF_ERROR_CODE | SIGFOX_ERROR_CODE |
215  * |_______________________|______________________|
216  * \endverbatim
217  *
218  *******************************************************************/
220 
221 
222 /*!******************************************************************
223  * \fn sfx_error_t ADDON_SIGFOX_RF_PROTOCOL_API_monarch_test_mode(sfx_rc_enum_t rc_enum, sfx_test_mode_t test_mode, sfx_u8 rc_capabilities)
224  * \brief This function executes the \htmlonly <font color=red> MONARCH </font> \endhtmlonly test modes needed for the Sigfox RF and Protocol Tests.
225  *
226  * ______________________________________________________________________________________________
227  *
228  * - <B> \htmlonly <font color=red>MONARCH FEATURE ONLY </font> \endhtmlonly
229  * If test_mode = SFX_TEST_MODE_RX_MONARCH_PATTERN_LISTENING_SWEEP (TEST_MODE 7).</B><BR>
230  * This test consists in setting the device in pattern scan for 30s in LISTENING_SWEEP mode
231  * and report status TRUE or FALSE depending on the pattern found vs expected pattern.
232  * ______________________________________________________________________________________________
233  *
234  * - <B> \htmlonly <font color=red>MONARCH FEATURE ONLY </font> \endhtmlonly
235  * If test_mode = SFX_TEST_MODE_RX_MONARCH_PATTERN_LISTENING_WINDOW (TEST_MODE 8).</B><BR>
236  * This test consists in setting the device in pattern scan for 30s in LISTENING_WINDOW mode
237  * and report status TRUE or FALSE depending on the pattern found vs expected pattern.
238  * ______________________________________________________________________________________________
239  *
240  * - <B> \htmlonly <font color=red>MONARCH FEATURE ONLY </font> \endhtmlonly
241  * If test_mode = SFX_TEST_MODE_RX_MONARCH_BEACON (TEST_MODE 9).</B><BR>
242  * This test is specific to SIGFOX's test equipments & softwares.<BR>
243  * This test execute a kind of "ping-pong" loop that starts with a frame sent by the device
244  * to the equipment. At the reception of the frame, the equipment sends the beacon that
245  * will be received by the device. The addon computes the RC found counters which are
246  * reported in the Uplink Sigfox Frame to the equipment.
247  * This test is executed for 1000 loops ( 1000 beacons sent )
248  * ______________________________________________________________________________________________
249  *
250  * - <B> \htmlonly <font color=red>MONARCH FEATURE ONLY </font> \endhtmlonly
251  * If test_mode = SFX_TEST_MODE_RX_MONARCH_SENSI (TEST_MODE 10).</B><BR>
252  * This test is specific to SIGFOX's test equipments & softwares.<BR>
253  * This test execute a kind of "ping-pong" loop that starts with a frame sent by the device
254  * to the equipment. At the reception of the frame, the equipment sends the beacon that
255  * will be received by the device. The addon computes the RC found counters which are
256  * reported in the Uplink Sigfox Frame to the equipment.
257  * This test is executed for 10 loops ( 10 beacons sent )
258  * ______________________________________________________________________________________________
259  *
260  *
261  * \param[in] sfx_rc_t Radio Configuration pointer
262  * \param[in] sfx_test_mode_t test_mode Test mode to be executed
263  * \param[in] sfx_u8 rc_capabilities Radio Capabilities in bitmask format
264  * as defined in SIGFOX_MONARCH_API_executed_rc_scan
265  *
266  * \retval The sfx_error_t is composed of the following :
267  *
268  * \verbatim
269  * MSB_____________________________________________LSB
270  * | | |
271  * | MANUF_ERROR_CODE | SIGFOX_ERROR_CODE |
272  * |_______________________|______________________|
273  * \endverbatim
274  *
275  *******************************************************************/
276 sfx_error_t ADDON_SIGFOX_RF_PROTOCOL_API_monarch_test_mode(sfx_rc_enum_t rc_enum, sfx_test_mode_t test_mode, sfx_u8 rc_capabilities);
277 
278 
279 
SFX_TEST_MODE_PUBLIC_KEY
Definition: addon_sigfox_rf_protocol_api.h:120
SFX_TEST_MODE_TX_FREQ_DISTRIBUTION
Definition: addon_sigfox_rf_protocol_api.h:114
SFX_TEST_MODE_RX_MONARCH_SENSI
Definition: addon_sigfox_rf_protocol_api.h:118
sfx_test_mode_t
sfx_test_mode_t
Definition: addon_sigfox_rf_protocol_api.h:106
ADDON_SIGFOX_RF_PROTOCOL_API_monarch_test_mode
sfx_error_t ADDON_SIGFOX_RF_PROTOCOL_API_monarch_test_mode(sfx_rc_enum_t rc_enum, sfx_test_mode_t test_mode, sfx_u8 rc_capabilities)
This function executes the <font color=red> MONARCH </font> test modes needed for the Sigfox RF and...
sfx_rc_enum_t
sfx_rc_enum_t
Definition: addon_sigfox_rf_protocol_api.h:90
SFX_RC3C
Definition: addon_sigfox_rf_protocol_api.h:95
SFX_TEST_MODE_TX_BIT
Definition: addon_sigfox_rf_protocol_api.h:119
SFX_RC1
Definition: addon_sigfox_rf_protocol_api.h:92
SFX_RC101
Definition: addon_sigfox_rf_protocol_api.h:99
SFX_RC_LIST_MAX_SIZE
Definition: addon_sigfox_rf_protocol_api.h:102
SFX_TEST_MODE_RX_GFSK
Definition: addon_sigfox_rf_protocol_api.h:111
SFX_TEST_MODE_RX_MONARCH_PATTERN_LISTENING_SWEEP
Definition: addon_sigfox_rf_protocol_api.h:115
SFX_RC6
Definition: addon_sigfox_rf_protocol_api.h:98
ADDON_SIGFOX_RF_PROTOCOL_API_get_version
sfx_error_t ADDON_SIGFOX_RF_PROTOCOL_API_get_version(sfx_u8 **version, sfx_u8 *size)
This function allows to get the version of the Addon.
SFX_RC3A
Definition: addon_sigfox_rf_protocol_api.h:94
SFX_RC5
Definition: addon_sigfox_rf_protocol_api.h:97
SFX_TEST_MODE_RX_SENSI
Definition: addon_sigfox_rf_protocol_api.h:112
sigfox_types.h
Sigfox types definition.
SFX_TEST_MODE_TX_PROTOCOL
Definition: addon_sigfox_rf_protocol_api.h:109
SFX_TEST_MODE_TX_BPSK
Definition: addon_sigfox_rf_protocol_api.h:108
ADDON_SIGFOX_RF_PROTOCOL_API_test_mode
sfx_error_t ADDON_SIGFOX_RF_PROTOCOL_API_test_mode(sfx_rc_enum_t rc_enum, sfx_test_mode_t test_mode)
This function executes the test modes needed for the Sigfox RF and Protocol Tests.
SFX_TEST_MODE_NVM
Definition: addon_sigfox_rf_protocol_api.h:121
SFX_RC2
Definition: addon_sigfox_rf_protocol_api.h:93
SFX_TEST_MODE_RX_MONARCH_PATTERN_LISTENING_WINDOW
Definition: addon_sigfox_rf_protocol_api.h:116
SFX_TEST_MODE_RX_PROTOCOL
Definition: addon_sigfox_rf_protocol_api.h:110
SFX_TEST_MODE_TX_SYNTH
Definition: addon_sigfox_rf_protocol_api.h:113
SFX_RC4
Definition: addon_sigfox_rf_protocol_api.h:96
SFX_TEST_MODE_RX_MONARCH_BEACON
Definition: addon_sigfox_rf_protocol_api.h:117