lusa 5 ani în urmă
părinte
comite
7bd649115e

BIN
app/bmc/bmc_app


+ 18 - 0
app/goahead-5.1.0/src/http.c

@@ -576,6 +576,8 @@ PUBLIC void websFree(Webs *wp)
  */
 PUBLIC void websDone(Webs *wp)
 {
+
+    printf("-------------writeDone------0-----------------s\n" );
     WebsSocket  *sp;
 
     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.
          */
+        printf("-------------writeDone  here------0-----------------s\n %d", wp->sid );
         if (websFlush(wp, 0) == 0) {
+             printf("-------------writeDone-- error----0-----------------s\n" );
             sp = socketPtr(wp->sid);
             socketCreateHandler(wp->sid, sp->handlerMask | SOCKET_WRITABLE, socketEvent, wp);
         }
@@ -839,6 +843,7 @@ static void readEvent(Webs *wp)
     if (nbytes > 0 || wp->state > WEBS_BEGIN) {
         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 );
     if (wp->flags & WEBS_CLOSED) {
         return;
@@ -1867,8 +1872,11 @@ PUBLIC int websWriteHeader(Webs *wp, cchar *key, cchar *fmt, ...)
 
 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);
     if (code & WEBS_CLOSE) {
+        printf("------------------keep-alive----------------%s\n", wp->flags);
         wp->flags &= ~WEBS_KEEP_ALIVE;
     }
 }
@@ -1880,6 +1888,8 @@ PUBLIC void websSetStatus(Webs *wp, int code)
  */
 PUBLIC void websWriteHeaders(Webs *wp, ssize length, cchar *location)
 {
+
+     printf("-------------writeHead------0-----------------s\n");
     WebsKey     *cookie, *key, *next;
     char        *date, *protoVersion;
 
@@ -1975,6 +1985,8 @@ PUBLIC void websSetTxLength(Webs *wp, ssize length)
  */
 PUBLIC ssize websWrite(Webs *wp, cchar *fmt, ...)
 {
+
+     printf("-------------writebody------0-----------------s\n" );
     va_list     vargs;
     char        *buf;
     ssize       rc;
@@ -1992,6 +2004,7 @@ PUBLIC ssize websWrite(Webs *wp, cchar *fmt, ...)
     va_end(vargs);
     assert(buf);
     if (buf) {
+        printf("-------------writebody------1-----------------s\n" );
         rc = websWriteBlock(wp, buf, strlen(buf));
         wfree(buf);
     }
@@ -2105,6 +2118,8 @@ static bool flushChunkData(Webs *wp)
  */
 PUBLIC int websFlush(Webs *wp, bool block)
 {
+
+    logmsg(2, "-----------------websFlush--1----------------\n");
     WebsBuf     *op;
     ssize       nbytes, written;
     int         errCode, wasBlocking;
@@ -2122,6 +2137,7 @@ PUBLIC int websFlush(Webs *wp, bool block)
             wp->flags &= ~WEBS_CHUNKING;
         }
     }
+    logmsg(2, "-----------------websFlush--2----------------\n");
     trace(6, "websFlush: buflen %d", bufLen(op));
     written = 0;
     while ((nbytes = bufLen(op)) > 0) {
@@ -2147,11 +2163,13 @@ PUBLIC int websFlush(Webs *wp, bool block)
         bufCompact(op);
         nbytes = bufLen(op);
     }
+    logmsg(2, "-----------------websFlush--3----------------\n");
     assert(websValid(wp));
 
     if (bufLen(op) == 0 && wp->finalized) {
         wp->state = WEBS_COMPLETE;
     }
+    logmsg(2, "-----------------websFlush--4----------------\n");
     if (block) {
         socketSetBlock(wp->sid, wasBlocking);
     }

Fișier diff suprimat deoarece este prea mare
+ 0 - 0
app/goahead-5.1.0/src/web/static/css/dashbord.css


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
app/goahead-5.1.0/src/web/static/css/sensor_history.css


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
app/goahead-5.1.0/src/web/static/js/dashbord.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
app/goahead-5.1.0/src/web/static/js/sensor_history.js


+ 49 - 41
app/goahead-5.1.0/src/web_interface/src/dashboard.c

@@ -34,6 +34,43 @@ void getDeviceInfo(Webs *wp){
     if (wRet == LIBIPMI_E_SUCCESS)
     {
         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);
+
+        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, "buildTime", BuildTime);
+        cJSON_AddStringToObject(data, "fwVersion", FwVersion);
+        // cJSON_AddStringToObject(data, "macAddr", MacAddr);
+        // cJSON_AddStringToObject(data, "ipAddr", IpAddr);
+
+        pStr = cJSON_Print(root);
+        sleep(2);
+        // printf("first json:\n%s\n", pStr);
+        // printf("-----------------------jso1n----------------------%s", pStr);
+        logmsg(2, "-------------111111111------0-----------------%s" , pStr);
+        websSetStatus(wp, 0x200);
+        logmsg(2, "--------------------1----------------");
+        websWriteHeaders(wp, -1, 0);
+        logmsg(2, "--------------------2----------------");
+        websWriteEndHeaders(wp); 
+        logmsg(2, "-------------------3----------------");
+        //websWrite(wp, "[");
+        websWrite(wp, ">>>>>>>>>>>>");
+        logmsg(2, "-------------------4----------------");
+        //websWrite(wp, "]");
+        websFlush(wp, 0);
+        websDone(wp);
     }
 
     //get mac address
@@ -85,37 +122,6 @@ void getDeviceInfo(Webs *wp){
     //Close session
     LIBIPMI_CloseSession(&wp->ipmi_session );
 
-    printf("BuildTime: %s\n", BuildTime);
-    printf("FwVersion: %s\n", FwVersion);
-    // printf("MacAddr: %s\n", MacAddr);
-    // printf("IpAddr: %s\n", IpAddr);
-
-    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, "buildTime", BuildTime);
-    cJSON_AddStringToObject(data, "fwVersion", FwVersion);
-    // cJSON_AddStringToObject(data, "macAddr", MacAddr);
-    // cJSON_AddStringToObject(data, "ipAddr", IpAddr);
-
-    pStr = cJSON_Print(root);
-
-    printf("first json:\n%s\n", pStr);
-    logmsg(2, "-----------------------jso1n----------------------%s", pStr);
-    logmsg(2, "--------------------ccccccccccsscc----------------");
-    websSetStatus(wp, 200);
-    websWriteHeaders(wp, -1, 0);
-    websWriteEndHeaders(wp); 
-    //websWrite(wp, "[");
-    websWrite(wp, pStr);
-    //websWrite(wp, "]");
-    //websFlush(wp, 0);
-    websDone(wp);
 }
 
 
@@ -330,14 +336,14 @@ void getSensorInfo(Webs *wp){
 
             logmsg(2, "-----------------------sensor----------------------");
 
-            // websSetStatus(wp, 200);
-            // websWriteHeaders(wp, -1, 0);
-            // websWriteEndHeaders(wp); 
-            // //websWrite(wp, "[");
-            // websWrite(wp, pStr);
-            // //websWrite(wp, "]");
-            // //websFlush(wp, 0);
-            // websDone(wp);
+            websSetStatus(wp, 200);
+            websWriteHeaders(wp, -1, 0);
+            websWriteEndHeaders(wp); 
+            //websWrite(wp, "[");
+            websWrite(wp, ">>>>>>>>>>>>>>>>>>>>>");
+            //websWrite(wp, "]");
+            //websFlush(wp, 0);
+            websDone(wp);
         }
     }
 
@@ -407,18 +413,20 @@ logmsg(2, "--------------------ggggggggg----------------");
     printf("BuildTime: %s\n", BuildTime);
     printf("FwVersion: %s\n", FwVersion);
     //Close session
-    LIBIPMI_CloseSession(&wp->ipmi_session );
+   
    
     cchar   *name, *address;
 
     name = websGetVar(wp, "name", NULL);
     address = websGetVar(wp, "address", NULL);
-    websSetStatus(wp, 200);
+    websSetStatus(wp, WEBS_KEEP_ALIVE);
     websWriteHeaders(wp, -1, 0);
     websWriteEndHeaders(wp);
     websWrite(wp, "Name %s", name);
     websFlush(wp, 0);
     websDone(wp);
+    sleep(5);
+    // LIBIPMI_CloseSession(&wp->ipmi_session );
 }
 
 

Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff