HT32SX Monarch Scan
Monarch Scan application for HT32SX
sigfox_monarch_api.h
Go to the documentation of this file.
1 
31 #ifndef SIGFOX_MONARCH_API_H
32 #define SIGFOX_MONARCH_API_H
33 
34 #include "sigfox_types.h"
35 
36 /********************************
37  * \enum sfx_timer_unit_enum_t
38  * \brief value used to identify the unit of the timer
39  *******************************/
40 typedef enum
41 {
42  SFX_TIME_MS = 0,
47 
48 /********************************
49  * \enum sfx_bitfield_rc_enum_t
50  * \brief value used to identify the RC supported by the device
51  * or the RC found after the monarch scan.
52  *******************************/
53 typedef enum
54 {
62  /* Keep the below line still at the end */
66 
67 /********************************
68  * \enum sfx_pattern_enum_t
69  * \brief This enum describes all the
70  * patterns that can be part of the
71  * Sigfox beacon, in first or second
72  * position of the beacon.
73  *******************************/
74 typedef enum
75 {
76  NO_MONARCH_PATTERN = 0,
77  MONARCH_DELTA_F1 = 1,
81  /* Keep this line at the end */
84 
85 #define MAX_MONARCH_PATTERN_PER_FREQUENCY_SEARCH 2 /* On 1 frequency, we can at the maximum ask for the research of 2 different patterns */
86 
87 /********************************
88  * \struct sfx_monarch_pattern_search_t
89  * \brief This structure describes
90  * for a single frequency, the patterns
91  * that need to be searched
92  *******************************/
93 typedef struct
94 {
95  sfx_u32 freq;
96  sfx_pattern_enum_t patterns[MAX_MONARCH_PATTERN_PER_FREQUENCY_SEARCH];
98 
99 /********************************
100  * \enum sfx_monarch_listening_mode_t
101  * \brief value used to define the monarch
102  * listening modes.
103  *******************************/
104 typedef enum
105 {
115 
116 /*!******************************************************************
117  * \fn sfx_error_t sfx_error_t SIGFOX_MONARCH_API_execute_rc_scan (sfx_u8 rc_capabilities_bit_mask, sfx_u16 timer, sfx_timer_unit_enum_t unit, sfx_u8 (* app_callback_handler ) ( sfx_u8 rc_bit_mask, sfx_s16 rssi ) )
118  * \brief This function executes a scan of the air to detect a Sigfox Beacon.
119  * It will return the RC enum value corresponding to the beacon found and its RSSI level.
120  * The scan is executed during the specific timer / unit time
121  *
122  * NOTE : there is no need to open the sigfox Library to run this function.
123  *
124  * \param[in] sfx_u8 rc_capabilities_bit_mask Bit Mask (format below ) of the RCx on which the scan has to be executed :
125  *
126  * ---------------------------------------------------------
127  * | Bit7 | Bit6 | Bit5 | Bit4 | Bit3 | Bit2 | Bit1 | Bit0 |
128  * ---------------------------------------------------------
129  * | - | - | RC6 | RC5 | RC4 | RC3 | RC2 | RC1 |
130  * ---------------------------------------------------------
131  *
132  * \param[in] sfx_u16 timer Scan duration value ( with the unit parameter information )
133  * \param[in] sfx_timer_unit_enum_t unit Unit to be considered for the scan time computation
134  * \param[in] app_callback_handler This is the function that will be called by the Sigfox Library when the scan is completed.
135  * ( either when RC Found or when Timeout )
136  * parameter of this callback are :
137  * \param[out] sfx_u8 rc Value of the RC found. There could be only 1 RC or 0 ( not found )
138  * \param[out] rssi RSSI value of the RC found. if rc = 0, rssi is not valid ( is set to 0 too )
139  *
140  * MSB_____________________________________________LSB
141  * 15 8|7 0
142  * | | |
143  * | MANUF_ERROR_CODE | SIGFOX_ERROR_CODE |
144  * |_______________________|______________________|
145  *
146  * SIGFOX_ERROR_CODE for this function : SFX_ERR_NONE or SFX_ERR_MONARCH_API_xx
147  *
148  *******************************************************************/
149 sfx_error_t SIGFOX_MONARCH_API_execute_rc_scan (sfx_u8 rc_capabilities_bit_mask, sfx_u16 timer, sfx_timer_unit_enum_t unit, sfx_u8 (* app_callback_handler ) ( sfx_u8 rc_bit_mask, sfx_s16 rssi ) );
150 
151 /*!******************************************************************
152  * \fn sfx_error_t SIGFOX_MONARCH_API_stop_rc_scan ( void )
153  * \brief This function stops a RC scan which is on going
154  *
155  * NOTE : there is no need to open the sigfox Library to run this function.
156  *
157  * MSB_____________________________________________LSB
158  * 15 8|7 0
159  * | | |
160  * | MANUF_ERROR_CODE | SIGFOX_ERROR_CODE |
161  * |_______________________|______________________|
162  *
163  * SIGFOX_ERROR_CODE for this function : SFX_ERR_NONE or SFX_ERR_MONARCH_API_xx
164  *
165  *******************************************************************/
166 sfx_error_t SIGFOX_MONARCH_API_stop_rc_scan (void);
167 
168 #endif
SFX_BITFIELD_SHIFT_RC2
Definition: sigfox_monarch_api.h:57
sfx_monarch_pattern_search_t
Definition: sigfox_monarch_api.h:89
SFX_MAX_SIGFOX_RC
Definition: sigfox_monarch_api.h:64
SFX_BITFIELD_SHIFT_RC1
Definition: sigfox_monarch_api.h:56
MONARCH_DELTA_F3
Definition: sigfox_monarch_api.h:81
sfx_bitfield_rc_enum_t
sfx_bitfield_rc_enum_t
Definition: sigfox_monarch_api.h:51
SFX_TIME_S
Definition: sigfox_monarch_api.h:44
MONARCH_LISTENING_WINDOW
Definition: sigfox_monarch_api.h:109
sfx_pattern_enum_t
sfx_pattern_enum_t
Definition: sigfox_monarch_api.h:71
SFX_TIME_H
Definition: sigfox_monarch_api.h:46
SFX_BITFIELD_SHIFT_RC6
Definition: sigfox_monarch_api.h:61
SFX_BITFIELD_SHIFT_RC3
Definition: sigfox_monarch_api.h:58
SIGFOX_MONARCH_API_stop_rc_scan
sfx_error_t SIGFOX_MONARCH_API_stop_rc_scan(void)
This function stops a RC scan which is on going.
SFX_BITFIELD_SHIFT_RC4
Definition: sigfox_monarch_api.h:59
sfx_monarch_listening_mode_t
sfx_monarch_listening_mode_t
Definition: sigfox_monarch_api.h:99
MONARCH_DELTA_F2
Definition: sigfox_monarch_api.h:80
MONARCH_LISTENING_SWEEP
Definition: sigfox_monarch_api.h:104
sfx_timer_unit_enum_t
sfx_timer_unit_enum_t
Definition: sigfox_monarch_api.h:39
NO_MONARCH_PATTERN
Definition: sigfox_monarch_api.h:78
SFX_BITFIELD_SHIFT_RC5
Definition: sigfox_monarch_api.h:60
SIGFOX_MONARCH_API_execute_rc_scan
sfx_error_t SIGFOX_MONARCH_API_execute_rc_scan(sfx_u8 rc_capabilities_bit_mask, sfx_u16 timer, sfx_timer_unit_enum_t unit, sfx_u8(*app_callback_handler)(sfx_u8 rc_bit_mask, sfx_s16 rssi))
This function executes a scan of the air to detect a Sigfox Beacon. It will return the RC enum value ...
sigfox_types.h
Sigfox types definition.
MONARCH_DELTA_F1
Definition: sigfox_monarch_api.h:79
LAST_MONARCH_PATTERN
Definition: sigfox_monarch_api.h:84
SFX_TIME_M
Definition: sigfox_monarch_api.h:45
SFX_TIME_MS
Definition: sigfox_monarch_api.h:43