WE310F5  39.00.000
M2MB Web Provisioing

This section describes the M2MB APIs for Web Provisioning. More...

#define WEB_PROV_DEBUG_PRINT(...)
 
#define M2MB_PROV_MAC_SSID_LEN   32
 
#define M2MB_PROV_MAX_DNS_DOMAIN_LEN   64
 
#define M2MB_PROV_MAX_SYS_ID_LEN   64
 
#define M2MB_PROV_NWIF_HOST_NAME_MAX_LEN   15
 
#define M2MB_PROV_SEC_PASSPHRASE_LEN   64
 
#define M2MB_PROV_SEC_MAX_WEP_KEY_LEN   M2MB_PROV_SEC_WEP104_KEY_LEN
 
#define M2MB_PROV_REG_DOMAIN_UNKNOWN_MAX_CH   14
 
#define M2MB_PROV_REG_DOMAIN_FCC_STR   "fcc"
 
#define M2MB_PROV_REG_DOMAIN_ETSI_STR   "etsi"
 
#define M2MB_PROV_REG_DOMAIN_ETSI_MEXS_STR   "etsi_mex"
 
#define M2MB_PROV_REG_DOMAIN_TELEC_STR   "telec"
 
#define M2MB_PROV_REG_DOMAIN_UNKNOWN_STR   "unknown"
 
#define M2MB_PROV_2_4_GHZ_BAND   "2.4GHz"
 
#define M2MB_PROV_5_GHZ_BAND   "5GHz"
 
#define M2MB_PROV_SECURITY_NONE_STR   "none"
 
#define M2MB_PROV_WEP_STR   "wep"
 
#define M2MB_PROV_WPA_PERSONAL_STR   "wpa-personal"
 
#define M2MB_PROV_WPA_ENTERPRISE_STR   "wpa-enterprise"
 
#define M2MB_PROV_HTTPD_MAX_USERNAME_LEN   32
 
#define M2MB_PROV_HTTPD_MAX_PASSWORD_LEN   32
 
#define M2MB_PROV_HTTPD_DEFAULT_USERNAME   "admin"
 
#define M2MB_PROV_HTTPD_DEFAULT_PASSWORD   "admin"
 
enum  M2MB_PROV_WEP_AUTH_TYPE {
  M2MB_PROV_SEC_WEP_OPEN,
  M2MB_PROV_SEC_WEP_SHARED
}
 WEP authentication type enumeration. More...
 
enum  M2MB_PROV_WEP_KEY_LEN {
  M2MB_PROV_SEC_WEP_KEY_INVLAID = 0,
  M2MB_PROV_SEC_WEP40_KEY_LEN = 5,
  M2MB_PROV_SEC_WEP104_KEY_LEN = 13
}
 WEP key length enumeration. More...
 
enum  M2MB_PROV_SEC_TYPE {
  M2MB_PROV_SEC_TYPE_NONE = 1,
  M2MB_PROV_SEC_TYPE_WEP,
  M2MB_PROV_SEC_TYPE_WPA_PERSONAL,
  M2MB_PROV_SEC_TYPE_WPA_ENTERPRISE
}
 Security type enumeration. More...
 
enum  M2MB_PROV_REG_DOMAIN {
  M2MB_PROV_REG_DOMAIN_FCC = 0,
  M2MB_PROV_REG_DOMAIN_ETSI,
  M2MB_PROV_REG_DOMAIN_TELEC,
  M2MB_PROV_REG_DOMAIN_ETSI_MEXS,
  M2MB_PROV_REG_DOMAIN_UNKNOWN
}
 Regulatory domains enumeration. More...
 
enum  M2MB_PROV_AP_MODE {
  M2MB_PROV_AP_MODE_PROV = 1,
  M2MB_PROV_AP_MODE_USER
}
 AP mode enumeration. More...
 
enum  M2MB_PROV_NETWORK_MODE {
  M2MB_PROV_NETWORK_MODE_INFRA_CLIENT = 1,
  M2MB_PROV_NETWORK_MODE_LIMITED_AP,
  M2MB_PROV_NETWORK_MODE_INFRA_CLIENT_VERIFY,
  M2MB_PROV_NETWORK_MODE_CONCURRENT
}
 Network mode enumeration. More...
 
enum  M2MB_PROV_SYS_CONFIG_OPTION {
  M2MB_PROV_SYS_CONFIG_OPTION_GET,
  M2MB_PROV_SYS_CONFIG_OPTION_SET
}
 Configuration opetions enumeration. More...
 
enum  M2MB_PROV_ENCODE_TYPE {
  M2MB_PROV_ENCODE_TYPE_XML,
  M2MB_PROV_ENCODE_TYPE_JSON
}
 Encoding types enumeration. More...
 
enum  M2MB_PROV_OBJECT_TYPE {
  M2MB_PROV_OBJECT_TYPE_NWK,
  M2MB_PROV_OBJECT_TYPE_SYSID,
  M2MB_PROV_OBJECT_TYPE_AUTH,
  M2MB_PROV_OBJECT_TYPE_VERIFIED_SUCCESS,
  M2MB_PROV_OBJECT_TYPE_VERIFIED_FAILURE,
  M2MB_PROV_OBJECT_TYPE_MAX
}
 Object types enumeration. More...
 
typedef enum M2MB_PROV_WEP_AUTH_TYPE M2MB_PROV_WEP_AUTH_TYPE_T
 WEP authentication type enumeration. More...
 
typedef enum M2MB_PROV_WEP_KEY_LEN M2MB_PROV_WEP_KEY_LEN_T
 WEP key length enumeration. More...
 
typedef enum M2MB_PROV_SEC_TYPE M2MB_PROV_SEC_TYPE_T
 Security type enumeration. More...
 
typedef enum M2MB_PROV_REG_DOMAIN M2MB_PROV_REG_DOMAIN_T
 Regulatory domains enumeration. More...
 
typedef enum M2MB_PROV_AP_MODE M2MB_PROV_AP_MODE_T
 AP mode enumeration. More...
 
typedef enum M2MB_PROV_NETWORK_MODE M2MB_PROV_NETWORK_MODE_T
 Network mode enumeration. More...
 
typedef enum M2MB_PROV_SYS_CONFIG_OPTION M2MB_PROV_SYS_CONFIG_OPTION_T
 Configuration opetions enumeration. More...
 
typedef enum M2MB_PROV_ENCODE_TYPE M2MB_PROV_ENCODE_TYPE_T
 Encoding types enumeration. More...
 
typedef enum M2MB_PROV_OBJECT_TYPE M2MB_PROV_OBJECT_TYPE_T
 Object types enumeration. More...
 
typedef struct M2MB_PROV_SSID M2MB_PROV_SSID_T
 SSID structure. More...
 
typedef struct M2MB_PROV_SEC_PSK M2MB_PROV_SEC_PSK_T
 PSK structure. More...
 
typedef struct M2MB_PROV_SEC_WEP_CONFIG M2MB_PROV_SEC_WEP_CONFIG_T
 WEP Configuration structure. More...
 
typedef struct M2MB_PROV_CLIENT_CONFIG M2MB_PROV_CLIENT_CONFIG_T
 Client Configuration structure. More...
 
typedef struct M2MB_PROV_IP_CONFIG M2MB_PROV_IP_CONFIG_T
 IP Configuration structure. More...
 
typedef struct M2MB_PROV_AP_CONFIG M2MB_PROV_AP_CONFIG_T
 AP Configuration structure. More...
 
typedef struct M2MB_PROV_NETWORK_CONFIG M2MB_PROV_NETWORK_CONFIG_T
 Network Configuration structure. More...
 
typedef struct M2MB_PROV_SYS_CONFIG_SYS_ID M2MB_PROV_SYS_CONFIG_SYS_ID_T
 System Configuration Identifier structure. More...
 
typedef struct M2MB_PROV_SYS_CONFIG M2MB_PROV_SYS_CONFIG_T
 System Configuration structure. More...
 
typedef int(* M2MB_PROV_CONFIG_CB_T) (M2MB_PROV_SYS_CONFIG_T *cfg, M2MB_PROV_SYS_CONFIG_OPTION_T option)
 Provision configuration call back prototype. More...
 
typedef struct M2MB_PROV_CONFIG_S M2MB_PROV_CONFIG_T
 Provisioning Configuration structure. More...
 
M2MB_STATUS_T m2mb_httpd_prov_start (M2MB_PROV_CONFIG_T *pProvcfg, M2MB_HTTPD_CONFIG_T *pHTTPDcfg)
 HTTP Provision Start. More...
 

Detailed Description

This section describes the M2MB APIs for Web Provisioning.

WE310F5_WebProvisioning.png
Web Provisioning

To initiate web provisioning, the system must be connected to a network or should create a network to communicate with other devices. HTTP server must be started and to make it secure SSL module must be initialized. The following steps must be performed:

Macro Definition Documentation

◆ M2MB_PROV_2_4_GHZ_BAND

#define M2MB_PROV_2_4_GHZ_BAND   "2.4GHz"

2.4GHz

Definition at line 77 of file m2mb_web_prov.h.

◆ M2MB_PROV_5_GHZ_BAND

#define M2MB_PROV_5_GHZ_BAND   "5GHz"

5 GHz

Definition at line 78 of file m2mb_web_prov.h.

◆ M2MB_PROV_HTTPD_DEFAULT_PASSWORD

#define M2MB_PROV_HTTPD_DEFAULT_PASSWORD   "admin"

Default password

Definition at line 89 of file m2mb_web_prov.h.

◆ M2MB_PROV_HTTPD_DEFAULT_USERNAME

#define M2MB_PROV_HTTPD_DEFAULT_USERNAME   "admin"

Default username

Definition at line 88 of file m2mb_web_prov.h.

◆ M2MB_PROV_HTTPD_MAX_PASSWORD_LEN

#define M2MB_PROV_HTTPD_MAX_PASSWORD_LEN   32

Maximum length of password

Definition at line 86 of file m2mb_web_prov.h.

◆ M2MB_PROV_HTTPD_MAX_USERNAME_LEN

#define M2MB_PROV_HTTPD_MAX_USERNAME_LEN   32

Maximum length of username

Definition at line 85 of file m2mb_web_prov.h.

◆ M2MB_PROV_MAC_SSID_LEN

#define M2MB_PROV_MAC_SSID_LEN   32

Maximum length of SSID

Definition at line 62 of file m2mb_web_prov.h.

◆ M2MB_PROV_MAX_DNS_DOMAIN_LEN

#define M2MB_PROV_MAX_DNS_DOMAIN_LEN   64

Maximum length of DNS Domain name

Definition at line 63 of file m2mb_web_prov.h.

◆ M2MB_PROV_MAX_SYS_ID_LEN

#define M2MB_PROV_MAX_SYS_ID_LEN   64

Maximum length of System Identifier

Definition at line 64 of file m2mb_web_prov.h.

◆ M2MB_PROV_NWIF_HOST_NAME_MAX_LEN

#define M2MB_PROV_NWIF_HOST_NAME_MAX_LEN   15

Maximum length of Network Interface Host name

Definition at line 65 of file m2mb_web_prov.h.

◆ M2MB_PROV_REG_DOMAIN_ETSI_MEXS_STR

#define M2MB_PROV_REG_DOMAIN_ETSI_MEXS_STR   "etsi_mex"

ETSI Mexico regulatory domain

Definition at line 73 of file m2mb_web_prov.h.

◆ M2MB_PROV_REG_DOMAIN_ETSI_STR

#define M2MB_PROV_REG_DOMAIN_ETSI_STR   "etsi"

ETSI regulatoty domain

Definition at line 72 of file m2mb_web_prov.h.

◆ M2MB_PROV_REG_DOMAIN_FCC_STR

#define M2MB_PROV_REG_DOMAIN_FCC_STR   "fcc"

FCC regulatory domain

Definition at line 71 of file m2mb_web_prov.h.

◆ M2MB_PROV_REG_DOMAIN_TELEC_STR

#define M2MB_PROV_REG_DOMAIN_TELEC_STR   "telec"

Telecom regulatory domain

Definition at line 74 of file m2mb_web_prov.h.

◆ M2MB_PROV_REG_DOMAIN_UNKNOWN_MAX_CH

#define M2MB_PROV_REG_DOMAIN_UNKNOWN_MAX_CH   14

Maximum channel count of unknown regulatory domain

Definition at line 69 of file m2mb_web_prov.h.

◆ M2MB_PROV_REG_DOMAIN_UNKNOWN_STR

#define M2MB_PROV_REG_DOMAIN_UNKNOWN_STR   "unknown"

Unknown regulatory domain

Definition at line 75 of file m2mb_web_prov.h.

◆ M2MB_PROV_SEC_MAX_WEP_KEY_LEN

#define M2MB_PROV_SEC_MAX_WEP_KEY_LEN   M2MB_PROV_SEC_WEP104_KEY_LEN

Maximul WEP Key length

Definition at line 67 of file m2mb_web_prov.h.

◆ M2MB_PROV_SEC_PASSPHRASE_LEN

#define M2MB_PROV_SEC_PASSPHRASE_LEN   64

Maximum length of security passphrase

Definition at line 66 of file m2mb_web_prov.h.

◆ M2MB_PROV_SECURITY_NONE_STR

#define M2MB_PROV_SECURITY_NONE_STR   "none"

No security

Definition at line 80 of file m2mb_web_prov.h.

◆ M2MB_PROV_WEP_STR

#define M2MB_PROV_WEP_STR   "wep"

WEP security

Definition at line 81 of file m2mb_web_prov.h.

◆ M2MB_PROV_WPA_ENTERPRISE_STR

#define M2MB_PROV_WPA_ENTERPRISE_STR   "wpa-enterprise"

WPA enterprise security

Definition at line 83 of file m2mb_web_prov.h.

◆ M2MB_PROV_WPA_PERSONAL_STR

#define M2MB_PROV_WPA_PERSONAL_STR   "wpa-personal"

WPA Personal security

Definition at line 82 of file m2mb_web_prov.h.

◆ WEB_PROV_DEBUG_PRINT

#define WEB_PROV_DEBUG_PRINT (   ...)

< Debug Print

Definition at line 59 of file m2mb_web_prov.h.

Typedef Documentation

◆ M2MB_PROV_AP_CONFIG_T

AP Configuration structure.

Structure for storing AP configuration.

◆ M2MB_PROV_AP_MODE_T

AP mode enumeration.

This enum defines macros for modes of AP supported by provisioning module.

◆ M2MB_PROV_CLIENT_CONFIG_T

Client Configuration structure.

Structure for storing client configuration.

◆ M2MB_PROV_CONFIG_CB_T

typedef int(* M2MB_PROV_CONFIG_CB_T) (M2MB_PROV_SYS_CONFIG_T *cfg, M2MB_PROV_SYS_CONFIG_OPTION_T option)

Provision configuration call back prototype.

Type definition of the user callback to handle provision configuration.

Definition at line 338 of file m2mb_web_prov.h.

◆ M2MB_PROV_CONFIG_T

Provisioning Configuration structure.

Structure for storing provisioning configuration.

◆ M2MB_PROV_ENCODE_TYPE_T

Encoding types enumeration.

This enum defines macros for types of encoding supported by provisioning module.

◆ M2MB_PROV_IP_CONFIG_T

IP Configuration structure.

Structure for storing IP configuration.

◆ M2MB_PROV_NETWORK_CONFIG_T

Network Configuration structure.

Structure for storing Network configuration.

◆ M2MB_PROV_NETWORK_MODE_T

Network mode enumeration.

This enum defines macros for network modes supported by provisioning module.

◆ M2MB_PROV_OBJECT_TYPE_T

Object types enumeration.

This enum defines macros for types of objects supported by provisioning module.

◆ M2MB_PROV_REG_DOMAIN_T

Regulatory domains enumeration.

This enum defines macros for regulatory domains supported by provisioning module.

◆ M2MB_PROV_SEC_PSK_T

PSK structure.

Structure for storing PSK and its length.

◆ M2MB_PROV_SEC_TYPE_T

Security type enumeration.

This enum defines macros for types of security supported by provisioning module.

◆ M2MB_PROV_SEC_WEP_CONFIG_T

WEP Configuration structure.

Structure for storing WEP Key and its configurations.

◆ M2MB_PROV_SSID_T

SSID structure.

Structure for storing SSID and its length.

◆ M2MB_PROV_SYS_CONFIG_OPTION_T

Configuration opetions enumeration.

This enum defines macros for configuration options supported by provisioning module.

◆ M2MB_PROV_SYS_CONFIG_SYS_ID_T

System Configuration Identifier structure.

Structure for storing system configuration identifier.

◆ M2MB_PROV_SYS_CONFIG_T

System Configuration structure.

Structure for storing system configuration.

◆ M2MB_PROV_WEP_AUTH_TYPE_T

WEP authentication type enumeration.

This enum defines macros for authentication type of WEP security.

◆ M2MB_PROV_WEP_KEY_LEN_T

WEP key length enumeration.

This enum defines macros for Key lengths of WEP security.

Enumeration Type Documentation

◆ M2MB_PROV_AP_MODE

AP mode enumeration.

This enum defines macros for modes of AP supported by provisioning module.

Enumerator
M2MB_PROV_AP_MODE_PROV 

Provisioning mode

M2MB_PROV_AP_MODE_USER 

User mode

Definition at line 149 of file m2mb_web_prov.h.

◆ M2MB_PROV_ENCODE_TYPE

Encoding types enumeration.

This enum defines macros for types of encoding supported by provisioning module.

Enumerator
M2MB_PROV_ENCODE_TYPE_XML 

XML encoding

M2MB_PROV_ENCODE_TYPE_JSON 

JSON encoding - Currently not supported in Provisioning

Definition at line 184 of file m2mb_web_prov.h.

◆ M2MB_PROV_NETWORK_MODE

Network mode enumeration.

This enum defines macros for network modes supported by provisioning module.

Enumerator
M2MB_PROV_NETWORK_MODE_INFRA_CLIENT 

Client mode

M2MB_PROV_NETWORK_MODE_LIMITED_AP 

AP mode

M2MB_PROV_NETWORK_MODE_INFRA_CLIENT_VERIFY 

Verified Clinet mode

M2MB_PROV_NETWORK_MODE_CONCURRENT 

Concurrent mode

Definition at line 160 of file m2mb_web_prov.h.

◆ M2MB_PROV_OBJECT_TYPE

Object types enumeration.

This enum defines macros for types of objects supported by provisioning module.

Enumerator
M2MB_PROV_OBJECT_TYPE_NWK 

Network

M2MB_PROV_OBJECT_TYPE_SYSID 

System Identifier

M2MB_PROV_OBJECT_TYPE_AUTH 

Authentication

M2MB_PROV_OBJECT_TYPE_VERIFIED_SUCCESS 

Verified Provisioning - Success

M2MB_PROV_OBJECT_TYPE_VERIFIED_FAILURE 

Verified Provisioning - Failure

M2MB_PROV_OBJECT_TYPE_MAX 

Reserved

Definition at line 195 of file m2mb_web_prov.h.

◆ M2MB_PROV_REG_DOMAIN

Regulatory domains enumeration.

This enum defines macros for regulatory domains supported by provisioning module.

Enumerator
M2MB_PROV_REG_DOMAIN_FCC 

FCC regulatory domain

M2MB_PROV_REG_DOMAIN_ETSI 

ETSI regulatory domain

M2MB_PROV_REG_DOMAIN_TELEC 

Telecom regulatory domain

M2MB_PROV_REG_DOMAIN_ETSI_MEXS 

ETSI Mexico regulatory domain

M2MB_PROV_REG_DOMAIN_UNKNOWN 

Unknown regulatory domain

Definition at line 135 of file m2mb_web_prov.h.

◆ M2MB_PROV_SEC_TYPE

Security type enumeration.

This enum defines macros for types of security supported by provisioning module.

Enumerator
M2MB_PROV_SEC_TYPE_NONE 

Open security

M2MB_PROV_SEC_TYPE_WEP 

WEP security

M2MB_PROV_SEC_TYPE_WPA_PERSONAL 

WPA personal security

M2MB_PROV_SEC_TYPE_WPA_ENTERPRISE 

Enterprise security

Definition at line 122 of file m2mb_web_prov.h.

◆ M2MB_PROV_SYS_CONFIG_OPTION

Configuration opetions enumeration.

This enum defines macros for configuration options supported by provisioning module.

Enumerator
M2MB_PROV_SYS_CONFIG_OPTION_GET 

Option to get configuration

M2MB_PROV_SYS_CONFIG_OPTION_SET 

Option to set configuration

Definition at line 173 of file m2mb_web_prov.h.

◆ M2MB_PROV_WEP_AUTH_TYPE

WEP authentication type enumeration.

This enum defines macros for authentication type of WEP security.

Enumerator
M2MB_PROV_SEC_WEP_OPEN 

WEP-40 Key length in bytes.

M2MB_PROV_SEC_WEP_SHARED 

WEP-104 Key length in bytes.

Definition at line 99 of file m2mb_web_prov.h.

◆ M2MB_PROV_WEP_KEY_LEN

WEP key length enumeration.

This enum defines macros for Key lengths of WEP security.

Enumerator
M2MB_PROV_SEC_WEP_KEY_INVLAID 

WEP-40 Key length in bytes.

M2MB_PROV_SEC_WEP40_KEY_LEN 

WEP-40 Key length in bytes.

M2MB_PROV_SEC_WEP104_KEY_LEN 

WEP-104 Key length in bytes.

Definition at line 110 of file m2mb_web_prov.h.

Function Documentation

◆ m2mb_httpd_prov_start()

M2MB_STATUS_T m2mb_httpd_prov_start ( M2MB_PROV_CONFIG_T pProvcfg,
M2MB_HTTPD_CONFIG_T pHTTPDcfg 
)

HTTP Provision Start.

This API starts HTTP provisioning.

Parameters
[in]pProvcfgPointer to the provisioning related configuration.
[in]pHTTPDcfgPointer to the HTTP server related configuration.
Returns
Returns M2MB_OK on success, M2MB_ERROR on failure

m2mb_httpd_prov_start( M2MB_PROV_CONFIG_T pProvcfg, M2MB_HTTPD_CONFIG_T pHTTPDcfg );

void m2m_s2w_webprov_otafu_cb( UINT32 resp_code )
{
}
int m2m_s2w_webprov_config_cb( M2MB_PROV_SYS_CONFIG_T *cfg, M2MB_PROV_SYS_CONFIG_OPTION_T option )
{
}
M2MB_STATUS_T m2m_verified_prov_apply_cb( UINT8 device_id, M2MB_PROFILE_EVENT_T event, VOID *pData )
{
}
int main()
{
M2MB_STATUS_T result;
M2MB_PROV_CONFIG_T prov_cfg = { 0 };
M2MB_HTTPD_CONFIG_T httpd_cfg = { 0 };
httpd_cfg.http_Port = 80;
httpd_cfg.username_auth = 1;
prov_cfg.pSystem = Pointer to your system configuration structure.
prov_cfg.otafu_cb = m2m_s2w_webprov_otafu_cb;
prov_cfg.config_cb = m2m_s2w_webprov_config_cb;
prov_cfg.profile_apply_cb = m2m_verified_prov_apply_cb;
result = m2mb_httpd_prov_start( &prov_cfg, &httpd_cfg );
if (result != M2MB_OK)
{
return M2MB_ERROR;
}
return M2MB_OK;
}