Wirepas SDK
shared_appconfig.h File Reference

Go to the source code of this file.

Typedefs

typedef void(* shared_app_config_received_cb_f) (uint16_t type, uint8_t length, uint8_t *value_p)
 The app config type reception callback. More...
 

Functions

shared_app_config_res_e Shared_Appconfig_init (void)
 Initialize the shared app config library library. More...
 
shared_app_config_res_e Shared_Appconfig_addFilter (shared_app_config_filter_t *filter, uint16_t *filter_id)
 Add a new app config type filter to the list. If the item is already in the list it is only updated. More...
 
shared_app_config_res_e Shared_Appconfig_removeFilter (uint16_t filter_id)
 Remove a received packet item from the list. Removed item fields are all set to 0. More...
 

Data Structures

struct  shared_app_config_filter_t
 Structure holding all parameters for app config type filtering. More...
 

Enumerations

enum  shared_app_config_res_e {
  SHARED_APP_CONFIG_RES_OK = 0, SHARED_APP_CONFIG_RES_NO_FILTER = 1, SHARED_APP_CONFIG_RES_INVALID_PARAM = 2, SHARED_APP_CONFIG_RES_INVALID_FILTER = 3,
  SHARED_APP_CONFIG_RES_UNINITIALIZED = 4
}
 List of return code. More...
 

Macros

#define SHARED_APP_CONFIG_ALL_TYPE_FILTER   0xFFFF
 Value to use to receive all types. More...
 
#define SHARED_APP_CONFIG_INCOMPATIBLE_FILTER   0xFFFE
 Value to use to receive incompatible raw app_config Ie, if the app config is not recognized by this library, the complete raw app config is sent to registered modules. More...
 

Typedef Documentation

◆ shared_app_config_received_cb_f

typedef void(* shared_app_config_received_cb_f) (uint16_t type, uint8_t length, uint8_t *value_p)

The app config type reception callback.

This is the callback called when a new app config is received and a matching type is present in the content.

Parameters
typeThe type that match the filtering
lengthThe length of this TLV entry.
value_pPointer to the value of the TLV

Definition at line 55 of file shared_appconfig.h.

Function Documentation

◆ Shared_Appconfig_addFilter()

shared_app_config_res_e Shared_Appconfig_addFilter ( shared_app_config_filter_t filter,
uint16_t *  filter_id 
)

Add a new app config type filter to the list. If the item is already in the list it is only updated.

Parameters
filterNew filter (type + cb)
filter_idFilter id to be used with Shared_Appconfig_removeTypeReceivedCb. Set only if return code is SHARED_APP_CONFIG_RES_OK
Returns
SHARED_APP_CONFIG_RES_OK if ok. See shared_app_config_res_e for other result codes.
Examples
appconfig/app.c, and inventory_app_router/app.c.

◆ Shared_Appconfig_init()

shared_app_config_res_e Shared_Appconfig_init ( void  )

Initialize the shared app config library library.

Note
If Shared app config module is used in application, the lib_data->setNewAppConfigCb() function offered by data library MUST NOT be used outside of this module.
Returns
SHARED_APP_CONFIG_RES_OK.
Examples
appconfig/app.c, inventory_app_router/app.c, and positioning_app/app.c.

◆ Shared_Appconfig_removeFilter()

shared_app_config_res_e Shared_Appconfig_removeFilter ( uint16_t  filter_id)

Remove a received packet item from the list. Removed item fields are all set to 0.

Parameters
filter_idfilter to remove.
Returns
SHARED_APP_CONFIG_RES_OK if ok. See shared_app_config_res_e for other result codes.

Data Structure Documentation

◆ shared_app_config_filter_t

struct shared_app_config_filter_t

Structure holding all parameters for app config type filtering.

Examples
appconfig/app.c, and inventory_app_router/app.c.

Definition at line 60 of file shared_appconfig.h.

Data Fields
bool call_cb_always

If set to true, the cb will be called everytime an app_config is received, even if the type is not present. If it happens, cb will have length set to 0 and value_p set to NULL

shared_app_config_received_cb_f cb

Will be called when the received app_config contains a matching type If the type is SHARED_APP_CONFIG_ALL_TYPE_FILTER the callback will be called multiple times

uint16_t type

Type for this filter. valid range [0;(2^16-1)], -1: to receive all types

Enumeration Type Documentation

◆ shared_app_config_res_e

List of return code.

Enumerator
SHARED_APP_CONFIG_RES_OK 

Operation is successful

SHARED_APP_CONFIG_RES_NO_FILTER 

No more filter available

SHARED_APP_CONFIG_RES_INVALID_PARAM 

Invalid Param

SHARED_APP_CONFIG_RES_INVALID_FILTER 

Trying to remove a filter that doesn't exist

SHARED_APP_CONFIG_RES_UNINITIALIZED 

Using the library without previous initialization

Definition at line 15 of file shared_appconfig.h.

Macro Definition Documentation

◆ SHARED_APP_CONFIG_ALL_TYPE_FILTER

#define SHARED_APP_CONFIG_ALL_TYPE_FILTER   0xFFFF

Value to use to receive all types.

Definition at line 32 of file shared_appconfig.h.

◆ SHARED_APP_CONFIG_INCOMPATIBLE_FILTER

#define SHARED_APP_CONFIG_INCOMPATIBLE_FILTER   0xFFFE

Value to use to receive incompatible raw app_config Ie, if the app config is not recognized by this library, the complete raw app config is sent to registered modules.

Examples
appconfig/app.c, and inventory_app_router/app.c.

Definition at line 39 of file shared_appconfig.h.

SHARED_APP_CONFIG_RES_NO_FILTER
@ SHARED_APP_CONFIG_RES_NO_FILTER
Definition: shared_appconfig.h:20
SHARED_APP_CONFIG_RES_OK
@ SHARED_APP_CONFIG_RES_OK
Definition: shared_appconfig.h:18
SHARED_APP_CONFIG_RES_INVALID_PARAM
@ SHARED_APP_CONFIG_RES_INVALID_PARAM
Definition: shared_appconfig.h:22
SHARED_APP_CONFIG_RES_INVALID_FILTER
@ SHARED_APP_CONFIG_RES_INVALID_FILTER
Definition: shared_appconfig.h:24
shared_app_config_res_e
shared_app_config_res_e
List of return code.
Definition: shared_appconfig.h:15
SHARED_APP_CONFIG_RES_UNINITIALIZED
@ SHARED_APP_CONFIG_RES_UNINITIALIZED
Definition: shared_appconfig.h:26