Browse Source

temp submit

zhangbo 5 years ago
parent
commit
3702877ddf

BIN
app/bmc/bmc_app


+ 2 - 1
app/goahead-5.1.0/src/goahead.c

@@ -150,7 +150,7 @@ MAIN(goahead, int argc, char **argv, char **envp)
     }
     }
 #endif
 #endif
     logHeader();
     logHeader();
-	error("---> argind = %d, argc = %d\n", argind, argc);
+	printf("---> argind = %d, argc = %d\n", argind, argc);
     if (argind < argc) {
     if (argind < argc) {
         while (argind < argc) {
         while (argind < argc) {
             endpoint = argv[argind++];
             endpoint = argv[argind++];
@@ -166,6 +166,7 @@ MAIN(goahead, int argc, char **argv, char **envp)
             if (strstr(endpoint, "https")) continue;
             if (strstr(endpoint, "https")) continue;
 #endif
 #endif
             if (websListen(endpoint) < 0) {
             if (websListen(endpoint) < 0) {
+                printf("websListen>>>>>>>>>>>>>>endpoint>>>>%s\n", endpoint);
                 wfree(endpoints);
                 wfree(endpoints);
                 return -1;
                 return -1;
             }
             }

+ 23 - 3
app/goahead-5.1.0/src/http.c

@@ -576,6 +576,8 @@ PUBLIC void websFree(Webs *wp)
  */
  */
 PUBLIC void websDone(Webs *wp)
 PUBLIC void websDone(Webs *wp)
 {
 {
+
+    printf("-------------writeDone------0-----------------s\n" );
     WebsSocket  *sp;
     WebsSocket  *sp;
 
 
     assert(wp);
     assert(wp);
@@ -600,7 +602,9 @@ PUBLIC void websDone(Webs *wp)
         /*
         /*
             Initiate flush. If not all flushed, wait for output to drain via a socket event.
             Initiate flush. If not all flushed, wait for output to drain via a socket event.
          */
          */
+        printf("-------------writeDone  here------0-----------------s\n %d", wp->sid );
         if (websFlush(wp, 0) == 0) {
         if (websFlush(wp, 0) == 0) {
+             printf("-------------writeDone-- error----0-----------------s\n" );
             sp = socketPtr(wp->sid);
             sp = socketPtr(wp->sid);
             socketCreateHandler(wp->sid, sp->handlerMask | SOCKET_WRITABLE, socketEvent, wp);
             socketCreateHandler(wp->sid, sp->handlerMask | SOCKET_WRITABLE, socketEvent, wp);
         }
         }
@@ -645,6 +649,9 @@ PUBLIC int websListen(cchar *endpoint)
         error("Too many listen endpoints");
         error("Too many listen endpoints");
         return -1;
         return -1;
     }
     }
+
+
+    printf("socket ++++++++++++++++++>%s\n", endpoint);
     socketParseAddress(endpoint, &ip, &port, &secure, 80);
     socketParseAddress(endpoint, &ip, &port, &secure, 80);
 	error("---> ip: %s, port: %d, secure: %d\n", ip, port, secure);
 	error("---> ip: %s, port: %d, secure: %d\n", ip, port, secure);
     if ((sid = socketListen(ip, port, websAccept, 0)) < 0) {
     if ((sid = socketListen(ip, port, websAccept, 0)) < 0) {
@@ -739,7 +746,7 @@ PUBLIC int websAccept(int sid, cchar *ipaddr, int port, int listenSid)
         Arrange for socketEvent to be called when read data is available
         Arrange for socketEvent to be called when read data is available
      */
      */
     lp = socketPtr(listenSid);
     lp = socketPtr(listenSid);
-    trace(4, "New connection from %s:%d to %s:%d", ipaddr, port, wp->ifaddr, lp->port);
+    printf("New connection from %s:%d to %s:%d", ipaddr, port, wp->ifaddr, lp->port);
 
 
 #if ME_COM_SSL
 #if ME_COM_SSL
     if (lp->secure) {
     if (lp->secure) {
@@ -839,6 +846,7 @@ static void readEvent(Webs *wp)
     if (nbytes > 0 || wp->state > WEBS_BEGIN) {
     if (nbytes > 0 || wp->state > WEBS_BEGIN) {
         websPump(wp);
         websPump(wp);
     }
     }
+    error("---> WEBS_CLOSED: %d", WEBS_CLOSED );
 	error("---> wp.flags: %d, nbytes: %d, wp.state: %d, wp.sid: %#x\n", wp->flags, nbytes, wp->state, wp->sid );
 	error("---> wp.flags: %d, nbytes: %d, wp.state: %d, wp.sid: %#x\n", wp->flags, nbytes, wp->state, wp->sid );
     if (wp->flags & WEBS_CLOSED) {
     if (wp->flags & WEBS_CLOSED) {
         return;
         return;
@@ -1633,13 +1641,13 @@ PUBLIC void websResponse(Webs *wp, int code, cchar *message)
         websWriteBlock(wp, message, len);
         websWriteBlock(wp, message, len);
         websWriteBlock(wp, "\r\n", 2);
         websWriteBlock(wp, "\r\n", 2);
 
 
-        // websWrite(wp, message);
+        websWrite(wp, message);
        
        
     } else {
     } else {
         logmsg(2,"-----------------------response 2-----------------------%s", message);
         logmsg(2,"-----------------------response 2-----------------------%s", message);
         websWriteHeaders(wp, 0, 0);
         websWriteHeaders(wp, 0, 0);
         websWriteEndHeaders(wp);
         websWriteEndHeaders(wp);
-        // websWriteBlock(wp, message, len);
+        websWriteBlock(wp, message, len);
     }
     }
     websDone(wp);
     websDone(wp);
 }
 }
@@ -1867,8 +1875,11 @@ PUBLIC int websWriteHeader(Webs *wp, cchar *key, cchar *fmt, ...)
 
 
 PUBLIC void websSetStatus(Webs *wp, int code)
 PUBLIC void websSetStatus(Webs *wp, int code)
 {
 {
+    printf("------------------code----------------%#x\n", wp->code);
+    // printf("------------------route----------------%s\n", wp->route);
     wp->code = (code & WEBS_CODE_MASK);
     wp->code = (code & WEBS_CODE_MASK);
     if (code & WEBS_CLOSE) {
     if (code & WEBS_CLOSE) {
+        printf("------------------keep-alive----------------%s\n", wp->flags);
         wp->flags &= ~WEBS_KEEP_ALIVE;
         wp->flags &= ~WEBS_KEEP_ALIVE;
     }
     }
 }
 }
@@ -1880,6 +1891,7 @@ PUBLIC void websSetStatus(Webs *wp, int code)
  */
  */
 PUBLIC void websWriteHeaders(Webs *wp, ssize length, cchar *location)
 PUBLIC void websWriteHeaders(Webs *wp, ssize length, cchar *location)
 {
 {
+
     WebsKey     *cookie, *key, *next;
     WebsKey     *cookie, *key, *next;
     char        *date, *protoVersion;
     char        *date, *protoVersion;
 
 
@@ -2105,6 +2117,7 @@ static bool flushChunkData(Webs *wp)
  */
  */
 PUBLIC int websFlush(Webs *wp, bool block)
 PUBLIC int websFlush(Webs *wp, bool block)
 {
 {
+
     WebsBuf     *op;
     WebsBuf     *op;
     ssize       nbytes, written;
     ssize       nbytes, written;
     int         errCode, wasBlocking;
     int         errCode, wasBlocking;
@@ -2247,6 +2260,7 @@ PUBLIC ssize websWriteBlock(Webs *wp, cchar *buf, ssize size)
         buf += thisWrite;
         buf += thisWrite;
         written += thisWrite;
         written += thisWrite;
     }
     }
+
     bufAddNull(op);
     bufAddNull(op);
     if (wp->state >= WEBS_COMPLETE && written == 0) {
     if (wp->state >= WEBS_COMPLETE && written == 0) {
         return -1;
         return -1;
@@ -2367,7 +2381,11 @@ static void checkTimeout(void *arg, int id)
 
 
     wp = (Webs*) arg;
     wp = (Webs*) arg;
     assert(websValid(wp));
     assert(websValid(wp));
+    printf("<<<<<<<<<checkTimeout<<<<<<<<>>%d\n", id);
 
 
+    printf("<<<<<<<<<checkTimeout<<<<websDebug<<<<>>%s\n", wp->path);
+
+    printf("<<<<<<<<<checkTimeout<<<<websDebug<<<<>>%#x\n", websDebug);
     elapsed = getTimeSinceMark(wp) * 1000;
     elapsed = getTimeSinceMark(wp) * 1000;
     if (websDebug) {
     if (websDebug) {
         websRestartEvent(id, (int) WEBS_TIMEOUT);
         websRestartEvent(id, (int) WEBS_TIMEOUT);
@@ -3428,6 +3446,8 @@ PUBLIC int websServer(cchar *endpoint, cchar *documents)
 {
 {
     int     finished = 0;
     int     finished = 0;
 
 
+
+    printf("websServer>>>>>>>>>>>>>>>>>>%s\n", documents);
     if (websOpen(documents, "route.txt") < 0) {
     if (websOpen(documents, "route.txt") < 0) {
         error("Cannot initialize server. Exiting.");
         error("Cannot initialize server. Exiting.");
         return -1;
         return -1;

+ 0 - 3
app/goahead-5.1.0/src/route.c

@@ -94,7 +94,6 @@ PUBLIC void websRouteRequest(Webs *wp)
 {
 {
 
 
     // logmsg(2,"——————————————————————0————————————");
     // logmsg(2,"——————————————————————0————————————");
-    logmsg(2, "-----------------------222----------------------");
     WebsRoute   *route;
     WebsRoute   *route;
     WebsHandler *handler;
     WebsHandler *handler;
     ssize       plen, len;
     ssize       plen, len;
@@ -108,7 +107,6 @@ PUBLIC void websRouteRequest(Webs *wp)
 
 
     safeMethod = smatch(wp->method, "POST") || smatch(wp->method, "GET") || smatch(wp->method, "HEAD");
     safeMethod = smatch(wp->method, "POST") || smatch(wp->method, "GET") || smatch(wp->method, "HEAD");
     plen = slen(wp->path);
     plen = slen(wp->path);
-        logmsg(2, "-----------------------0.1----------------------");
     /*
     /*
         Resume routine from last matched route. This permits the legacy service() callbacks to return false
         Resume routine from last matched route. This permits the legacy service() callbacks to return false
         and continue routing.
         and continue routing.
@@ -163,7 +161,6 @@ PUBLIC void websRouteRequest(Webs *wp)
         }
         }
 
 
         wp->route = route;
         wp->route = route;
-         logmsg(2,"-----------------------11-----------------------");
 #if ME_GOAHEAD_AUTH
 #if ME_GOAHEAD_AUTH
         logmsg(2,"-----------------------22-----111-------%#X-----------", route->authType);
         logmsg(2,"-----------------------22-----111-------%#X-----------", route->authType);
         if (route->authType) {
         if (route->authType) {

File diff suppressed because it is too large
+ 0 - 0
app/goahead-5.1.0/src/web/static/css/dashbord.css


File diff suppressed because it is too large
+ 0 - 0
app/goahead-5.1.0/src/web/static/css/sensor_history.css


File diff suppressed because it is too large
+ 0 - 0
app/goahead-5.1.0/src/web/static/js/dashbord.js


File diff suppressed because it is too large
+ 0 - 0
app/goahead-5.1.0/src/web/static/js/sensor_history.js


+ 124 - 52
app/goahead-5.1.0/src/web_interface/src/dashboard.c

@@ -30,7 +30,7 @@ void getDeviceInfo(Webs *wp){
     
     
 
 
     //Create session
     //Create session
-    LIBIPMI_CreateSession(&UDSSession, 10);
+    LIBIPMI_CreateSession(&UDSSession, 10000);
 
 
     //get build time
     //get build time
     sprintf(BuildTime, "%s %s", __DATE__, __TIME__);
     sprintf(BuildTime, "%s %s", __DATE__, __TIME__);
@@ -40,6 +40,12 @@ void getDeviceInfo(Webs *wp){
     if (wRet == LIBIPMI_E_SUCCESS)
     if (wRet == LIBIPMI_E_SUCCESS)
     {
     {
         sprintf(FwVersion, "%d.%d", DeviceID.FirmwareRevision1, DeviceID.FirmwareRevision2);
         sprintf(FwVersion, "%d.%d", DeviceID.FirmwareRevision1, DeviceID.FirmwareRevision2);
+
+
+        printf("BuildTime: %s\n", BuildTime);
+        printf("FwVersion: %s\n", FwVersion);
+        printf("MacAddr: %s\n", MacAddr);
+        printf("IpAddr: %s\n", IpAddr);
     }
     }
 
 
     //Close session
     //Close session
@@ -91,6 +97,7 @@ void getDeviceInfo(Webs *wp){
     // }
     // }
     // close(sock);
     // close(sock);
 
 
+
     char *pStr = malloc(500);
     char *pStr = malloc(500);
     char *dataStr = malloc(200);
     char *dataStr = malloc(200);
     char msgStr[10] = "\"\"";
     char msgStr[10] = "\"\"";
@@ -99,6 +106,7 @@ void getDeviceInfo(Webs *wp){
     sprintf(dataStr, "{\"buildTime\":\"%s\",\"fwVersion\":\"%s\",\"macAddr\":\"%s\",\"ipAddr\":\"%s\"}", \
     sprintf(dataStr, "{\"buildTime\":\"%s\",\"fwVersion\":\"%s\",\"macAddr\":\"%s\",\"ipAddr\":\"%s\"}", \
         BuildTime, FwVersion, MacAddr, IpAddr);
         BuildTime, FwVersion, MacAddr, IpAddr);
 
 
+
     sprintf(pStr, "{\"data\": %s,\"msg\":%s,\"code\": %s}", \
     sprintf(pStr, "{\"data\": %s,\"msg\":%s,\"code\": %s}", \
          dataStr, msgStr, codeStr);
          dataStr, msgStr, codeStr);
 
 
@@ -116,11 +124,13 @@ void getDeviceInfo(Webs *wp){
 
 
     //pStr = cJSON_Print(root);
     //pStr = cJSON_Print(root);
 
 
-    printf("json str:\n%s\n", pStr);
+
     websSetStatus(wp, 200);
     websSetStatus(wp, 200);
     websWriteHeaders(wp, -1, 0);
     websWriteHeaders(wp, -1, 0);
     websWriteEndHeaders(wp); 
     websWriteEndHeaders(wp); 
-    websWrite(wp, "%s", pStr);
+    //websWrite(wp, "[");
+    websWrite(wp, pStr);
+    //websWrite(wp, "]");
     websFlush(wp, 0);
     websFlush(wp, 0);
     websDone(wp);
     websDone(wp);
 
 
@@ -132,6 +142,9 @@ void getDeviceInfo(Webs *wp){
 
 
 /*获取系统信息*/
 /*获取系统信息*/
 void getSysInfo(Webs *wp){
 void getSysInfo(Webs *wp){
+
+
+    printf("lisentid value is %d\n", wp->listenSid);
     int wRet;
     int wRet;
     SysInfo_T sysInfo;
     SysInfo_T sysInfo;
     uint8_t Req[5] = {0,0,0,0,0};
     uint8_t Req[5] = {0,0,0,0,0};
@@ -159,38 +172,49 @@ void getSysInfo(Webs *wp){
         memset(sysInfo.text, 0, MAX_TEXT_LEN);
         memset(sysInfo.text, 0, MAX_TEXT_LEN);
 
 
     //Create session
     //Create session
-    wRet = LIBIPMI_CreateSession(&UDSSession, 10);
+    wRet = LIBIPMI_CreateSession(&UDSSession, 10000);
     
     
     LIBIPMI_HL_GetSysInfo(&UDSSession, &sysInfo, DEFAULT_TIMEOUT);
     LIBIPMI_HL_GetSysInfo(&UDSSession, &sysInfo, DEFAULT_TIMEOUT);
 
 
     //Close session
     //Close session
-    LIBIPMI_CloseSession(&UDSSession );
+    // LIBIPMI_CloseSession(&UDSSession );
 
 
     printf("Title: %s\n", sysInfo.title);
     printf("Title: %s\n", sysInfo.title);
     printf("Text: %s\n", sysInfo.text);
     printf("Text: %s\n", sysInfo.text);
 
 
 
 
-    cchar *pStr;
-    int code = 200;
-    cJSON * root =  cJSON_CreateObject();
-    cJSON * data =  cJSON_CreateObject();
-    // cJSON * next =  cJSON_CreateObject();
-    cJSON_AddItemToObject(root, "data", data);//根节点下添加
-    cJSON_AddItemToObject(root, "msg", cJSON_CreateString(""));
-    cJSON_AddItemToObject(root, "code", cJSON_CreateString("200"));
-    cJSON_AddStringToObject(data, "title", sysInfo.title);
-    cJSON_AddStringToObject(data, "text", sysInfo.text);
+    // cchar *pStr;
+    // int code = 200;
+    // cJSON * root =  cJSON_CreateObject();
+    // cJSON * data =  cJSON_CreateObject();
+    // // cJSON * next =  cJSON_CreateObject();
+    // cJSON_AddItemToObject(root, "data", data);//根节点下添加
+    // cJSON_AddItemToObject(root, "msg", cJSON_CreateString(""));
+    // cJSON_AddItemToObject(root, "code", cJSON_CreateString("200"));
+    // cJSON_AddStringToObject(data, "title", sysInfo.title);
+    // cJSON_AddStringToObject(data, "text", sysInfo.text);
 
 
-    pStr = cJSON_Print(root);
+    // pStr = cJSON_Print(root);
 
 
+
+     char *pStr;
+
+    char *testStr;
+    testStr = malloc(500); 
+    //sprintf(testStr, "{data: {\"Version\": \"%s\", \"MAC\": \"%s\", \"IP\": \"%s\"}, \"msg\":\"\"}", FwVersion, MacAddr, IpAddr);
+
+    sprintf(testStr, "{\"data\": {\"buildTime\":\"%s\",\"fwVersion\":\"%s\",\"macAddr\":\"%s\",\"ipAddr\":\"%s\"},\"msg\":\"\",\"code\": %d}", \
+        "BuildTime", "FwVersion", "MacAddr", "IpAddr", 200);
+
+    pStr = testStr;
     printf("first json:\n%s\n", pStr);
     printf("first json:\n%s\n", pStr);
     logmsg(2, "-----------------------sys----------------------%s", pStr);
     logmsg(2, "-----------------------sys----------------------%s", pStr);
-    websSetStatus(wp, WEBS_KEEP_ALIVE);
+    websSetStatus(wp, 200);
     websWriteHeaders(wp, -1, 0);
     websWriteHeaders(wp, -1, 0);
     websWriteEndHeaders(wp); 
     websWriteEndHeaders(wp); 
-    websWrite(wp, pStr);
+    websWrite(wp,"%s", pStr);
+    websFlush(wp, 0);
     websDone(wp);
     websDone(wp);
-    sleep(1);
 sys_info_end: 
 sys_info_end: 
     if(sysInfo.title)
     if(sysInfo.title)
         free(sysInfo.title);
         free(sysInfo.title);
@@ -198,8 +222,8 @@ sys_info_end:
         free(sysInfo.text);
         free(sysInfo.text);
 
 
     free(pStr);
     free(pStr);
-    cJSON_Delete(root);
-    cJSON_Delete(data);
+    // cJSON_Delete(root);
+    // cJSON_Delete(data);
 
 
 }
 }
 
 
@@ -237,7 +261,7 @@ void getSensorInfo(Webs *wp){
     IPMI20_UDS_SESSION_T    UDSSession;
     IPMI20_UDS_SESSION_T    UDSSession;
 
 
     //Create session
     //Create session
-    wRet = LIBIPMI_CreateSession(&UDSSession, 10);
+    wRet = LIBIPMI_CreateSession(&UDSSession, 10000);
    
    
     /* Get number of SEL records in the system at this time */
     /* Get number of SEL records in the system at this time */
     wRet = LIBIPMI_HL_GetSensorCount(&UDSSession,&nSensors,DEFAULT_TIMEOUT);
     wRet = LIBIPMI_HL_GetSensorCount(&UDSSession,&nSensors,DEFAULT_TIMEOUT);
@@ -347,6 +371,14 @@ void getSensorInfo(Webs *wp){
 
 
             logmsg(2, "-----------------------sensor----------------------");
             logmsg(2, "-----------------------sensor----------------------");
 
 
+            websSetStatus(wp, 200);
+            websWriteHeaders(wp, -1, 0);
+            websWriteEndHeaders(wp); 
+            //websWrite(wp, "[");
+            websWrite(wp, ">>>>>>>>>>>>>>>>>>>>>");
+            //websWrite(wp, "]");
+            //websFlush(wp, 0);
+            websDone(wp);
             // websSetStatus(wp, WEBS_KEEP_ALIVE);
             // websSetStatus(wp, WEBS_KEEP_ALIVE);
             // websWriteHeaders(wp, -1, 0);
             // websWriteHeaders(wp, -1, 0);
             // websWriteEndHeaders(wp); 
             // websWriteEndHeaders(wp); 
@@ -403,6 +435,49 @@ void buy(Webs *wp)
 // /*
 // /*
 //     Implement /action/actionTest. Parse the form variables: name, address and echo back.
 //     Implement /action/actionTest. Parse the form variables: name, address and echo back.
 //  */
 //  */
+// void actionTest(Webs *wp)
+// {
+
+//     printf("sid value is >>>>>>>>>>>>>: %d<<<<<<<<<<<\n", wp->sid);
+//     IPMI20_UDS_SESSION_T    UDSSession;
+//     GetDevIDRes_T   DeviceID;
+
+//     //Create session
+//     printf("actionTest!\n");
+//     LIBIPMI_CreateSession(&UDSSession, 10);
+//     IPMICMD_GetDeviceID( &UDSSession, &DeviceID, DEFAULT_TIMEOUT);
+
+//     printf("sid value is >>>>>1>>>>>>>>: %d<<<<<<<\n", wp->sid);
+
+
+//     char *pStr;
+
+//     char *testStr;
+//     testStr = malloc(500); 
+//     //sprintf(testStr, "{data: {\"Version\": \"%s\", \"MAC\": \"%s\", \"IP\": \"%s\"}, \"msg\":\"\"}", FwVersion, MacAddr, IpAddr);
+
+//     sprintf(testStr, "{\"data\": {\"buildTime\":\"%s\",\"fwVersion\":\"%s\",\"macAddr\":\"%s\",\"ipAddr\":\"%s\"},\"msg\":\"\",\"code\": %d}", \
+//         BuildTime, FwVersion, MacAddr, IpAddr, 200);
+
+
+//     //sprintf(testStr, "jimbo and lusa are very confused, please git me some tips, my god!");
+
+//      pStr = testStr;
+
+
+//     char name[] = "jimbo";
+//     char address[] = "shanghai";
+//     printf("name: %s, address: %s\n", name, address);
+//     websSetStatus(wp, 200);
+//     websWriteHeaders(wp, -1, 0);
+//     websWriteEndHeaders(wp);
+//     websWrite(wp,  testStr);
+//     websFlush(wp, 0);
+//     websDone(wp);
+//     // LIBIPMI_CloseSession(&UDSSession );
+// }
+
+
 void actionTest(Webs *wp)
 void actionTest(Webs *wp)
 {
 {
     IPMI20_UDS_SESSION_T    UDSSession;
     IPMI20_UDS_SESSION_T    UDSSession;
@@ -413,10 +488,11 @@ void actionTest(Webs *wp)
     char IpAddr[16] = "192.168.255.255";
     char IpAddr[16] = "192.168.255.255";
 
 
     //Create session
     //Create session
-    printf("actionTest!\n");
-    LIBIPMI_CreateSession(&UDSSession, 10);
-    IPMICMD_GetDeviceID( &UDSSession, &DeviceID, DEFAULT_TIMEOUT);
-    LIBIPMI_CloseSession(&UDSSession );
+
+    // LIBIPMI_CreateSession(&UDSSession, 10);
+    // IPMICMD_GetDeviceID( &UDSSession, &DeviceID, DEFAULT_TIMEOUT);
+    // LIBIPMI_CloseSession(&UDSSession );
+
 
 
     char *pStr;
     char *pStr;
 
 
@@ -426,31 +502,29 @@ void actionTest(Webs *wp)
 
 
     sprintf(testStr, "{\n\t\"data\": {\n\t\t\"buildTime\":\"%s\",\n\t\t\"fwVersion\":\"%s\",\n\t\t\"macAddr\":\"%s\",\n\t\t\"ipAddr\":\"%s\"\n\t},\n\t\"msg\":\"\",\n\t\"code\": %d\n}", \
     sprintf(testStr, "{\n\t\"data\": {\n\t\t\"buildTime\":\"%s\",\n\t\t\"fwVersion\":\"%s\",\n\t\t\"macAddr\":\"%s\",\n\t\t\"ipAddr\":\"%s\"\n\t},\n\t\"msg\":\"\",\n\t\"code\": %d\n}", \
         BuildTime, FwVersion, MacAddr, IpAddr, 200);
         BuildTime, FwVersion, MacAddr, IpAddr, 200);
+     pStr = testStr;
 
 
-
-    //sprintf(testStr, "jimbo and lusa are very confused, please git me some tips, my god!");
-
-    pStr = testStr;
-
-    cJSON * root =  cJSON_CreateObject();
-    cJSON * data =  cJSON_CreateObject();
+    // cJSON * root =  cJSON_CreateObject();
+    // cJSON * data =  cJSON_CreateObject();
     printf("log1\n");
     printf("log1\n");
-    //cJSON_AddItemToObject(root, "data", data);//根节点下添加
-    cJSON_AddStringToObject(root, "msg", NULL);
-    cJSON_AddNumberToObject(root, "code", 200);
-    cJSON_AddStringToObject(data, "buildTime", BuildTime);
-    cJSON_AddStringToObject(data, "fwVersion", FwVersion);
-    cJSON_AddStringToObject(data, "macAddr", MacAddr);
-    cJSON_AddStringToObject(data, "ipAddr", IpAddr);
- //   /*pStr = */cJSON_Print(root);     //include malloc
+    // cJSON_AddItemToObject(root, "data", data);//根节点下添加
+    // cJSON_AddItemToObject(root, "msg", cJSON_CreateString(""));
+    // cJSON_AddItemToObject(root, "code", cJSON_CreateString("200"));
+    // cJSON_AddStringToObject(data, "buildTime", BuildTime);
+    // cJSON_AddStringToObject(data, "fwVersion", FwVersion);
+    // cJSON_AddStringToObject(data, "macAddr", MacAddr);
+    // cJSON_AddStringToObject(data, "ipAddr", IpAddr);
+    // pStr = cJSON_Print(root);     //include malloc
+ //    cJSON_AddItemToObject(root, "data", data);//根节点下添加
+ //    cJSON_AddStringToObject(root, "msg", NULL);
+ //    cJSON_AddNumberToObject(root, "code", 200);
+ // //   cJSON_AddStringToObject(data, "buildTime", BuildTime);
+ // //   cJSON_AddStringToObject(data, "fwVersion", FwVersion);
+ // //   cJSON_AddStringToObject(data, "macAddr", MacAddr);
+ // //   cJSON_AddStringToObject(data, "ipAddr", IpAddr);
+ //    pStr = cJSON_Print(root);     //include malloc
     
     
     printf("%s\n", pStr);
     printf("%s\n", pStr);
-    int i=0;
-    while(pStr[i])
-    {
-        printf("%#x ", pStr[i++]);
-    }
-    printf("\n");
     websSetStatus(wp, 200);
     websSetStatus(wp, 200);
     websWriteHeaders(wp, -1, 0);
     websWriteHeaders(wp, -1, 0);
     websWriteEndHeaders(wp);
     websWriteEndHeaders(wp);
@@ -461,10 +535,8 @@ void actionTest(Webs *wp)
     if(pStr)
     if(pStr)
         free(pStr);
         free(pStr);
 
 
-    cJSON_Delete(root);
-    cJSON_Delete(data);
+    // cJSON_Delete(root);
+    // cJSON_Delete(data);
 
 
     
     
-}
-
-
+}

Some files were not shown because too many files changed in this diff