This section describes the M2MB APIs for XML module.
More...
| enum | M2MB_XML_OBJ_TYPE {
M2MB_XML_COMPLEX_ELEMENT,
M2MB_XML_SIMPLE_ELEMENT,
M2MB_XML_ATTRIBUTE,
M2MB_XML_NONE
} |
| | Object type supported by the xml. More...
|
| |
| enum | M2MB_XML_DATA_TYPE {
M2MB_XML_DT_NONE,
M2MB_XML_DT_UINT8,
M2MB_XML_DT_INT8,
M2MB_XML_DT_UINT16,
M2MB_XML_DT_INT16,
M2MB_XML_DT_UINT32,
M2MB_XML_DT_INT32,
M2MB_XML_DT_UINT64,
M2MB_XML_DT_INT64,
M2MB_XML_DT_FLOAT,
M2MB_XML_DT_DOUBLE,
M2MB_XML_DT_STR,
M2MB_XML_DT_TOKEN,
M2MB_XML_DT_BASE64BIN,
M2MB_XML_DT_HEXBIN,
M2MB_XML_DT_DATE,
M2MB_XML_DT_TIME,
M2MB_XML_DT_DATE_TIME,
M2MB_XML_DT_DURATION
} |
| | Data type supported by the XML. More...
|
| |
| typedef enum M2MB_XML_OBJ_TYPE | M2MB_XML_OBJ_TYPE_T |
| | Object type supported by the xml. More...
|
| |
| typedef enum M2MB_XML_DATA_TYPE | M2MB_XML_DATA_TYPE_T |
| | Data type supported by the XML. More...
|
| |
| typedef struct M2MB_XML_NODE | M2MB_XML_NODE_T |
| | Xml node structure. More...
|
| |
| typedef struct M2MB_XML_DATE | M2MB_XML_DATE_T |
| | XML date structure xml. More...
|
| |
| typedef struct M2MB_XML_TIME | M2MB_XML_TIME_T |
| | Xml time structure xml. More...
|
| |
| typedef struct M2MB_XML_DATE_TIME | M2MB_XML_DATE_TIME_T |
| | Xml date & time structure xml. More...
|
| |
| typedef struct M2MB_XML_DURATION | M2MB_XML_DURATION_T |
| | Xml duration structure. More...
|
| |
| typedef struct M2MB_XML_STRING | M2MB_XML_STRING_T |
| | Duration structure XML. More...
|
| |
| typedef struct M2MB_XML_OBJ | M2MB_XML_OBJ_T |
| | Xml object structure. More...
|
| |
| typedef struct M2MB_XML_COMPLEX_INFO | M2MB_XML_COMPLEX_INFO_T |
| | XML complex information structure. More...
|
| |
| typedef struct M2MB_XML_COMPLEX_OBJ | M2MB_XML_COMPLEX_OBJ_T |
| | Xml complex object structure. More...
|
| |
| M2MB_STATUS_T | m2mb_xml_encode (M2MB_XML_COMPLEX_OBJ_T *xml_schema, UINT8 *user_struct, UINT8 *xml_file_buffer, UINT32 xml_file_buffer_Size, UINT32 *len_of_xml_written) |
| | Encode API for XML module. More...
|
| |
| M2MB_STATUS_T | m2mb_xml_decode (UINT8 *parent_start, UINT8 *parent_end, M2MB_XML_COMPLEX_OBJ_T *xml_schema, UINT8 *return_struct) |
| | Decode API for XML module. More...
|
| |
| M2MB_STATUS_T | m2mb_xml_node_get (M2MB_XML_NODE_T *child_node, UINT8 *parent_node_start, UINT8 *parent_node_end, UINT8 *tag_end) |
| | Get node API for XML module. More...
|
| |
| UINT8 | m2mb_xml_node_occ_get (UINT8 *pTName, UINT8 *pPNStart, UINT8 *pPNEnd) |
| | Occurrence of node present API for XML module. More...
|
| |
This section describes the M2MB APIs for XML module.
XML modules provides APIs to decodes a XML string and fills the parameters in the provided structure. Similarly, it also provides APIs to encode XMLstring from the provided structure. The structure information and the XML tag information are given to the XML module in a proprietary embedded schema format. Each TAG in XML string is defined in a structured format that gives the detail information about it, like the tag name, tag type, info on where to decode and fill the data of the tag, tag data type.
◆ M2MB_XML_COMPLEX_INFO_T
XML complex information structure.
XML complex information structure.
◆ M2MB_XML_COMPLEX_OBJ_T
Xml complex object structure.
Xml complex object structure.
◆ M2MB_XML_DATA_TYPE_T
Data type supported by the XML.
List of data types supported by XML module.
◆ M2MB_XML_DATE_T
XML date structure xml.
Date structure XML module.
◆ M2MB_XML_DATE_TIME_T
Xml date & time structure xml.
Date & Time structure xml module.
◆ M2MB_XML_DURATION_T
Xml duration structure.
Duration structure xml module.
◆ M2MB_XML_NODE_T
Xml node structure.
Xml node structure.
◆ M2MB_XML_OBJ_T
Xml object structure.
Xml object structure.
◆ M2MB_XML_OBJ_TYPE_T
Object type supported by the xml.
List of object types supported by xml module.
◆ M2MB_XML_STRING_T
Duration structure XML.
Duration structure XML module.
◆ M2MB_XML_TIME_T
Xml time structure xml.
Time structure xml module.
◆ M2MB_XML_DATA_TYPE
Data type supported by the XML.
List of data types supported by XML module.
| Enumerator |
|---|
| M2MB_XML_DT_NONE | If data type is not any of the below mention. Used for complex objects.
|
| M2MB_XML_DT_UINT8 | Unsigned 8-bit integer
|
| M2MB_XML_DT_INT8 | Signed 8-bit integer
|
| M2MB_XML_DT_UINT16 | Unsigned 16-bit integer
|
| M2MB_XML_DT_INT16 | Signed 16-bit integer
|
| M2MB_XML_DT_UINT32 | Unsigned 32-bit integer
|
| M2MB_XML_DT_INT32 | Signed 32-bit integer
|
| M2MB_XML_DT_UINT64 | Unsigned 64-bit integer
|
| M2MB_XML_DT_INT64 | Signed 64-bit integer
|
| M2MB_XML_DT_FLOAT | Float value
|
| M2MB_XML_DT_DOUBLE | Double value
|
| M2MB_XML_DT_STR | String
|
| M2MB_XML_DT_TOKEN | String but LF, CR, TAB and trailing spaces are removed from the string
|
| M2MB_XML_DT_BASE64BIN | Base64-encoded binary data
|
| M2MB_XML_DT_HEXBIN | Hexadecimal-encoded binary data
|
| M2MB_XML_DT_DATE | Date in Format: YYYY-MM-DD-/+hh:mm, where-/+ specifies the time offset from the UTC time
|
| M2MB_XML_DT_TIME | Time in Format:HH:MM:SS-/+hh:mm, where-/+ specifies the time offset from the UTC time
|
| M2MB_XML_DT_DATE_TIME | Date and time in Format:YYYY_MM_DDTHH:MM:SS-/+hh:mm, where-/+ specifies the time offset from the UTC time
|
| M2MB_XML_DT_DURATION | Duration in Format:PnYnMnDTnHnMnS
|
Definition at line 85 of file m2mb_xml.h.
◆ M2MB_XML_OBJ_TYPE
Object type supported by the xml.
List of object types supported by xml module.
| Enumerator |
|---|
| M2MB_XML_COMPLEX_ELEMENT | Complex element
|
| M2MB_XML_SIMPLE_ELEMENT | Simple element
|
| M2MB_XML_ATTRIBUTE | Attribute
|
| M2MB_XML_NONE | Not in use
|
Definition at line 70 of file m2mb_xml.h.
◆ m2mb_xml_decode()
Decode API for XML module.
This function decode the XML file, extract the data and fill that on user structure.
- Parameters
-
| [in] | parent_start | The starting address of the XML file |
| [in] | parent_end | The Ending address of the XML file. |
| [in] | xml_schema | |
| [in] | return_struct | The user structure buffer to be filled with the data. |
- Returns
- M2MB_OK – when xml decode was successful M2MB_ERROR – when xml decode failed
- Note
- <Notes> Example
typedef struct M2M_XML_WLAN_STA_CFG_S
{
}M2M_XML_WLAN_STA_CFG_T;
{
"enable",
1,
offsetof(M2M_XML_WLAN_STA_CFG_T, enable),
};
{
"ssid",
1,
offsetof(M2M_XML_WLAN_STA_CFG_T, ssid),
};
{
"pwd",
1,
offsetof(M2M_XML_WLAN_STA_CFG_T, pwd),
};
};
"sta",
1,
offsetof( M2M_XML_WLAN_CFG_T, sta ),
{
sizeof( M2M_XML_WLAN_STA_CFG_T ),
xml_sta_wlan_input
}
};
M2M_XML_WLAN_STA_CFG_T sta_cfg;
UINT8 *xml_encoded_str =
"<sta><enable>1<//enable><ssid>SSID1<//ssid><pwd>PWD1<//pwd><//sta>";
◆ m2mb_xml_encode()
Encode API for XML module.
This function create the XML file from the data structure and the XML schema.
- Parameters
-
| [in] | xml_schema | The xml schema for XML file. |
| [in] | user_struct | The user structure which holds all data to be encoded. |
| [in] | xml_file_buffer | The user buffer which will be filled with the XML file. |
| [in] | xml_file_buffer_Size | Total Size of the user buffer. |
| [in] | len_of_xml_written | Size of the user buffer filled with XML file. |
- Returns
- M2MB_OK – when xml encode was successful M2MB_ERROR – when xml encode failed
- Note
- <Notes> Example
typedef struct M2M_XML_WLAN_STA_CFG_S
{
}M2M_XML_WLAN_STA_CFG_T;
{
"enable",
1,
offsetof(M2M_XML_WLAN_STA_CFG_T, enable),
};
{
"ssid",
1,
offsetof(M2M_XML_WLAN_STA_CFG_T, ssid),
};
{
"pwd",
1,
offsetof(M2M_XML_WLAN_STA_CFG_T, pwd),
};
};
"sta",
1,
offsetof( M2M_XML_WLAN_CFG_T, sta ),
{
sizeof( M2M_XML_WLAN_STA_CFG_T ),
xml_sta_wlan_input
}
};
M2M_XML_WLAN_STA_CFG_T sta_cfg = {
.ssid = {.type = 0, .len = 5, .ptr = "SSID1" },
.pwd = { .type = 0, .len = 4, .ptr = "PWD1" }
};
UINT8 xml_encoded_str[1024];
sizeof(xml_encoded_str), (
UINT32* )&length );
xml_encoded_str[length++] = '\0';
◆ m2mb_xml_node_get()
Get node API for XML module.
This function gets the node information from the XML file. It fills the child_node(child node structure) if it finds the tag. The tag name is taken from the parent name element in the child_node
- Parameters
-
| [in] | child_node | XML child node details. User has to fill the name of the tag and the API would fill the start and end pointer with in the pPNStart and pPNEnd pointer. |
| [in] | parent_node_start | The starting address of the XML file. |
| [in] | parent_node_end | The Ending address of the XML file. |
| [in] | tag_end | The Ending tag of the XML file. |
- Returns
- M2MB_OK – when xml decode was successful. M2MB_ERROR – when xml decode failed.
- Note
- <Notes> Example
UINT8 *xml_encoded_str =
"<sta><enable>1<//enable><ssid>SSID1<//ssid><pwd>PWD1<//pwd><//sta>";
xml_encoded_str + strlen(xml_encoded_str), &tag_end );
◆ m2mb_xml_node_occ_get()
Occurrence of node present API for XML module.
This function finds the occurrence of a tag within the start and end pointer given.
- Parameters
-
| [in] | pTName | Name of the tag. |
| [in] | pPNStart | The starting address of the XML file. |
| [in] | pPNEnd | The Ending address of the XML file. |
- Returns
- Number of occurrence of the tag within the start and end pointer.
- Note
- <Notes> Example
UINT8 *xml_encoded_str =
"<sta><enable>1<//enable><ssid>SSID1<//ssid><pwd>PWD1<//pwd><//sta>";
xml_encoded_str + strlen(xml_encoded_str) );