zhangbo пре 3 година
родитељ
комит
8b8b2328f8

+ 70 - 3
app/bmc/Api.c

@@ -445,7 +445,28 @@ int PostEventMessage (uint8_t *EventMsg,uint8_t size)
 
 	SelRecord->hdr.Type = 0x02;
 	SelRecord->hdr.TimeStamp = GetSysTime ();
-	memcpy (SelRecord->GenID, EventMsg, size);
+	memcpy (&SelRecord->body, EventMsg, size);
+	
+	LockedAddSELEntry(SelReq, sizeof (SELEventRecord_T), SelRes);
+
+	return 0;
+}
+
+/*
+	EventMsg共6个字节。
+ */
+int PostOemEventMessage (uint8_t *EventMsg)
+{
+	uint8_t             SelReq [sizeof(SELEventRecord_T)];
+	uint8_t             SelRes [sizeof(AddSELRes_T)];
+	SELEventRecord_T*   SelRecord = ( SELEventRecord_T*) SelReq;
+
+	SelRecord->hdr.Type = 0xC0;		//storlead oem event Record ID
+	SelRecord->hdr.TimeStamp = GetSysTime ();
+	SelRecord->body.oemEventRecord.ManufacturerID[0] = 0x30;
+	SelRecord->body.oemEventRecord.ManufacturerID[1] = 0x30;
+	SelRecord->body.oemEventRecord.ManufacturerID[2] = 0x0f;
+	memcpy (SelRecord->body.oemEventRecord.OEMDefined, EventMsg, 6);
 	
 	LockedAddSELEntry(SelReq, sizeof (SELEventRecord_T), SelRes);
 
@@ -505,7 +526,15 @@ uint8_t PDK_GetChassisID(void)
 
 int PDK_PowerOffChassis(void)
 {
-	//printf("Api power off chassis\n");
+	printf("Api power off chassis\n");
+	uint8_t EventMsg[6];
+	EventMsg[0] = 1;	//命令类1
+	EventMsg[1] = 2;	//命令,chassis
+	EventMsg[2] = 2;	//power off
+	EventMsg[3] = 2;	//命令来源:BMC CMD
+	EventMsg[4] = 0;	//Reserve
+	EventMsg[5] = 0;	//Reserve
+	PostOemEventMessage (EventMsg);
 	g_BMCInfo.PowerGoodFlag = 0;
 	printf("Not support power control!\n");
 	return 0;
@@ -513,7 +542,15 @@ int PDK_PowerOffChassis(void)
 
 int PDK_PowerOnChassis(void)
 {
-	//printf("power on chassis\n");
+	printf("power on chassis\n");
+	uint8_t EventMsg[6];
+	EventMsg[0] = 1;	//命令类1
+	EventMsg[1] = 2;	//命令,chassis
+	EventMsg[2] = 1;	//power on
+	EventMsg[3] = 2;	//命令来源:BMC CMD
+	EventMsg[4] = 0;	//Reserve
+	EventMsg[5] = 0;	//Reserve
+	PostOemEventMessage (EventMsg);
 	g_BMCInfo.PowerGoodFlag = 1;
 	printf("Not support power control!\n");
 }
@@ -528,12 +565,34 @@ int PDK_SoftOffChassis(void)
 int PDK_GetPowerStatus(void)
 {
 	//TODO:
+	// if(g_BMCInfo.PowerGoodFlag != retval)
+	// {
+	// 	uint8_t EventMsg[6];
+	// 	EventMsg[0] = 2;	//命令类2
+	// 	EventMsg[1] = 1;	//命令,power good
+	// 	if(retval == 0)	//power down
+	// 		EventMsg[2] = 0;	//power goes down
+	// 	else
+	// 		EventMsg[2] = 1;	//power goes up
+	// 	EventMsg[3] = 0;	//命令来源:BMC CMD
+	// 	EventMsg[4] = 0;	//Reserve
+	// 	EventMsg[5] = 0;	//Reserve
+	// 	PostOemEventMessage (EventMsg);
+	// }
 	return 1;
 }
 
 int PDK_PowerCycleChassis(void)
 {
 	//printf("power cycle chassis\n");
+	// uint8_t EventMsg[6];
+	// EventMsg[0] = 1;	//命令类1
+	// EventMsg[1] = 2;	//命令,chassis
+	// EventMsg[2] = 4;	//power cycle
+	// EventMsg[3] = 2;	//命令来源:BMC CMD
+	// EventMsg[4] = 0;	//Reserve
+	// EventMsg[5] = 0;	//Reserve
+	// PostOemEventMessage (EventMsg);
 	printf("Not support power control!\n");
 	return 0;
 }
@@ -541,6 +600,14 @@ int PDK_PowerCycleChassis(void)
 int PDK_ResetChassis(void)
 {
 	//printf("power reset chassis\n");
+	// uint8_t EventMsg[6];
+	// EventMsg[0] = 1;	//命令类1
+	// EventMsg[1] = 2;	//命令,chassis
+	// EventMsg[2] = 3;	//reset
+	// EventMsg[3] = 2;	//命令来源:BMC CMD
+	// EventMsg[4] = 0;	//Reserve
+	// EventMsg[5] = 0;	//Reserve
+	// PostOemEventMessage (EventMsg);
 	printf("Not support power control!\n");
 	return 0;
 }

+ 1 - 0
app/bmc/Api.h

@@ -13,6 +13,7 @@ long int GetSysTime(void);
 #define GET_SYSTEM_TIME_STAMP GetSysTime
 
 int PostEventMessage (uint8_t *EventMsg,uint8_t size);
+int PostOemEventMessage (uint8_t *EventMsg);
 
  uint8_t PDK_GetSlotID(void);
  uint8_t PDK_GetChassisID(void);

+ 1 - 5
app/bmc/msghndlr/MsgHndlrTask.c

@@ -343,7 +343,6 @@ ProcessIPMIReq (MsgPkt_T* pReq, MsgPkt_T* pRes)
 	{
 		pRes->Data [HdrOffset] = CC_INV_CMD;
 		printf ("Invalid Net Function 0x%x or Invalid Command 0x%x\n",NET_FN(pReq->NetFnLUN), pReq->Cmd);
-		pRes->Size;//	+= 2;		//??? why
 		return;
 	}
 	
@@ -362,7 +361,6 @@ ProcessIPMIReq (MsgPkt_T* pReq, MsgPkt_T* pRes)
 			{
 				pRes->Data [HdrOffset] = CC_INV_CMD;
 				printf ("MsgHndlr.c : Invalid Net Function 0x%x or Invalid Command 0x%x\n",NET_FN(pReq->NetFnLUN), pReq->Cmd);
-				pRes->Size;//	+= 2;
 				return;
 			}			
 		}
@@ -370,7 +368,6 @@ ProcessIPMIReq (MsgPkt_T* pReq, MsgPkt_T* pRes)
 		if(GetCmdHndlr(pReq,pRes,pCmdHndlrMap,HdrOffset,CmdOverride,&pCmdHndlrMap) == FALSE)
 		{
 			pRes->Data [HdrOffset] = CC_INV_CMD;
-			pRes->Size;//	+= 2;		//??? why
 			return;
 		}
    }
@@ -381,9 +378,8 @@ ProcessIPMIReq (MsgPkt_T* pReq, MsgPkt_T* pRes)
 		/* Check for invalid request size */
 		if (pCmdHndlrMap->ReqLen != pReq->Size)
 		{	
-			printf("Warning: Request data len error, require %d\n", pCmdHndlrMap->ReqLen);
+			printf("Warning: Request data len error, require %d, recv %d\n", pCmdHndlrMap->ReqLen, pReq->Size);
 			pRes->Data [HdrOffset] = CC_REQ_INV_LEN;
-			pRes->Size;//	+= 2;	//??? why
 			return;
 		}
 	}

+ 5 - 45
app/bmc/msghndlr/Storage/SELDevice/SEL.c

@@ -941,54 +941,14 @@ static uint8_t SELTimeClockSync(uint8_t Action)
     SELEventRecord_T *EventRec = (SELEventRecord_T*)m_SysEventMsg;
     uint8_t pRes[sizeof(AddSELRes_T)];
 
-    EventRec->SensorNum  = 0xFF;
-    EventRec->EvtDirType = 0x6F;    // Sensor Specific
-    EventRec->EvtData1   = 0x05;    // Offset 05h - Timestamp Clock Sync
-    EventRec->EvtData2   = Action;
-    EventRec->EvtData3   = 0xFF;
+    EventRec->body.sysEventRecord.SensorNum  = 0xFF;
+    EventRec->body.sysEventRecord.EvtDirType = 0x6F;    // Sensor Specific
+    EventRec->body.sysEventRecord.EvtData1   = 0x05;    // Offset 05h - Timestamp Clock Sync
+    EventRec->body.sysEventRecord.EvtData2   = Action;
+    EventRec->body.sysEventRecord.EvtData3   = 0xFF;
 
     LockedAddSELEntry((uint8_t*)EventRec, sizeof(SELEventRecord_T), pRes);
     
     return 0;
 }
 
-
-///*---------------------------------------------------------------------------
-// * @fn SetSELPolicy
-// *
-// * @brief This function is invoked when switch SEL policy, make appropriate
-// *        adjustment for environment variables that related to SEL buffer.
-// *
-// * @param   Policy  - Specify Linear SEL policy or Circular SEL policy.
-// * @param   BMCInst - Index of BMC instance.
-// *---------------------------------------------------------------------------*/
-//void
-//SetSELPolicy(uint8_t Policy)
-//{
-////    SELRepository_T* m_sel = NULL;
-
-//	m_sel = (SELRepository_T*)g_BMCInfo.pSEL;
-
-//    switch (Policy)
-//    {
-//        case LINEAR_SEL:
-//            /* Reset LastRecID because GetNextSELEntry func will stop finding the next record if RecID >= LastRecRD,
-//               but RecID may greater than LastRecID in Circular SEL mode. */
-///*            LOCK_BMC_SHARED_MEM(BMCInst);
-//            BMC_GET_SHARED_MEM (BMCInst)->m_LastRecID = m_sel->SELRecord[pBMCInfo->SELConfig.MaxSELRecord].EvtRecord.hdr.ID;
-//            BMC_GET_SHARED_MEM (BMCInst)->m_SELIndex = m_sel->NumRecords;
-//            BMC_GET_SHARED_MEM (BMCInst)->m_FirstRecID = m_sel->SELRecord[0].EvtRecord.hdr.ID;
-//            UNLOCK_BMC_SHARED_MEM(BMCInst);*/
-//            break;
-
-//        case CIRCULAR_SEL:
-//            /*Update the Last and First Record ID when switch back to Circular-linear-Circular cycle */
-////            if(m_sel->NumRecords == g_BMCInfo.SELConfig.MaxSELRecord)
-////            {
-////                FindRecOrder();
-////            }
-//            break;
-//    }
-//}
-
-

+ 7 - 6
app/bmc/msghndlr/Storlead/Storlead.c

@@ -17,10 +17,10 @@ int  Storlead_GetSysInfo(uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes)
 	char Title[] = "系统信息";
 	char Text[] = "模块名称:多端口光纤接口模块;FPGA型号:XC7VX690T;简介: ";
 	int len = 0,remainLen = 0;
-	uint16_t offset = (pReq[1]<<8) | pReq[2];
+	uint16_t offset = (pReq[2]<<8) | pReq[1];
 	int totalLen = 0;
 	char *pStr = NULL;
-	int reqLen = (pReq[3]<<8) | pReq[4];
+	int reqLen = (pReq[4]<<8) | pReq[3];
 	
 	switch(pReq[0])
 	{
@@ -64,10 +64,11 @@ int  Storlead_GetSysInfo(uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes)
 	}
 	
 	remainLen = totalLen - offset - len;
-	*(pRes+1) = (len>>8)&0xff;
-	*(pRes+2) = len&0xff;
-	*(pRes+3) = (remainLen>>8)&0xff;
-	*(pRes+4) = remainLen&0xff;
+	*(pRes+1) = len&0xff;
+    *(pRes+2) = (len>>8)&0xff;
+	*(pRes+3) = remainLen&0xff;
+    *(pRes+4) = (remainLen>>8)&0xff;
+	
 	memcpy(pRes+5, pStr+offset, len);
 
 	// int i;

+ 23 - 9
app/common_include/com_IPMI_SEL.h

@@ -43,15 +43,7 @@ typedef struct
 
 }   SELRecHdr_T;
 
-/**
- * @struct SELEventRecord_T
- * @brief SEL Event Record
-**/
-typedef struct
-{
-    /* SEL ENTRY RECORD HEADER */
-    SELRecHdr_T hdr;
-
+typedef struct {
     /* RECORD BODY BYTES */
     uint8_t   GenID [2];
     uint8_t   EvMRev;
@@ -61,9 +53,31 @@ typedef struct
     uint8_t   EvtData1;
     uint8_t   EvtData2;
     uint8_t   EvtData3;
+} EventRecord_T;
+
+typedef struct {
+    /* RECORD BODY BYTES */
+    uint8_t   ManufacturerID[3];
+    uint8_t   OEMDefined[6];
+} OemEventRecord_T;
+
+/**
+ * @struct SELEventRecord_T
+ * @brief SEL Event Record
+**/
+typedef struct
+{
+    /* SEL ENTRY RECORD HEADER */
+    SELRecHdr_T hdr;
+
+    union {
+        EventRecord_T sysEventRecord;
+        OemEventRecord_T oemEventRecord;
+    } body;
 
 }   SELEventRecord_T;
 
+
 /**
  * @struct SELRec_T
  * @brief SEL Record

+ 2 - 4
app/goahead-3.6.5/src/libipmi/src/libipmi_StorDevice.c

@@ -1074,13 +1074,11 @@ uint8_t IPMC_SetSELTimeUTCOffset(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t Ipmb
 	Req[6] = CMD_SET_SEL_TIME_UTC_OFFSET;	
 	Req[7] = pSetSELTimeUTCOffsetReq->UTCOffset&0xff;
 	Req[8] = (pSetSELTimeUTCOffsetReq->UTCOffset>>8)&0xff;
-	Req[9] = (pSetSELTimeUTCOffsetReq->UTCOffset>>16)&0xff;
-	Req[10] = (pSetSELTimeUTCOffsetReq->UTCOffset>>24)&0xff;
-	Req[11] = 0x100 - (Req[4] + Req[5] + Req[6] + Req[7] + Req[8] + Req[9] + Req[10])&0xff;
+	Req[9] = 0x100 - (Req[4] + Req[5] + Req[6] + Req[7] + Req[8])&0xff;
 
 	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,  
 							NETFNLUN_IPMI_APP, CMD_SEND_MSG,
-							Req, 12,
+							Req, 10,
 							Res,  &dwResLen,
 							timeout);
 	if ((wRet != 0) || (Res[6] != 0))

+ 1 - 2
app/goahead-3.6.5/src/libipmi/src/libipmi_session.c

@@ -212,8 +212,7 @@ uint16_t LIBIPMI_Send_RAW_IPMI2_0_Command(IPMI20_UDS_SESSION_T *pUDSSession,
 
     if(byretval > 0)
     {
-        IPMIUDSMsg_T *pIPMIUDSMsg = (IPMIUDSMsg_T *)&pbyIPMIUDSResData[0];   
-        //TODO:UDS的数据结构在最后多了一个0,找机会要给他去掉。     
+        IPMIUDSMsg_T *pIPMIUDSMsg = (IPMIUDSMsg_T *)&pbyIPMIUDSResData[0];        
         *pdwResDataLen = pIPMIUDSMsg->IPMIMsgLen-sizeof(IPMIUDSMsg_T);  //remove header, 最后多出来的一个0,and checksum
         memcpy(pszResData,&pbyIPMIUDSResData[sizeof(IPMIUDSMsg_T)],*pdwResDataLen);
     }

+ 9 - 8
app/goahead-3.6.5/src/libipmi/src/libipmi_storlead_OEM.c

@@ -86,8 +86,8 @@ uint16_t LIBIPMI_HL_GetSysInfo( IPMI20_UDS_SESSION_T *pUDSSession, SysInfo_T *pS
 	Req[0] = 0;
 	Req[1] = 0;
 	Req[2] = 0;
-	Req[3] = (MAX_TITLE_LEN>>8)&0xff;	//max title len
-	Req[4] = MAX_TITLE_LEN&0xff;
+	Req[3] = MAX_TITLE_LEN&0xff;
+	Req[4] = (MAX_TITLE_LEN>>8)&0xff;	//max title len
 	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,   
 												NETFNLUN_IPMI_STORLEAD, CMD_GET_SYS_INFO,
 												(uint8_t*)Req, 5,
@@ -98,16 +98,17 @@ uint16_t LIBIPMI_HL_GetSysInfo( IPMI20_UDS_SESSION_T *pUDSSession, SysInfo_T *pS
 		printf("---> get Title error\n");
 		return -1;
 	}
-	strLen = (Res[1]<<8) | Res[2];
-	remainLen = (Res[3]<<8) | Res[4];
+	strLen = (Res[2]<<8) | Res[1];
+	remainLen = (Res[4]<<8) | Res[3];
 	memcpy(pSysInfo->title,&Res[5],strLen);
 
 	//get text
 	Req[0] = 1;
 	Req[1] = 0;
 	Req[2] = 0;
-	Req[3] = (MAX_TEXT_LEN>>8)&0xff;	//max text len
-	Req[4] = MAX_TEXT_LEN&0xff;
+	Req[3] = MAX_TEXT_LEN&0xff;
+	Req[4] = (MAX_TEXT_LEN>>8)&0xff;	//max text len
+	
 	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,   
 												NETFNLUN_IPMI_STORLEAD, CMD_GET_SYS_INFO,
 												(uint8_t*)Req, 5,
@@ -118,8 +119,8 @@ uint16_t LIBIPMI_HL_GetSysInfo( IPMI20_UDS_SESSION_T *pUDSSession, SysInfo_T *pS
 		printf("---> get Text error\n");
 		return -1;
 	}
-	strLen = (Res[1]<<8) | Res[2];
-	remainLen = (Res[3]<<8) | Res[4];
+	strLen = (Res[2]<<8) | Res[1];
+	remainLen = (Res[4]<<8) | Res[3];
 	memcpy(pSysInfo->text,&Res[5],strLen);
 	
 	return 0;

+ 58 - 61
app/goahead-3.6.5/src/web_interface/src/sel.c

@@ -129,22 +129,9 @@ void GetAllSELEntriesSorted(Webs *wp)
         if(nEntries == 0)
         {
             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);
-            
-            // if(root)
-            //     cJSON_Delete(root);
-            // if(pStr)
-            //     wfree(pStr);
-
             return;
         }
 
@@ -171,10 +158,7 @@ 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;
@@ -205,62 +189,75 @@ void GetAllSELEntriesSorted(Webs *wp)
                 // 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);
-                if((SELEventData.SensorNum != 0xff) && (SELEventData.hdr.Type == 0x02))
+                if(SELEventData.hdr.Type == 0x02)
                 {
-                    found_flag = 0;
-                    for(i=0;i<MAX_SENSOR_NUMBERS;i++)   //先从之前的缓存里查找传感器名称
+                    if(i!=0)
                     {
-                        if(senNumNameTab[i].sensor_number == 0xff)  //再往后没有内容了。
-                            break;
-
-                        if(senNumNameTab[i].sensor_number == SELEventData.SensorNum)
-                        {                                                
-                            //cJSON_AddStringToObject(pJsonsub, "D12", senNumNameTab[i].sensor_name);  //SensorName -> D12
-                            websWrite(wp, "\"D12\":\"%s\"}", senNumNameTab[i].sensor_name);
-                            found_flag = 1;
-                            break;
-                        }
+                        websWrite(wp, ",");
                     }
-
-                    if(found_flag == 0) //在缓存里没有找到
+                    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.body.sysEventRecord.GenID[0],  SELEventData.body.sysEventRecord.GenID[1], 
+                        SELEventData.body.sysEventRecord.EvMRev, SELEventData.body.sysEventRecord.SensorType, 
+                        SELEventData.body.sysEventRecord.EvtDirType,SELEventData.body.sysEventRecord.EvtData1, 
+                        SELEventData.body.sysEventRecord.EvtData2, SELEventData.body.sysEventRecord.EvtData3);
+                                
+                    //获取传感器名称
+                    //printf("sensor number %d\n", SELEventData.SensorNum);
+                    if(SELEventData.body.sysEventRecord.SensorNum != 0xff)
                     {
-                        if(target_addr == 0x20)
+                        found_flag = 0;
+                        for(i=0;i<MAX_SENSOR_NUMBERS;i++)   //先从之前的缓存里查找传感器名称
                         {
-                            wRet = IPMI_GetSensorName(&UDSSession, SELEventData.SensorNum, sensorName, DEFAULT_TIMEOUT);
-                            //printf("---> get sensor name: %s\n", sensorName);
-                        }
-                        else
-                        {
-                            wRet = IPMC_GetSensorName(&UDSSession, target_addr,SELEventData.SensorNum, sensorName, DEFAULT_TIMEOUT);
+                            if(senNumNameTab[i].sensor_number == 0xff)  //再往后没有内容了。
+                                break;
+
+                            if(senNumNameTab[i].sensor_number == SELEventData.body.sysEventRecord.SensorNum)
+                            {                                                
+                                //cJSON_AddStringToObject(pJsonsub, "D12", senNumNameTab[i].sensor_name);  //SensorName -> D12
+                                websWrite(wp, "\"D12\":\"%s\"}", senNumNameTab[i].sensor_name);
+                                found_flag = 1;
+                                break;
+                            }
                         }
-                        //cJSON_AddStringToObject(pJsonsub, "D12", senNumNameTab[i].sensor_name);     //SensorName->D12
-                        websWrite(wp, "\"D12\":\"%s\"}", senNumNameTab[i].sensor_name);
-                        if(wRet == 0)
+
+                        if(found_flag == 0) //在缓存里没有找到
                         {
-                            //将得到的传感器名称保存到缓存中
-                            for(i=0;i<MAX_SENSOR_NUMBERS;i++)
+                            if(target_addr == 0x20)
+                            {
+                                wRet = IPMI_GetSensorName(&UDSSession, SELEventData.body.sysEventRecord.SensorNum, sensorName, DEFAULT_TIMEOUT);
+                                //printf("---> get sensor name: %s\n", sensorName);
+                            }
+                            else
+                            {
+                                wRet = IPMC_GetSensorName(&UDSSession, target_addr,SELEventData.body.sysEventRecord.SensorNum, sensorName, DEFAULT_TIMEOUT);
+                            }
+                            //cJSON_AddStringToObject(pJsonsub, "D12", senNumNameTab[i].sensor_name);     //SensorName->D12
+                            websWrite(wp, "\"D12\":\"%s\"}", senNumNameTab[i].sensor_name);
+                            if(wRet == 0)
                             {
-                                if(senNumNameTab[i].sensor_number == 0xff)
+                                //将得到的传感器名称保存到缓存中
+                                for(i=0;i<MAX_SENSOR_NUMBERS;i++)
                                 {
-                                    senNumNameTab[i].sensor_number = SELEventData.SensorNum;
-                                    strcpy(senNumNameTab[i].sensor_name, sensorName);                                
-                                    break;
+                                    if(senNumNameTab[i].sensor_number == 0xff)
+                                    {
+                                        senNumNameTab[i].sensor_number = SELEventData.body.sysEventRecord.SensorNum;
+                                        strcpy(senNumNameTab[i].sensor_name, sensorName);                                
+                                        break;
+                                    }
                                 }
-                            }
-                        }    
-                    }                
+                            }    
+                        }                
+                    }
+                    else
+                    {
+                        //cJSON_AddStringToObject(pJsonsub, "D12", "--"); //SensorName -> D12
+                        websWrite(wp, "\"D12\":\"--\"}");
+                    }
                 }
-                else
+                else if(SELEventData.hdr.Type == 0xC0)
                 {
-                    //cJSON_AddStringToObject(pJsonsub, "D12", "--"); //SensorName -> D12
-                    websWrite(wp, "\"D12\":\"%s\"}", senNumNameTab[i].sensor_name);
+                    //TODO:
                 }
 
                 if(RecID == 0xffff) //last record