|
@@ -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 );
|
|
|
}
|
|
|
|
|
|
|