|
@@ -13,7 +13,6 @@
|
|
|
#else
|
|
|
#include <unistd.h>
|
|
|
#endif
|
|
|
-
|
|
|
#include <stdarg.h>
|
|
|
#include <ctype.h>
|
|
|
#include "libwebsockets.h"
|
|
@@ -614,6 +613,7 @@ typedef enum {
|
|
|
DeAuthorized
|
|
|
} StopTransactionReason;
|
|
|
|
|
|
+#if 0
|
|
|
static char * StopTransactionReasonStr[] = {
|
|
|
MACROSTR(EmergencyStop),
|
|
|
MACROSTR(EVDisconnected),
|
|
@@ -627,6 +627,7 @@ static char * StopTransactionReasonStr[] = {
|
|
|
MACROSTR(UnlockCommand),
|
|
|
MACROSTR(DeAuthorized)
|
|
|
};
|
|
|
+#endif
|
|
|
|
|
|
/*CancelReservationStatus*/
|
|
|
typedef enum {
|
|
@@ -2092,46 +2093,36 @@ S_FAULT =12
|
|
|
{
|
|
|
for (int index = 0; index < CHAdeMO_QUANTITY; index++)
|
|
|
{
|
|
|
- //printf("gun_index=%d\n",gun_index);
|
|
|
- //printf("ShmSysConfigAndInfo->SysInfo.ChademoChargingData[0].SystemStatus=%d\n",ShmSysConfigAndInfo->SysInfo.ChademoChargingData[0].SystemStatus);
|
|
|
if ((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == gun_index)&&(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_IDLE)) //S_IDLE
|
|
|
{
|
|
|
- //strcpy(ShmOCPP16Data->StatusNotification[gun_index].Status, "Available");
|
|
|
- currentStatus = 0; //OCPP Status
|
|
|
+ currentStatus = 0; //OCPP Status: Available
|
|
|
}
|
|
|
else if ((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == gun_index)&&(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_PREPARING)) //S_PRECHARGE
|
|
|
{
|
|
|
- //strcpy(ShmOCPP16Data->StatusNotification[gun_index].Status, "Preparing");
|
|
|
- currentStatus = 1; //OCPP Status
|
|
|
+ currentStatus = 1; //OCPP Status: Preparing
|
|
|
}
|
|
|
else if ((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == gun_index)&&(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_CHARGING)) //S_CHARGING
|
|
|
{
|
|
|
- //strcpy(ShmOCPP16Data->StatusNotification[gun_index].Status, "Charging");
|
|
|
- currentStatus = 2; //OCPP Status
|
|
|
+ currentStatus = 2; //OCPP Status: Charging
|
|
|
}
|
|
|
else if ((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == gun_index)&&(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_COMPLETE)) //S_COMPLETE
|
|
|
{
|
|
|
- //strcpy(ShmOCPP16Data->StatusNotification[gun_index].Status, "Finishing");
|
|
|
- currentStatus = 5; //OCPP Status
|
|
|
+ currentStatus = 5; //OCPP Status: Finishing
|
|
|
}
|
|
|
- else if ((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == gun_index)&&(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_ALARM)) //S_ALARM ---> SuspendedEV
|
|
|
+ else if ((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == gun_index)&&((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_ALARM)|| (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_TERMINATING))) //S_ALARM, S_TERMINATING ---> SuspendedEV
|
|
|
{
|
|
|
- //strcpy(ShmOCPP16Data->StatusNotification[gun_index].Status, ChargePointStatusStr[SuspendedEV]);
|
|
|
- currentStatus = 4; //OCPP Status
|
|
|
+ currentStatus = 4; //OCPP Status: SuspendedEV
|
|
|
}
|
|
|
- else if ((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == gun_index)&&((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_MAINTAIN)|| (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_DEBUG) || (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_UPDATE) || (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_TERMINATING) )) //S_TERMINATING ---> Unavailable
|
|
|
+ else if ((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == gun_index)&&((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_MAINTAIN)|| (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_DEBUG) || (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_UPDATE) )) // ---> Unavailable
|
|
|
{
|
|
|
- //strcpy(ShmOCPP16Data->StatusNotification[gun_index].Status, ChargePointStatusStr[SuspendedEV]);
|
|
|
currentStatus = 7; //OCPP Status: Unavailable
|
|
|
}
|
|
|
else if ((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == gun_index)&&(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_FAULT)) //S_FAULT ---> Faulted
|
|
|
{
|
|
|
- //strcpy(ShmOCPP16Data->StatusNotification[gun_index].Status, ChargePointStatusStr[SuspendedEV]);
|
|
|
currentStatus = 8; //OCPP Status: Faulted
|
|
|
}
|
|
|
else if ((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == gun_index)&&(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_RESERVATION)) // ---> Reserved
|
|
|
{
|
|
|
- //strcpy(ShmOCPP16Data->StatusNotification[gun_index].Status, ChargePointStatusStr[SuspendedEV]);
|
|
|
currentStatus = 6; //OCPP Status: Reserved
|
|
|
}
|
|
|
|
|
@@ -2139,92 +2130,74 @@ S_FAULT =12
|
|
|
|
|
|
for (int index = 0; index < CCS_QUANTITY; index++)
|
|
|
{
|
|
|
- //printf("ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].SystemStatus=%d\n",ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].SystemStatus);
|
|
|
if ((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == gun_index)&&(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_IDLE)) //S_IDLE
|
|
|
{
|
|
|
- //strcpy(ShmOCPP16Data->StatusNotification[gun_index].Status, "Available");
|
|
|
- currentStatus = 0; //OCPP Status
|
|
|
+ currentStatus = 0; //OCPP Status: Available
|
|
|
}
|
|
|
else if ((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == gun_index)&&(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_PREPARING)) //S_PRECHARGE
|
|
|
{
|
|
|
- //strcpy(ShmOCPP16Data->StatusNotification[gun_index].Status, "Preparing");
|
|
|
- currentStatus = 1; //OCPP Status
|
|
|
+ currentStatus = 1; //OCPP Status: Preparing
|
|
|
}
|
|
|
else if ((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == gun_index)&&(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_CHARGING)) //S_CHARGING
|
|
|
{
|
|
|
- //strcpy(ShmOCPP16Data->StatusNotification[gun_index].Status, "Charging");
|
|
|
- currentStatus = 2; //OCPP Status
|
|
|
+ currentStatus = 2; //OCPP Status: Charging
|
|
|
}
|
|
|
else if ((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == gun_index)&&(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_COMPLETE)) //S_COMPLETE
|
|
|
{
|
|
|
- //strcpy(ShmOCPP16Data->StatusNotification[gun_index].Status, "Finishing");
|
|
|
- currentStatus = 5; //OCPP Status
|
|
|
+ currentStatus = 5; //OCPP Status: Finishing
|
|
|
}
|
|
|
- else if ((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == gun_index)&&(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_ALARM)) //S_ALARM ---> SuspendedEV
|
|
|
+ else if ((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == gun_index)&&((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_ALARM) || (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_TERMINATING))) //S_ALARM ,S_TERMINATING ---> SuspendedEV
|
|
|
{
|
|
|
- //strcpy(ShmOCPP16Data->StatusNotification[gun_index].Status, ChargePointStatusStr[SuspendedEV]);
|
|
|
- currentStatus = 4; //OCPP Status
|
|
|
+ currentStatus = 4; //OCPP Status: SuspendedEV
|
|
|
}
|
|
|
- else if ((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == gun_index)&&((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_MAINTAIN) || (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_DEBUG) || (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_UPDATE) || (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_TERMINATING) )) //S_TERMINATING ---> Unavailable
|
|
|
+ else if ((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == gun_index)&&((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_MAINTAIN) || (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_DEBUG) || (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_UPDATE))) // ---> Unavailable
|
|
|
{
|
|
|
- //strcpy(ShmOCPP16Data->StatusNotification[gun_index].Status, ChargePointStatusStr[Unavailable]);
|
|
|
currentStatus = 7; //OCPP Status : Unavailable
|
|
|
}
|
|
|
else if ((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == gun_index)&&(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_FAULT)) //S_FAULT ---> Faulted
|
|
|
{
|
|
|
- //strcpy(ShmOCPP16Data->StatusNotification[gun_index].Status, ChargePointStatusStr[SuspendedEV]);
|
|
|
- currentStatus = 8; //OCPP Status
|
|
|
+ currentStatus = 8; //OCPP Status: Faulted
|
|
|
}
|
|
|
else if ((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == gun_index)&&(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_RESERVATION)) // ---> Reserved
|
|
|
{
|
|
|
- //strcpy(ShmOCPP16Data->StatusNotification[gun_index].Status, ChargePointStatusStr[SuspendedEV]);
|
|
|
- currentStatus = 6; //OCPP Status
|
|
|
+ currentStatus = 6; //OCPP Status: Reserved
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
for (int index = 0; index < GB_QUANTITY; index++)
|
|
|
{
|
|
|
- //printf("ShmSysConfigAndInfo->SysInfo.GbChargingData[0].SystemStatus=%d\n",ShmSysConfigAndInfo->SysInfo.GbChargingData[0].SystemStatus);
|
|
|
if ((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == gun_index) &&(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_IDLE)) //S_IDLE
|
|
|
{
|
|
|
- //strcpy(ShmOCPP16Data->StatusNotification[gun_index].Status, "Available");
|
|
|
- currentStatus = 0; //OCPP Status
|
|
|
+ currentStatus = 0; //OCPP Status: Available
|
|
|
}
|
|
|
else if ((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == gun_index) &&(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_PREPARING)) //S_PRECHARGE
|
|
|
{
|
|
|
- //strcpy(ShmOCPP16Data->StatusNotification[gun_index].Status, "Preparing");
|
|
|
- currentStatus = 1; //OCPP Status
|
|
|
+ currentStatus = 1; //OCPP Status: Preparing
|
|
|
}
|
|
|
else if ((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == gun_index)&&(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_CHARGING)) //S_CHARGING
|
|
|
{
|
|
|
- //strcpy(ShmOCPP16Data->StatusNotification[gun_index].Status, "Charging");
|
|
|
- currentStatus = 2; //OCPP Status
|
|
|
+ currentStatus = 2; //OCPP Status: Charging
|
|
|
}
|
|
|
else if ((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == gun_index)&&(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_COMPLETE)) //S_COMPLETE
|
|
|
{
|
|
|
- // strcpy(ShmOCPP16Data->StatusNotification[gun_index].Status, "Finishing");
|
|
|
- currentStatus = 5; //OCPP Status
|
|
|
+ currentStatus = 5; //OCPP Status: Finishing
|
|
|
}
|
|
|
- else if ((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == gun_index)&&(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_ALARM)) //S_ALARM ---> SuspendedEV
|
|
|
+ else if ((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == gun_index)&&((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_ALARM) || (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_TERMINATING))) //S_ALARM , S_TERMINATING ---> SuspendedEV
|
|
|
{
|
|
|
- //strcpy(ShmOCPP16Data->StatusNotification[gun_index].Status, ChargePointStatusStr[SuspendedEV]);
|
|
|
- currentStatus = 4; //OCPP Status
|
|
|
+ currentStatus = 4; //OCPP Status: SuspendedEV
|
|
|
}
|
|
|
- else if ((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == gun_index)&&((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_MAINTAIN) || (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_DEBUG) || (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_UPDATE) || (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_TERMINATING))) //S_TERMINATING ---> Unavailable
|
|
|
+ else if ((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == gun_index)&&((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_MAINTAIN) || (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_DEBUG) || (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_UPDATE))) // ---> Unavailable
|
|
|
{
|
|
|
- //strcpy(ShmOCPP16Data->StatusNotification[gun_index].Status, ChargePointStatusStr[SuspendedEV]);
|
|
|
currentStatus = 7; //OCPP Status: Unavailable
|
|
|
}
|
|
|
else if ((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == gun_index)&&(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_FAULT)) //S_FAULT ---> Faulted
|
|
|
{
|
|
|
- //strcpy(ShmOCPP16Data->StatusNotification[gun_index].Status, ChargePointStatusStr[SuspendedEV]);
|
|
|
currentStatus = 8; //OCPP Status: Faulted
|
|
|
}
|
|
|
else if ((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == gun_index)&&(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_RESERVATION)) // ---> Reserved
|
|
|
{
|
|
|
- //strcpy(ShmOCPP16Data->StatusNotification[gun_index].Status, ChargePointStatusStr[SuspendedEV]);
|
|
|
- currentStatus = 6; //OCPP Status: Faulted
|
|
|
+ currentStatus = 6; //OCPP Status: Reserved
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2233,46 +2206,36 @@ S_FAULT =12
|
|
|
{
|
|
|
for (int index = 0; index < AC_QUANTITY; index++)
|
|
|
{
|
|
|
- //printf("gun_index=%d\n",gun_index);
|
|
|
- //printf("ShmSysConfigAndInfo->SysInfo.ChademoChargingData[0].SystemStatus=%d\n",ShmSysConfigAndInfo->SysInfo.ChademoChargingData[0].SystemStatus);
|
|
|
if ((ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == gun_index)&&(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus == SYS_MODE_IDLE)) //S_IDLE
|
|
|
{
|
|
|
- //strcpy(ShmOCPP16Data->StatusNotification[gun_index].Status, "Available");
|
|
|
- currentStatus = 0; //OCPP Status
|
|
|
+ currentStatus = 0; //OCPP Status: Available
|
|
|
}
|
|
|
else if ((ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == gun_index)&&(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus == SYS_MODE_PREPARING)) //S_PRECHARGE
|
|
|
{
|
|
|
- //strcpy(ShmOCPP16Data->StatusNotification[gun_index].Status, "Preparing");
|
|
|
- currentStatus = 1; //OCPP Status
|
|
|
+ currentStatus = 1; //OCPP Status: Preparing
|
|
|
}
|
|
|
else if ((ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == gun_index)&&(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus == SYS_MODE_CHARGING)) //S_CHARGING
|
|
|
{
|
|
|
- //strcpy(ShmOCPP16Data->StatusNotification[gun_index].Status, "Charging");
|
|
|
- currentStatus = 2; //OCPP Status
|
|
|
+ currentStatus = 2; //OCPP Status: Charging
|
|
|
}
|
|
|
else if ((ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == gun_index)&&(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus == SYS_MODE_COMPLETE)) //S_COMPLETE
|
|
|
{
|
|
|
- //strcpy(ShmOCPP16Data->StatusNotification[gun_index].Status, "Finishing");
|
|
|
- currentStatus = 5; //OCPP Status
|
|
|
+ currentStatus = 5; //OCPP Status: Finishing
|
|
|
}
|
|
|
- else if ((ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == gun_index)&&(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus == SYS_MODE_ALARM)) //S_ALARM ---> SuspendedEV
|
|
|
+ else if ((ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == gun_index)&&((ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus == SYS_MODE_ALARM) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus == SYS_MODE_TERMINATING))) //S_ALARM, S_TERMINATING ---> SuspendedEV
|
|
|
{
|
|
|
- //strcpy(ShmOCPP16Data->StatusNotification[gun_index].Status, ChargePointStatusStr[SuspendedEV]);
|
|
|
- currentStatus = 4; //OCPP Status
|
|
|
+ currentStatus = 4; //OCPP Status: SuspendedEV
|
|
|
}
|
|
|
- else if ((ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == gun_index)&&((ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus == SYS_MODE_MAINTAIN)|| (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus == SYS_MODE_DEBUG) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus == SYS_MODE_UPDATE) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus == SYS_MODE_TERMINATING) )) //S_TERMINATING ---> Unavailable
|
|
|
+ else if ((ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == gun_index)&&((ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus == SYS_MODE_MAINTAIN)|| (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus == SYS_MODE_DEBUG) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus == SYS_MODE_UPDATE))) // ---> Unavailable
|
|
|
{
|
|
|
- //strcpy(ShmOCPP16Data->StatusNotification[gun_index].Status, ChargePointStatusStr[SuspendedEV]);
|
|
|
currentStatus = 7; //OCPP Status: Unavailable
|
|
|
}
|
|
|
else if ((ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == gun_index)&&(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus == SYS_MODE_FAULT)) //S_FAULT ---> Faulted
|
|
|
{
|
|
|
- //strcpy(ShmOCPP16Data->StatusNotification[gun_index].Status, ChargePointStatusStr[SuspendedEV]);
|
|
|
currentStatus = 8; //OCPP Status: Faulted
|
|
|
}
|
|
|
else if ((ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == gun_index)&&(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus == SYS_MODE_RESERVATION)) // ---> Reserved
|
|
|
{
|
|
|
- //strcpy(ShmOCPP16Data->StatusNotification[gun_index].Status, ChargePointStatusStr[SuspendedEV]);
|
|
|
currentStatus = 6; //OCPP Status: Reserved
|
|
|
}
|
|
|
|
|
@@ -2281,11 +2244,9 @@ S_FAULT =12
|
|
|
|
|
|
}//END OF ELSE
|
|
|
|
|
|
-
|
|
|
//it's option
|
|
|
strcpy((char *)ShmOCPP16Data->StatusNotification[gun_index].Timestamp, buf);
|
|
|
strcpy((char *)ShmOCPP16Data->StatusNotification[gun_index].VendorId, "PhihongTechnology");
|
|
|
- //strcpy((char *)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode, "000000");
|
|
|
strcpy((char *)ShmOCPP16Data->StatusNotification[gun_index].Status, ChargePointStatusStr[currentStatus]);
|
|
|
|
|
|
random_uuid(guid);
|
|
@@ -2311,11 +2272,6 @@ S_FAULT =12
|
|
|
result = PASS;
|
|
|
}
|
|
|
|
|
|
- //#ifdef SystemLogMessage
|
|
|
- //DEBUG_INFO(">>>>>StatusNotification request\n");
|
|
|
- //DEBUG_INFO("Message: %s\n", SendBuffer);
|
|
|
- //#endif
|
|
|
-
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -2339,13 +2295,7 @@ int sendStopTransactionRequest(int gun_index)
|
|
|
if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == gun_index)
|
|
|
{
|
|
|
ShmOCPP16Data->StopTransaction[gun_index].MeterStop = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].PresentChargedEnergy;
|
|
|
- //Check Status
|
|
|
- if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_ALARM) // S_ALARM (Temporally for SuspendedEV )
|
|
|
- {
|
|
|
- strcpy((char *)ShmOCPP16Data->StopTransaction[gun_index].StopReason, StopTransactionReasonStr[EVDisconnected]); //
|
|
|
- }
|
|
|
|
|
|
- //sprintf(ShmOCPP16Data->MeterValues[gun_index].MeterValue[idx_transaction].SampledValue[idx_sample].Value, "%s" ,ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].PresentChargedEnergy );
|
|
|
}
|
|
|
}// END OF CHAdeMO_QUANTITY
|
|
|
|
|
@@ -2353,22 +2303,7 @@ int sendStopTransactionRequest(int gun_index)
|
|
|
{
|
|
|
if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == gun_index)
|
|
|
{
|
|
|
- //for test
|
|
|
- //ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PresentChargedEnergy = 100.0;
|
|
|
-
|
|
|
ShmOCPP16Data->StopTransaction[gun_index].MeterStop = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PresentChargedEnergy;
|
|
|
-
|
|
|
- //Check Status
|
|
|
- if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_ALARM) // S_ALARM (Temporally for SuspendedEV )
|
|
|
- {
|
|
|
- strcpy((char *)ShmOCPP16Data->StopTransaction[gun_index].StopReason, StopTransactionReasonStr[EVDisconnected]); //
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- strcpy((char *)ShmOCPP16Data->StopTransaction[gun_index].StopReason, StopTransactionReasonStr[Local]); //
|
|
|
- }
|
|
|
-
|
|
|
- //sprintf(ShmOCPP16Data->MeterValues[gun_index].MeterValue[idx_transaction].SampledValue[idx_sample].Value, "%s" ,ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PresentChargedEnergy );
|
|
|
}
|
|
|
}// END OF CCS_QUANTITY
|
|
|
|
|
@@ -2376,22 +2311,8 @@ int sendStopTransactionRequest(int gun_index)
|
|
|
{
|
|
|
if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == gun_index)
|
|
|
{
|
|
|
- // for test
|
|
|
- //ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargedEnergy = 100.0;
|
|
|
-
|
|
|
ShmOCPP16Data->StopTransaction[gun_index].MeterStop = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargedEnergy;
|
|
|
|
|
|
- //Check Status
|
|
|
- if(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_ALARM) // S_ALARM (Temporally for SuspendedEV )
|
|
|
- {
|
|
|
- strcpy((char *)ShmOCPP16Data->StopTransaction[gun_index].StopReason, StopTransactionReasonStr[EVDisconnected]); //
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- strcpy((char *)ShmOCPP16Data->StopTransaction[gun_index].StopReason, StopTransactionReasonStr[Local]); //
|
|
|
- }
|
|
|
-
|
|
|
- //sprintf(ShmOCPP16Data->MeterValues[gun_index].MeterValue[idx_transaction].SampledValue[idx_sample].Value, "%f" ,ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargedEnergy);
|
|
|
}
|
|
|
}// END OF GB_QUANTITY
|
|
|
|
|
@@ -2403,13 +2324,6 @@ int sendStopTransactionRequest(int gun_index)
|
|
|
if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == gun_index)
|
|
|
{
|
|
|
ShmOCPP16Data->StopTransaction[gun_index].MeterStop = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PresentChargedEnergy;
|
|
|
- //Check Status
|
|
|
- if(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus == SYS_MODE_ALARM) // S_ALARM (Temporally for SuspendedEV )
|
|
|
- {
|
|
|
- strcpy((char *)ShmOCPP16Data->StopTransaction[gun_index].StopReason, StopTransactionReasonStr[EVDisconnected]); //
|
|
|
- }
|
|
|
-
|
|
|
- //sprintf(ShmOCPP16Data->MeterValues[gun_index].MeterValue[idx_transaction].SampledValue[idx_sample].Value, "%s" ,ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].PresentChargedEnergy );
|
|
|
}
|
|
|
}// END OF AC_QUANTITY
|
|
|
|
|
@@ -2428,7 +2342,6 @@ int sendStopTransactionRequest(int gun_index)
|
|
|
tm = gmtime(&t);
|
|
|
strftime(buf,28,"%Y-%m-%dT%H:%M:%SZ", tm);
|
|
|
|
|
|
- //strcpy(ShmOCPP16Data->StopTransaction[gun_index].Timestamp,"2019-05-04T18:15:33Z");
|
|
|
strcpy((char *)ShmOCPP16Data->StopTransaction[gun_index].Timestamp,buf);
|
|
|
ShmOCPP16Data->StopTransaction[gun_index].TransactionId = ShmOCPP16Data->StartTransaction[gun_index].ResponseTransactionId;
|
|
|
|
|
@@ -2436,9 +2349,6 @@ int sendStopTransactionRequest(int gun_index)
|
|
|
|
|
|
/***********************************transactionData******************************************************/
|
|
|
memset(ShmOCPP16Data->StopTransaction[gun_index].TransactionData, 0, sizeof(sizeof(struct StructMeterValue)));
|
|
|
- //ShmOCPP16Data->StopTransaction[gun_index].TransactionData = (struct StructMeterValue *)malloc(sizeof(struct StructMeterValue));
|
|
|
- //ShmOCPP16Data->StopTransaction[gun_index].TransactionData[0].SampledValue = (struct StructSampledValue *)malloc(sizeof(struct StructSampledValue)*10);
|
|
|
-
|
|
|
strcpy((char *)ShmOCPP16Data->StopTransaction[gun_index].TransactionData[0].TimeStamp, buf);
|
|
|
|
|
|
//=================================
|
|
@@ -2562,7 +2472,7 @@ int sendStopTransactionRequest(int gun_index)
|
|
|
|
|
|
strcpy((char *)ShmOCPP16Data->StopTransaction[gun_index].TransactionData[0].SampledValue[2].Context,ReadingContextStr[ReadingContext_Transaction_End]);
|
|
|
strcpy((char *)ShmOCPP16Data->StopTransaction[gun_index].TransactionData[0].SampledValue[2].Format,ValueFormatStr[Raw]);
|
|
|
- strcpy((char *)ShmOCPP16Data->StopTransaction[gun_index].TransactionData[0].SampledValue[2].Measurand,MeasurandStr[Energy_Active_Export_Interval/*Energy_Reactive_Export_Register*/]);
|
|
|
+ strcpy((char *)ShmOCPP16Data->StopTransaction[gun_index].TransactionData[0].SampledValue[2].Measurand,MeasurandStr[Energy_Active_Export_Interval]);
|
|
|
//strcpy((char *)ShmOCPP16Data->StopTransaction[gun_index].TransactionData[0].SampledValue[2].Phase,PhaseStr[L1_N]);
|
|
|
strcpy((char *)ShmOCPP16Data->StopTransaction[gun_index].TransactionData[0].SampledValue[2].Location,LocationStr[Location_Outlet]);
|
|
|
strcpy((char *)ShmOCPP16Data->StopTransaction[gun_index].TransactionData[0].SampledValue[2].Unit,UnitOfMeasureStr[UnitOfMeasure_Wh/*UnitOfMeasure_kWh*/]);
|
|
@@ -2614,7 +2524,7 @@ int sendStopTransactionRequest(int gun_index)
|
|
|
|
|
|
strcpy((char *)ShmOCPP16Data->StopTransaction[gun_index].TransactionData[0].SampledValue[3].Context,ReadingContextStr[ReadingContext_Transaction_End]);
|
|
|
strcpy((char *)ShmOCPP16Data->StopTransaction[gun_index].TransactionData[0].SampledValue[3].Format,ValueFormatStr[Raw]);
|
|
|
- strcpy((char *)ShmOCPP16Data->StopTransaction[gun_index].TransactionData[0].SampledValue[3].Measurand,MeasurandStr[Power_Active_Export/*Energy_Reactive_Export_Register*/]);
|
|
|
+ strcpy((char *)ShmOCPP16Data->StopTransaction[gun_index].TransactionData[0].SampledValue[3].Measurand,MeasurandStr[Power_Active_Export]);
|
|
|
//strcpy((char *)ShmOCPP16Data->StopTransaction[gun_index].TransactionData[0].SampledValue[3].Phase,PhaseStr[L1_N]);
|
|
|
strcpy((char *)ShmOCPP16Data->StopTransaction[gun_index].TransactionData[0].SampledValue[3].Location,LocationStr[Location_Outlet]);
|
|
|
strcpy((char *)ShmOCPP16Data->StopTransaction[gun_index].TransactionData[0].SampledValue[3].Unit,UnitOfMeasureStr[UnitOfMeasure_kW/*UnitOfMeasure_kWh*/]);
|
|
@@ -2889,6 +2799,7 @@ int sendMeterValuesRequest(int gun_index)
|
|
|
strftime(buf,28,"%Y-%m-%dT%H:%M:%SZ", tm);
|
|
|
strcpy((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].TimeStamp, buf);
|
|
|
|
|
|
+ DEBUG_INFO( "ShmSysConfigAndInfo->SysConfig.ModelName[0]=%c\n", ShmSysConfigAndInfo->SysConfig.ModelName[0]);
|
|
|
|
|
|
//idx_sample=0;
|
|
|
//********************************(1)Current.Export************************************************/
|
|
@@ -6272,25 +6183,104 @@ int handleGetConfigurationRequest(char *uuid, char *payload)
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+static char fnamePlusPath[100]={0};
|
|
|
+static char fnamePWithNoPath[60]={0};
|
|
|
+void checkUploadLog(void)
|
|
|
+{
|
|
|
+ FILE *fp;
|
|
|
+ /* Open the command for reading. */
|
|
|
+ fp = popen("find ../mnt/ -type f -name \"*.zip\" |xargs ls -t", "r");
|
|
|
+ if (fp == NULL) {
|
|
|
+ printf("Failed to run command\n" );
|
|
|
+ exit(1);
|
|
|
+ }
|
|
|
+
|
|
|
+ int ftppathlen = 0;
|
|
|
+ memset(fnamePlusPath, 0, sizeof(fnamePlusPath));
|
|
|
+ int i = 0;
|
|
|
+ /* Read the output a line at a time - output it. */
|
|
|
+ while (fgets(fnamePlusPath, sizeof(fnamePlusPath), fp) != NULL) {
|
|
|
+ if(i==0)
|
|
|
+ {
|
|
|
+ ftppathlen = strlen(fnamePlusPath);
|
|
|
+ printf("%s\n", fnamePlusPath);
|
|
|
+ fnamePlusPath[ftppathlen]='\0';
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ i= i+1;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* close */
|
|
|
+ pclose(fp);
|
|
|
+
|
|
|
+ for(int k=0; k< sizeof(fnamePlusPath); k++)
|
|
|
+ {
|
|
|
+ if((fnamePlusPath[k]=='\n') || (fnamePlusPath[k]=='r'))
|
|
|
+ {
|
|
|
+ fnamePlusPath[k]='\0';
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ i=1;
|
|
|
+ //char fname[60]={0};
|
|
|
+ while(i < ftppathlen)
|
|
|
+ {
|
|
|
+ int len=ftppathlen-i;
|
|
|
+ if(fnamePlusPath[len]== 47) // '/' ascll code: 47
|
|
|
+ {
|
|
|
+ printf("compare '/' all right\n");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ i=i+1;
|
|
|
+ }
|
|
|
+
|
|
|
+ memset(fnamePWithNoPath, 0, sizeof(fnamePWithNoPath));
|
|
|
+ strncpy(fnamePWithNoPath, fnamePlusPath+(ftppathlen-i+1), i+1);
|
|
|
+ fnamePWithNoPath[i+1] = '\0';
|
|
|
+
|
|
|
+ for(int j=0; j< sizeof(fnamePWithNoPath); j++)
|
|
|
+ {
|
|
|
+ if((fnamePWithNoPath[j]=='\n') || (fnamePWithNoPath[j]=='r'))
|
|
|
+ {
|
|
|
+ fnamePWithNoPath[j]='\0';
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ FILE* fp1 = fopen(fnamePlusPath, "r");
|
|
|
+ if (fp1)
|
|
|
+ {
|
|
|
+ printf("testfuc : fnamePlusPath=%s exist.\n", fnamePlusPath);
|
|
|
+ // file exists
|
|
|
+ fclose(fp1);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // file doesn't exist
|
|
|
+ printf("testfuc : fnamePlusPath=%s not exist!\n", fnamePlusPath);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
static char GetDiagnosticspayloadData[300]={0};
|
|
|
int handleGetDiagnosticsRequest(char *uuid, char *payload)
|
|
|
{
|
|
|
mtrace();
|
|
|
int result = FAIL;
|
|
|
//void *ret; //
|
|
|
- char fnamePlusPath[100]="";
|
|
|
- char fname[40]="";
|
|
|
+ //char fnamePlusPath[100]="";
|
|
|
+ //char fname[40]="";
|
|
|
pthread_t t; // pthread 變數
|
|
|
- time_t rawtime;
|
|
|
- struct tm * timeinfo;
|
|
|
+ //time_t rawtime;
|
|
|
+ //struct tm * timeinfo;
|
|
|
|
|
|
//system("exec /root/Module_WebService 'log' 6"); // for OCTT TEST
|
|
|
system("exec /root/logPackTools 'log' 6");
|
|
|
-
|
|
|
+#if 0
|
|
|
//char buffer [128];
|
|
|
time (&rawtime);
|
|
|
//printf("%ld\n", rawtime);
|
|
|
timeinfo = localtime (&rawtime);
|
|
|
+
|
|
|
strftime (fnamePlusPath,sizeof(fnamePlusPath),"../mnt/%4Y-%2m.zip",timeinfo);
|
|
|
DEBUG_INFO("fnamePlusPath =%s\n",fnamePlusPath);
|
|
|
if((access(fnamePlusPath,F_OK))!=-1)
|
|
@@ -6302,11 +6292,11 @@ int handleGetDiagnosticsRequest(char *uuid, char *payload)
|
|
|
{
|
|
|
DEBUG_INFO("fnamePlusPath not exist!\n");
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+#endif
|
|
|
+ checkUploadLog();
|
|
|
memset(GetDiagnosticspayloadData, 0, 300);
|
|
|
strcpy(GetDiagnosticspayloadData, payload);
|
|
|
- sendGetDiagnosticsConfirmation(uuid,fname/*(char*) ret*/);
|
|
|
+ sendGetDiagnosticsConfirmation(uuid,fnamePWithNoPath/*(char*) ret*/);
|
|
|
pthread_create(&t, NULL, GetDiagnosticsProcess, payload);
|
|
|
// pthread_join(t, NULL/*&ret*/);
|
|
|
|
|
@@ -6323,8 +6313,8 @@ void* GetDiagnosticsProcess(void* data)
|
|
|
int retriesIsNULL,retryIntervalIsNULL, startTimeIsNULL, stopTimeIsNULL;
|
|
|
char protocol[10]={0}, user[50]={0},password[50]={0},host[50]={0}, path[50]={0}, ftppath[60]={0},host1[50]={0},path1[50]={0};
|
|
|
int port=0;
|
|
|
- char fnamePlusPath[100]="";//="00000_2019-06-09_160902_CSULog.zip";
|
|
|
- char fname[40]="";
|
|
|
+ //char fnamePlusPath[100]="";//="00000_2019-06-09_160902_CSULog.zip";
|
|
|
+ //char fname[40]="";
|
|
|
char sstr[260]={ 0 };//sstr[200]={ 0 };
|
|
|
int c = 0;
|
|
|
char *loc;
|
|
@@ -6456,6 +6446,7 @@ void* GetDiagnosticsProcess(void* data)
|
|
|
memset(path1, 0, sizeof(path1));
|
|
|
/*location: ftp://user:password@host:port/path*/
|
|
|
|
|
|
+#if 0
|
|
|
time_t rawtime;
|
|
|
struct tm * timeinfo;
|
|
|
//char buffer [128];
|
|
@@ -6464,6 +6455,7 @@ void* GetDiagnosticsProcess(void* data)
|
|
|
timeinfo = localtime (&rawtime);
|
|
|
strftime (fnamePlusPath,sizeof(fnamePlusPath),"../mnt/%4Y-%2m.zip",timeinfo);
|
|
|
strftime (fname,sizeof(fname),"%4Y-%2m-%d-%H-%M-%S.zip",timeinfo);
|
|
|
+#endif
|
|
|
//DEBUG_INFO("fnamePlusPath =%s\n",fnamePlusPath);
|
|
|
if((access(fnamePlusPath,F_OK))!=-1)
|
|
|
{
|
|
@@ -6535,8 +6527,8 @@ void* GetDiagnosticsProcess(void* data)
|
|
|
//strncpy(filenametemp, ftppath+(ftppathlen-i+1), i+1);
|
|
|
//filenametemp[i+1] = 0;
|
|
|
//sendFirmwareStatusNotificationRequest(FirmwareStatusStr[FirmwareStatus_Downloading]);
|
|
|
- memset(fnamePlusPath, 0, sizeof(fnamePlusPath));
|
|
|
- strftime (fnamePlusPath,sizeof(fnamePlusPath),"/mnt/%4Y-%2m.zip",timeinfo);
|
|
|
+ //memset(fnamePlusPath, 0, sizeof(fnamePlusPath));
|
|
|
+ //strftime (fnamePlusPath,sizeof(fnamePlusPath),"/mnt/%4Y-%2m.zip",timeinfo);
|
|
|
|
|
|
|
|
|
do{
|
|
@@ -6596,7 +6588,7 @@ void* GetDiagnosticsProcess(void* data)
|
|
|
port = 21;
|
|
|
|
|
|
do{
|
|
|
- isSuccess = ftpFile(/*"test.evsocket.phihong.com.cn","phihong","y42j/4cj84",21,"/",fname*/host1, user, password, port, ftppath, fnamePlusPath, fname);
|
|
|
+ isSuccess = ftpFile(/*"test.evsocket.phihong.com.cn","phihong","y42j/4cj84",21,"/",fname*/host1, user, password, port, ftppath, fnamePlusPath, fnamePWithNoPath);
|
|
|
sleep(retryIntervalInt);
|
|
|
}while((!isSuccess)&&(retriesInt > 0 && retriesInt --));
|
|
|
|
|
@@ -7289,11 +7281,9 @@ int handleRemoteStopTransactionRequest(char *uuid, char *payload)
|
|
|
|
|
|
if(server_pending == TRUE)
|
|
|
{
|
|
|
-
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
c=0;
|
|
|
loc = strstr(payload, "transactionId");
|
|
|
|
|
@@ -7317,19 +7307,18 @@ int handleRemoteStopTransactionRequest(char *uuid, char *payload)
|
|
|
if(transactionIdIsNULL == FALSE)
|
|
|
{
|
|
|
|
|
|
- for(int gun_index=0;gun_index < gunTotalNumber/*(CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY)*/;gun_index++)
|
|
|
+ for(int gun_index=0;gun_index < gunTotalNumber;gun_index++)
|
|
|
{
|
|
|
if(ShmOCPP16Data->StartTransaction[gun_index].ResponseTransactionId == transactionIdInt)
|
|
|
{
|
|
|
//check Transaction active
|
|
|
-
|
|
|
if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
|
|
|
{
|
|
|
for (int index = 0; index < CHAdeMO_QUANTITY; index++)
|
|
|
{
|
|
|
if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == gun_index)
|
|
|
{
|
|
|
- if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_CHARGING) // S_CHARGING
|
|
|
+ if((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_CHARGING) || (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_TERMINATING)) // SYS_MODE_CHARGING, SYS_MODE_TERMINATING
|
|
|
{
|
|
|
match = TRUE;
|
|
|
GunNO = gun_index;
|
|
@@ -7341,12 +7330,11 @@ int handleRemoteStopTransactionRequest(char *uuid, char *payload)
|
|
|
{
|
|
|
if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == gun_index)
|
|
|
{
|
|
|
- if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_CHARGING) // S_CHARGING
|
|
|
+ if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_CHARGING) || (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_TERMINATING) ) // SYS_MODE_CHARGING, SYS_MODE_TERMINATING
|
|
|
{
|
|
|
match = TRUE;
|
|
|
GunNO = gun_index;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}// END FOR CCS_QUANTITY
|
|
|
|
|
@@ -7354,12 +7342,11 @@ int handleRemoteStopTransactionRequest(char *uuid, char *payload)
|
|
|
{
|
|
|
if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == gun_index)
|
|
|
{
|
|
|
- if(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_CHARGING) // S_CHARGING
|
|
|
+ if((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_CHARGING) || (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_TERMINATING)) // SYS_MODE_CHARGING, SYS_MODE_TERMINATING
|
|
|
{
|
|
|
match = TRUE;
|
|
|
GunNO = gun_index;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}// END FOR GB_QUANTITY
|
|
|
}
|
|
@@ -7369,7 +7356,7 @@ int handleRemoteStopTransactionRequest(char *uuid, char *payload)
|
|
|
{
|
|
|
if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == gun_index)
|
|
|
{
|
|
|
- if(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus == SYS_MODE_CHARGING) // S_CHARGING
|
|
|
+ if((ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus == SYS_MODE_CHARGING) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus == SYS_MODE_TERMINATING)) // SYS_MODE_CHARGING, SYS_MODE_TERMINATING
|
|
|
{
|
|
|
match = TRUE;
|
|
|
GunNO = gun_index;
|
|
@@ -7378,7 +7365,6 @@ int handleRemoteStopTransactionRequest(char *uuid, char *payload)
|
|
|
}// END FOR CHAdeMO_QUANTITY
|
|
|
}// END FOR AC ELSE
|
|
|
|
|
|
-
|
|
|
}// CHECK IF ResponseTransactionId == transactionIdInt
|
|
|
|
|
|
}//END FOR
|
|
@@ -7393,8 +7379,6 @@ int handleRemoteStopTransactionRequest(char *uuid, char *payload)
|
|
|
{
|
|
|
strcpy(comfirmstr, RemoteStartStopStatusStr[RemoteStartStopStatus_Rejected]);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
sendRemoteStopTransactionConfirmation(uuid, comfirmstr);
|
|
@@ -9879,21 +9863,21 @@ void handleAuthorizeResponse(char *payload, int gun_index)
|
|
|
|
|
|
strcpy((char *)ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status, statusstr);
|
|
|
|
|
|
-//Update idTag information to authorization cache if supproted
|
|
|
- if((strcmp((const char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizationCacheEnabled].ItemData, "true") == 0) && (ShmOCPP16Data->Authorize.ResponseIdTagInfo.ParentIdTag != NULL) && (ShmOCPP16Data->Authorize.ResponseIdTagInfo.ExpiryDate != NULL) )
|
|
|
+ //Update idTag information to authorization cache if supproted
|
|
|
+ if((strcmp((const char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizationCacheEnabled].ItemData, "TRUE") == 0) && (ShmOCPP16Data->Authorize.ResponseIdTagInfo.ParentIdTag != NULL) && (ShmOCPP16Data->Authorize.ResponseIdTagInfo.ExpiryDate != NULL) )
|
|
|
{
|
|
|
if((access(filename,F_OK))!=-1)
|
|
|
{
|
|
|
- DEBUG_INFO("AuthorizationCache exist.\n");
|
|
|
+ printf("AuthorizationCache exist.\n");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- DEBUG_INFO("AuthorizationCache not exist\n");
|
|
|
+ printf("AuthorizationCache not exist\n");
|
|
|
FILE *log = fopen(filename, "w+");
|
|
|
|
|
|
if(log == NULL)
|
|
|
{
|
|
|
- DEBUG_INFO("log is NULL\n");
|
|
|
+ printf("log is NULL\n");
|
|
|
goto out;
|
|
|
}
|
|
|
else
|
|
@@ -9953,11 +9937,11 @@ void handleAuthorizeResponse(char *payload, int gun_index)
|
|
|
|
|
|
if(resultRename == 0)
|
|
|
{
|
|
|
- DEBUG_INFO("File renamed successfully");
|
|
|
+ printf("File renamed successfully");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- DEBUG_INFO("Error: unable to rename the file");
|
|
|
+ printf("Error: unable to rename the file");
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -13704,14 +13688,16 @@ int httpUploadFile(char *location, char *path, char *filename,char *url)
|
|
|
}
|
|
|
|
|
|
memset(ftpbuf, 0, sizeof(ftpbuf));
|
|
|
- sprintf(ftpbuf, "%s","../bin/php-cgi /var/www/ocpp_upload.php");
|
|
|
- //sprintf(ftpbuf, "ftpput -u %s -p %s %s -P %d %s%s %s",user,password,IPbuffer,21,filename,filename,path);
|
|
|
+ //sprintf(ftpbuf, "%s","../bin/php-cgi /var/www/ocpp_upload.php");
|
|
|
+ //sprintf(ftpbuf, "ftpput -u %s -p %s %s -P %d %s%s %s",user,password,IPbuffer,21,filename,filename,path);
|
|
|
+ //curl -i -F filename=image.jpg -F image=@/path/to/image.jpg http://localhost/xmlcreate/curlupload.php
|
|
|
+ sprintf(ftpbuf, "curl -i -F filename=%s -F image=@%s%s %s",filename,path,filename,url);
|
|
|
systemresult = system(ftpbuf);
|
|
|
|
|
|
DEBUG_INFO("systemresult=%d\n",systemresult);
|
|
|
if(systemresult != 0)
|
|
|
{
|
|
|
- DEBUG_INFO("http DownLoad error!\n");
|
|
|
+ DEBUG_INFO("http upload error!\n");
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -14733,6 +14719,7 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
ChargePointMaxProfile_TEMP.ChargingProfileId = tempchargingProfileId;
|
|
|
ChargePointMaxProfile_TEMP.StackLevel = tempstackLevel;
|
|
|
ChargePointMaxProfile_TEMP.TransactionId = 0;
|
|
|
+ strcpy((char *)ChargePointMaxProfile_TEMP.ChargingSchedule.ChargingRateUnit, (const char *)tempchargingRateUnitStr);
|
|
|
strcpy((char *)ChargePointMaxProfile_TEMP.ChargingProfileKind, (const char *)tempchargingProfileKindStr);
|
|
|
strcpy((char *)ChargePointMaxProfile_TEMP.ChargingProfilePurpose, (const char *)tempchargingProfilePurposeStr);
|
|
|
strcpy((char *)ChargePointMaxProfile_TEMP.RecurrencyKind, (const char *)temprecurrencyKindStr);
|
|
@@ -15107,7 +15094,7 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
TxDefaultProfile_TEMP.StackLevel = tempstackLevel;
|
|
|
TxDefaultProfile_TEMP.TransactionId = 0;
|
|
|
TxDefaultProfile_TEMP.ChargingSchedule.Duration = tempdurationInt;
|
|
|
- strcpy((char *)TxDefaultProfile_TEMP.ChargingSchedule.ChargingRateUnit, (const char *)tempchargingRateUnitStr);
|
|
|
+ strcpy((char *)TxDefaultProfile_TEMP.ChargingSchedule.ChargingRateUnit, (const char *)tempchargingRateUnitStr);
|
|
|
strcpy((char *)TxDefaultProfile_TEMP.ChargingProfileKind, (const char *)tempchargingProfileKindStr);
|
|
|
strcpy((char *)TxDefaultProfile_TEMP.ChargingProfilePurpose, (const char *)tempchargingProfilePurposeStr);
|
|
|
strcpy((char *)TxDefaultProfile_TEMP.RecurrencyKind, (const char *)temprecurrencyKindStr);
|
|
@@ -15157,7 +15144,6 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
TxDefaultProfile.Period[TxDefaultProfile.TotalPeriod].StartPeriod = TxDefaultProfile.Duration;
|
|
|
TxDefaultProfile.TotalPeriod = TxDefaultProfile.TotalPeriod + 1;
|
|
|
TxDefaultProfile.Duration = TxDefaultProfiletemp[l].Duration;
|
|
|
-
|
|
|
TxDefaultProfile.Period[TxDefaultProfile.TotalPeriod].Limit = TxDefaultProfiletemp[l].Period[k].Limit;
|
|
|
TxDefaultProfile.Period[TxDefaultProfile.TotalPeriod].NumberPhases = TxDefaultProfiletemp[l].Period[k].NumberPhases;
|
|
|
TxDefaultProfile.Period[TxDefaultProfile.TotalPeriod].StartPeriod = TxDefaultProfiletemp[l].Period[k].StartPeriod;
|