|
@@ -65,6 +65,7 @@ void GetAllSELEntriesSorted(Webs *wp)
|
|
|
uint8 *pStartBuff = NULL;
|
|
|
uint16 nMaxEntries = 0;
|
|
|
IPMI20_UDS_SESSION_T UDSSession;
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -103,9 +104,25 @@ void GetAllSELEntriesSorted(Webs *wp)
|
|
|
pSELBuff = (SELEventRecordWithSensorName_T *) walloc(nMaxEntries * sizeof(SELEventRecordWithSensorName_T));
|
|
|
if(pSELBuff == NULL)
|
|
|
{
|
|
|
- printf("Error allocating memory for SEL entries!!\n");
|
|
|
- wRet = -1;
|
|
|
- goto error_out;
|
|
|
+ char *pStr;
|
|
|
+ int code = 200;
|
|
|
+ cJSON *root = cJSON_CreateObject();
|
|
|
+ cJSON *pJsonArry,*pJsonsub;
|
|
|
+ pJsonArry=cJSON_CreateArray(); /*创建数组*/
|
|
|
+ cJSON_AddItemToObject(root, "data", pJsonArry);
|
|
|
+ pStr = cJSON_PrintUnformatted(root);
|
|
|
+ printf("---> pStr %d: %s\n", strlen(pStr), pStr);
|
|
|
+
|
|
|
+ websSetStatus(wp, 200);
|
|
|
+ websWriteHeaders(wp, -1, 0);
|
|
|
+ websWriteEndHeaders(wp);
|
|
|
+ websWrite(wp, pStr);
|
|
|
+ websDone(wp);
|
|
|
+
|
|
|
+ // printf("Error allocating memory for SEL entries!!\n");
|
|
|
+ // wRet = -1;
|
|
|
+ // goto error_out;
|
|
|
+ return;
|
|
|
}
|
|
|
pStartBuff = (uint8 *)pSELBuff;
|
|
|
|
|
@@ -116,7 +133,7 @@ void GetAllSELEntriesSorted(Webs *wp)
|
|
|
{
|
|
|
char *pStr;
|
|
|
int code = 200;
|
|
|
- cJSON * root = cJSON_CreateObject();
|
|
|
+ cJSON *root = cJSON_CreateObject();
|
|
|
cJSON *pJsonArry,*pJsonsub;
|
|
|
pJsonArry=cJSON_CreateArray(); /*创建数组*/
|
|
|
/* Write entries here */
|
|
@@ -155,9 +172,7 @@ void GetAllSELEntriesSorted(Webs *wp)
|
|
|
cJSON_Delete(root);
|
|
|
if(pStr)
|
|
|
wfree(pStr);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
+ } else {
|
|
|
printf("Error reading All SEL entries\n");
|
|
|
}
|
|
|
wfree(pStartBuff);
|
|
@@ -170,6 +185,15 @@ void GetAllSELEntriesSorted(Webs *wp)
|
|
|
|
|
|
error_out:
|
|
|
websError(wp, 404, "Get SEL error!");
|
|
|
+ // cJSON_AddItemToObject(root, "data", pJsonArry);
|
|
|
+ // pStr = cJSON_PrintUnformatted(root);
|
|
|
+ // printf("---> pStr %d: %s\n", strlen(pStr), pStr);
|
|
|
+
|
|
|
+ // websSetStatus(wp, 200);
|
|
|
+ // websWriteHeaders(wp, -1, 0);
|
|
|
+ // websWriteEndHeaders(wp);
|
|
|
+ // websWrite(wp, pStr);
|
|
|
+ // websDone(wp);
|
|
|
|
|
|
}
|
|
|
|