|
@@ -142,10 +142,11 @@ typedef union
|
|
|
unsigned char CsMsgValue[CHAdeMO_QUANTITY+ CCS_QUANTITY + GB_QUANTITY + AC_QUANTITY];
|
|
|
struct
|
|
|
{
|
|
|
- //CsMsgValue[0]
|
|
|
- unsigned char StatusNotificationReq :1; //bit 0,
|
|
|
- unsigned char StatusNotificationConf :1; //bit 0,
|
|
|
- unsigned char :6; //bit 2~7
|
|
|
+ //CsMsgValue[0]
|
|
|
+ unsigned char StatusNotificationReq:1; //bit 0,
|
|
|
+ unsigned char StatusNotificationConf:1; //bit 1,
|
|
|
+ unsigned char TriggerMeterValue:1; //bit 2,
|
|
|
+ unsigned char :5; //bit 5~7
|
|
|
}bits[CHAdeMO_QUANTITY+ CCS_QUANTITY + GB_QUANTITY + AC_QUANTITY];
|
|
|
}CpinitiateMsg;
|
|
|
|
|
@@ -2578,6 +2579,12 @@ void CheckSystemValue(void)
|
|
|
//==============================================
|
|
|
// Meter report
|
|
|
//==============================================
|
|
|
+ if(cpinitateMsg.bits[gun_index].TriggerMeterValue)
|
|
|
+ {
|
|
|
+ sendMeterValuesRequest(gun_index, ReadingContext_Trigger);
|
|
|
+ cpinitateMsg.bits[gun_index].TriggerMeterValue = 0;
|
|
|
+ }
|
|
|
+
|
|
|
if(/*(server_sign == TRUE) &&(isOFFline() == TRUE) ||*/
|
|
|
(((time((time_t*)NULL) - clientTime.MeterValues[gun_index]) > (atoi((const char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValueSampleInterval].ItemData)- 1)) || ((atoi((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[ClockAlignedDataInterval].ItemData) > 0)?((getTimePassSinceToday()%(atoi((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[ClockAlignedDataInterval].ItemData)))==0):FALSE)))
|
|
|
{
|
|
@@ -2710,6 +2717,7 @@ void CheckSystemValue(void)
|
|
|
sleep(1);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
//==============================================
|
|
|
// Check Connector reserved
|
|
|
//==============================================
|
|
@@ -4589,22 +4597,6 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
|
|
|
int tempIndex = 0;
|
|
|
|
|
|
DEBUG_INFO("sendMeterValuesRequest ...\n");
|
|
|
- //DEBUG_ERROR("gun_index =%d\n",gun_index);
|
|
|
-
|
|
|
- /*
|
|
|
- if((ShmOCPP16Data->StartTransaction[gun_index].ResponseTransactionId == 0) && (ShmOCPP16Data->CsMsg.bits[gun_index].TriggerMessageReq == 0)) // no TransactionId
|
|
|
- {
|
|
|
- DEBUG_INFO("NOT SENT METER Vlaue\n");
|
|
|
- //DEBUG_ERROR("ShmOCPP16Data->StartTransaction[gun_index].ResponseTransactionId =%d\n",ShmOCPP16Data->StartTransaction[gun_index].ResponseTransactionId);
|
|
|
- //DEBUG_ERROR("ShmOCPP16Data->CsMsg.bits[gun_index].TriggerMessageReq =%d\n",ShmOCPP16Data->CsMsg.bits[gun_index].TriggerMessageReq);
|
|
|
-
|
|
|
- return result;
|
|
|
- }*/
|
|
|
-
|
|
|
- if(ShmOCPP16Data->CsMsg.bits[gun_index].TriggerMessageReq == 1)
|
|
|
- {
|
|
|
- ShmOCPP16Data->CsMsg.bits[gun_index].TriggerMessageReq = 0;
|
|
|
- }
|
|
|
|
|
|
memset(queuedata, 0, ARRAY_SIZE(queuedata));
|
|
|
//set value
|
|
@@ -5466,7 +5458,11 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
|
|
|
result = PASS;
|
|
|
DEBUG_INFO("MeterValues mapitem pass\n");
|
|
|
}
|
|
|
- queue_operation(QUEUE_OPERATION_ADD, guid, queuedata );//addq(guid, queuedata); ---> remove temporally
|
|
|
+
|
|
|
+ if(dataType != ReadingContext_Trigger)
|
|
|
+ queue_operation(QUEUE_OPERATION_ADD, guid, queuedata );//addq(guid, queuedata); ---> remove temporally
|
|
|
+ else
|
|
|
+ LWS_Send(queuedata +2);
|
|
|
/*
|
|
|
if(GetTransactionQueueNum() == 1)
|
|
|
{
|
|
@@ -10348,15 +10344,27 @@ int handleTriggerMessageRequest(char *uuid, char *payload)
|
|
|
connectorIdInt = atoi(sstr);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- if(connectorIdIsNULL == FALSE && ((connectorIdInt > 0) && (connectorIdInt <= gunTotalNumber /*(CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY)*/ )))
|
|
|
+ if((connectorIdIsNULL == TRUE) || ((connectorIdIsNULL == FALSE) && ((connectorIdInt > 0) && (connectorIdInt <= gunTotalNumber /*(CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY)*/ ))) )
|
|
|
{
|
|
|
- //connectorIdInt = json_object_get_int(connectorId);
|
|
|
sprintf((char *)ShmOCPP16Data->TriggerMessage[connectorIdInt -1].RequestedMessage, "%s" ,requestedMessagestr);
|
|
|
ShmOCPP16Data->TriggerMessage[connectorIdInt -1].ConnectorId = connectorIdInt;
|
|
|
- //ShmOCPP16Data->CsMsg.bits[connectorIdInt -1].TriggerMessageReq = 1;
|
|
|
- sprintf(comfirmstr, "%s",TriggerMessageStatusStr[TriggerMessageStatus_Accepted] );
|
|
|
- sendTriggerMessageConfirmation(uuid,comfirmstr);
|
|
|
+
|
|
|
+ if((strcmp(requestedMessagestr, MessageTriggerStr[FirmwareStatusNotification]) != 0) &&
|
|
|
+ (strcmp(requestedMessagestr, MessageTriggerStr[DiagnosticsStatusNotification]) != 0) &&
|
|
|
+ (strcmp(requestedMessagestr, MessageTriggerStr[BootNotification]) != 0 ) &&
|
|
|
+ (strcmp(requestedMessagestr, MessageTriggerStr[Heartbeat]) != 0) &&
|
|
|
+ (strcmp(requestedMessagestr, MessageTriggerStr[MeterValues]) != 0) &&
|
|
|
+ (strcmp(requestedMessagestr, MessageTriggerStr[StatusNotification]) != 0 ))
|
|
|
+ {
|
|
|
+ sprintf(comfirmstr, "%s",TriggerMessageStatusStr[TriggerMessageStatus_NotImplemented] );
|
|
|
+ sendTriggerMessageConfirmation(uuid,comfirmstr);
|
|
|
+ return TRUE;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ sprintf(comfirmstr, "%s",TriggerMessageStatusStr[TriggerMessageStatus_Accepted] );
|
|
|
+ sendTriggerMessageConfirmation(uuid,comfirmstr);
|
|
|
+ }
|
|
|
}
|
|
|
else if(connectorIdIsNULL == FALSE && ((connectorIdInt <= 0) || (connectorIdInt > gunTotalNumber /*(CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY)*/) ))
|
|
|
{
|
|
@@ -10365,23 +10373,9 @@ int handleTriggerMessageRequest(char *uuid, char *payload)
|
|
|
return TRUE;
|
|
|
}
|
|
|
|
|
|
- if((strcmp(requestedMessagestr, MessageTriggerStr[FirmwareStatusNotification]) != 0) &&
|
|
|
- (strcmp(requestedMessagestr, MessageTriggerStr[DiagnosticsStatusNotification]) != 0) &&
|
|
|
- (strcmp(requestedMessagestr, MessageTriggerStr[BootNotification]) != 0 ) &&
|
|
|
- (strcmp(requestedMessagestr, MessageTriggerStr[Heartbeat]) != 0) &&
|
|
|
- (strcmp(requestedMessagestr, MessageTriggerStr[MeterValues]) != 0) &&
|
|
|
- (strcmp(requestedMessagestr, MessageTriggerStr[StatusNotification]) != 0 ))
|
|
|
- {
|
|
|
- sprintf(comfirmstr, "%s",TriggerMessageStatusStr[TriggerMessageStatus_NotImplemented] );
|
|
|
- sendTriggerMessageConfirmation(uuid,comfirmstr);
|
|
|
- return TRUE;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- sprintf(comfirmstr, "%s",TriggerMessageStatusStr[TriggerMessageStatus_Accepted] );
|
|
|
- sendTriggerMessageConfirmation(uuid,comfirmstr);
|
|
|
- }
|
|
|
-
|
|
|
+ //==========================
|
|
|
+ // Trigger message
|
|
|
+ //==========================
|
|
|
if( strcmp(requestedMessagestr, MessageTriggerStr[FirmwareStatusNotification]) == 0)
|
|
|
{
|
|
|
if((FirmwareStatusNotificationStatus != FIRMWARE_STATUS_DOWNLOADING) &&
|
|
@@ -10393,26 +10387,19 @@ int handleTriggerMessageRequest(char *uuid, char *payload)
|
|
|
}
|
|
|
|
|
|
sendFirmwareStatusNotificationRequest(FirmwareStatusStr[FirmwareStatusNotificationStatus]);
|
|
|
- //sprintf(comfirmstr, "%s",TriggerMessageStatusStr[TriggerMessageStatus_Accepted] );
|
|
|
-
|
|
|
}
|
|
|
else if(strcmp(requestedMessagestr, MessageTriggerStr[DiagnosticsStatusNotification]) == 0 )
|
|
|
{
|
|
|
- //printf("DiagnosticsStatusStr[DiagnosticsStatus_Idle] =%s\n",DiagnosticsStatusStr[DiagnosticsStatus_Idle]);
|
|
|
sendDiagnosticsStatusNotificationRequest(DiagnosticsStatusStr[DiagnosticsStatusNotificationStatus]);
|
|
|
- //sprintf(comfirmstr, "%s",TriggerMessageStatusStr[TriggerMessageStatus_Accepted] );
|
|
|
-
|
|
|
}
|
|
|
else if(strcmp(requestedMessagestr, MessageTriggerStr[BootNotification]) == 0 )
|
|
|
{
|
|
|
- sendBootNotificationRequest();
|
|
|
- //sprintf(comfirmstr, "%s",TriggerMessageStatusStr[TriggerMessageStatus_Accepted] );
|
|
|
-
|
|
|
+ //sendBootNotificationRequest();
|
|
|
+ server_sign = FALSE;
|
|
|
}
|
|
|
else if(strcmp(requestedMessagestr, MessageTriggerStr[Heartbeat]) == 0 )
|
|
|
{
|
|
|
clientTime.Heartbeat = time((time_t*)NULL) - (ShmOCPP16Data->BootNotification.ResponseHeartbeatInterval);
|
|
|
- //sprintf(comfirmstr, "%s",TriggerMessageStatusStr[TriggerMessageStatus_Accepted] );
|
|
|
}
|
|
|
else if (strcmp(requestedMessagestr, MessageTriggerStr[MeterValues]) == 0 )
|
|
|
{
|
|
@@ -10420,18 +10407,16 @@ int handleTriggerMessageRequest(char *uuid, char *payload)
|
|
|
{
|
|
|
if((connectorIdInt > 0) && ((connectorIdInt -1) < gunTotalNumber))
|
|
|
{
|
|
|
- ShmOCPP16Data->CsMsg.bits[connectorIdInt -1].TriggerMessageReq = 1;
|
|
|
- sendMeterValuesRequest((connectorIdInt -1), ReadingContext_Trigger);
|
|
|
- //sprintf(comfirmstr, "%s",TriggerMessageStatusStr[TriggerMessageStatus_Accepted] );
|
|
|
+ //sendMeterValuesRequest((connectorIdInt -1), ReadingContext_Trigger);
|
|
|
+ cpinitateMsg.bits[connectorIdInt -1].TriggerMeterValue = 1;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
for(int idx=0;idx< gunTotalNumber;idx++)
|
|
|
{
|
|
|
- ShmOCPP16Data->CsMsg.bits[idx].TriggerMessageReq = 1;
|
|
|
- sendMeterValuesRequest(idx, ReadingContext_Trigger);
|
|
|
+ //sendMeterValuesRequest(idx, ReadingContext_Trigger);
|
|
|
+ cpinitateMsg.bits[idx].TriggerMeterValue = 1;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -10442,17 +10427,13 @@ int handleTriggerMessageRequest(char *uuid, char *payload)
|
|
|
if((connectorIdInt > 0) && ((connectorIdInt -1) < gunTotalNumber))
|
|
|
{
|
|
|
cpinitateMsg.bits[connectorIdInt -1].StatusNotificationReq = 1;
|
|
|
- //sprintf(comfirmstr, "%s",TriggerMessageStatusStr[TriggerMessageStatus_Accepted] );
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
for(int idx=0;idx< gunTotalNumber;idx++)
|
|
|
cpinitateMsg.bits[idx].StatusNotificationReq = 1;
|
|
|
-
|
|
|
- //sprintf(comfirmstr, "%s",TriggerMessageStatusStr[TriggerMessageStatus_Accepted] );
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
return result;
|