![]() |
WE310F5
39.00.000
|
This section describes the M2MB APIs related to profile. More...
This section describes the M2MB APIs related to profile.
Profile module provides data types and APIs for the system configuration. The data types defined are compatible with the JSON schema for the JSON parser module. These structure can be used to store the configuration in the JSON format in the file system. The system_schema variable defines the schema for JSON which user can use for this purpose. User can define variable of data type M2MB_SYSTEM_CFG_T and set the system configuration and using the system_schema, can store the configuration to file system in JSON format as shown below:-
UINT8 buffer[BUFFER_LEN]; -> BUFFER_LEN should be large enough to store the JSON encoded values UINT32 length; M2MB_SYSTEM_CFG_T sys_profile; .............. set the configuration in the sys_profile; .............. return_status = m2mb_json_encode((M2MB_JSON_COMPLEX_OBJ_T *)&system_schema, ( UINT8* )&sys_profile, ( UINT8* )buffer, BUFFER_LEN, ( UINT32* )&length );
The buffer will contain the JSON formated configuration. User can use file system APIs to store the buffer content to a configuration file in the flash.
On boot up, user can extract the configuration to the sys_profile by decoding back the buffer content as shown below:
return_status = m2mb_json_decode( buffer, buffer + length, ( M2MB_JSON_COMPLEX_OBJ_T* )&system_schema, ( UINT8* )&sys_profile );
Here, the buffer contains the content read from the configuration file and length is the length of the configuration file.
It also provides the API to initialize the module based on the profile setting. User callback with the appropriate events and data gets called while initializing the modules.
#define DEFAULT_TCP_CLIENT 2 |
Definition at line 92 of file m2mb_profile.h.
#define DEFAULT_TCP_SERVER 1 |
Definition at line 91 of file m2mb_profile.h.
#define DEFAULT_UDP_SOCKET 3 |
Definition at line 93 of file m2mb_profile.h.
#define M2M_HTTPD_PROFILE_ENABLE |
Definition at line 95 of file m2mb_profile.h.
typedef struct M2M_PROFILE_AP_SET_RESULT_S M2M_PROFILE_AP_SET_RESULT_T |
AP structure used in user callback to update the status of AP initialization.
AP structure used in user callback to update the status of AP initialization.
typedef struct M2M_PROFILE_STA_SET_RESULT_S M2M_PROFILE_STA_SET_RESULT_T |
STA structure used in user callback to update the status of STA initialization.
STA structure used in user callback to update the status of STA initialization.
typedef struct M2MB_AP_CFG_S M2MB_AP_CFG_T |
AP cfg structure.
AP cfg structure.
typedef struct M2MB_AP_WLAN_CFG_S M2MB_AP_WLAN_CFG_T |
AP WLAN cfg structure.
AP WLAN cfg structure.
typedef struct M2MB_DHCP_SRV_CFG_S M2MB_DHCP_SRV_CFG_T |
DHCP server cfg structure.
DHCP server cfg structure.
typedef struct M2MB_DNS_HOST_CFG_ARRAY_S M2MB_DNS_HOST_CFG_ARRAY_T |
Array of DNS host cfg structure.
Array of DNS host cfg structure.
typedef struct M2MB_DNS_HOST_CFG_S M2MB_DNS_HOST_CFG_T |
DNS host cfg structure.
DNS host cfg structure. To add DNS host name and IP address pair to the list of DNS server database.
typedef struct M2MB_EAP_CONF_S M2MB_EAP_CONF_T |
typedef struct M2MB_HTTPC_CGF_S M2MB_HTTPC_CFG_ARRAY_T |
HTTP client cfg structure.
HTTP client cfg structure.
typedef struct M2MB_HTTPD_PROFILE_CFG_S M2MB_HTTPD_PROFILE_CFG_T |
HTTP Server cfg structure.
HTTP Server cfg structure.
typedef struct M2MB_HTTPD_PROFILE_S M2MB_HTTPD_PROFILE_T |
HTTP Server Profile cfg structure.
HTTP Server Profile cfg structure.
HTTP Server URI config structure.
HTTP Server URI config structure.
typedef struct M2MB_HTTPD_PROFILE_URI_INFO_S M2MB_HTTPD_PROFILE_URI_INFO_T |
HTTP Server URI info structure.
HTTP Server URI info structure.
typedef struct M2M_IP_CFG_S M2MB_IP_CFG_T |
IP cfg structure.
IP cfg structure.
typedef struct M2MB_MDNS_CFG_S M2MB_MDNS_CFG_T |
MDNS cfg structure.
MDNS cfg structure.
typedef struct M2MB_MDNS_HOST_CFG_S M2MB_MDNS_HOST_CFG_T |
MDNS host cfg structure.
MDNS host cfg structure.
typedef struct M2MB_MDNS_SERVICE_CFG_ARRAY_S M2MB_MDNS_SERVICE_CFG_ARRAY_T |
typedef struct M2MB_MDNS_SERVICE_CFG_S M2MB_MDNS_SERVICE_CFG_T |
MDNS service cfg structure.
MDNS service structure.
typedef struct M2MB_POWER_SAVE_CFG_S M2MB_POWER_SAVE_CFG_T |
typedef M2MB_STATUS_T(* M2MB_PROFILE_APPLY_CB_T) (UINT8 device_id, M2MB_PROFILE_EVENT_T event, M2MB_STATUS_T status, VOID *pData) |
Profile apply callback prototype.
Profile apply callback prototype. The pData pointer has to be interpreted based on the event.
[in] | device_id | Device ID in operation |
[in] | event | Event of the profile apply |
[in] | status | Status of the event |
[in] | pData | Data related to event. User has to typecast to the appropriate structure based on the event passed in the event parameter. The structure to typecast to interpret the data is explained in the event enum:M2MB_PROFILE_EVENT_T. |
m2mb_profile_apply(&pcfg, profile_apply_cb)/
Definition at line 215 of file m2mb_profile.h.
typedef struct M2MB_PROFILE_DBG_CFG_S M2MB_PROFILE_DBG_CFG_T |
Debug configuration structure.
This structure is used configure the Debug module.
typedef enum M2MB_PROFILE_EVENT M2MB_PROFILE_EVENT_T |
Profile event enumeration.
Profile event enumeration, passed in user callback while applying profile.
typedef struct M2MB_PROFILE_GPIO_CFG_ARRAY_S M2MB_PROFILE_GPIO_CFG_ARRAY_T |
GPIO cfg structure for the system.
GPIO cfg structure for the system.
typedef struct M2MB_PROFILE_GPIO_CFG_S M2MB_PROFILE_GPIO_CFG_T |
typedef struct M2MB_PROFILE_SOC_RESULT M2MB_PROFILE_SOC_RESULT_T |
Socket for UDP & TCP initialization result.
This structure is used to notify user about the status of UDP & TCP socket initialization result.
typedef struct M2MB_PROFILE_UART_CB M2MB_PROFILE_UART_CB_T |
UART read and write callback data structure.
This structure is used to notify user about the details of UART read and write callback.
typedef struct M2MB_PROFILE_UART_CFG M2MB_PROFILE_UART_CFG_T |
UART configuration structure.
UART configuration structure.
typedef struct M2MB_PROFILE_UART_OPEN_CB M2MB_PROFILE_UART_OPEN_CB_T |
UART initialization result.
This structure is used to notify user about the status of UART initialization result.
typedef struct M2MB_PROFILE_XFP_CFG_S M2MB_PROFILE_XFP_CFG_T |
XFP configuration structure.
XFP configuration structure. If it is enabled XFP based FWUP can be done over the configured port.
typedef struct M2MB_RETRY_CFG_S M2MB_RETRY_CFG_T |
typedef struct M2MB_ROAMING_CFG_S M2MB_ROAMING_CFG_T |
Roaming cfg structure.
Roaming cfg structure.
typedef struct M2MB_SNTP_CFG_S M2MB_SNTP_CFG_T |
SNTP client cfg structure.
SNTP client cfg structure.
typedef struct M2MB_STA_CFG_S M2MB_STA_CFG_T |
STA cfg structure.
STA cfg structure.
typedef struct M2MB_STA_SCAN_CFG_S M2MB_STA_SCAN_CFG_T |
STA scan cfg structure.
STA scan cfg structure.
typedef struct M2MB_SYSTEM_CFG_S M2MB_SYSTEM_CFG_T |
System cfg structure.
System cfg structure.
typedef struct M2MB_T_CFG_S M2MB_T_CFG_T |
TCP cfg structure.
TCP cfg structure.
typedef struct M2MB_T_CFG_ARRAY_S M2MB_TCP_CFG_ARRAY_T |
TCP cfg structure for the system.
TCP cfg structure for the system.
typedef struct M2MB_UDP_CFG_ARRAY_S M2MB_UDP_CFG_ARRAY_T |
UDP cfg structure for the system.
UDP cfg structure for the system.
typedef struct M2MB_UDP_CFG_S M2MB_UDP_CFG_T |
UDP cfg structure.
UDP cfg structure.
typedef struct M2MB_WLAN_STA_CFG_ARRAY_S M2MB_WLAN_STA_CFG_ARRAY_T |
Array of WLAN STATION configuration structure.
Array of WLAN STATION configuration structure.
typedef struct M2MB_WLAN_STA_CFG_S M2MB_WLAN_STA_CFG_T |
WLAN sta structure.
WLAN sta structure.
enum M2MB_PROFILE_EVENT |
Profile event enumeration.
Profile event enumeration, passed in user callback while applying profile.
Definition at line 106 of file m2mb_profile.h.
|
inline |
Definition at line 164 of file m2mb_profile.h.
INT32 m2mb_profile_apply | ( | const M2MB_SYSTEM_CFG_T * | pCfg, |
M2MB_PROFILE_APPLY_CB_T | cb | ||
) |
m2mb_profile_apply is called to apply the profile.
m2mb_profile_apply initializes the system with the profile configuration given. Based on the profile, it starts configuring WLAN and sets up the network layer.
[in] | pCfg | Pointer to system configuration. |
[in] | cb | User callback for the the event handling. |
INT32 m2mb_profile_tcp_soc_init | ( | M2MB_T_CFG_T * | t_cfg | ) |
m2mb_profile_tcp_soc_init is called to apply the profile related to TCP.
m2mb_profile_tcp_soc_init initializes the TCP socket with the given TCP configuration. Based on the profile, it starts configuring TCP socket and sets up the transport layer.
[in] | t_cfg | Pointer to TCP configuration. |
INT32 m2mb_profile_udp_soc_init | ( | M2MB_UDP_CFG_T * | udp_cfg | ) |
m2mb_profile_udp_soc_init is called to apply the profile related to UDP.
m2mb_profile_udp_soc_init initializes the UDP socket with the given UDP configuration. Based on the profile, it starts configuring UDP socket and sets up the transport layer.
[in] | udp_cfg | Pointer to UDP configuration. |
UINT8* m2mb_profile_event_str[] |
const M2MB_JSON_COMPLEX_OBJ_T system_schema |