ThingPlug GMMP library for mbed

Dependents:   ThingPlug_WiFi_Example

Committer:
lesmin
Date:
Thu Aug 13 07:04:29 2015 +0000
Revision:
4:bb6c1ee1d5f0
Parent:
0:32c20cfb2b30
added NTP error return

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lesmin 0:32c20cfb2b30 1 /**
lesmin 0:32c20cfb2b30 2 * @file GMMP_Operation.cpp
lesmin 0:32c20cfb2b30 3 * @date 2015/07/20
lesmin 0:32c20cfb2b30 4 * @version 0.0.1.0
lesmin 0:32c20cfb2b30 5 **/
lesmin 0:32c20cfb2b30 6
lesmin 0:32c20cfb2b30 7 /*
lesmin 0:32c20cfb2b30 8 #include <stdio.h>
lesmin 0:32c20cfb2b30 9 #include <stdlib.h>
lesmin 0:32c20cfb2b30 10 #include <string.h>
lesmin 0:32c20cfb2b30 11 #include <time.h>
lesmin 0:32c20cfb2b30 12 #include <signal.h>
lesmin 0:32c20cfb2b30 13 #include <pthread.h>
lesmin 0:32c20cfb2b30 14 #include <unistd.h>
lesmin 0:32c20cfb2b30 15 #include <stdarg.h>
lesmin 0:32c20cfb2b30 16 */
lesmin 0:32c20cfb2b30 17 #include <time.h>
lesmin 0:32c20cfb2b30 18
lesmin 0:32c20cfb2b30 19 #include "GMMP_Operation.h"
lesmin 0:32c20cfb2b30 20
lesmin 0:32c20cfb2b30 21 long g_nTID = 0;
lesmin 0:32c20cfb2b30 22 int g_bLog = false;
lesmin 0:32c20cfb2b30 23
lesmin 0:32c20cfb2b30 24 int g_nErrorLevel = GMMP_ERROR_LEVEL_ERROR;
lesmin 0:32c20cfb2b30 25
lesmin 0:32c20cfb2b30 26
lesmin 0:32c20cfb2b30 27 //GW/Device 등록/해지 Request
lesmin 0:32c20cfb2b30 28 int GMMP_SetReg(const char* pszAuthID,
lesmin 0:32c20cfb2b30 29 const char* pszAuthKey,
lesmin 0:32c20cfb2b30 30 const char* pszDomainCode,
lesmin 0:32c20cfb2b30 31 const char* pszGWID,
lesmin 0:32c20cfb2b30 32 const char* pszManufactureID)
lesmin 0:32c20cfb2b30 33 {
lesmin 0:32c20cfb2b30 34 debugln("GMMP_SetReg()");
lesmin 0:32c20cfb2b30 35
lesmin 0:32c20cfb2b30 36 int nRet = GMMP_SUCCESS;
lesmin 0:32c20cfb2b30 37
lesmin 0:32c20cfb2b30 38 if(pszGWID == NULL) {
lesmin 0:32c20cfb2b30 39 GwRegist_Req stRegist_Req;
lesmin 0:32c20cfb2b30 40 memset(&stRegist_Req, 0 ,sizeof(stRegist_Req));
lesmin 0:32c20cfb2b30 41
lesmin 0:32c20cfb2b30 42 nRet = SetHeader((void*)&stRegist_Req, sizeof(stRegist_Req), 1, 1, OPERATION_GW_REG_REQ, pszAuthID, NULL);
lesmin 0:32c20cfb2b30 43 if(nRet != GMMP_SUCCESS) {
lesmin 0:32c20cfb2b30 44 return nRet;
lesmin 0:32c20cfb2b30 45 }
lesmin 0:32c20cfb2b30 46
lesmin 0:32c20cfb2b30 47 memcpy(stRegist_Req.body.usDomainCode, pszDomainCode, strlen(pszDomainCode));
lesmin 0:32c20cfb2b30 48 memcpy(stRegist_Req.body.usManufactureID, pszManufactureID, strlen(pszManufactureID));
lesmin 0:32c20cfb2b30 49
lesmin 0:32c20cfb2b30 50 GMMP_Trace(&stRegist_Req.header, &stRegist_Req.body);
lesmin 0:32c20cfb2b30 51
lesmin 0:32c20cfb2b30 52 nRet = GMMP_GW_Reg_Req((GwRegist_Req*)&stRegist_Req);
lesmin 0:32c20cfb2b30 53
lesmin 0:32c20cfb2b30 54 }
lesmin 0:32c20cfb2b30 55 else
lesmin 0:32c20cfb2b30 56 {
lesmin 0:32c20cfb2b30 57 /*
lesmin 0:32c20cfb2b30 58 if(pszAuthKey == NULL || strlen(pszAuthKey) > LEN_AUTH_KEY || strlen(pszGWID) > LEN_GW_ID)
lesmin 0:32c20cfb2b30 59 {
lesmin 0:32c20cfb2b30 60 return LIB_PARAM_ERROR;
lesmin 0:32c20cfb2b30 61 }
lesmin 0:32c20cfb2b30 62 */
lesmin 0:32c20cfb2b30 63
lesmin 0:32c20cfb2b30 64 DeviceRegist_Req stRegist_Req;
lesmin 0:32c20cfb2b30 65
lesmin 0:32c20cfb2b30 66 memset(&stRegist_Req, 0 ,sizeof(stRegist_Req));
lesmin 0:32c20cfb2b30 67
lesmin 0:32c20cfb2b30 68 nRet = SetHeader((void*)&stRegist_Req, sizeof(stRegist_Req), 1, 1, OPERATION_DEVICE_REG_REQ, pszAuthID, pszAuthKey);
lesmin 0:32c20cfb2b30 69 if(nRet != GMMP_SUCCESS)
lesmin 0:32c20cfb2b30 70 {
lesmin 0:32c20cfb2b30 71 return nRet;
lesmin 0:32c20cfb2b30 72 }
lesmin 0:32c20cfb2b30 73
lesmin 0:32c20cfb2b30 74 memcpy(stRegist_Req.body.usDomainCode, pszDomainCode, strlen(pszDomainCode));
lesmin 0:32c20cfb2b30 75 memcpy(stRegist_Req.body.usGWID, pszGWID, strlen(pszGWID));
lesmin 0:32c20cfb2b30 76 memcpy(stRegist_Req.body.usManufactureID, pszManufactureID, strlen(pszManufactureID));
lesmin 0:32c20cfb2b30 77
lesmin 0:32c20cfb2b30 78 GMMP_Trace(&stRegist_Req.header, &stRegist_Req.body);
lesmin 0:32c20cfb2b30 79
lesmin 0:32c20cfb2b30 80 nRet = GMMP_Device_Reg_Req((DeviceRegist_Req*)&stRegist_Req);
lesmin 0:32c20cfb2b30 81 }
lesmin 0:32c20cfb2b30 82
lesmin 0:32c20cfb2b30 83 return nRet;
lesmin 0:32c20cfb2b30 84 }
lesmin 0:32c20cfb2b30 85
lesmin 0:32c20cfb2b30 86 int GMMP_SetDeReg(const char* pszAuthID,
lesmin 0:32c20cfb2b30 87 const char* pszAuthKey,
lesmin 0:32c20cfb2b30 88 const char* pszDomainCode,
lesmin 0:32c20cfb2b30 89 const char* pszGWID,
lesmin 0:32c20cfb2b30 90 const char* pszDeviceID)
lesmin 0:32c20cfb2b30 91 {
lesmin 0:32c20cfb2b30 92 /*
lesmin 0:32c20cfb2b30 93 if(pszAuthID == NULL
lesmin 0:32c20cfb2b30 94 || pszAuthKey == NULL
lesmin 0:32c20cfb2b30 95 || pszDomainCode == NULL
lesmin 0:32c20cfb2b30 96 || pszGWID == NULL
lesmin 0:32c20cfb2b30 97 || strlen(pszAuthID) > LEN_AUTH_ID
lesmin 0:32c20cfb2b30 98 || strlen(pszAuthKey) > LEN_AUTH_KEY
lesmin 0:32c20cfb2b30 99 || strlen(pszDomainCode) > LEN_DOMAIN_CODE
lesmin 0:32c20cfb2b30 100 || strlen(pszGWID) > LEN_GW_ID)
lesmin 0:32c20cfb2b30 101 {
lesmin 0:32c20cfb2b30 102 return LIB_PARAM_ERROR;
lesmin 0:32c20cfb2b30 103 }
lesmin 0:32c20cfb2b30 104 */
lesmin 0:32c20cfb2b30 105
lesmin 0:32c20cfb2b30 106 int nRet = GMMP_SUCCESS;
lesmin 0:32c20cfb2b30 107
lesmin 0:32c20cfb2b30 108 if(pszDeviceID == NULL) //GW DeReg
lesmin 0:32c20cfb2b30 109 {
lesmin 0:32c20cfb2b30 110 GwDeRegist_Req stDeRegist_Req;
lesmin 0:32c20cfb2b30 111 memset(&stDeRegist_Req, 0 ,sizeof(stDeRegist_Req));
lesmin 0:32c20cfb2b30 112
lesmin 0:32c20cfb2b30 113 nRet = SetHeader((void*)&stDeRegist_Req, sizeof(stDeRegist_Req), 1, 1, OPERATION_GW_DEREG_REQ, pszAuthID, pszAuthKey);
lesmin 0:32c20cfb2b30 114 if(nRet != GMMP_SUCCESS)
lesmin 0:32c20cfb2b30 115 {
lesmin 0:32c20cfb2b30 116 return nRet;
lesmin 0:32c20cfb2b30 117 }
lesmin 0:32c20cfb2b30 118
lesmin 0:32c20cfb2b30 119 memcpy(stDeRegist_Req.body.usDomainCode, pszDomainCode, strlen(pszDomainCode));
lesmin 0:32c20cfb2b30 120 memcpy(stDeRegist_Req.body.usGWID, pszGWID, strlen(pszGWID));
lesmin 0:32c20cfb2b30 121
lesmin 0:32c20cfb2b30 122 GMMP_Trace(&stDeRegist_Req.header, &stDeRegist_Req.body);
lesmin 0:32c20cfb2b30 123
lesmin 0:32c20cfb2b30 124 nRet = GMMP_GW_DeReg_Req((GwDeRegist_Req*)&stDeRegist_Req);
lesmin 0:32c20cfb2b30 125 }
lesmin 0:32c20cfb2b30 126 else
lesmin 0:32c20cfb2b30 127 {
lesmin 0:32c20cfb2b30 128 DeviceDeRegist_Req stDeviceDeRegist_Req;
lesmin 0:32c20cfb2b30 129
lesmin 0:32c20cfb2b30 130 memset(&stDeviceDeRegist_Req, 0 ,sizeof(stDeviceDeRegist_Req));
lesmin 0:32c20cfb2b30 131
lesmin 0:32c20cfb2b30 132 nRet = SetHeader((void*)&stDeviceDeRegist_Req, sizeof(stDeviceDeRegist_Req), 1, 1, OPERATION_DEVICE_DEREG_REQ, pszAuthID, pszAuthKey);
lesmin 0:32c20cfb2b30 133 if(nRet != GMMP_SUCCESS)
lesmin 0:32c20cfb2b30 134 {
lesmin 0:32c20cfb2b30 135 return nRet;
lesmin 0:32c20cfb2b30 136 }
lesmin 0:32c20cfb2b30 137
lesmin 0:32c20cfb2b30 138 memcpy(stDeviceDeRegist_Req.body.usDomainCode, pszDomainCode, strlen(pszDomainCode));
lesmin 0:32c20cfb2b30 139 memcpy(stDeviceDeRegist_Req.body.usGWID, pszGWID, strlen(pszGWID));
lesmin 0:32c20cfb2b30 140 memcpy(stDeviceDeRegist_Req.body.usDeviceID, pszDeviceID, strlen(pszDeviceID));
lesmin 0:32c20cfb2b30 141
lesmin 0:32c20cfb2b30 142 GMMP_Trace(&stDeviceDeRegist_Req.header, &stDeviceDeRegist_Req.body);
lesmin 0:32c20cfb2b30 143
lesmin 0:32c20cfb2b30 144 nRet = GMMP_Device_DeReg_Req((DeviceDeRegist_Req*)&stDeviceDeRegist_Req);
lesmin 0:32c20cfb2b30 145 }
lesmin 0:32c20cfb2b30 146
lesmin 0:32c20cfb2b30 147 return nRet;
lesmin 0:32c20cfb2b30 148 }
lesmin 0:32c20cfb2b30 149
lesmin 0:32c20cfb2b30 150 //Profile Info Request
lesmin 0:32c20cfb2b30 151 int GMMP_SetProfile(const char* pszAuthID, const char* pszAuthKey, const char* pszDomainCode, const char* pszGWID, const char* pszDeviceID)
lesmin 0:32c20cfb2b30 152 {
lesmin 0:32c20cfb2b30 153 /*
lesmin 0:32c20cfb2b30 154 if(pszAuthID == NULL
lesmin 0:32c20cfb2b30 155 || pszAuthKey == NULL
lesmin 0:32c20cfb2b30 156 || pszDomainCode == NULL
lesmin 0:32c20cfb2b30 157 || pszGWID ==NULL
lesmin 0:32c20cfb2b30 158 || strlen(pszAuthID) > LEN_AUTH_ID
lesmin 0:32c20cfb2b30 159 || strlen(pszAuthKey) > LEN_AUTH_KEY
lesmin 0:32c20cfb2b30 160 || strlen(pszDomainCode) > LEN_DOMAIN_CODE
lesmin 0:32c20cfb2b30 161 || strlen(pszGWID) > LEN_GW_ID)
lesmin 0:32c20cfb2b30 162 {
lesmin 0:32c20cfb2b30 163 return LIB_PARAM_ERROR;
lesmin 0:32c20cfb2b30 164 }
lesmin 0:32c20cfb2b30 165 */
lesmin 0:32c20cfb2b30 166
lesmin 0:32c20cfb2b30 167 int nRet = GMMP_SUCCESS;
lesmin 0:32c20cfb2b30 168
lesmin 0:32c20cfb2b30 169 Profile_Req stProfile_Req;
lesmin 0:32c20cfb2b30 170
lesmin 0:32c20cfb2b30 171 memset(&stProfile_Req, 0 ,sizeof(stProfile_Req));
lesmin 0:32c20cfb2b30 172
lesmin 0:32c20cfb2b30 173 nRet = SetHeader((void*)&stProfile_Req, sizeof(stProfile_Req), 1, 1, OPERATION_PROFILE_REQ, pszAuthID, pszAuthKey);
lesmin 0:32c20cfb2b30 174 if(nRet != GMMP_SUCCESS)
lesmin 0:32c20cfb2b30 175 {
lesmin 0:32c20cfb2b30 176 return nRet;
lesmin 0:32c20cfb2b30 177 }
lesmin 0:32c20cfb2b30 178
lesmin 0:32c20cfb2b30 179 memcpy(stProfile_Req.body.usDomainCode, pszDomainCode, strlen(pszDomainCode));
lesmin 0:32c20cfb2b30 180 memcpy(stProfile_Req.body.usGWID, pszGWID, strlen(pszGWID));
lesmin 0:32c20cfb2b30 181
lesmin 0:32c20cfb2b30 182 if(pszDeviceID != NULL) //Device 판단
lesmin 0:32c20cfb2b30 183 {
lesmin 0:32c20cfb2b30 184 if(strlen(pszDeviceID) > LEN_DEVICE_ID) //Device ID 길이 확인
lesmin 0:32c20cfb2b30 185 {
lesmin 0:32c20cfb2b30 186 }
lesmin 0:32c20cfb2b30 187 else
lesmin 0:32c20cfb2b30 188 {
lesmin 0:32c20cfb2b30 189 memcpy(stProfile_Req.body.usDeviceID, pszDeviceID, strlen(pszDeviceID));
lesmin 0:32c20cfb2b30 190 }
lesmin 0:32c20cfb2b30 191 }
lesmin 0:32c20cfb2b30 192
lesmin 0:32c20cfb2b30 193 GMMP_Trace(&stProfile_Req.header, &stProfile_Req.body);
lesmin 0:32c20cfb2b30 194
lesmin 0:32c20cfb2b30 195 nRet = GMMP_Profile_Req(&stProfile_Req);
lesmin 0:32c20cfb2b30 196
lesmin 0:32c20cfb2b30 197 return nRet;
lesmin 0:32c20cfb2b30 198 }
lesmin 0:32c20cfb2b30 199
lesmin 0:32c20cfb2b30 200 //수집 데이터 보고 Request
lesmin 0:32c20cfb2b30 201 int GMMP_SetDelivery(const char* pszAuthID,
lesmin 0:32c20cfb2b30 202 const char* pszAuthKey,
lesmin 0:32c20cfb2b30 203 const char* pszDomainCode,
lesmin 0:32c20cfb2b30 204 const char* pszGWID,
lesmin 0:32c20cfb2b30 205 const char* pszDeviceID,
lesmin 0:32c20cfb2b30 206 const char cReportType,
lesmin 0:32c20cfb2b30 207 const char cMediaType,
lesmin 0:32c20cfb2b30 208 const char* pszMessageBody,
lesmin 0:32c20cfb2b30 209 const int nTotalCount,
lesmin 0:32c20cfb2b30 210 const int nCurrentCount)
lesmin 0:32c20cfb2b30 211 {
lesmin 0:32c20cfb2b30 212 /*
lesmin 0:32c20cfb2b30 213 if(pszAuthID == NULL
lesmin 0:32c20cfb2b30 214 || pszAuthKey == NULL
lesmin 0:32c20cfb2b30 215 || pszDomainCode == NULL
lesmin 0:32c20cfb2b30 216 || pszGWID == NULL
lesmin 0:32c20cfb2b30 217 || strlen(pszAuthID) > LEN_AUTH_ID
lesmin 0:32c20cfb2b30 218 || strlen(pszAuthKey) > LEN_AUTH_KEY
lesmin 0:32c20cfb2b30 219 || strlen(pszDomainCode) > LEN_DOMAIN_CODE
lesmin 0:32c20cfb2b30 220 || strlen(pszGWID) > LEN_GW_ID
lesmin 0:32c20cfb2b30 221 || cReportType < 0x00
lesmin 0:32c20cfb2b30 222 || cReportType > 0x04
lesmin 0:32c20cfb2b30 223 || cMediaType < 0x01
lesmin 0:32c20cfb2b30 224 || pszMessageBody == NULL
lesmin 0:32c20cfb2b30 225 || strlen(pszMessageBody) > MAX_MSG_BODY)
lesmin 0:32c20cfb2b30 226 {
lesmin 0:32c20cfb2b30 227 return LIB_PARAM_ERROR;
lesmin 0:32c20cfb2b30 228 }
lesmin 0:32c20cfb2b30 229 */
lesmin 0:32c20cfb2b30 230
lesmin 0:32c20cfb2b30 231 int nMessageBodyLen = strlen(pszMessageBody);
lesmin 0:32c20cfb2b30 232
lesmin 0:32c20cfb2b30 233 //debug("msgBodyLen = ");
lesmin 0:32c20cfb2b30 234 //debugln(nMessageBodyLen);
lesmin 0:32c20cfb2b30 235 DBG("msgBodyLen = %d", nMessageBodyLen);
lesmin 0:32c20cfb2b30 236
lesmin 0:32c20cfb2b30 237 int nRet = GMMP_SUCCESS;
lesmin 0:32c20cfb2b30 238
lesmin 0:32c20cfb2b30 239 Delivery_Req stDelivery_Req;
lesmin 0:32c20cfb2b30 240
lesmin 0:32c20cfb2b30 241 //debug(F("ReqSize = "));
lesmin 0:32c20cfb2b30 242 //debugln(sizeof(stDelivery_Req));
lesmin 0:32c20cfb2b30 243 DBG("ReqSize = %d", sizeof(stDelivery_Req));
lesmin 0:32c20cfb2b30 244
lesmin 0:32c20cfb2b30 245 memset(&stDelivery_Req, 0, sizeof(stDelivery_Req));
lesmin 0:32c20cfb2b30 246
lesmin 0:32c20cfb2b30 247 int PacketSize = sizeof(stDelivery_Req) - MAX_MSG_BODY + nMessageBodyLen ; //Message Body의 속성은 Optinal이다
lesmin 0:32c20cfb2b30 248
lesmin 0:32c20cfb2b30 249 // debug(F("pacektSize = "));
lesmin 0:32c20cfb2b30 250 // debugln(PacketSize);
lesmin 0:32c20cfb2b30 251 DBG("packetSize = %d", PacketSize);
lesmin 0:32c20cfb2b30 252
lesmin 0:32c20cfb2b30 253 nRet = SetHeader((void*)&stDelivery_Req, PacketSize, nTotalCount, nCurrentCount, OPERATION_DELIVERY_REQ, pszAuthID, pszAuthKey);
lesmin 0:32c20cfb2b30 254 if(nRet != GMMP_SUCCESS)
lesmin 0:32c20cfb2b30 255 {
lesmin 0:32c20cfb2b30 256 return nRet;
lesmin 0:32c20cfb2b30 257 }
lesmin 0:32c20cfb2b30 258
lesmin 0:32c20cfb2b30 259 memcpy(stDelivery_Req.body.usDomainCode, pszDomainCode, strlen(pszDomainCode));
lesmin 0:32c20cfb2b30 260 memcpy(stDelivery_Req.body.usGWID, pszGWID, strlen(pszGWID));
lesmin 0:32c20cfb2b30 261
lesmin 0:32c20cfb2b30 262 if(pszDeviceID != NULL) //Device 판단
lesmin 0:32c20cfb2b30 263 {
lesmin 0:32c20cfb2b30 264 if(strlen(pszDeviceID) > LEN_DEVICE_ID) //Device ID 길이 확인
lesmin 0:32c20cfb2b30 265 {
lesmin 0:32c20cfb2b30 266 }
lesmin 0:32c20cfb2b30 267 else
lesmin 0:32c20cfb2b30 268 {
lesmin 0:32c20cfb2b30 269 memcpy(stDelivery_Req.body.usDeviceID, pszDeviceID, strlen(pszDeviceID));
lesmin 0:32c20cfb2b30 270 }
lesmin 0:32c20cfb2b30 271 }
lesmin 0:32c20cfb2b30 272
lesmin 0:32c20cfb2b30 273 stDelivery_Req.body.ucReportType = cReportType;
lesmin 0:32c20cfb2b30 274 stDelivery_Req.body.ucMediaType = cMediaType;
lesmin 0:32c20cfb2b30 275
lesmin 0:32c20cfb2b30 276 if(nMessageBodyLen > 0)
lesmin 0:32c20cfb2b30 277 {
lesmin 0:32c20cfb2b30 278 memcpy(stDelivery_Req.body.usMessageBody, pszMessageBody, nMessageBodyLen);
lesmin 0:32c20cfb2b30 279 }
lesmin 0:32c20cfb2b30 280
lesmin 0:32c20cfb2b30 281 GMMP_Trace(&stDelivery_Req.header, &stDelivery_Req.body);
lesmin 0:32c20cfb2b30 282
lesmin 0:32c20cfb2b30 283 nRet = GMMP_Delivery_Req(&stDelivery_Req, PacketSize);
lesmin 0:32c20cfb2b30 284
lesmin 0:32c20cfb2b30 285 return nRet;
lesmin 0:32c20cfb2b30 286 }
lesmin 0:32c20cfb2b30 287
lesmin 0:32c20cfb2b30 288 //제어 수신 기능은 Thread에서 처리
lesmin 0:32c20cfb2b30 289 //제어 수신 보고 Response
lesmin 0:32c20cfb2b30 290 int GMMP_SetControl(const char* pszAuthID, const char* pszAuthKey, const char* pszDomainCode, const char* pszGWID, const char* pszDeviceID, const char cControlType, const char cResultCode)
lesmin 0:32c20cfb2b30 291 {
lesmin 0:32c20cfb2b30 292 /*
lesmin 0:32c20cfb2b30 293 if(pszAuthID == NULL
lesmin 0:32c20cfb2b30 294 || pszAuthKey == NULL
lesmin 0:32c20cfb2b30 295 || pszDomainCode == NULL
lesmin 0:32c20cfb2b30 296 || pszGWID ==NULL
lesmin 0:32c20cfb2b30 297 || strlen(pszAuthID) > LEN_AUTH_ID
lesmin 0:32c20cfb2b30 298 || strlen(pszAuthKey) > LEN_AUTH_KEY
lesmin 0:32c20cfb2b30 299 || strlen(pszDomainCode) > LEN_DOMAIN_CODE
lesmin 0:32c20cfb2b30 300 || strlen(pszGWID) > LEN_GW_ID)
lesmin 0:32c20cfb2b30 301 {
lesmin 0:32c20cfb2b30 302 return LIB_PARAM_ERROR;
lesmin 0:32c20cfb2b30 303 }
lesmin 0:32c20cfb2b30 304 */
lesmin 0:32c20cfb2b30 305
lesmin 0:32c20cfb2b30 306 int nRet = GMMP_SUCCESS;
lesmin 0:32c20cfb2b30 307
lesmin 0:32c20cfb2b30 308 Control_Rsp stControl_Rsp;
lesmin 0:32c20cfb2b30 309
lesmin 0:32c20cfb2b30 310 memset(&stControl_Rsp, 0 ,sizeof(stControl_Rsp));
lesmin 0:32c20cfb2b30 311
lesmin 0:32c20cfb2b30 312 nRet = SetHeader((void*)&stControl_Rsp, sizeof(stControl_Rsp), 1, 1, OPERATION_CONTROL_RSP, pszAuthID, pszAuthKey);
lesmin 0:32c20cfb2b30 313 if(nRet != GMMP_SUCCESS)
lesmin 0:32c20cfb2b30 314 {
lesmin 0:32c20cfb2b30 315 return nRet;
lesmin 0:32c20cfb2b30 316 }
lesmin 0:32c20cfb2b30 317
lesmin 0:32c20cfb2b30 318 memcpy(stControl_Rsp.body.usDomainCode, pszDomainCode, strlen(pszDomainCode));
lesmin 0:32c20cfb2b30 319 memcpy(stControl_Rsp.body.usGWID, pszGWID, strlen(pszGWID));
lesmin 0:32c20cfb2b30 320
lesmin 0:32c20cfb2b30 321 if(pszDeviceID != NULL) //Device 판단
lesmin 0:32c20cfb2b30 322 {
lesmin 0:32c20cfb2b30 323 if(strlen(pszDeviceID) > LEN_DEVICE_ID) //Device ID 길이 확인
lesmin 0:32c20cfb2b30 324 {
lesmin 0:32c20cfb2b30 325 }
lesmin 0:32c20cfb2b30 326 else
lesmin 0:32c20cfb2b30 327 {
lesmin 0:32c20cfb2b30 328 memcpy(stControl_Rsp.body.usDeviceID, pszDeviceID, strlen(pszDeviceID));
lesmin 0:32c20cfb2b30 329 }
lesmin 0:32c20cfb2b30 330 }
lesmin 0:32c20cfb2b30 331
lesmin 0:32c20cfb2b30 332 stControl_Rsp.body.ucControlType = cControlType;
lesmin 0:32c20cfb2b30 333 stControl_Rsp.body.ucResultCode = cResultCode;
lesmin 0:32c20cfb2b30 334
lesmin 0:32c20cfb2b30 335 GMMP_Trace(&stControl_Rsp.header, &stControl_Rsp.body);
lesmin 0:32c20cfb2b30 336
lesmin 0:32c20cfb2b30 337 nRet = GMMP_Control_Rsp(&stControl_Rsp);
lesmin 0:32c20cfb2b30 338
lesmin 0:32c20cfb2b30 339 return nRet;
lesmin 0:32c20cfb2b30 340 }
lesmin 0:32c20cfb2b30 341
lesmin 0:32c20cfb2b30 342 //제어 동작 완료 결과 보고 Request
lesmin 0:32c20cfb2b30 343 int GMMP_SetNotifi(const char* pszAuthID,
lesmin 0:32c20cfb2b30 344 const char* pszAuthKey,
lesmin 0:32c20cfb2b30 345 const char* pszDomainCode,
lesmin 0:32c20cfb2b30 346 const char* pszGWID,
lesmin 0:32c20cfb2b30 347 const char* pszDeviceID,
lesmin 0:32c20cfb2b30 348 const char cControlType,
lesmin 0:32c20cfb2b30 349 const char cResultCode,
lesmin 0:32c20cfb2b30 350 const char* pszMessageBody,
lesmin 0:32c20cfb2b30 351 const int nMessageSize)
lesmin 0:32c20cfb2b30 352 {
lesmin 0:32c20cfb2b30 353 /*
lesmin 0:32c20cfb2b30 354 if(pszAuthID == NULL
lesmin 0:32c20cfb2b30 355 || pszAuthKey == NULL
lesmin 0:32c20cfb2b30 356 || pszDomainCode == NULL
lesmin 0:32c20cfb2b30 357 || pszGWID ==NULL
lesmin 0:32c20cfb2b30 358 || strlen(pszAuthID) > LEN_AUTH_ID
lesmin 0:32c20cfb2b30 359 || strlen(pszAuthKey) > LEN_AUTH_KEY
lesmin 0:32c20cfb2b30 360 || strlen(pszDomainCode) > LEN_DOMAIN_CODE
lesmin 0:32c20cfb2b30 361 || strlen(pszGWID) > LEN_GW_ID)
lesmin 0:32c20cfb2b30 362 {
lesmin 0:32c20cfb2b30 363 return LIB_PARAM_ERROR;
lesmin 0:32c20cfb2b30 364 }
lesmin 0:32c20cfb2b30 365 */
lesmin 0:32c20cfb2b30 366
lesmin 0:32c20cfb2b30 367 int nRet = GMMP_SUCCESS;
lesmin 0:32c20cfb2b30 368
lesmin 0:32c20cfb2b30 369 Notifi_Req stNotifi_Req;
lesmin 0:32c20cfb2b30 370
lesmin 0:32c20cfb2b30 371 memset(&stNotifi_Req, 0 ,sizeof(stNotifi_Req));
lesmin 0:32c20cfb2b30 372
lesmin 0:32c20cfb2b30 373 int PacketSize =sizeof(stNotifi_Req) - MAX_MSG_BODY + nMessageSize ; //Message Body의 속성은 Optinal이다
lesmin 0:32c20cfb2b30 374
lesmin 0:32c20cfb2b30 375 nRet = SetHeader((void*)&stNotifi_Req, PacketSize, 1, 1, OPERATION_NOTIFICATION_REQ, pszAuthID, pszAuthKey);
lesmin 0:32c20cfb2b30 376 if(nRet != GMMP_SUCCESS)
lesmin 0:32c20cfb2b30 377 {
lesmin 0:32c20cfb2b30 378 return nRet;
lesmin 0:32c20cfb2b30 379 }
lesmin 0:32c20cfb2b30 380
lesmin 0:32c20cfb2b30 381 memcpy(stNotifi_Req.body.usDomainCode, pszDomainCode, strlen(pszDomainCode));
lesmin 0:32c20cfb2b30 382 memcpy(stNotifi_Req.body.usGWID, pszGWID, strlen(pszGWID));
lesmin 0:32c20cfb2b30 383
lesmin 0:32c20cfb2b30 384 if(pszDeviceID != NULL) //Device 판단
lesmin 0:32c20cfb2b30 385 {
lesmin 0:32c20cfb2b30 386 if(strlen(pszDeviceID) > LEN_DEVICE_ID) //Device ID 길이 확인
lesmin 0:32c20cfb2b30 387 {
lesmin 0:32c20cfb2b30 388 }
lesmin 0:32c20cfb2b30 389 else
lesmin 0:32c20cfb2b30 390 {
lesmin 0:32c20cfb2b30 391 memcpy(stNotifi_Req.body.usDeviceID, pszDeviceID, strlen(pszDeviceID));
lesmin 0:32c20cfb2b30 392 }
lesmin 0:32c20cfb2b30 393 }
lesmin 0:32c20cfb2b30 394
lesmin 0:32c20cfb2b30 395 stNotifi_Req.body.ucControlType = cControlType;
lesmin 0:32c20cfb2b30 396 stNotifi_Req.body.ucResultCode = cResultCode;
lesmin 0:32c20cfb2b30 397
lesmin 0:32c20cfb2b30 398 if(pszMessageBody != NULL) //Message 사용 판단
lesmin 0:32c20cfb2b30 399 {
lesmin 0:32c20cfb2b30 400 if(nMessageSize > MAX_MSG_BODY)
lesmin 0:32c20cfb2b30 401 {
lesmin 0:32c20cfb2b30 402 }
lesmin 0:32c20cfb2b30 403 else
lesmin 0:32c20cfb2b30 404 {
lesmin 0:32c20cfb2b30 405 memcpy(stNotifi_Req.body.usMessageBody, pszMessageBody, nMessageSize);
lesmin 0:32c20cfb2b30 406 }
lesmin 0:32c20cfb2b30 407 }
lesmin 0:32c20cfb2b30 408
lesmin 0:32c20cfb2b30 409 GMMP_Trace(&stNotifi_Req.header, &stNotifi_Req.body);
lesmin 0:32c20cfb2b30 410
lesmin 0:32c20cfb2b30 411 nRet = GMMP_Notifi_Req(&stNotifi_Req, PacketSize);
lesmin 0:32c20cfb2b30 412
lesmin 0:32c20cfb2b30 413 return nRet;
lesmin 0:32c20cfb2b30 414 }
lesmin 0:32c20cfb2b30 415
lesmin 0:32c20cfb2b30 416 int GMMP_SetHB(const char* pszAuthID,
lesmin 0:32c20cfb2b30 417 const char* pszAuthKey,
lesmin 0:32c20cfb2b30 418 const char* pszDomainCode,
lesmin 0:32c20cfb2b30 419 const char* pszGWID)
lesmin 0:32c20cfb2b30 420 {
lesmin 0:32c20cfb2b30 421 /*
lesmin 0:32c20cfb2b30 422 if(pszAuthID == NULL
lesmin 0:32c20cfb2b30 423 || pszAuthKey == NULL
lesmin 0:32c20cfb2b30 424 || pszDomainCode == NULL
lesmin 0:32c20cfb2b30 425 || pszGWID ==NULL
lesmin 0:32c20cfb2b30 426 || strlen(pszAuthID) > LEN_AUTH_ID
lesmin 0:32c20cfb2b30 427 || strlen(pszAuthKey) > LEN_AUTH_KEY
lesmin 0:32c20cfb2b30 428 || strlen(pszDomainCode) > LEN_DOMAIN_CODE
lesmin 0:32c20cfb2b30 429 || strlen(pszGWID) > LEN_GW_ID)
lesmin 0:32c20cfb2b30 430 {
lesmin 0:32c20cfb2b30 431 return LIB_PARAM_ERROR;
lesmin 0:32c20cfb2b30 432 }
lesmin 0:32c20cfb2b30 433 */
lesmin 0:32c20cfb2b30 434
lesmin 0:32c20cfb2b30 435 int nRet = GMMP_SUCCESS;
lesmin 0:32c20cfb2b30 436
lesmin 0:32c20cfb2b30 437 HB_Req stHB_Req;
lesmin 0:32c20cfb2b30 438
lesmin 0:32c20cfb2b30 439 memset(&stHB_Req, 0 ,sizeof(stHB_Req));
lesmin 0:32c20cfb2b30 440
lesmin 0:32c20cfb2b30 441 nRet = SetHeader((void*)&stHB_Req, sizeof(stHB_Req), 1, 1, OPERATION_HEARTBEAT_REQ, pszAuthID, pszAuthKey);
lesmin 0:32c20cfb2b30 442 if(nRet != GMMP_SUCCESS)
lesmin 0:32c20cfb2b30 443 {
lesmin 0:32c20cfb2b30 444 return nRet;
lesmin 0:32c20cfb2b30 445 }
lesmin 0:32c20cfb2b30 446
lesmin 0:32c20cfb2b30 447 memcpy(stHB_Req.body.usDomainCode, pszDomainCode, strlen(pszDomainCode));
lesmin 0:32c20cfb2b30 448 memcpy(stHB_Req.body.usGWID, pszGWID, strlen(pszGWID));
lesmin 0:32c20cfb2b30 449
lesmin 0:32c20cfb2b30 450 GMMP_Trace(&stHB_Req.header, &stHB_Req.body);
lesmin 0:32c20cfb2b30 451
lesmin 0:32c20cfb2b30 452 nRet = GMMP_Heartbeat_Req(&stHB_Req);
lesmin 0:32c20cfb2b30 453
lesmin 0:32c20cfb2b30 454 return nRet;
lesmin 0:32c20cfb2b30 455 }
lesmin 0:32c20cfb2b30 456
lesmin 0:32c20cfb2b30 457 //GW/Device 등록/해지 Response
lesmin 0:32c20cfb2b30 458 int GMMP_GetReg(GwRegist_Rsp* pstGwRegist_Rsp, DeviceRegist_Rsp* pstDeviceRegist_Rsp)
lesmin 0:32c20cfb2b30 459 {
lesmin 0:32c20cfb2b30 460 int nRet = GMMP_SUCCESS;
lesmin 0:32c20cfb2b30 461
lesmin 0:32c20cfb2b30 462 if(pstGwRegist_Rsp != NULL)
lesmin 0:32c20cfb2b30 463 {
lesmin 0:32c20cfb2b30 464 nRet = GMMP_GW_Reg_Rsp(pstGwRegist_Rsp);
lesmin 0:32c20cfb2b30 465 GMMP_Trace(&pstGwRegist_Rsp->header, &pstGwRegist_Rsp->body);
lesmin 0:32c20cfb2b30 466 }
lesmin 0:32c20cfb2b30 467 else
lesmin 0:32c20cfb2b30 468 {
lesmin 0:32c20cfb2b30 469 nRet = GMMP_Device_Reg_Rsp(pstDeviceRegist_Rsp);
lesmin 0:32c20cfb2b30 470 GMMP_Trace(&pstDeviceRegist_Rsp->header, &pstDeviceRegist_Rsp->body);
lesmin 0:32c20cfb2b30 471 }
lesmin 0:32c20cfb2b30 472
lesmin 0:32c20cfb2b30 473 CloseSocket();
lesmin 0:32c20cfb2b30 474
lesmin 0:32c20cfb2b30 475 return nRet;
lesmin 0:32c20cfb2b30 476 }
lesmin 0:32c20cfb2b30 477
lesmin 0:32c20cfb2b30 478 int GMMP_GetDeReg(GwDeRegist_Rsp* pstGwRegist_Rsp, DeviceDeRegist_Rsp* pstDeviceDeRegist_Rsp)
lesmin 0:32c20cfb2b30 479 {
lesmin 0:32c20cfb2b30 480 int nRet = GMMP_SUCCESS;
lesmin 0:32c20cfb2b30 481
lesmin 0:32c20cfb2b30 482 if(pstGwRegist_Rsp != NULL)
lesmin 0:32c20cfb2b30 483 {
lesmin 0:32c20cfb2b30 484 nRet = GMMP_GW_DeReg_Rsp(pstGwRegist_Rsp);
lesmin 0:32c20cfb2b30 485 GMMP_Trace(&pstGwRegist_Rsp->header, &pstGwRegist_Rsp->body);
lesmin 0:32c20cfb2b30 486 }
lesmin 0:32c20cfb2b30 487 else
lesmin 0:32c20cfb2b30 488 {
lesmin 0:32c20cfb2b30 489 nRet = GMMP_Device_DeReg_Rsp(pstDeviceDeRegist_Rsp);
lesmin 0:32c20cfb2b30 490 GMMP_Trace(&pstDeviceDeRegist_Rsp->header, &pstDeviceDeRegist_Rsp->body);
lesmin 0:32c20cfb2b30 491 }
lesmin 0:32c20cfb2b30 492
lesmin 0:32c20cfb2b30 493 CloseSocket();
lesmin 0:32c20cfb2b30 494
lesmin 0:32c20cfb2b30 495 return nRet;
lesmin 0:32c20cfb2b30 496 }
lesmin 0:32c20cfb2b30 497
lesmin 0:32c20cfb2b30 498 //Profile Info Response
lesmin 0:32c20cfb2b30 499 int GMMP_GetProfile(Profile_Rsp* pstProfile_Rsp)
lesmin 0:32c20cfb2b30 500 {
lesmin 0:32c20cfb2b30 501 int nRet = GMMP_Profile_Rsp(pstProfile_Rsp);
lesmin 0:32c20cfb2b30 502
lesmin 0:32c20cfb2b30 503 GMMP_Trace(&pstProfile_Rsp->header, &pstProfile_Rsp->body);
lesmin 0:32c20cfb2b30 504
lesmin 0:32c20cfb2b30 505 CloseSocket();
lesmin 0:32c20cfb2b30 506
lesmin 0:32c20cfb2b30 507 return nRet;
lesmin 0:32c20cfb2b30 508 }
lesmin 0:32c20cfb2b30 509
lesmin 0:32c20cfb2b30 510 //수집 데이터 보고 Response
lesmin 0:32c20cfb2b30 511 int GMMP_GetDelivery(Delivery_Rsp* pstDelivery_Rsp)
lesmin 0:32c20cfb2b30 512 {
lesmin 0:32c20cfb2b30 513 int nRet = GMMP_Delivery_Rsp(pstDelivery_Rsp);
lesmin 0:32c20cfb2b30 514
lesmin 0:32c20cfb2b30 515 GMMP_Trace(&pstDelivery_Rsp->header, &pstDelivery_Rsp->body);
lesmin 0:32c20cfb2b30 516
lesmin 0:32c20cfb2b30 517 CloseSocket();
lesmin 0:32c20cfb2b30 518
lesmin 0:32c20cfb2b30 519 return nRet;
lesmin 0:32c20cfb2b30 520 }
lesmin 0:32c20cfb2b30 521 //제어 동작 완료 결과 보고 Response
lesmin 0:32c20cfb2b30 522 int GMMP_GetNotifi(Notifi_Rsp* pstNotifi_Rsp)
lesmin 0:32c20cfb2b30 523 {
lesmin 0:32c20cfb2b30 524 int nRet = GMMP_Notifi_Rsp(pstNotifi_Rsp);
lesmin 0:32c20cfb2b30 525
lesmin 0:32c20cfb2b30 526 GMMP_Trace(&pstNotifi_Rsp->header, &pstNotifi_Rsp->body);
lesmin 0:32c20cfb2b30 527
lesmin 0:32c20cfb2b30 528 CloseSocket();
lesmin 0:32c20cfb2b30 529
lesmin 0:32c20cfb2b30 530 return nRet;
lesmin 0:32c20cfb2b30 531 }
lesmin 0:32c20cfb2b30 532
lesmin 0:32c20cfb2b30 533 int GMMP_GetHB(HB_Rsp* pstHB_Rsp) //TCP Always ON 모드일 경우 (Thread 생성) 사용 TCP Disconnect하지 않음
lesmin 0:32c20cfb2b30 534 {
lesmin 0:32c20cfb2b30 535 int nRet = GMMP_Heartbeat_Rsp(pstHB_Rsp);
lesmin 0:32c20cfb2b30 536
lesmin 0:32c20cfb2b30 537 GMMP_Trace(&pstHB_Rsp->header, &pstHB_Rsp->body);
lesmin 0:32c20cfb2b30 538
lesmin 0:32c20cfb2b30 539 return nRet;
lesmin 0:32c20cfb2b30 540 }
lesmin 0:32c20cfb2b30 541
lesmin 0:32c20cfb2b30 542 int GMMP_Read(GMMPHeader* pstGMMPHeader, void** pBody)
lesmin 0:32c20cfb2b30 543 {
lesmin 0:32c20cfb2b30 544 return GMMP_Read2(pstGMMPHeader, pBody, 1);
lesmin 0:32c20cfb2b30 545 }
lesmin 0:32c20cfb2b30 546
lesmin 0:32c20cfb2b30 547 int GMMP_Read2(GMMPHeader* pstGMMPHeader, void** pBody, byte blocking)
lesmin 0:32c20cfb2b30 548 {
lesmin 0:32c20cfb2b30 549 ConvertShort cvtShort;
lesmin 0:32c20cfb2b30 550 //ConvertInt cvtint;
lesmin 0:32c20cfb2b30 551
lesmin 0:32c20cfb2b30 552 int nRet = 0;
lesmin 0:32c20cfb2b30 553 int nHeaderSize = sizeof(GMMPHeader);
lesmin 0:32c20cfb2b30 554
lesmin 0:32c20cfb2b30 555 memset(pstGMMPHeader, 0, nHeaderSize);
lesmin 0:32c20cfb2b30 556
lesmin 0:32c20cfb2b30 557 cvtShort.sU8 = 0;
lesmin 0:32c20cfb2b30 558 //cvtint.sU8 = 0;
lesmin 0:32c20cfb2b30 559
lesmin 0:32c20cfb2b30 560 nRet = 0;
lesmin 0:32c20cfb2b30 561
lesmin 0:32c20cfb2b30 562 nRet = ReadTCP2((char*)pstGMMPHeader, nHeaderSize, blocking);
lesmin 0:32c20cfb2b30 563 if (nRet != GMMP_SUCCESS)
lesmin 0:32c20cfb2b30 564 {
lesmin 0:32c20cfb2b30 565 return nRet;
lesmin 0:32c20cfb2b30 566 }
lesmin 0:32c20cfb2b30 567
lesmin 0:32c20cfb2b30 568 memcpy(cvtShort.usShort, pstGMMPHeader->usMessageLength, sizeof(pstGMMPHeader->usMessageLength));
lesmin 0:32c20cfb2b30 569 cvtShort.sU8 = btols(cvtShort.sU8);
lesmin 0:32c20cfb2b30 570
lesmin 0:32c20cfb2b30 571 if (cvtShort.sU8 < nHeaderSize)
lesmin 0:32c20cfb2b30 572 {
lesmin 0:32c20cfb2b30 573 return GMMP_HEADER_SIZE_ERROR;
lesmin 0:32c20cfb2b30 574 }
lesmin 0:32c20cfb2b30 575
lesmin 0:32c20cfb2b30 576 int nBodySize = 0;
lesmin 0:32c20cfb2b30 577
lesmin 0:32c20cfb2b30 578 if ((*pBody = MallocBody(pstGMMPHeader->ucMessageType, &nBodySize))== NULL || nBodySize <= 0)
lesmin 0:32c20cfb2b30 579 {
lesmin 0:32c20cfb2b30 580 return GMMP_MALLOC_ERROR;
lesmin 0:32c20cfb2b30 581 }
lesmin 0:32c20cfb2b30 582
lesmin 0:32c20cfb2b30 583 memset(*pBody, 0, nBodySize);
lesmin 0:32c20cfb2b30 584
lesmin 0:32c20cfb2b30 585 int ReadPacketSize = cvtShort.sU8 - nHeaderSize;
lesmin 0:32c20cfb2b30 586
lesmin 0:32c20cfb2b30 587 nRet = ReadTCP2((char*)(*pBody), ReadPacketSize, blocking);
lesmin 0:32c20cfb2b30 588 if(nRet != GMMP_SUCCESS)
lesmin 0:32c20cfb2b30 589 {
lesmin 0:32c20cfb2b30 590 CloseSocket();
lesmin 0:32c20cfb2b30 591
lesmin 0:32c20cfb2b30 592 return nRet;
lesmin 0:32c20cfb2b30 593 }
lesmin 0:32c20cfb2b30 594
lesmin 0:32c20cfb2b30 595 return GMMP_SUCCESS;
lesmin 0:32c20cfb2b30 596 }
lesmin 0:32c20cfb2b30 597
lesmin 0:32c20cfb2b30 598 int GMMP_Recv(GMMPHeader* pstGMMPHeader, void* pBody)
lesmin 0:32c20cfb2b30 599 {
lesmin 0:32c20cfb2b30 600 GMMP_Trace(pstGMMPHeader, pBody);
lesmin 0:32c20cfb2b30 601
lesmin 0:32c20cfb2b30 602 char cMessageType = pstGMMPHeader->ucMessageType ;
lesmin 0:32c20cfb2b30 603
lesmin 0:32c20cfb2b30 604 if(cMessageType == OPERATION_GW_REG_RSP)
lesmin 0:32c20cfb2b30 605 {
lesmin 0:32c20cfb2b30 606 stGwRegistrationRspHdr* pstRspHdr =(stGwRegistrationRspHdr*) pBody;
lesmin 0:32c20cfb2b30 607 OG_Reg_Recv(pstGMMPHeader, pstRspHdr, NULL);
lesmin 0:32c20cfb2b30 608 }
lesmin 0:32c20cfb2b30 609 else if(cMessageType == OPERATION_GW_DEREG_RSP)
lesmin 0:32c20cfb2b30 610 {
lesmin 0:32c20cfb2b30 611 stGwDeRegistrationRspHdr* pstRspHdr =(stGwDeRegistrationRspHdr*) pBody;
lesmin 0:32c20cfb2b30 612 OG_DeReg_Recv(pstGMMPHeader, pstRspHdr, NULL);
lesmin 0:32c20cfb2b30 613 }
lesmin 0:32c20cfb2b30 614 else if(cMessageType == OPERATION_PROFILE_RSP)
lesmin 0:32c20cfb2b30 615 {
lesmin 0:32c20cfb2b30 616 stProfileRspHdr* pstRspHdr =(stProfileRspHdr*) pBody;
lesmin 0:32c20cfb2b30 617 OG_Profile_Recv(pstGMMPHeader, pstRspHdr);
lesmin 0:32c20cfb2b30 618 }
lesmin 0:32c20cfb2b30 619 else if(cMessageType == OPERATION_DEVICE_REG_RSP)
lesmin 0:32c20cfb2b30 620 {
lesmin 0:32c20cfb2b30 621 stDeviceRegistrationRspHdr* pstRspHdr =(stDeviceRegistrationRspHdr*) pBody;
lesmin 0:32c20cfb2b30 622 OG_Reg_Recv(pstGMMPHeader, NULL, pstRspHdr);
lesmin 0:32c20cfb2b30 623 }
lesmin 0:32c20cfb2b30 624 else if(cMessageType == OPERATION_DEVICE_DEREG_RSP)
lesmin 0:32c20cfb2b30 625 {
lesmin 0:32c20cfb2b30 626 stDeviceDeRegistrationRspHdr* pstRspHdr =(stDeviceDeRegistrationRspHdr*) pBody;
lesmin 0:32c20cfb2b30 627 OG_DeReg_Recv(pstGMMPHeader, NULL, pstRspHdr);
lesmin 0:32c20cfb2b30 628 }
lesmin 0:32c20cfb2b30 629 else if(cMessageType == OPERATION_DELIVERY_RSP)
lesmin 0:32c20cfb2b30 630 {
lesmin 0:32c20cfb2b30 631 stPacketDeliveryRspHdr* pstRspHdr =(stPacketDeliveryRspHdr*) pBody;
lesmin 0:32c20cfb2b30 632 OG_Delivery_Recv(pstGMMPHeader, pstRspHdr);
lesmin 0:32c20cfb2b30 633 }
lesmin 0:32c20cfb2b30 634 else if(cMessageType == OPERATION_CONTROL_REQ)
lesmin 0:32c20cfb2b30 635 {
lesmin 0:32c20cfb2b30 636 stControlReqHdr* pstReqHdr =(stControlReqHdr*) pBody;
lesmin 0:32c20cfb2b30 637 GMMP_Ctrl_Recv(pstGMMPHeader, pstReqHdr);
lesmin 0:32c20cfb2b30 638 }
lesmin 0:32c20cfb2b30 639 else if(cMessageType == OPERATION_HEARTBEAT_RSP)
lesmin 0:32c20cfb2b30 640 {
lesmin 0:32c20cfb2b30 641 stHeartBeatMsgRspHdr* pstRspHdr =(stHeartBeatMsgRspHdr*) pBody;
lesmin 0:32c20cfb2b30 642 OG_HB_Recv(pstGMMPHeader, pstRspHdr);
lesmin 0:32c20cfb2b30 643 }
lesmin 0:32c20cfb2b30 644 else if(cMessageType == OPERATION_NOTIFICATION_RSP)
lesmin 0:32c20cfb2b30 645 {
lesmin 0:32c20cfb2b30 646 stNotificationRspHdr* pstRspHdr =(stNotificationRspHdr*) pBody;
lesmin 0:32c20cfb2b30 647 OG_Notifi_Recv(pstGMMPHeader, pstRspHdr);
lesmin 0:32c20cfb2b30 648 }
lesmin 0:32c20cfb2b30 649
lesmin 0:32c20cfb2b30 650 return GMMP_SUCCESS;
lesmin 0:32c20cfb2b30 651 }
lesmin 0:32c20cfb2b30 652
lesmin 0:32c20cfb2b30 653 int GMMP_Ctrl_Recv(GMMPHeader* pstGMMPHeader, stControlReqHdr* pstReqHdr)
lesmin 0:32c20cfb2b30 654 {
lesmin 0:32c20cfb2b30 655 char cControlType = pstReqHdr->ucControlType;
lesmin 0:32c20cfb2b30 656
lesmin 0:32c20cfb2b30 657 //단순 제어 명령어인 경우
lesmin 0:32c20cfb2b30 658 switch(cControlType)
lesmin 0:32c20cfb2b30 659 {
lesmin 0:32c20cfb2b30 660 case CONTROL_Reset:
lesmin 0:32c20cfb2b30 661 break;
lesmin 0:32c20cfb2b30 662 case CONTROL_Turn_Off:
lesmin 0:32c20cfb2b30 663 break;
lesmin 0:32c20cfb2b30 664 case CONTROL_Report_On:
lesmin 0:32c20cfb2b30 665 break;
lesmin 0:32c20cfb2b30 666 case CONTROL_Report_Off:
lesmin 0:32c20cfb2b30 667 break;
lesmin 0:32c20cfb2b30 668 case CONTROL_Time_Sync:
lesmin 0:32c20cfb2b30 669 break;
lesmin 0:32c20cfb2b30 670 case CONTROL_Pause:
lesmin 0:32c20cfb2b30 671 break;
lesmin 0:32c20cfb2b30 672 case CONTROL_Restart:
lesmin 0:32c20cfb2b30 673 break;
lesmin 0:32c20cfb2b30 674 case CONTROL_Signal_Power_Check:
lesmin 0:32c20cfb2b30 675 break;
lesmin 0:32c20cfb2b30 676 case CONTROL_Diagnostic:
lesmin 0:32c20cfb2b30 677 break;
lesmin 0:32c20cfb2b30 678 case CONTROL_Reserved:
lesmin 0:32c20cfb2b30 679 break;
lesmin 0:32c20cfb2b30 680 case CONTROL_Profile_Reset:
lesmin 0:32c20cfb2b30 681 break;
lesmin 0:32c20cfb2b30 682 case CONTROL_Status_Check:
lesmin 0:32c20cfb2b30 683 break;
lesmin 0:32c20cfb2b30 684 case CONTROL_FW_Download: //FTP 연결
lesmin 0:32c20cfb2b30 685 break;
lesmin 0:32c20cfb2b30 686 case CONTROL_FW_Update:
lesmin 0:32c20cfb2b30 687 break;
lesmin 0:32c20cfb2b30 688 case CONTROL_App_Download: //FTP 연결
lesmin 0:32c20cfb2b30 689 break;
lesmin 0:32c20cfb2b30 690 case CONTROL_App_Update:
lesmin 0:32c20cfb2b30 691 break;
lesmin 0:32c20cfb2b30 692 case CONTROL_Remote_Access: //Remote Info 연결
lesmin 0:32c20cfb2b30 693 break;
lesmin 0:32c20cfb2b30 694 case CONTROL_Multimedia_Control_Start: //Multimedia URL Info 연결
lesmin 0:32c20cfb2b30 695 break;
lesmin 0:32c20cfb2b30 696 case CONTROL_Multimedia_Control_Pause:
lesmin 0:32c20cfb2b30 697 break;
lesmin 0:32c20cfb2b30 698 case CONTROL_Multimedia_Control_Stop:
lesmin 0:32c20cfb2b30 699 break;
lesmin 0:32c20cfb2b30 700 case CONTROL_Multimedia_Control_Restart:
lesmin 0:32c20cfb2b30 701 break;
lesmin 0:32c20cfb2b30 702 default:
lesmin 0:32c20cfb2b30 703 break;
lesmin 0:32c20cfb2b30 704 }
lesmin 0:32c20cfb2b30 705
lesmin 0:32c20cfb2b30 706 OG_Ctrl_Recv(pstGMMPHeader, pstReqHdr);
lesmin 0:32c20cfb2b30 707
lesmin 0:32c20cfb2b30 708 return 1;
lesmin 0:32c20cfb2b30 709 }
lesmin 0:32c20cfb2b30 710
lesmin 0:32c20cfb2b30 711 void SetTID(long nTid)
lesmin 0:32c20cfb2b30 712 {
lesmin 0:32c20cfb2b30 713 g_nTID = nTid;
lesmin 0:32c20cfb2b30 714 }
lesmin 0:32c20cfb2b30 715
lesmin 0:32c20cfb2b30 716 long GetTID()
lesmin 0:32c20cfb2b30 717 {
lesmin 0:32c20cfb2b30 718 return g_nTID;
lesmin 0:32c20cfb2b30 719 }
lesmin 0:32c20cfb2b30 720
lesmin 0:32c20cfb2b30 721 //protected
lesmin 0:32c20cfb2b30 722 int SetHeader(void* pData,
lesmin 0:32c20cfb2b30 723 int nPacketSize,
lesmin 0:32c20cfb2b30 724 int nTotalCount,
lesmin 0:32c20cfb2b30 725 int nCurrentCount,
lesmin 0:32c20cfb2b30 726 const char cMessageType,
lesmin 0:32c20cfb2b30 727 const char* pszAuthID,
lesmin 0:32c20cfb2b30 728 const char* pszAuthKey)
lesmin 0:32c20cfb2b30 729 {
lesmin 0:32c20cfb2b30 730 GMMPHeader* pHeader = (GMMPHeader*)pData;
lesmin 0:32c20cfb2b30 731 ConvertShort cvtShort;
lesmin 0:32c20cfb2b30 732
lesmin 0:32c20cfb2b30 733 // debug(F("authID len = "));
lesmin 0:32c20cfb2b30 734 // debugln(strlen(pszAuthID));
lesmin 0:32c20cfb2b30 735 DBG("authID len = %d", strlen(pszAuthID));
lesmin 0:32c20cfb2b30 736
lesmin 0:32c20cfb2b30 737 memset(pHeader, 0, sizeof(GMMPHeader));
lesmin 0:32c20cfb2b30 738 memset(cvtShort.usShort, 0, sizeof(cvtShort.usShort));
lesmin 0:32c20cfb2b30 739
lesmin 0:32c20cfb2b30 740 pHeader->ucVersion = GMMP_VERSION;
lesmin 0:32c20cfb2b30 741
lesmin 0:32c20cfb2b30 742 ConvertInt cvtInt;
lesmin 0:32c20cfb2b30 743
lesmin 0:32c20cfb2b30 744 time_t t; time ( &t );
lesmin 0:32c20cfb2b30 745
lesmin 0:32c20cfb2b30 746 // debug(F("TIME = "));
lesmin 0:32c20cfb2b30 747 // debugln(t);
lesmin 0:32c20cfb2b30 748 DBG("TIME = %d", t);
lesmin 0:32c20cfb2b30 749
lesmin 0:32c20cfb2b30 750 memcpy(cvtInt.usInt, &t, sizeof(cvtInt.usInt));
lesmin 0:32c20cfb2b30 751
lesmin 0:32c20cfb2b30 752 cvtInt.sU8 = ltobi(cvtInt.sU8);
lesmin 0:32c20cfb2b30 753
lesmin 0:32c20cfb2b30 754 memcpy(&pHeader->unOriginTimeStamp, &cvtInt.usInt, sizeof(cvtInt.usInt));
lesmin 0:32c20cfb2b30 755 memcpy(&pHeader->usAuthID, pszAuthID, strlen(pszAuthID));
lesmin 0:32c20cfb2b30 756
lesmin 0:32c20cfb2b30 757 if(pszAuthKey != NULL)
lesmin 0:32c20cfb2b30 758 {
lesmin 0:32c20cfb2b30 759 memcpy(&pHeader->usAuthKey, pszAuthKey, strlen(pszAuthKey));
lesmin 0:32c20cfb2b30 760 }
lesmin 0:32c20cfb2b30 761
lesmin 0:32c20cfb2b30 762 // debug(F("TID = "));
lesmin 0:32c20cfb2b30 763 // debugln(g_nTID);
lesmin 0:32c20cfb2b30 764 DBG("TID = %ld", g_nTID);
lesmin 0:32c20cfb2b30 765
lesmin 0:32c20cfb2b30 766 memcpy(&cvtInt.usInt, &g_nTID, sizeof(g_nTID));
lesmin 0:32c20cfb2b30 767 cvtInt.sU8 = ltobi(cvtInt.sU8);
lesmin 0:32c20cfb2b30 768
lesmin 0:32c20cfb2b30 769 memcpy(pHeader->usTID, &cvtInt.usInt, sizeof(pHeader->usTID));
lesmin 0:32c20cfb2b30 770
lesmin 0:32c20cfb2b30 771 cvtShort.sU8 = ltobs((short)nPacketSize);
lesmin 0:32c20cfb2b30 772 memcpy(pHeader->usMessageLength, cvtShort.usShort, sizeof(cvtShort.usShort));
lesmin 0:32c20cfb2b30 773
lesmin 0:32c20cfb2b30 774 cvtShort.sU8 = ltobs((short)nTotalCount);
lesmin 0:32c20cfb2b30 775 memcpy(pHeader->usTotalCount, cvtShort.usShort, sizeof(cvtShort.usShort));
lesmin 0:32c20cfb2b30 776
lesmin 0:32c20cfb2b30 777 cvtShort.sU8 = ltobs((short)nCurrentCount);
lesmin 0:32c20cfb2b30 778 memcpy(pHeader->usCurrentCount, cvtShort.usShort, sizeof(cvtShort.usShort));
lesmin 0:32c20cfb2b30 779
lesmin 0:32c20cfb2b30 780 pHeader->ucMessageType = cMessageType;
lesmin 0:32c20cfb2b30 781
lesmin 0:32c20cfb2b30 782 return GMMP_SUCCESS;
lesmin 0:32c20cfb2b30 783 }
lesmin 0:32c20cfb2b30 784
lesmin 0:32c20cfb2b30 785 int SetIntiSocket(void)
lesmin 0:32c20cfb2b30 786 {
lesmin 0:32c20cfb2b30 787 return Connect();
lesmin 0:32c20cfb2b30 788 }
lesmin 0:32c20cfb2b30 789
lesmin 0:32c20cfb2b30 790 char* MallocBody(const char Type, int* nBodySize)
lesmin 0:32c20cfb2b30 791 {
lesmin 0:32c20cfb2b30 792 char* pBuffer = NULL;
lesmin 0:32c20cfb2b30 793
lesmin 0:32c20cfb2b30 794 switch(Type)
lesmin 0:32c20cfb2b30 795 {
lesmin 0:32c20cfb2b30 796 case OPERATION_GW_REG_RSP:
lesmin 0:32c20cfb2b30 797 {
lesmin 0:32c20cfb2b30 798 pBuffer = (char*)malloc(sizeof(stGwRegistrationRspHdr));
lesmin 0:32c20cfb2b30 799 *nBodySize = sizeof(stGwRegistrationRspHdr);
lesmin 0:32c20cfb2b30 800 break;
lesmin 0:32c20cfb2b30 801 }
lesmin 0:32c20cfb2b30 802 case OPERATION_GW_DEREG_RSP:
lesmin 0:32c20cfb2b30 803 {
lesmin 0:32c20cfb2b30 804 pBuffer = (char*)malloc(sizeof(stGwDeRegistrationRspHdr));
lesmin 0:32c20cfb2b30 805 *nBodySize = sizeof(stGwDeRegistrationRspHdr);
lesmin 0:32c20cfb2b30 806 break;
lesmin 0:32c20cfb2b30 807 }
lesmin 0:32c20cfb2b30 808 case OPERATION_PROFILE_RSP:
lesmin 0:32c20cfb2b30 809 {
lesmin 0:32c20cfb2b30 810 pBuffer = (char*)malloc(sizeof(stProfileRspHdr));
lesmin 0:32c20cfb2b30 811 *nBodySize = sizeof(stProfileRspHdr);
lesmin 0:32c20cfb2b30 812 break;
lesmin 0:32c20cfb2b30 813 }
lesmin 0:32c20cfb2b30 814 case OPERATION_DEVICE_REG_RSP:
lesmin 0:32c20cfb2b30 815 {
lesmin 0:32c20cfb2b30 816 pBuffer = (char*)malloc(sizeof(stDeviceRegistrationRspHdr));
lesmin 0:32c20cfb2b30 817 *nBodySize = sizeof(stDeviceRegistrationRspHdr);
lesmin 0:32c20cfb2b30 818 break;
lesmin 0:32c20cfb2b30 819 }
lesmin 0:32c20cfb2b30 820 case OPERATION_DEVICE_DEREG_RSP:
lesmin 0:32c20cfb2b30 821 {
lesmin 0:32c20cfb2b30 822 pBuffer = (char*)malloc(sizeof(stDeviceDeRegistrationRspHdr));
lesmin 0:32c20cfb2b30 823 *nBodySize = sizeof(stDeviceDeRegistrationRspHdr);
lesmin 0:32c20cfb2b30 824 break;
lesmin 0:32c20cfb2b30 825 }
lesmin 0:32c20cfb2b30 826 case OPERATION_DELIVERY_RSP:
lesmin 0:32c20cfb2b30 827 {
lesmin 0:32c20cfb2b30 828 pBuffer = (char*)malloc(sizeof(stPacketDeliveryRspHdr));
lesmin 0:32c20cfb2b30 829 *nBodySize = sizeof(stPacketDeliveryRspHdr);
lesmin 0:32c20cfb2b30 830 break;
lesmin 0:32c20cfb2b30 831 }
lesmin 0:32c20cfb2b30 832 case OPERATION_CONTROL_REQ:
lesmin 0:32c20cfb2b30 833 {
lesmin 0:32c20cfb2b30 834 pBuffer = (char*)malloc(sizeof(stControlReqHdr));
lesmin 0:32c20cfb2b30 835 *nBodySize = sizeof(stControlReqHdr);
lesmin 0:32c20cfb2b30 836 break;
lesmin 0:32c20cfb2b30 837 }
lesmin 0:32c20cfb2b30 838 case OPERATION_HEARTBEAT_RSP:
lesmin 0:32c20cfb2b30 839 {
lesmin 0:32c20cfb2b30 840 pBuffer = (char*)malloc(sizeof(stHeartBeatMsgRspHdr));
lesmin 0:32c20cfb2b30 841 *nBodySize = sizeof(stHeartBeatMsgRspHdr);
lesmin 0:32c20cfb2b30 842 break;
lesmin 0:32c20cfb2b30 843 }
lesmin 0:32c20cfb2b30 844 case OPERATION_NOTIFICATION_RSP:
lesmin 0:32c20cfb2b30 845 {
lesmin 0:32c20cfb2b30 846 pBuffer = (char*)malloc(sizeof(stNotificationRspHdr));
lesmin 0:32c20cfb2b30 847 *nBodySize = sizeof(stNotificationRspHdr);
lesmin 0:32c20cfb2b30 848 break;
lesmin 0:32c20cfb2b30 849 }
lesmin 0:32c20cfb2b30 850 default:
lesmin 0:32c20cfb2b30 851 {
lesmin 0:32c20cfb2b30 852 nBodySize = 0;
lesmin 0:32c20cfb2b30 853 }
lesmin 0:32c20cfb2b30 854 }
lesmin 0:32c20cfb2b30 855
lesmin 0:32c20cfb2b30 856 return pBuffer;
lesmin 0:32c20cfb2b30 857 }
lesmin 0:32c20cfb2b30 858
lesmin 0:32c20cfb2b30 859 int GMMP_Trace(GMMPHeader* pstGMMPHeader, void* pBody)
lesmin 0:32c20cfb2b30 860 {
lesmin 0:32c20cfb2b30 861 ConvertInt cvtint;
lesmin 0:32c20cfb2b30 862
lesmin 0:32c20cfb2b30 863 char cMessageType = pstGMMPHeader->ucMessageType ;
lesmin 0:32c20cfb2b30 864
lesmin 0:32c20cfb2b30 865 memcpy(cvtint.usInt, pstGMMPHeader->usTID, sizeof(pstGMMPHeader->usTID));
lesmin 0:32c20cfb2b30 866 cvtint.sU8 = btoli(cvtint.sU8);
lesmin 0:32c20cfb2b30 867
lesmin 0:32c20cfb2b30 868 if(cMessageType == OPERATION_GW_REG_REQ)
lesmin 0:32c20cfb2b30 869 {
lesmin 0:32c20cfb2b30 870 stGwRegistrationReqHdr* pstRspHdr =(stGwRegistrationReqHdr*) pBody;
lesmin 0:32c20cfb2b30 871 }
lesmin 0:32c20cfb2b30 872 else if(cMessageType == OPERATION_GW_REG_RSP)
lesmin 0:32c20cfb2b30 873 {
lesmin 0:32c20cfb2b30 874 stGwRegistrationRspHdr* pstRspHdr =(stGwRegistrationRspHdr*) pBody;
lesmin 0:32c20cfb2b30 875 }
lesmin 0:32c20cfb2b30 876 else if(cMessageType == OPERATION_GW_DEREG_REQ)
lesmin 0:32c20cfb2b30 877 {
lesmin 0:32c20cfb2b30 878 stGwDeRegistrationReqHdr* pstRspHdr =(stGwDeRegistrationReqHdr*) pBody;
lesmin 0:32c20cfb2b30 879 }
lesmin 0:32c20cfb2b30 880 else if(cMessageType == OPERATION_GW_DEREG_RSP)
lesmin 0:32c20cfb2b30 881 {
lesmin 0:32c20cfb2b30 882 stGwDeRegistrationRspHdr* pstRspHdr =(stGwDeRegistrationRspHdr*) pBody;
lesmin 0:32c20cfb2b30 883 }
lesmin 0:32c20cfb2b30 884 else if(cMessageType == OPERATION_PROFILE_REQ)
lesmin 0:32c20cfb2b30 885 {
lesmin 0:32c20cfb2b30 886 stProfileReqHdr* pstRspHdr =(stProfileReqHdr*) pBody;
lesmin 0:32c20cfb2b30 887 }
lesmin 0:32c20cfb2b30 888 else if(cMessageType == OPERATION_PROFILE_RSP)
lesmin 0:32c20cfb2b30 889 {
lesmin 0:32c20cfb2b30 890 stProfileRspHdr* pstRspHdr =(stProfileRspHdr*) pBody;
lesmin 0:32c20cfb2b30 891
lesmin 0:32c20cfb2b30 892 memcpy(cvtint.usInt, pstRspHdr->unHeartbeatPeriod, sizeof(pstRspHdr->unHeartbeatPeriod));
lesmin 0:32c20cfb2b30 893 cvtint.sU8 = btoli(cvtint.sU8);
lesmin 0:32c20cfb2b30 894
lesmin 0:32c20cfb2b30 895 memcpy(cvtint.usInt, pstRspHdr->unReportPeriod, sizeof(pstRspHdr->unReportPeriod));
lesmin 0:32c20cfb2b30 896 cvtint.sU8 = btoli(cvtint.sU8);
lesmin 0:32c20cfb2b30 897
lesmin 0:32c20cfb2b30 898 memcpy(cvtint.usInt, pstRspHdr->unReportOffset, sizeof(pstRspHdr->unReportOffset));
lesmin 0:32c20cfb2b30 899 cvtint.sU8 = btoli(cvtint.sU8);
lesmin 0:32c20cfb2b30 900
lesmin 0:32c20cfb2b30 901 memcpy(cvtint.usInt, pstRspHdr->unResponseTimeout, sizeof(pstRspHdr->unResponseTimeout));
lesmin 0:32c20cfb2b30 902 cvtint.sU8 = btoli(cvtint.sU8);
lesmin 0:32c20cfb2b30 903 }
lesmin 0:32c20cfb2b30 904 else if(cMessageType == OPERATION_DEVICE_REG_REQ)
lesmin 0:32c20cfb2b30 905 {
lesmin 0:32c20cfb2b30 906 stDeviceRegistrationReqHdr* pstRspHdr =(stDeviceRegistrationReqHdr*) pBody;
lesmin 0:32c20cfb2b30 907 }
lesmin 0:32c20cfb2b30 908 else if(cMessageType == OPERATION_DEVICE_REG_RSP)
lesmin 0:32c20cfb2b30 909 {
lesmin 0:32c20cfb2b30 910 stDeviceRegistrationRspHdr* pstRspHdr =(stDeviceRegistrationRspHdr*) pBody;
lesmin 0:32c20cfb2b30 911 }
lesmin 0:32c20cfb2b30 912 else if(cMessageType == OPERATION_DEVICE_DEREG_REQ)
lesmin 0:32c20cfb2b30 913 {
lesmin 0:32c20cfb2b30 914 stDeviceDeRegistrationReqHdr* pstRspHdr =(stDeviceDeRegistrationReqHdr*) pBody;
lesmin 0:32c20cfb2b30 915 }
lesmin 0:32c20cfb2b30 916 else if(cMessageType == OPERATION_DEVICE_DEREG_RSP)
lesmin 0:32c20cfb2b30 917 {
lesmin 0:32c20cfb2b30 918 stDeviceDeRegistrationRspHdr* pstRspHdr =(stDeviceDeRegistrationRspHdr*) pBody;
lesmin 0:32c20cfb2b30 919 }
lesmin 0:32c20cfb2b30 920 else if(cMessageType == OPERATION_DELIVERY_REQ)
lesmin 0:32c20cfb2b30 921 {
lesmin 0:32c20cfb2b30 922 stPacketDeliveryReqHdr* pstRspHdr =(stPacketDeliveryReqHdr*) pBody;
lesmin 0:32c20cfb2b30 923 }
lesmin 0:32c20cfb2b30 924 else if(cMessageType == OPERATION_DELIVERY_RSP)
lesmin 0:32c20cfb2b30 925 {
lesmin 0:32c20cfb2b30 926 stPacketDeliveryRspHdr* pstRspHdr =(stPacketDeliveryRspHdr*) pBody;
lesmin 0:32c20cfb2b30 927
lesmin 0:32c20cfb2b30 928 memcpy(cvtint.usInt, pstRspHdr->unBackOffTime, sizeof(pstRspHdr->unBackOffTime));
lesmin 0:32c20cfb2b30 929 cvtint.sU8 = btoli(cvtint.sU8);
lesmin 0:32c20cfb2b30 930 }
lesmin 0:32c20cfb2b30 931 else if(cMessageType == OPERATION_CONTROL_REQ)
lesmin 0:32c20cfb2b30 932 {
lesmin 0:32c20cfb2b30 933 stControlReqHdr* pstReqHdr =(stControlReqHdr*) pBody;
lesmin 0:32c20cfb2b30 934 }
lesmin 0:32c20cfb2b30 935 else if(cMessageType == OPERATION_CONTROL_RSP)
lesmin 0:32c20cfb2b30 936 {
lesmin 0:32c20cfb2b30 937 stControlRspHdr* pstRspHdr =(stControlRspHdr*) pBody;
lesmin 0:32c20cfb2b30 938 }
lesmin 0:32c20cfb2b30 939 else if(cMessageType == OPERATION_HEARTBEAT_REQ)
lesmin 0:32c20cfb2b30 940 {
lesmin 0:32c20cfb2b30 941 stHeartBeatMsgRspHdr* pstRspHdr =(stHeartBeatMsgRspHdr*) pBody;
lesmin 0:32c20cfb2b30 942 }
lesmin 0:32c20cfb2b30 943 else if(cMessageType == OPERATION_HEARTBEAT_RSP)
lesmin 0:32c20cfb2b30 944 {
lesmin 0:32c20cfb2b30 945 stHeartBeatMsgRspHdr* pstRspHdr =(stHeartBeatMsgRspHdr*) pBody;
lesmin 0:32c20cfb2b30 946 }
lesmin 0:32c20cfb2b30 947 else if(cMessageType == OPERATION_NOTIFICATION_REQ)
lesmin 0:32c20cfb2b30 948 {
lesmin 0:32c20cfb2b30 949 stNotificationReqHdr* pstRspHdr =(stNotificationReqHdr*) pBody;
lesmin 0:32c20cfb2b30 950 }
lesmin 0:32c20cfb2b30 951 else if(cMessageType == OPERATION_NOTIFICATION_RSP)
lesmin 0:32c20cfb2b30 952 {
lesmin 0:32c20cfb2b30 953 stNotificationRspHdr* pstRspHdr =(stNotificationRspHdr*) pBody;
lesmin 0:32c20cfb2b30 954 }
lesmin 0:32c20cfb2b30 955
lesmin 0:32c20cfb2b30 956 return GMMP_SUCCESS;
lesmin 0:32c20cfb2b30 957 }