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_joining.h"
30#include "wms_advertiser.h"
31#include "wms_beacon_tx.h"
32#include "wms_beacon_rx.h"
33#include "wms_sleep.h"
34
35#include "wms_secure_storage.h"
36
37// Expose common APIs
38extern const app_global_functions_t * global_func __attribute((weak));
39extern const app_lib_data_t * lib_data __attribute((weak));
40extern const app_lib_otap_t * lib_otap __attribute((weak));
41extern const app_lib_settings_t * lib_settings __attribute((weak));
42extern const app_lib_state_t * lib_state __attribute((weak));
43extern const app_lib_storage_t * lib_storage __attribute((weak));
44extern const app_lib_system_t * lib_system __attribute((weak));
45extern const app_lib_time_t * lib_time __attribute((weak));
46extern const app_lib_hardware_t * lib_hw __attribute((weak));
47// BLE beacons
48extern const app_lib_beacon_tx_t * lib_beacon_tx __attribute((weak));
49extern const app_lib_beacon_rx_t * lib_beacon_rx __attribute((weak));
50extern const app_lib_sleep_t * lib_sleep __attribute((weak));
51extern const app_lib_advertiser_t * lib_advertiser __attribute((weak));
52extern const app_lib_joining_t * lib_joining __attribute((weak));
53extern const app_lib_memory_area_t * lib_memory_area __attribute((weak));
54extern const app_lib_radio_cfg_t * lib_radio_cfg __attribute((weak));
55
56
57
58extern const app_lib_secure_storage_t * lib_secure_storage __attribute((weak));
59
91bool API_Open(const app_global_functions_t * functions);
92
93// Define error value for functions
94#define ERR_NOT_OPEN APP_RES_INVALID_NULL_POINTER
95
96// System library
97#define Sys_enterCriticalSection() \
98 lib_system ? lib_system->enterCriticalSection() : ERR_NOT_OPEN
99
100#define Sys_exitCriticalSection() \
101 lib_system ? lib_system->exitCriticalSection() : ERR_NOT_OPEN
102
103#define Sys_disableDs(_dis) \
104 lib_system ? lib_system->disableDeepSleep(_dis) : ERR_NOT_OPEN
105
106#define Sys_enableAppIrq(_irqn, _isr) \
107 lib_system ? lib_system->enableAppIrq(false, _irqn, APP_LIB_SYSTEM_IRQ_PRIO_LO, _isr) : ERR_NOT_OPEN
108
109#define Sys_disableAppIrq(_irqn) \
110 lib_system ? lib_system->disableAppIrq(_irqn) : ERR_NOT_OPEN
111
112#define Sys_enableFastAppIrq(_irqn, _prio, _isr) \
113 lib_system ? lib_system->enableAppIrq(true, _irqn, _prio, _isr) : ERR_NOT_OPEN
114
115#define Sys_clearFastAppIrq(_irqn) \
116 lib_system ? lib_system->clearPendingFastAppIrq(_irqn) : ERR_NOT_OPEN
117
118// BLE beacon scanner library
119#define Ble_beaconRx_setRxCb(_cb) \
120 lib_beacon_rx ? lib_beacon_rx->setBeaconReceivedCb(_cb) : ERR_NOT_OPEN
121
122#define Ble_beaconRx_startScanner(_chan) \
123 lib_beacon_rx ? lib_beacon_rx->startScanner(_chan) : ERR_NOT_OPEN
124
125#define Ble_beaconRx_stopScanner() \
126 lib_beacon_rx ? lib_beacon_rx->stopScanner() : ERR_NOT_OPEN
127
128#define Ble_beaconRx_isStarted() \
129 (lib_beacon_rx ? lib_beacon_rx->isScannerStarted() : ERR_NOT_OPEN)
130
131
132#endif /* API_H_ */
const app_global_functions_t *global_func __attribute((weak))
bool API_Open(const app_global_functions_t *functions)
Open API (open all libraries)
List of library functions.
List of global functions, passed to App_entrypoint()
Definition wms_app.h:158
List of library functions.
List of library services.
Definition wms_data.h:1012
List of library functions.
List of library functions.
List of library functions.
List of library functions.
List of library functions.
Settings library API.
List of library functions.
Definition wms_sleep.h:177
List of library functions.
Definition wms_state.h:628
List of library functions.
Definition wms_system.h:579
List of library functions.
Definition wms_time.h:191