Wirepas SDK
api.h File Reference

Detailed Description

Implements global API for Wirepas library services

One can use the libraries individually, or use this interface that binds the libraries to function like macros for convenient (and safe) use

Definition in file api.h.

Go to the source code of this file.

Functions

const app_global_functions_t *global_func __attribute ((weak))
 
bool API_Open (const app_global_functions_t *functions)
 Open API (open all libraries) More...
 

Macros

#define ERR_NOT_OPEN   APP_RES_INVALID_NULL_POINTER
 
#define Sys_enterCriticalSection()   lib_system ? lib_system->enterCriticalSection() : ERR_NOT_OPEN
 
#define Sys_exitCriticalSection()   lib_system ? lib_system->exitCriticalSection() : ERR_NOT_OPEN
 
#define Sys_disableDs(_dis)   lib_system ? lib_system->disableDeepSleep(_dis) : ERR_NOT_OPEN
 
#define Sys_enableAppIrq(_irqn, _isr)   lib_system ? lib_system->enableAppIrq(false, _irqn, APP_LIB_SYSTEM_IRQ_PRIO_LO, _isr) : ERR_NOT_OPEN
 
#define Sys_disableAppIrq(_irqn)   lib_system ? lib_system->disableAppIrq(_irqn) : ERR_NOT_OPEN
 
#define Sys_enableFastAppIrq(_irqn, _prio, _isr)   lib_system ? lib_system->enableAppIrq(true, _irqn, _prio, _isr) : ERR_NOT_OPEN
 
#define Sys_clearFastAppIrq(_irqn)   lib_system ? lib_system->clearPendingFastAppIrq(_irqn) : ERR_NOT_OPEN
 
#define Ble_beaconRx_setRxCb(_cb)   lib_beacon_rx ? lib_beacon_rx->setBeaconReceivedCb(_cb) : ERR_NOT_OPEN
 
#define Ble_beaconRx_startScanner(_chan)   lib_beacon_rx ? lib_beacon_rx->startScanner(_chan) : ERR_NOT_OPEN
 
#define Ble_beaconRx_stopScanner()   lib_beacon_rx ? lib_beacon_rx->stopScanner() : ERR_NOT_OPEN
 
#define Ble_beaconRx_isStarted()   (lib_beacon_rx ? lib_beacon_rx->isScannerStarted() : ERR_NOT_OPEN)
 

Function Documentation

◆ __attribute()

const app_lib_joining_t *lib_joining __attribute ( (weak)  )

◆ API_Open()

bool API_Open ( const app_global_functions_t functions)

Open API (open all libraries)

This function opens all libraries and stores the handle to those for function pointers (app_lib_<library>_t *). Then, application may continue using those pointers.

Example on using this function. After opening, the system library can be used by using lib_system handle.

void App_init(const app_global_functions_t * functions)
{
// Open Wirepas public API
API_Open(functions);
...
// Enable interrupt
lib_system->enableAppIrq(false, TEMP_IRQn, APP_LIB_SYSTEM_IRQ_PRIO_LO, temp_interrupt_handler);
...
}
Parameters
functionsThe root library address passed to Application startup App_init()
Returns
status of operation

Macro Definition Documentation

◆ Ble_beaconRx_isStarted

#define Ble_beaconRx_isStarted ( )    (lib_beacon_rx ? lib_beacon_rx->isScannerStarted() : ERR_NOT_OPEN)

Definition at line 124 of file api.h.

◆ Ble_beaconRx_setRxCb

#define Ble_beaconRx_setRxCb (   _cb)    lib_beacon_rx ? lib_beacon_rx->setBeaconReceivedCb(_cb) : ERR_NOT_OPEN

Definition at line 115 of file api.h.

◆ Ble_beaconRx_startScanner

#define Ble_beaconRx_startScanner (   _chan)    lib_beacon_rx ? lib_beacon_rx->startScanner(_chan) : ERR_NOT_OPEN

Definition at line 118 of file api.h.

◆ Ble_beaconRx_stopScanner

#define Ble_beaconRx_stopScanner ( )    lib_beacon_rx ? lib_beacon_rx->stopScanner() : ERR_NOT_OPEN

Definition at line 121 of file api.h.

◆ ERR_NOT_OPEN

#define ERR_NOT_OPEN   APP_RES_INVALID_NULL_POINTER

Definition at line 90 of file api.h.

◆ Sys_clearFastAppIrq

#define Sys_clearFastAppIrq (   _irqn)    lib_system ? lib_system->clearPendingFastAppIrq(_irqn) : ERR_NOT_OPEN

Definition at line 111 of file api.h.

◆ Sys_disableAppIrq

#define Sys_disableAppIrq (   _irqn)    lib_system ? lib_system->disableAppIrq(_irqn) : ERR_NOT_OPEN

Definition at line 105 of file api.h.

◆ Sys_disableDs

#define Sys_disableDs (   _dis)    lib_system ? lib_system->disableDeepSleep(_dis) : ERR_NOT_OPEN

Definition at line 99 of file api.h.

◆ Sys_enableAppIrq

#define Sys_enableAppIrq (   _irqn,
  _isr 
)    lib_system ? lib_system->enableAppIrq(false, _irqn, APP_LIB_SYSTEM_IRQ_PRIO_LO, _isr) : ERR_NOT_OPEN

Definition at line 102 of file api.h.

◆ Sys_enableFastAppIrq

#define Sys_enableFastAppIrq (   _irqn,
  _prio,
  _isr 
)    lib_system ? lib_system->enableAppIrq(true, _irqn, _prio, _isr) : ERR_NOT_OPEN

Definition at line 108 of file api.h.

◆ Sys_enterCriticalSection

#define Sys_enterCriticalSection ( )    lib_system ? lib_system->enterCriticalSection() : ERR_NOT_OPEN

Definition at line 93 of file api.h.

◆ Sys_exitCriticalSection

#define Sys_exitCriticalSection ( )    lib_system ? lib_system->exitCriticalSection() : ERR_NOT_OPEN

Definition at line 96 of file api.h.

API_Open
bool API_Open(const app_global_functions_t *functions)
Open API (open all libraries)
APP_LIB_SYSTEM_IRQ_PRIO_LO
#define APP_LIB_SYSTEM_IRQ_PRIO_LO
Definition: wms_system.h:55
app_global_functions_t
List of global functions, passed to App_entrypoint()
Definition: wms_app.h:157