|
@@ -56,6 +56,7 @@
|
|
|
|
|
|
struct SysConfigAndInfo *ShmSysConfigAndInfo;
|
|
struct SysConfigAndInfo *ShmSysConfigAndInfo;
|
|
struct StatusCodeData *ShmStatusCodeData;
|
|
struct StatusCodeData *ShmStatusCodeData;
|
|
|
|
+struct OCPP16Data *ShmOCPP16Data;
|
|
|
|
|
|
int StoreLogMsg(const char *fmt, ...)
|
|
int StoreLogMsg(const char *fmt, ...)
|
|
{
|
|
{
|
|
@@ -185,34 +186,43 @@ int InitShareMemory()
|
|
//Initial ShmSysConfigAndInfo
|
|
//Initial ShmSysConfigAndInfo
|
|
if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo), 0777)) < 0)
|
|
if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo), 0777)) < 0)
|
|
{
|
|
{
|
|
- #ifdef SystemLogMessage
|
|
|
|
DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
|
|
DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
|
|
- #endif
|
|
|
|
result = FAIL;
|
|
result = FAIL;
|
|
}
|
|
}
|
|
else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1)
|
|
else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1)
|
|
{
|
|
{
|
|
- #ifdef SystemLogMessage
|
|
|
|
DEBUG_ERROR("[shmat ShmSysConfigAndInfo NG\n");
|
|
DEBUG_ERROR("[shmat ShmSysConfigAndInfo NG\n");
|
|
- #endif
|
|
|
|
result = FAIL;
|
|
result = FAIL;
|
|
}
|
|
}
|
|
|
|
+ else
|
|
|
|
+ {}
|
|
|
|
|
|
//Initial ShmStatusCodeData
|
|
//Initial ShmStatusCodeData
|
|
if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData), 0777)) < 0)
|
|
if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData), 0777)) < 0)
|
|
{
|
|
{
|
|
- #ifdef SystemLogMessage
|
|
|
|
DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
|
|
DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
|
|
- #endif
|
|
|
|
result = FAIL;
|
|
result = FAIL;
|
|
}
|
|
}
|
|
else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
|
|
else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
|
|
{
|
|
{
|
|
- #ifdef SystemLogMessage
|
|
|
|
DEBUG_ERROR("shmat ShmStatusCodeData NG\n");
|
|
DEBUG_ERROR("shmat ShmStatusCodeData NG\n");
|
|
- #endif
|
|
|
|
result = FAIL;
|
|
result = FAIL;
|
|
}
|
|
}
|
|
|
|
+ else
|
|
|
|
+ {}
|
|
|
|
+
|
|
|
|
+ if ((MeterSMId = shmget(ShmOcppModuleKey, sizeof(struct OCPP16Data), 0777)) < 0)
|
|
|
|
+ {
|
|
|
|
+ DEBUG_ERROR("shmget ShmOCPP16Data NG\n");
|
|
|
|
+ result = FAIL;
|
|
|
|
+ }
|
|
|
|
+ else if ((ShmOCPP16Data = shmat(MeterSMId, NULL, 0)) == (void *) -1)
|
|
|
|
+ {
|
|
|
|
+ DEBUG_ERROR("shmat ShmOCPP16Data NG\n");
|
|
|
|
+ result = FAIL;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {}
|
|
|
|
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
@@ -621,6 +631,7 @@ int main(void)
|
|
printf("\n ***** test menu ******************");
|
|
printf("\n ***** test menu ******************");
|
|
printf("\n start: EVSE start charging request.");
|
|
printf("\n start: EVSE start charging request.");
|
|
printf("\n stop: EVSE stop charging request.");
|
|
printf("\n stop: EVSE stop charging request.");
|
|
|
|
+ printf("\n auth: Authorize request.");
|
|
printf("\n cancel: return to main menu.");
|
|
printf("\n cancel: return to main menu.");
|
|
printf("\n *************************************************");
|
|
printf("\n *************************************************");
|
|
printf("\n Please input operation item: ");
|
|
printf("\n Please input operation item: ");
|
|
@@ -656,6 +667,15 @@ int main(void)
|
|
printf("\n Invalid input gun_index.");
|
|
printf("\n Invalid input gun_index.");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ else if(strcmp(cmd, "auth") == 0)
|
|
|
|
+ {
|
|
|
|
+ memset(cmd, 0x00, ARRAY_SIZE(cmd));
|
|
|
|
+ printf("\n Please input idtag: ");
|
|
|
|
+ scanf("%s", &cmd[0]);
|
|
|
|
+
|
|
|
|
+ sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%s", cmd);
|
|
|
|
+ ShmOCPP16Data->SpMsg.bits.AuthorizeReq = 1;
|
|
|
|
+ }
|
|
else if(strcmp(cmd, "cancel") == 0)
|
|
else if(strcmp(cmd, "cancel") == 0)
|
|
{}
|
|
{}
|
|
}
|
|
}
|