## 2 Architecture
### M2M Gateway Resource Control and Management
#### 2.2.2 Resource Mapping Mechanism
\begin{table}
\begin{tabular}{|c c c|} \hline
**Field Name** & **Definition** & **Comments** \\ \hline NUMBER & number & number for resource access, starting from 1 \\ \hline COM\_ID & Terminal ID & one resource corresponding to one number, and one \\  & & number contains multiple resources \\ \hline PLC\_ID & ID for accessed PLC & one source belongs to one PLC hardware device \\ \hline SENSOR\_ID & Sensor ID & one sensor ID corresponding to one address in PLC \\ \hline WORD\_COUNT & word count for resource & 1 or 2 means resource in analogue data, 0 means \\  & & resource in digital switch \\ \hline NAME & measure item & e.g., temperature, power \\ \hline DEVICE\_NAME & Device name & e.g., SIEMENS, DVP \\ \hline DEVICE\_PROTOCOL & Protocol name & MODBUS\_RTU(Modbus protocol RTU mode) and \\  & & MODBUS\_ASC(Modbus protocol ASC mode) \\ \hline DATA\_TYPE & Data type & analog means analog data, digital means digital switch; \\ \hline CONTROL\_TYPE & Control type & number 1 means read only, 2 means writable \\ \hline MEASURE UNIT & Measure unit & e.g., Mpa: temperature (\({}^{\circ}\)C), pressure (Mpa) \\ \hline VALUE & Measure value & means specific value \\ \hline STATUS & status & 0 means not usable, 1 means usable \\ \hline FACTOR & factor & means original data need to determine factor \\ \hline OFFSET & offset & means original data need to calculate offset \\ \hline \end{tabular}
\end{table} 
Table 12: Structure of the resource status description table. The terminal communication module number is unique. In addition, the GPRS protocol used in the terminal communication module is also different because of varying physical modules. The STATUS indicates whether the terminal communication module is usable at present, whereas OPEN indicates whether this module has been connected to the gateway server through the GPRS protocol. There are many procedures necessary for the resource management to process a data request. The procedures encompass searching in the resource status description table and in the interface information of the query description table. The procedures for data processing in resource management layer are outlined in Figure 4.  
1. Parse the XML data object. Extract the resource position information. 2. Map the application layer to the physical layer. Identify the specific address of the physical storage. 3. Search the resource status description table and extract the resource information and the usable condition of the resource. In the resource description table, if the STATUS associated with a resource is 0, the sensor is not usable; if the STATUS is 1, that sensor is usable. Then extract COM_ID from the matching term information. COM_ID is the number of the terminal communication module connecting the sensor to the server; this number is unique. \begin{table}
\begin{tabular}{c c c} \hline
**Field Name** & **Definition** & **Comments** \\ \hline COM\_ID & communication ID & means ID for terminal communication module \\ PORT & port ID & means ID of the port access to the server \\ PROTOCOL & protocol & means GPRS protocol used by the terminal module \\ STATUS & status & 0 means not usable, 1 means usable \\ OPEN & ON/OFF status; & 0 means OFF, 1 means ON \\ \hline \end{tabular}
\end{table} 
Table 13: Structure of the interface description table. Figure 4: Procedures for data processing in resource management layer. 4. Search the interface description table using COM_ID to determine if the terminal communication module is usable. If there is no matching term, then there is no terminal module with this number. If there is a matching term, but the STATUS of the matching term is 0, then the terminal communication module is not usable, and an error message is returned. 5. Extract the resource protocol information. If the terminal communication module is usable, the DEVICE_PROTOCOL information from the matching resource is extracted. 6. Find the matching protocol information in the protocol description module. If there is a protocol corresponding to DEVICE_PROTOCOL, return the protocol information.