Wirepas SDK
api.h
Go to the documentation of this file.
1 /* Copyright 2017 Wirepas Ltd. All Rights Reserved.
2  *
3  * See file LICENSE.txt for full license details.
4  *
5  */
6 
15 #ifndef API_H_
16 #define API_H_
17 
18 #include "wms_app.h"
19 #include "wms_data.h"
20 #include "wms_otap.h"
21 #include "wms_settings.h"
22 #include "wms_state.h"
23 #include "wms_storage.h"
24 #include "wms_system.h"
25 #include "wms_time.h"
26 #include "wms_hardware.h"
27 #include "wms_memory_area.h"
28 #include "wms_radio_config.h"
29 #include "wms_testing.h"
30 
31 // Expose common APIs
32 extern const app_global_functions_t * global_func __attribute((weak));
33 extern const app_lib_data_t * lib_data __attribute((weak));
34 extern const app_lib_otap_t * lib_otap __attribute((weak));
35 extern const app_lib_settings_t * lib_settings __attribute((weak));
36 extern const app_lib_state_t * lib_state __attribute((weak));
37 extern const app_lib_storage_t * lib_storage __attribute((weak));
38 extern const app_lib_system_t * lib_system __attribute((weak));
39 extern const app_lib_time_t * lib_time __attribute((weak));
40 extern const app_lib_hardware_t * lib_hw __attribute((weak));
41 extern const app_lib_testing_t * lib_testing __attribute((weak));
42 extern const app_lib_memory_area_t * lib_memory_area __attribute((weak));
43 extern const app_lib_radio_cfg_t * lib_radio_cfg __attribute((weak));
44 
45 
46 
77 bool API_Open(const app_global_functions_t * functions);
78 
79 // Define error value for functions
80 #define ERR_NOT_OPEN APP_RES_INVALID_NULL_POINTER
81 
82 // System library
83 #define Sys_enterCriticalSection() \
84  lib_system ? lib_system->enterCriticalSection() : ERR_NOT_OPEN
85 
86 #define Sys_exitCriticalSection() \
87  lib_system ? lib_system->exitCriticalSection() : ERR_NOT_OPEN
88 
89 #define Sys_disableDs(_dis) \
90  lib_system ? lib_system->disableDeepSleep(_dis) : ERR_NOT_OPEN
91 
92 #define Sys_enableAppIrq(_irqn, _isr) \
93  lib_system ? lib_system->enableAppIrq(false, _irqn, APP_LIB_SYSTEM_IRQ_PRIO_LO, _isr) : ERR_NOT_OPEN
94 
95 #define Sys_disableAppIrq(_irqn) \
96  lib_system ? lib_system->disableAppIrq(_irqn) : ERR_NOT_OPEN
97 
98 #define Sys_enableFastAppIrq(_irqn, _prio, _isr) \
99  lib_system ? lib_system->enableAppIrq(true, _irqn, _prio, _isr) : ERR_NOT_OPEN
100 
101 #define Sys_clearFastAppIrq(_irqn) \
102  lib_system ? lib_system->clearPendingFastAppIrq(_irqn) : ERR_NOT_OPEN
103 
104 // BLE beacon scanner library
105 #define Ble_beaconRx_setRxCb(_cb) \
106  lib_beacon_rx ? lib_beacon_rx->setBeaconReceivedCb(_cb) : ERR_NOT_OPEN
107 
108 #define Ble_beaconRx_startScanner(_chan) \
109  lib_beacon_rx ? lib_beacon_rx->startScanner(_chan) : ERR_NOT_OPEN
110 
111 #define Ble_beaconRx_stopScanner() \
112  lib_beacon_rx ? lib_beacon_rx->stopScanner() : ERR_NOT_OPEN
113 
114 #define Ble_beaconRx_isStarted() \
115  (lib_beacon_rx ? lib_beacon_rx->isScannerStarted() : ERR_NOT_OPEN)
116 
117 
118 #endif /* API_H_ */
app_lib_system_t
List of library functions.
Definition: wms_system.h:533
wms_testing.h
wms_state.h
app_lib_data_t
List of library services.
Definition: wms_data.h:797
wms_app.h
wms_settings.h
API_Open
bool API_Open(const app_global_functions_t *functions)
Open API (open all libraries)
app_lib_hardware_t
List of library functions.
Definition: wms_hardware.h:112
app_lib_state_t
List of library functions.
Definition: wms_state.h:618
app_global_functions_t
List of global functions, passed to App_entrypoint()
Definition: wms_app.h:157
wms_memory_area.h
wms_storage.h
app_lib_otap_t
Definition: wms_otap.h:488
__attribute
const app_global_functions_t *global_func __attribute((weak))
app_lib_testing_t
Definition: wms_testing.h:37
wms_hardware.h
wms_otap.h
wms_data.h
app_lib_storage_t
Definition: wms_storage.h:77
wms_system.h
wms_time.h
app_lib_settings_t
Definition: wms_settings.h:698
app_lib_time_t
List of library functions.
Definition: wms_time.h:192
app_lib_memory_area_t
List of library functions.
Definition: wms_memory_area.h:255
app_lib_radio_cfg_t
List of library functions.
Definition: wms_radio_config.h:247
wms_radio_config.h