Ver Fonte

basecode release r1.4

zhangbo há 3 anos atrás
pai
commit
ca50975265

+ 1 - 1
app/bmc/msghndlr/App/IPMDevice/IPMDevice.c

@@ -88,7 +88,7 @@ GetDevID ( uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes)
     static unsigned char MinorBCD;
     static int firsttime = 1;
 
-    printf("GetDevID ReqLen %d\n", ReqLen);
+//    printf("GetDevID ReqLen %d\n", ReqLen);
 
     if(firsttime == 1)
     {

+ 2 - 1
app/common_include/com_BMCCfg.h

@@ -5,8 +5,9 @@
 #define 	MAX_FAN_NUMS 	10		//该系统最多支持10个风扇
 #define 	BLADE_NUMBERS	10
 #define SENSOR_NUMBERS				(15)
+//r1.4 	网页初步成型,ASSERT NULL的错误解掉了,清除了日志。
 #define FW_VERSION_MAJOR			(1)
-#define FW_VERSION_MINOR			(3)
+#define FW_VERSION_MINOR			(4)
 
 extern uint8_t ChassisPrimaryIPMBAddr[BLADE_NUMBERS];
 extern uint8_t ChassisSecondaryIPMBAddr[BLADE_NUMBERS];

+ 55 - 43
app/goahead-3.6.5/src/web_interface/src/sel.c

@@ -99,6 +99,11 @@ void GetAllSELEntriesSorted(Webs *wp)
         senNumNameTab[i].sensor_name[0] = '\0';
     }
 
+    websSetStatus(wp, 200);
+    websWriteHeaders(wp, -1, 0);
+    websWriteEndHeaders(wp); 
+    websWrite(wp, "{\"data\":[");
+
     //Create session
     LIBIPMI_CreateSession(&UDSSession, DEFAULT_TIMEOUT);
 
@@ -125,19 +130,20 @@ void GetAllSELEntriesSorted(Webs *wp)
         {
             cJSON_AddItemToObject(root, "data", pJsonArry);
 
-            char *pStr;
-            pStr = cJSON_PrintUnformatted(root);
-            websSetStatus(wp, 200);
-            websWriteHeaders(wp, -1, 0);
-            websWriteEndHeaders(wp); 
-            websWrite(wp, pStr);
+            // char *pStr;
+            // pStr = cJSON_PrintUnformatted(root);
+            // websSetStatus(wp, 200);
+            // websWriteHeaders(wp, -1, 0);
+            // websWriteEndHeaders(wp); 
+            // websWrite(wp, pStr);
+            websWrite(wp, "]}");
             websFlush(wp, 0);
             websDone(wp);
             
-            if(root)
-                cJSON_Delete(root);
-            if(pStr)
-                wfree(pStr);
+            // if(root)
+            //     cJSON_Delete(root);
+            // if(pStr)
+            //     wfree(pStr);
 
             return;
         }
@@ -165,6 +171,10 @@ void GetAllSELEntriesSorted(Webs *wp)
             RecID = 0;  //first record
             for(i=0;i<nEntries;i++)
             {
+                if(i!=0)
+                {
+                    websWrite(wp, ",");
+                }
                 //获取日志
                 GetSelReq.ReservationID = ReserveID;
                 GetSelReq.RecID = RecID;
@@ -182,18 +192,23 @@ void GetAllSELEntriesSorted(Webs *wp)
                 {
                     break;
                 }
-                cJSON_AddItemToArray(pJsonArry,pJsonsub=cJSON_CreateObject()); /* 给创建的数组增加对对象*/
-                cJSON_AddNumberToObject(pJsonsub, "D1", SELEventData.hdr.ID);    //RecordID      -> D1
-                cJSON_AddNumberToObject(pJsonsub, "D2", SELEventData.hdr.Type);  //RecordType    -> D2
-                cJSON_AddNumberToObject(pJsonsub, "D3", SELEventData.hdr.TimeStamp); //TimeStamp -> D3
-                cJSON_AddNumberToObject(pJsonsub, "D4", SELEventData.GenID[0]);      //GenID1    -> D4
-                cJSON_AddNumberToObject(pJsonsub, "D5", SELEventData.GenID[1]);      //GenID2    -> D5
-                cJSON_AddNumberToObject(pJsonsub, "D6", SELEventData.EvMRev);        //EvmRev    -> D6
-                cJSON_AddNumberToObject(pJsonsub, "D7", SELEventData.SensorType);    //SensorType    -> D7
-                cJSON_AddNumberToObject(pJsonsub, "D8", SELEventData.EvtDirType);    //EventDirType  -> D8
-                cJSON_AddNumberToObject(pJsonsub, "D9", SELEventData.EvtData1);      //EventData1    -> D9
-                cJSON_AddNumberToObject(pJsonsub, "D10", SELEventData.EvtData2);     //EventData2    -> D10
-                cJSON_AddNumberToObject(pJsonsub, "D11", SELEventData.EvtData3);     //EventData3    -> D11
+                // cJSON_AddItemToArray(pJsonArry,pJsonsub=cJSON_CreateObject()); /* 给创建的数组增加对对象*/
+                // cJSON_AddNumberToObject(pJsonsub, "D1", SELEventData.hdr.ID);    //RecordID      -> D1
+                // cJSON_AddNumberToObject(pJsonsub, "D2", SELEventData.hdr.Type);  //RecordType    -> D2
+                // cJSON_AddNumberToObject(pJsonsub, "D3", SELEventData.hdr.TimeStamp); //TimeStamp -> D3
+                // cJSON_AddNumberToObject(pJsonsub, "D4", SELEventData.GenID[0]);      //GenID1    -> D4
+                // cJSON_AddNumberToObject(pJsonsub, "D5", SELEventData.GenID[1]);      //GenID2    -> D5
+                // cJSON_AddNumberToObject(pJsonsub, "D6", SELEventData.EvMRev);        //EvmRev    -> D6
+                // cJSON_AddNumberToObject(pJsonsub, "D7", SELEventData.SensorType);    //SensorType    -> D7
+                // cJSON_AddNumberToObject(pJsonsub, "D8", SELEventData.EvtDirType);    //EventDirType  -> D8
+                // cJSON_AddNumberToObject(pJsonsub, "D9", SELEventData.EvtData1);      //EventData1    -> D9
+                // cJSON_AddNumberToObject(pJsonsub, "D10", SELEventData.EvtData2);     //EventData2    -> D10
+                // cJSON_AddNumberToObject(pJsonsub, "D11", SELEventData.EvtData3);     //EventData3    -> D11
+
+                websWrite(wp, "{\"D1\":%d,\"D2\":%d,\"D3\":%d,\"D4\":%d,\"D5\":%d,\"D6\":%d,\"D7\":%d,\"D8\":%d,\"D9\":%d,\"D10\":%d,\"D11\":%d,",
+                    SELEventData.hdr.ID, SELEventData.hdr.Type, SELEventData.hdr.TimeStamp, SELEventData.GenID[0],
+                    SELEventData.GenID[1], SELEventData.EvMRev, SELEventData.SensorType, SELEventData.EvtDirType,
+                    SELEventData.EvtData1, SELEventData.EvtData2, SELEventData.EvtData3);
                             
                 //获取传感器名称
                 //printf("sensor number %d\n", SELEventData.SensorNum);
@@ -206,9 +221,9 @@ void GetAllSELEntriesSorted(Webs *wp)
                             break;
 
                         if(senNumNameTab[i].sensor_number == SELEventData.SensorNum)
-                        {                        
-                            //cJSON_AddStringToObject(pJsonsub, "c", senNumNameTab[i].sensor_name);
-                            cJSON_AddStringToObject(pJsonsub, "D12", senNumNameTab[i].sensor_name);  //SensorName -> D12
+                        {                                                
+                            //cJSON_AddStringToObject(pJsonsub, "D12", senNumNameTab[i].sensor_name);  //SensorName -> D12
+                            websWrite(wp, "\"D12\":\"%s\"}", senNumNameTab[i].sensor_name);
                             found_flag = 1;
                             break;
                         }
@@ -225,7 +240,8 @@ void GetAllSELEntriesSorted(Webs *wp)
                         {
                             wRet = IPMC_GetSensorName(&UDSSession, target_addr,SELEventData.SensorNum, sensorName, DEFAULT_TIMEOUT);
                         }
-                        cJSON_AddStringToObject(pJsonsub, "D12", senNumNameTab[i].sensor_name);     //SensorName->D12
+                        //cJSON_AddStringToObject(pJsonsub, "D12", senNumNameTab[i].sensor_name);     //SensorName->D12
+                        websWrite(wp, "\"D12\":\"%s\"}", senNumNameTab[i].sensor_name);
                         if(wRet == 0)
                         {
                             //将得到的传感器名称保存到缓存中
@@ -243,13 +259,14 @@ void GetAllSELEntriesSorted(Webs *wp)
                 }
                 else
                 {
-                    cJSON_AddStringToObject(pJsonsub, "D12", "--"); //SensorName -> D12
+                    //cJSON_AddStringToObject(pJsonsub, "D12", "--"); //SensorName -> D12
+                    websWrite(wp, "\"D12\":\"%s\"}", senNumNameTab[i].sensor_name);
                 }
 
                 if(RecID == 0xffff) //last record
                     break;
 
-                usleep(1);
+                //usleep(1);
             }
         }
     }
@@ -257,22 +274,17 @@ void GetAllSELEntriesSorted(Webs *wp)
     //Close session
     LIBIPMI_CloseSession(&UDSSession );
 
-    cJSON_AddItemToObject(root, "data", pJsonArry);
+    //cJSON_AddItemToObject(root, "data", pJsonArry);
 
-    char *pStr;
-    pStr = cJSON_PrintUnformatted(root);
-    websSetStatus(wp, 200);
-    websWriteHeaders(wp, -1, 0);
-    websWriteEndHeaders(wp); 
-    websWrite(wp, pStr);
+    websWrite(wp, "]}");
     websFlush(wp, 0);
     websDone(wp);
     //printf("cJSON:%s\n",pStr);
     
-    if(root)
-        cJSON_Delete(root);
-    if(pStr)
-        wfree(pStr);
+    // if(root)
+    //     cJSON_Delete(root);
+    // if(pStr)
+    //     wfree(pStr);
     if(pSELBuff)
         wfree(pSELBuff);
 
@@ -282,10 +294,10 @@ error_out:
     //Close session
     LIBIPMI_CloseSession(&UDSSession );
     websError(wp, 404, "Get SEL error!");
-    if(root)
-        cJSON_Delete(root);
-    if(pStr)
-        wfree(pStr);
+    // if(root)
+    //     cJSON_Delete(root);
+    // if(pStr)
+    //     wfree(pStr);
     if(pSELBuff)
         wfree(pSELBuff);