|
@@ -27,6 +27,8 @@ void getDeviceInfo(Webs *wp){
|
|
char MacAddr[18] = {0};
|
|
char MacAddr[18] = {0};
|
|
char IpAddr[16] = {0};
|
|
char IpAddr[16] = {0};
|
|
|
|
|
|
|
|
+ printf("---> getSensorInfo, wp.index = %d\n", wp->index);
|
|
|
|
+
|
|
//Create session
|
|
//Create session
|
|
LIBIPMI_CreateSession(&UDSSession, DEFAULT_TIMEOUT);
|
|
LIBIPMI_CreateSession(&UDSSession, DEFAULT_TIMEOUT);
|
|
|
|
|
|
@@ -118,6 +120,7 @@ void getSysInfo(Webs *wp){
|
|
IPMI20_UDS_SESSION_T UDSSession;
|
|
IPMI20_UDS_SESSION_T UDSSession;
|
|
|
|
|
|
|
|
|
|
|
|
+ printf("---> getSysInfo, wp.index = %d\n", wp->index);
|
|
sysInfo.title = walloc(MAX_TITLE_LEN);
|
|
sysInfo.title = walloc(MAX_TITLE_LEN);
|
|
if(sysInfo.title == NULL)
|
|
if(sysInfo.title == NULL)
|
|
{
|
|
{
|
|
@@ -208,6 +211,7 @@ void getSensorInfo(Webs *wp){
|
|
unsigned char *pStartBuff = NULL;
|
|
unsigned char *pStartBuff = NULL;
|
|
IPMI20_UDS_SESSION_T UDSSession;
|
|
IPMI20_UDS_SESSION_T UDSSession;
|
|
|
|
|
|
|
|
+ printf("---> getSensorInfo, wp.index = %d\n", wp->index);
|
|
//Create session
|
|
//Create session
|
|
LIBIPMI_CreateSession(&UDSSession, 10000);
|
|
LIBIPMI_CreateSession(&UDSSession, 10000);
|
|
|
|
|
|
@@ -238,7 +242,7 @@ void getSensorInfo(Webs *wp){
|
|
memset(pSensorBuff, 0, nSensors * sizeof(struct sensor_data));
|
|
memset(pSensorBuff, 0, nSensors * sizeof(struct sensor_data));
|
|
pStartBuff = (unsigned char *)pSensorBuff;
|
|
pStartBuff = (unsigned char *)pSensorBuff;
|
|
|
|
|
|
- printf("sensorcount = %d\n", nSensors);
|
|
|
|
|
|
+ //printf("sensorcount = %d\n", nSensors);
|
|
nSensors -= 1; //remove first sdr
|
|
nSensors -= 1; //remove first sdr
|
|
wRet = LIBIPMI_HL_GetAllSensorReadings(&UDSSession,pSensorBuff, nSensors,DEFAULT_TIMEOUT);
|
|
wRet = LIBIPMI_HL_GetAllSensorReadings(&UDSSession,pSensorBuff, nSensors,DEFAULT_TIMEOUT);
|
|
|
|
|
|
@@ -258,7 +262,6 @@ void getSensorInfo(Webs *wp){
|
|
cJSON * root = cJSON_CreateObject();
|
|
cJSON * root = cJSON_CreateObject();
|
|
cJSON *pJsonArry,*pJsonsub;
|
|
cJSON *pJsonArry,*pJsonsub;
|
|
pJsonArry=cJSON_CreateArray(); /*创建数组*/
|
|
pJsonArry=cJSON_CreateArray(); /*创建数组*/
|
|
- logmsg(2, "-----------------------sensor----------------------");
|
|
|
|
while(nSensors)
|
|
while(nSensors)
|
|
{
|
|
{
|
|
sprintf(reading, "%.3f", pSensorBuff->sensor_reading);
|
|
sprintf(reading, "%.3f", pSensorBuff->sensor_reading);
|
|
@@ -275,17 +278,7 @@ void getSensorInfo(Webs *wp){
|
|
cJSON_AddNumberToObject(pJsonsub, "sensorNum", pSensorBuff->sensor_num);
|
|
cJSON_AddNumberToObject(pJsonsub, "sensorNum", pSensorBuff->sensor_num);
|
|
cJSON_AddStringToObject(pJsonsub, "sensorName", pSensorBuff->sensor_name);
|
|
cJSON_AddStringToObject(pJsonsub, "sensorName", pSensorBuff->sensor_name);
|
|
|
|
|
|
- //cJSON_AddNumberToObject(pJsonsub, "ownerId", pSensorBuff->owner_id);
|
|
|
|
- //cJSON_AddNumberToObject(pJsonsub, "ownerNun", pSensorBuff->owner_lun);
|
|
|
|
- //cJSON_AddNumberToObject(pJsonsub, "sensorType", pSensorBuff->sensor_type);
|
|
|
|
- // cJSON_AddNumberToObject(pJsonsub, "sensorUnits1", pSensorBuff->sensor_units[0]);
|
|
|
|
- // cJSON_AddNumberToObject(pJsonsub, "sensorUnits2", pSensorBuff->sensor_units[1]);
|
|
|
|
- // cJSON_AddNumberToObject(pJsonsub, "sensorUnits3", pSensorBuff->sensor_units[2]);
|
|
|
|
-
|
|
|
|
- //cJSON_AddNumberToObject(pJsonsub, "rawReading", pSensorBuff->raw_reading);
|
|
|
|
- //cJSON_AddNumberToObject(pJsonsub, "sensorState", pSensorBuff->sensor_state);
|
|
|
|
- //cJSON_AddNumberToObject(pJsonsub, "discreteState", pSensorBuff->discrete_state);
|
|
|
|
- //cJSON_AddNumberToObject(pJsonsub, "SensorAccessibleFlags", pSensorBuff->SensorAccessibleFlags);
|
|
|
|
|
|
+
|
|
cJSON_AddStringToObject(pJsonsub, "reading", reading); /* 给对象增加内容 */
|
|
cJSON_AddStringToObject(pJsonsub, "reading", reading); /* 给对象增加内容 */
|
|
cJSON_AddStringToObject(pJsonsub, "lownr", lownr);
|
|
cJSON_AddStringToObject(pJsonsub, "lownr", lownr);
|
|
cJSON_AddStringToObject(pJsonsub, "lowct", lowct);
|
|
cJSON_AddStringToObject(pJsonsub, "lowct", lowct);
|
|
@@ -401,49 +394,6 @@ void actionTest(Webs *wp)
|
|
wfree(name);
|
|
wfree(name);
|
|
if(age)
|
|
if(age)
|
|
wfree(age);
|
|
wfree(age);
|
|
- // IPMI20_UDS_SESSION_T UDSSession;
|
|
|
|
- // GetDevIDRes_T DeviceID;
|
|
|
|
-
|
|
|
|
- // //Create session
|
|
|
|
- // LIBIPMI_CreateSession(&UDSSession, DEFAULT_TIMEOUT);
|
|
|
|
- // LIBIPMI_IPMC_GetDeviceID(&UDSSession, 0x8a, &DeviceID, DEFAULT_TIMEOUT);
|
|
|
|
-
|
|
|
|
- // //Close session
|
|
|
|
- // LIBIPMI_CloseSession(&UDSSession );
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- // char *pStr;
|
|
|
|
-
|
|
|
|
- // cJSON * root = cJSON_CreateObject();
|
|
|
|
- // cJSON * data = cJSON_CreateObject();
|
|
|
|
- // cJSON_AddItemToObject(root, "data", data);//根节点下添加
|
|
|
|
- // cJSON_AddStringToObject(root, "msg", "");
|
|
|
|
- // cJSON_AddNumberToObject(root, "code", 200);
|
|
|
|
-
|
|
|
|
- // cJSON_AddNumberToObject(data, "DeviceID", DeviceID.DeviceID);
|
|
|
|
- // cJSON_AddNumberToObject(data, "DevRevision", DeviceID.DevRevision);
|
|
|
|
- // cJSON_AddNumberToObject(data, "FirmwareRevision1", DeviceID.FirmwareRevision1);
|
|
|
|
- // cJSON_AddNumberToObject(data, "FirmwareRevision2", DeviceID.FirmwareRevision2);
|
|
|
|
- // cJSON_AddNumberToObject(data, "IPMIVersion", DeviceID.IPMIVersion);
|
|
|
|
- // cJSON_AddNumberToObject(data, "DevSupport", DeviceID.DevSupport);
|
|
|
|
- // cJSON_AddNumberToObject(data, "MfgID", DeviceID.MfgID[0]<<24 | DeviceID.MfgID[1]<<16 | DeviceID.MfgID[2]<<8 | DeviceID.MfgID[3]);
|
|
|
|
- // cJSON_AddNumberToObject(data, "ProdID", DeviceID.ProdID);
|
|
|
|
- // cJSON_AddNumberToObject(data, "AuxFirmwareRevision", DeviceID.AuxFirmwareRevision);
|
|
|
|
-
|
|
|
|
- // pStr = cJSON_PrintUnformatted(root);
|
|
|
|
-
|
|
|
|
- // printf("%s\n", pStr);
|
|
|
|
- // websSetStatus(wp, 200);
|
|
|
|
- // websWriteHeaders(wp, -1, 0);
|
|
|
|
- // websWriteEndHeaders(wp);
|
|
|
|
- // websWrite(wp,"%s", pStr);
|
|
|
|
- // websFlush(wp, 0);
|
|
|
|
- // websDone(wp);
|
|
|
|
-
|
|
|
|
- // if(pStr)
|
|
|
|
- // wfree(pStr);
|
|
|
|
- // if(root)
|
|
|
|
- // cJSON_Delete(root);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -505,35 +455,9 @@ void getAllBladeInfo(Webs *wp){
|
|
}
|
|
}
|
|
|
|
|
|
void setBladeManage(Webs *wp){
|
|
void setBladeManage(Webs *wp){
|
|
- // uint16_t wRet = LIBIPMI_E_SUCCESS;
|
|
|
|
- // IPMI20_UDS_SESSION_T UDSSession;
|
|
|
|
-
|
|
|
|
char *strEnable = websGetVar(wp, "enable", NULL);
|
|
char *strEnable = websGetVar(wp, "enable", NULL);
|
|
|
|
|
|
gChassisManageEn = atoi(strEnable);
|
|
gChassisManageEn = atoi(strEnable);
|
|
-
|
|
|
|
- // if(enable > 1)
|
|
|
|
- // {
|
|
|
|
- // websError(wp, 404, "Invalid param");
|
|
|
|
- // return ;
|
|
|
|
- // }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- // //Create session
|
|
|
|
- // LIBIPMI_CreateSession(&UDSSession, DEFAULT_TIMEOUT);
|
|
|
|
-
|
|
|
|
- // wRet = LIBIPMI_HL_SetBladeManageFn(&UDSSession, enable, DEFAULT_TIMEOUT);
|
|
|
|
- // if(wRet != 0)
|
|
|
|
- // {
|
|
|
|
- // printf("Set Blade Manage error!\n");
|
|
|
|
- // websError(wp, 404, "Set Blade Manage Error!");
|
|
|
|
- // LIBIPMI_CloseSession(&UDSSession );
|
|
|
|
- // return;
|
|
|
|
- // }
|
|
|
|
-
|
|
|
|
- // //Close session
|
|
|
|
- // LIBIPMI_CloseSession(&UDSSession );
|
|
|
|
-
|
|
|
|
|
|
|
|
char *pStr;
|
|
char *pStr;
|
|
cJSON * root = cJSON_CreateObject();
|
|
cJSON * root = cJSON_CreateObject();
|