123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860 |
- #include <sys/time.h>
- #include <sys/timeb.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <sys/types.h>
- #include <sys/ioctl.h>
- #include <sys/socket.h>
- #include <sys/ipc.h>
- #include <sys/shm.h>
- #include <sys/shm.h>
- #include <sys/mman.h>
- #include <linux/wireless.h>
- #include <arpa/inet.h>
- #include <netinet/in.h>
- #include <unistd.h>
- #include <stdarg.h>
- #include <stdio.h> /*標準輸入輸出定義*/
- #include <stdlib.h> /*標準函數庫定義*/
- #include <unistd.h> /*Unix 標準函數定義*/
- #include <fcntl.h> /*檔控制定義*/
- #include <termios.h> /*PPSIX 終端控制定義*/
- #include <errno.h> /*錯誤號定義*/
- #include <errno.h>
- #include <string.h>
- #include <time.h>
- #include <ctype.h>
- #include <ifaddrs.h>
- #include <math.h>
- #include <stdbool.h>
- #include "../../define.h"
- #include "VCCU.h"
- typedef unsigned char byte;
- #define PASS 1
- #define FAIL -1
- #define ARRAY_SIZE(A) (sizeof(A) / sizeof(A[0]))
- struct SysConfigAndInfo *ShmSysConfigAndInfo;
- struct StatusCodeData *ShmStatusCodeData;
- struct PrimaryMcuData *ShmPrimaryMcuData;
- struct CHAdeMOData *ShmCHAdeMOData;
- struct CcsData *ShmCcsData;
- struct FanModuleData *ShmFanModuleData;
- struct RelayModuleData *ShmRelayModuleData;
- struct ATE *ate;
- struct ChargingInfoData *_chargingData[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
- int gunCount = CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY;
- char *msg = "stop : set ate stop (x) : \n"
- "targetCurrent : set&get ate targetCurrent (x) : \n"
- "targetVoltage : get ate targetVoltage (x) \n"
- "maximumCurrent : set&get ate maximumCurrent (x) \n"
- "maximumVoltage : set&get ate maximumVoltage (x) \n"
- "presentVoltage : set&get ccs presentVoltage (x) \n"
- "linkVoltage : set&get ate linkVoltage (x) \n"
- "contactorVoltage : set&get ate contactorVoltage (x) \n"
- "chademoPrmission : set chademo ate ChargingPermission (x) \n"
- "totalBatteryCap : set chademo ate totalBatteryCap (x) \n"
- "maxBatteryCurrent : set chademo ate maxBatteryCurrent (x) \n"
- "maxBatteryVoltage : set chademo ate maxBatteryVoltage (x) \n"
- "requireVoltage : set&get chademo ate requireVoltage (x) \n"
- "requireCurrent : set&get chademo ate requireCurrent (x) \n"
- "presentBattVoltage : set&get chademo ate presentBattVoltage (x) \n"
- "minimumChargeCurrent : set&get chademo ate minimumChargeCurrent (x) \n"
- "soc : set chademo ate soc (x) \n"
- "relay : set chademo ate relay (x) \n"
- "cstate : set chademo ate state (x) \n"
- "startstate : set start ate state (x) \n"
- "crelaystate : set chademo relay ate state (x) \n"
- "ccstate : set chademo relay 192 state (x) \n"
- "vccuinfo : show vccuinfo state \n"
- "chademoinfo : chademoinfo state \n"
- "chromainfo : chromainfo state \n"
- "modeChange : modeChange state (x) \n"
- "ateState : ateState (x) \n";
- #define ShmATEKey 1020
- int InitShareMemory()
- {
- int result = PASS;
- int MeterSMId;
- //initial ShmSysConfigAndInfo
- if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo), IPC_CREAT | 0777)) < 0)
- {
- result = FAIL;
- }
- else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1)
- {
- result = FAIL;
- }
- else
- {}
- /*
- //initial ShmStatusCodeData
- if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData), 0777)) < 0)
- {
- result = FAIL;
- }
- else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
- {
- result = FAIL;
- }
- else
- {}
- if(CHAdeMO_QUANTITY > 0)
- {
- if ((MeterSMId = shmget(ShmCHAdeMOCommKey, sizeof(struct CHAdeMOData),
- IPC_CREAT | 0777)) < 0) {
- result = FAIL;
- } else if ((ShmCHAdeMOData = shmat(MeterSMId, NULL, 0))
- == (void *) -1) {
- result = FAIL;
- } else {
- }
- }
- if ((MeterSMId = shmget(ShmCcsCommKey, sizeof(struct CcsData),
- IPC_CREAT | 0777)) < 0) {
- result = FAIL;
- } else if ((ShmCcsData = shmat(MeterSMId, NULL, 0)) == (void *) -1) {
- result = FAIL;
- } else {
- }*/
- /*
- if ((MeterSMId = shmget(ShmPrimaryMcuKey, sizeof(struct PrimaryMcuData), IPC_CREAT | 0777)) < 0)
- {
- result = FAIL;
- }
- else if ((ShmPrimaryMcuData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
- {
- result = FAIL;
- }
- if ((MeterSMId = shmget(ShmFanBdKey, sizeof(struct FanModuleData), IPC_CREAT | 0777)) < 0)
- {
- result = FAIL;
- }
- else if ((ShmFanModuleData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
- {
- result = FAIL;
- }
- if ((MeterSMId = shmget(ShmRelayBdKey, sizeof(struct RelayModuleData), IPC_CREAT | 0777)) < 0)
- {
- result = FAIL;
- }
- else if ((ate = shmat(MeterSMId, NULL, 0)) == (void *) -1)
- {
- result = FAIL;
- }
- */
- if ((MeterSMId = shmget(ShmATEKey, sizeof(struct ATE), IPC_CREAT | 0777)) < 0)
- {
- result = FAIL;
- }
- else if ((ate = shmat(MeterSMId, NULL, 0)) == (void *) -1)
- {
- result = FAIL;
- }
- return result;
- }
- bool FindChargingInfoData(byte target, struct ChargingInfoData **chargingData)
- {
- for (byte index = 0; index < CHAdeMO_QUANTITY; index++)
- {
- if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == target)
- {
- chargingData[target] = &ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index];
- return true;
- }
- }
- for (byte index = 0; index < CCS_QUANTITY; index++)
- {
- if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == target)
- {
- chargingData[target] = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[index];
- return true;
- }
- }
- for (byte index = 0; index < GB_QUANTITY; index++)
- {
- if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == target)
- {
- chargingData[target] = &ShmSysConfigAndInfo->SysInfo.GbChargingData[index];
- return true;
- }
- }
- return false;
- }
- void RunStatusProc(char *v1, char *v2)
- {
- int _index = atoi(v1);
- if (!FindChargingInfoData(_index, &_chargingData[0]))
- {
- printf ("FindChargingInfoData error\n");
- return;
- }
- if (strcmp(v2, "-1") == 0 || strcmp(v2, "") == 0)
- {
- // get
- printf ("index = %x, status = %x\n", _index, _chargingData[_index]->SystemStatus);
- }
- else
- {
- // set
- _chargingData[_index]->SystemStatus = atoi(v2);
- }
- }
- void StopATE( char *v1){
- if(strcmp(v1, "-1") == 0 || strcmp(v1, "") == 0 ){
- printf("ATEStatus = %d \n", ShmSysConfigAndInfo->ate.ATEStatus);
- }else{
- if(strcmp(v1, "0") == 0 ){
- ShmSysConfigAndInfo->ate.ATEStatus = 0;
- }else if(strcmp(v1, "1") == 0 ){
- ShmSysConfigAndInfo->ate.ATEStatus = 1;
- }else if(strcmp(v1, "2") == 0 ){
- ShmSysConfigAndInfo->ate.ATEStatus = 2;
- }else if(strcmp(v1, "3") == 0 ){
- ShmSysConfigAndInfo->ate.ATEStatus = 3;
- }
- }
- }
- void targetCurrent(char *v1){
- if(strcmp(v1, "-1") == 0 || strcmp(v1, "") == 0 ){
- printf("targetCurrent = %d \n", ShmSysConfigAndInfo->ate.targetCurrent_Value);
- }else{
- int value = atoi(v1);
- ShmSysConfigAndInfo->ate.targetCurrent_Value = value;
- printf("targetCurrent = %d \n", ShmSysConfigAndInfo->ate.targetCurrent_Value);
- }
- }
- void targetVoltage(char *v1){
- if(strcmp(v1, "-1") == 0 || strcmp(v1, "") == 0 ){
- printf("targetVoltage = %d \n", ShmSysConfigAndInfo->ate.targetVoltage_Value);
- }else{
- int value = atoi(v1);
- if(ShmSysConfigAndInfo->ate.ATEState == 1){//VCCU
- int voltage = value;
- int maxValue = 950;
- if(voltage > (maxValue - 10)){
- ShmSysConfigAndInfo->ate.maximumVoltage_value = maxValue;
- ShmSysConfigAndInfo->ate.targetVoltage_Value = maxValue - 20;
- ShmSysConfigAndInfo->ate.linkVoltage = maxValue - 20;
- }else{
- ShmSysConfigAndInfo->ate.maximumVoltage_value = voltage + 10;
- ShmSysConfigAndInfo->ate.targetVoltage_Value = voltage - 10;
- ShmSysConfigAndInfo->ate.linkVoltage = voltage - 10;
- }
- }else if(ShmSysConfigAndInfo->ate.ATEState == 2){//GB
- int voltage = value;
- int gbmaxValue = 750;
- if(voltage > (gbmaxValue - 100)){
- //ShmSysConfigAndInfo->ate.targetVoltage_Value = maxValue - 100;
- ShmSysConfigAndInfo->ate.chademoTargetVoltage_Value = gbmaxValue - 100;
- ShmSysConfigAndInfo->ate.RequireVoltage = gbmaxValue -100;
- ShmSysConfigAndInfo->ate.MaxBatteryVoltage = gbmaxValue;
- }else{
- ShmSysConfigAndInfo->ate.chademoTargetVoltage_Value = voltage;
- ShmSysConfigAndInfo->ate.RequireVoltage = voltage;
- ShmSysConfigAndInfo->ate.MaxBatteryVoltage = gbmaxValue;
- }
- }
- //ShmSysConfigAndInfo->ate.targetVoltage_Value = value;
- printf("targetVoltage = %d \n", ShmSysConfigAndInfo->ate.targetVoltage_Value);
- }
- }
- void maximumCurrent(char *v1){
- if(strcmp(v1, "-1") == 0 || strcmp(v1, "") == 0 ){
- printf("maximumCurrent = %d \n", ShmSysConfigAndInfo->ate.maximumCurrent_value);
- }else{
- int value = atoi(v1);
- ShmSysConfigAndInfo->ate.maximumCurrent_value = value;
- printf("maximumCurrent = %d \n", ShmSysConfigAndInfo->ate.maximumCurrent_value);
- }
- }
- void maximumVoltage(char *v1){
- if(strcmp(v1, "-1") == 0 || strcmp(v1, "") == 0 ){
- printf("maximumVoltage = %d \n", ShmSysConfigAndInfo->ate.maximumVoltage_value);
- }else{
- int value = atoi(v1);
- ShmSysConfigAndInfo->ate.maximumVoltage_value = value;
- printf("maximumVoltage = %d \n", ShmSysConfigAndInfo->ate.maximumVoltage_value);
- }
- }
- void presentVoltage(char *v1){
- if(strcmp(v1, "-1") == 0 || strcmp(v1, "") == 0 ){
- printf("presentVoltage = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_EVSEPresentVoltage.VCCU_V2G_EVSEPresentVoltage_Va);
- }else{
- int value = atoi(v1);
- ShmSysConfigAndInfo->ate.vccu.v2g_EVSEPresentVoltage.VCCU_V2G_EVSEPresentVoltage_Va = value;
- printf("presentVoltage = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_EVSEPresentVoltage.VCCU_V2G_EVSEPresentVoltage_Va);
- }
- }
- void linkVoltage(char *v1){
- if(strcmp(v1, "-1") == 0 || strcmp(v1, "") == 0 ){
- printf("linkVoltage = %d \n", ShmSysConfigAndInfo->ate.linkVoltage);
- }else{
- int value = atoi(v1);
- ShmSysConfigAndInfo->ate.linkVoltage = value;
- printf("linkVoltage = %d \n", ShmSysConfigAndInfo->ate.linkVoltage);
- }
- }
- void contactorVoltage(char *v1){
- if(strcmp(v1, "-1") == 0 || strcmp(v1, "") == 0 ){
- printf("contactorVoltage = %d \n", ShmSysConfigAndInfo->ate.contactorVoltage);
- }else{
- int value = atoi(v1);
- ShmSysConfigAndInfo->ate.contactorVoltage = value;
- printf("contactorVoltage = %d \n", ShmSysConfigAndInfo->ate.contactorVoltage);
- }
- }
- void setChademoPrmission(char *v1){
- if(strcmp(v1, "-1") == 0 || strcmp(v1, "") == 0 ){
- printf("Permission = %d \n", ShmSysConfigAndInfo->ate.Permission);
- //return;
- }else{
- int value = atoi(v1);
- ShmSysConfigAndInfo->ate.Permission = value;
- printf("Permission = %d ", ShmSysConfigAndInfo->ate.Permission);
- }
- }
- void setTotalBatteryCap(char *v1){
- if(strcmp(v1, "-1") == 0 || strcmp(v1, "") == 0 ){
- printf("TotalBatteryCap = %d \n", ShmSysConfigAndInfo->ate.TotalBatteryCap);
- //return;
- }else{
- int value = atoi(v1);
- ShmSysConfigAndInfo->ate.TotalBatteryCap = value * 10;
- printf("TotalBatteryCap = %d ", ShmSysConfigAndInfo->ate.TotalBatteryCap);
- }
- }
- void setMaxBatteryCurrent(char *v1){
- if(strcmp(v1, "-1") == 0 || strcmp(v1, "") == 0 ){
- printf("MaxBatteryCurrent = %d \n", ShmSysConfigAndInfo->ate.MaxBatteryCurrent);
- //return;
- }else{
- int value = atoi(v1);
- ShmSysConfigAndInfo->ate.MaxBatteryCurrent = value * 10;
- printf("MaxBatteryCurrent = %d ", ShmSysConfigAndInfo->ate.MaxBatteryCurrent);
- }
- }
- void setMaxBatteryVoltage(char *v1){
- if(strcmp(v1, "-1") == 0 || strcmp(v1, "") == 0 ){
- printf("MaxBatteryVoltage = %d \n", ShmSysConfigAndInfo->ate.MaxBatteryVoltage);
- //return;
- }else{
- int value = atoi(v1);
- ShmSysConfigAndInfo->ate.MaxBatteryVoltage = value * 10;
- printf("MaxBatteryVoltage = %d ", ShmSysConfigAndInfo->ate.MaxBatteryVoltage);
- }
- }
- void SetChargingPermission(char *v1, char *v2, char *v3, char *v4){
- if(strcmp(v1, "-1") == 0 || strcmp(v1, "") == 0 ){
- printf("Permission = %d \n", ShmSysConfigAndInfo->ate.Permission);
- //return;
- }else{
- int value = atoi(v1);
- ShmSysConfigAndInfo->ate.Permission = value;
- //printf("Permission = %d ", ShmSysConfigAndInfo->ate.Permission);
- }
- if(strcmp(v2, "-1") == 0 || strcmp(v2, "") == 0 ){
- //printf("Permission = %d \n", ShmSysConfigAndInfo->ate.Permission);
- }else{
- int value = atoi(v2);
- ShmSysConfigAndInfo->ate.TotalBatteryCap = value * 10;
- //printf("TotalBatteryCapa = %d ", ShmSysConfigAndInfo->ate.TotalBatteryCapacity);
- }
- if(strcmp(v3, "-1") == 0 || strcmp(v3, "") == 0 ){
- //printf("Permission = %d \n", ShmSysConfigAndInfo->ate.MaximumBatteryCurrent);
- }else{
- int value = atoi(v3);
- if(value > 0){
- ShmSysConfigAndInfo->ate.MaxBatteryCurrent = value * 10;
- }else{
- if(strcmp(v3, "0") == 0 ){
- ShmSysConfigAndInfo->ate.MaxBatteryCurrent = value * 10;
- }
- }
- printf("=====%d, %d \n", value, ShmSysConfigAndInfo->ate.MaxBatteryCurrent);
- //printf("MaximumBatteryCurrent = %d ", ShmSysConfigAndInfo->ate.MaximumBatteryCurrent);
- }
- if(strcmp(v4, "-1") == 0 || strcmp(v4, "") == 0 ){
- //printf("Permission = %d \n", ShmSysConfigAndInfo->ate.Permission);
- }else{
- int value = atoi(v4);
- ShmSysConfigAndInfo->ate.MaxBatteryVoltage = value * 10;
- printf("=====%d, %d \n", value, ShmSysConfigAndInfo->ate.MaxBatteryVoltage);
- //printf("MaximumBatteryCurrent = %d ", ShmSysConfigAndInfo->ate.MaximumBatteryVoltage);
- }
- printf(" Permission : %d, TotalBatteryCapacity : %d, MaximumBatteryCurrent : %d, MaximumBatteryCurrent : %d \n", ShmSysConfigAndInfo->ate.Permission, ShmSysConfigAndInfo->ate.TotalBatteryCap, ShmSysConfigAndInfo->ate.MaxBatteryCurrent, ShmSysConfigAndInfo->ate.MaxBatteryVoltage);
- }
- void SetRequireVoltage(char *v1){
- if(strcmp(v1, "-1") == 0 || strcmp(v1, "") == 0 ){
- printf("RequireVoltage = %d \n", ShmSysConfigAndInfo->ate.RequireVoltage);
- //return;
- }else{
- int value = atoi(v1);
- ShmSysConfigAndInfo->ate.RequireVoltage = value * 10;
- printf("RequireVoltage = %d ", ShmSysConfigAndInfo->ate.RequireVoltage);
- }
- }
- void SetRequireCurrent(char *v1){
- if(strcmp(v1, "-1") == 0 || strcmp(v1, "") == 0 ){
- printf("RequireCurrent = %d \n", ShmSysConfigAndInfo->ate.RequireCurrent);
- //return;
- }else{
- int value = atoi(v1);
- ShmSysConfigAndInfo->ate.RequireCurrent = value * 10;
- printf("RequireCurrent = %d ", ShmSysConfigAndInfo->ate.RequireCurrent);
- }
- }
- void SetPresentBattVoltage(char *v1){
- if(strcmp(v1, "-1") == 0 || strcmp(v1, "") == 0 ){
- printf("PresentBattVoltage = %d \n", ShmSysConfigAndInfo->ate.PresentBattVoltage);
- //return;
- }else{
- int value = atoi(v1);
- ShmSysConfigAndInfo->ate.PresentBattVoltage = value * 10;
- printf("PresentBattVoltage = %d ", ShmSysConfigAndInfo->ate.PresentBattVoltage);
- }
- }
- void SetMinimumChargeCurrent(char *v1){
- if(strcmp(v1, "-1") == 0 || strcmp(v1, "") == 0 ){
- printf("MinimumChargeCurrent = %d \n", ShmSysConfigAndInfo->ate.MinimumChargeCurrent);
- //return;
- }else{
- int value = atoi(v1);
- ShmSysConfigAndInfo->ate.MinimumChargeCurrent = value * 10;
- printf("MinimumChargeCurrent = %d ", ShmSysConfigAndInfo->ate.MinimumChargeCurrent);
- }
- }
- /*
- void SetPresentInputRequirement(char *v1, char *v2, char *v3, char *v4){
- if(strcmp(v1, "-1") == 0 || strcmp(v1, "") == 0 ){
- //printf("Permission = %d \n", ShmSysConfigAndInfo->ate.Permission);
- }else{
- int value = atoi(v1);
- ShmSysConfigAndInfo->ate.RequireVoltage = value * 10;
- //printf("Permission = %d ", ShmSysConfigAndInfo->ate.Permission);
- }
- if(strcmp(v2, "-1") == 0 || strcmp(v2, "") == 0 ){
- //printf("Permission = %d \n", ShmSysConfigAndInfo->ate.Permission);
- }else{
- int value = atoi(v2);
- ShmSysConfigAndInfo->ate.RequireCurrent = value * 10;
- //printf("TotalBatteryCapacity = %d ", ShmSysConfigAndInfo->ate.TotalBatteryCapacity);
- }
- if(strcmp(v3, "-1") == 0 || strcmp(v3, "") == 0 ){
- //printf("Permission = %d \n", ShmSysConfigAndInfo->ate.MaximumBatteryCurrent);
- }else{
- int value = atoi(v3);
- ShmSysConfigAndInfo->ate.PresentBattVoltage = value * 10;
- //printf("MaximumBatteryCurrent = %d ", ShmSysConfigAndInfo->ate.MaximumBatteryCurrent);
- }
- if(strcmp(v4, "-1") == 0 || strcmp(v4, "") == 0 ){
- //printf("Permission = %d \n", ShmSysConfigAndInfo->ate.Permission);
- }else{
- int value = atoi(v4);
- ShmSysConfigAndInfo->ate.MinimumChargeCurrent = value * 10;
- //printf("MaximumBatteryCurrent = %d ", ShmSysConfigAndInfo->ate.MaximumBatteryVoltage);
- }
- printf(" RequireVoltage : %d, RequireCurrent : %d, PresentBattVoltage : %d, MinimumChargeCurrent : %d \n", ShmSysConfigAndInfo->ate.RequireVoltage, ShmSysConfigAndInfo->ate.RequireCurrent, ShmSysConfigAndInfo->ate.PresentBattVoltage, ShmSysConfigAndInfo->ate.MinimumChargeCurrent);
- }
- */
- void SetSoc(char *v1){
- if(strcmp(v1, "-1") == 0 || strcmp(v1, "") == 0 ){
- printf("Soc = %d \n", ShmSysConfigAndInfo->ate.chademo.id0D_req.Soc);
- }else{
- int value = atoi(v1);
- ShmSysConfigAndInfo->ate.chademo.id0D_req.Soc = value;
- printf("Soc = %d ", ShmSysConfigAndInfo->ate.chademo.id0D_req.Soc);
- }
- printf("%d \n",ShmSysConfigAndInfo->ate.vccu.controlPilotStatus.ControlPilot_DutyCycle.bits.value);
- }
- void SetRelay(char *v1){
- if(strcmp(v1, "-1") == 0 || strcmp(v1, "") == 0 ){
- printf("relay = %d \n", ShmSysConfigAndInfo->ate.chademo.id0D_req.K1K2Status);
- }else{
- int value = atoi(v1);
- ShmSysConfigAndInfo->ate.chademo.id0D_req.K1K2Status = value;
- printf("relay = %d ", ShmSysConfigAndInfo->ate.chademo.id0D_req.K1K2Status);
- }
- }
- void SetState(char *v1){
- if(strcmp(v1, "-1") == 0 || strcmp(v1, "") == 0 ){
- printf("state = %d \n", ShmSysConfigAndInfo->ate.chademo.id03.state);
- }else{
- int value = atoi(v1);
- ShmSysConfigAndInfo->ate.chademo.id03.state = value;
- printf("state = %d ", ShmSysConfigAndInfo->ate.chademo.id03.state);
- }
- }
- void SetCState(char *v1){
- if(strcmp(v1, "-1") == 0 || strcmp(v1, "") == 0 ){
- printf("cstatus = %d \n", ShmSysConfigAndInfo->ate.cstatus );
- }else{
- int value = atoi(v1);
- ShmSysConfigAndInfo->ate.cstatus = value;
- printf("cstatus = %d ", ShmSysConfigAndInfo->ate.cstatus );
- }
- }
- void SetStartState(char *v1){
- if(strcmp(v1, "-1") == 0 || strcmp(v1, "") == 0 ){
- printf("start state = %d \n", ShmSysConfigAndInfo->ate.status);
- }else{
- int value = atoi(v1);
- ShmSysConfigAndInfo->ate.status = value;
- printf("start state = %d ", ShmSysConfigAndInfo->ate.status);
- }
- }
- void SetRelayState(char *v1){
- if(strcmp(v1, "-1") == 0 || strcmp(v1, "") == 0 ){
- printf("relay state = %d \n", ShmSysConfigAndInfo->ate.chademo.relaystatus);
- }else{
- int value = atoi(v1);
- ShmSysConfigAndInfo->ate.chademo.relaystatus = value;
- printf("relay state = %d ", ShmSysConfigAndInfo->ate.chademo.relaystatus);
- }
- }
- void SetATEState(char *v1){
- if(strcmp(v1, "-1") == 0 || strcmp(v1, "") == 0 ){
- printf("ATEState = %d \n", ShmSysConfigAndInfo->ate.ATEState);
- }else{
- int value = atoi(v1);
- ShmSysConfigAndInfo->ate.ATEState = value;
- printf("ATEState = %d ", ShmSysConfigAndInfo->ate.ATEState);
- }
- }
- void getVCCUInfo(){
- printf("VCCU_Vehicle_LinkVoltage = %d \n", ShmSysConfigAndInfo->ate.vccu.chargeFromVehicle.VCCU_Vehicle_LinkVoltage);
- printf("VCCU_Vehicle_ContactorVoltage = %d \n", ShmSysConfigAndInfo->ate.vccu.chargeFromVehicle.VCCU_Vehicle_ContactorVoltage);
- printf("VCCU_Vehicle_ContactorStatus = %d \n", ShmSysConfigAndInfo->ate.vccu.chargeFromVehicle.bits.VCCU_Vehicle_ContactorStatus);
- printf("VCCU_Vehicle_ChargePermission = %d \n", ShmSysConfigAndInfo->ate.vccu.chargeFromVehicle.DATA.bits.VCCU_Vehicle_ChargePermission);
- printf("VCCU_Vehicle_IsolationMeasurem = %d \n", ShmSysConfigAndInfo->ate.vccu.chargeFromVehicle.DATA.bits.VCCU_Vehicle_IsolationMeasurem);
- printf("VCCU_Vehicle_PlugLockPermissio = %d \n", ShmSysConfigAndInfo->ate.vccu.chargeFromVehicle.DATA.bits.VCCU_Vehicle_PlugLockPermissio);
- printf("VCCU_Vehicle_PlugUnlockPermiss = %d \n", ShmSysConfigAndInfo->ate.vccu.chargeFromVehicle.DATA.bits.VCCU_Vehicle_PlugUnlockPermiss);
- printf("VCCU_ControlPilot_Frequency = %d \n", ShmSysConfigAndInfo->ate.vccu.controlPilotStatus.ControlPilot_Frequency.bits.VCCU_ControlPilot_Frequency);
- printf("ControlPilot_Voltage = %d \n", ShmSysConfigAndInfo->ate.vccu.controlPilotStatus.ControlPilot_Voltage.bits.value);
- printf("VCCU_ChargeUnit_Mode = %d \n", ShmSysConfigAndInfo->ate.vccu.controlPilotStatus.DATA.bits.VCCU_ChargeUnit_Mode);
- printf("VCCU_ChargeUnit_State = %d \n", ShmSysConfigAndInfo->ate.vccu.controlPilotStatus.DATA.bits.VCCU_ChargeUnit_State);
- printf("VCCU_ControlPilot_Wakeup = %d \n", ShmSysConfigAndInfo->ate.vccu.controlPilotStatus.DATA.bits.VCCU_ControlPilot_Wakeup);
- printf("ControlPilot_Voltage = %d \n", ShmSysConfigAndInfo->ate.vccu.controlPilotStatus.ChargeUnit_MaxCurrent);
- printf("ControlPilot_Voltage = %d \n", ShmSysConfigAndInfo->ate.vccu.controlPilotStatus.ControlPilot_DutyCycle.bits.value);
- printf("VCCU_Vehicle_ContactorRequest = %d \n", ShmSysConfigAndInfo->ate.vccu.chargeToVehicle.bits.VCCU_Vehicle_ContactorRequest);
- printf("VCCU_Vehicle_IsolationMea_0000 = %d \n", ShmSysConfigAndInfo->ate.vccu.chargeToVehicle.bits.VCCU_Vehicle_IsolationMea_0000);
- printf("VCCU_PlugPresent_Status = %d \n", ShmSysConfigAndInfo->ate.vccu.inletStatus.DATA2.VCCU_PlugPresent_Status);
- printf("VCCU_PlugPresent_SelfDiagnosti = %d \n", ShmSysConfigAndInfo->ate.vccu.inletStatus.DATA2.VCCU_PlugPresent_SelfDiagnosti);
- printf("VCCU_PlugPresent_Resistance = %d \n", ShmSysConfigAndInfo->ate.vccu.inletStatus.DATA2.VCCU_PlugPresent_Resistance);
- printf("VCCU_PlugPresent_Wakeup = %d \n", ShmSysConfigAndInfo->ate.vccu.inletStatus.DATA3.VCCU_PlugPresent_Wakeup);
- printf("VCCU_PlugLock_MotorStatus = %d \n", ShmSysConfigAndInfo->ate.vccu.inletStatus.DATA3.VCCU_PlugLock_MotorStatus);
- printf("VCCU_POSFeedback_SelfDiagnosti = %d \n", ShmSysConfigAndInfo->ate.vccu.inletStatus.DATA3.VCCU_POSFeedback_SelfDiagnosti);
- printf("VCCU_Inlet_HWVariant = %d \n", ShmSysConfigAndInfo->ate.vccu.inletStatus.DATA4.VCCU_Inlet_HWVariant);
- printf("VCCU_PlugLock_Output0_SelfDiag = %d \n", ShmSysConfigAndInfo->ate.vccu.inletStatus.DATA4.VCCU_PlugLock_Output0_SelfDiag);
- printf("VCCU_PlugLock_Output1_SelfDiag = %d \n", ShmSysConfigAndInfo->ate.vccu.inletStatus.DATA4.VCCU_PlugLock_Output1_SelfDiag);
- printf("VCCU_Inlet_MotorStatus = %d \n", ShmSysConfigAndInfo->ate.vccu.inletStatus.DATA5.bits.VCCU_Inlet_MotorStatus);
- printf("VCCU_DigitalInput_Wakeup = %d \n", ShmSysConfigAndInfo->ate.vccu.inletStatus.DATA5.bits.VCCU_DigitalInput_Wakeup);
- printf("VCCU_DigitalInput_Status = %d \n", ShmSysConfigAndInfo->ate.vccu.inletStatus.DATA5.bits.VCCU_DigitalInput_Status);
- printf("VCCU_S3Switch_Status = %d \n", ShmSysConfigAndInfo->ate.vccu.inletStatus.DATA7.bits.VCCU_S3Switch_Status);
- printf("VCCU_S3Switch_DebouncedStatus = %d \n", ShmSysConfigAndInfo->ate.vccu.inletStatus.DATA7.bits.VCCU_S3Switch_DebouncedStatus);
- printf("VCCU_Inlet_ConnectionStatus = %d \n", ShmSysConfigAndInfo->ate.vccu.inletStatus.DATA7.bits.VCCU_Inlet_ConnectionStatus);
- printf("VCCU_DigitalInput_DebouncedSta = %d \n", ShmSysConfigAndInfo->ate.vccu.inletStatus.DATA7.bits.VCCU_DigitalInput_DebouncedSta);
- printf("VCCU_Inlet_MaxCurrent = %d \n", ShmSysConfigAndInfo->ate.vccu.inletStatus.VCCU_Inlet_MaxCurrent);
- printf("VCCU_POSFeedback_Voltage = %d \n", ShmSysConfigAndInfo->ate.vccu.inletStatus.VCCU_POSFeedback_Voltage);
- printf("VCCU_V2G_EVErrorCode = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_VehicleStatus.DATA1.VCCU_V2G_EVErrorCode);
- printf("VCCU_V2G_BulkChargingCompleteF = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_VehicleStatus.DATA1.VCCU_V2G_BulkChargingCompleteF);
- printf("VCCU_V2G_BulkChargingComplete = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_VehicleStatus.DATA1.VCCU_V2G_BulkChargingComplete);
- printf("VCCU_V2G_BulkSOCFlag = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_VehicleStatus.DATA2.VCCU_V2G_BulkSOCFlag);
- printf("VCCU_V2G_ChargingComplete = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_VehicleStatus.DATA2.VCCU_V2G_ChargingComplete);
- printf("VCCU_V2G_EVCabinConditioning = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_VehicleStatus.DATA2.VCCU_V2G_EVCabinConditioning);
- printf("VCCU_V2G_FullSOCFlag = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_VehicleStatus.DATA2.VCCU_V2G_FullSOCFlag);
- printf("VCCU_V2G_EVReady = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_VehicleStatus.DATA3.VCCU_V2G_EVReady);
- printf("VCCU_V2G_EVRESSConditioningFla = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_VehicleStatus.DATA3.VCCU_V2G_EVRESSConditioningFla);
- printf("VCCU_V2G_EVRESSConditioning = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_VehicleStatus.DATA3.VCCU_V2G_EVRESSConditioning);
- printf("VCCU_V2G_EVCabinConditioningFl = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_VehicleStatus.DATA3.VCCU_V2G_EVCabinConditioningFl);
- printf("VCCU_V2G_EVPowerDeliveryParame = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_VehicleStatus.DATA4.VCCU_V2G_EVPowerDeliveryParame);
- printf("VCCU_V2G_StateM_EnergyTra_0000 = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_VehicleStatus.DATA4.VCCU_V2G_StateM_EnergyTra_0000);
- printf("VCCU_V2G_StateM_StateMachineSt = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_StateM.VCCU_V2G_StateM_StateMachineSt);
- printf("VCCU_V2G_StateM_StateMachineMe = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_StateM.VCCU_V2G_StateM_StateMachineMe);
- printf("VCCU_V2G_StateM_StateMachineEr = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_StateM.VCCU_V2G_StateM_StateMachineEr);
- printf("VCCU_V2G_StateM_EnergyTransfer = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_StateM.VCCU_V2G_StateM_EnergyTransfer);
- printf("VCCU_V2G_StateM_InternetAvaila = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_StateM.DATA.bits.VCCU_V2G_StateM_InternetAvaila);
- printf("VCCU_V2G_Appl_SccFuncModeReq = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_StateM.DATA.bits.VCCU_V2G_Appl_SccFuncModeReq);
- printf("VCCU_V2G_Appl_SccChargeModeReq = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_StateM.DATA.bits.VCCU_V2G_Appl_SccChargeModeReq);
- printf("VCCU_V2G_EVTargetVoltage_Value = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_EVTargetVoltage.VCCU_V2G_EVTargetVoltage_Value.value);
- printf("VCCU_V2G_EVTargetVoltage_UnitF = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_EVTargetVoltage.VCCU_V2G_EVTargetVoltage_UnitF.value);
- printf("VCCU_V2G_EVTargetVoltage_Unit = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_EVTargetVoltage.VCCU_V2G_EVTargetVoltage_Unit.value);
- printf("VCCU_V2G_EVTargetVoltage_Multi = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_EVTargetVoltage.VCCU_V2G_EVTargetVoltage_Multi.value);
- printf("VCCU_V2G_EVTargetCurrent_Value = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_EVTargetCurrent.VCCU_V2G_EVTargetCurrent_Value.value);
- printf("VCCU_V2G_EVTargetCurrent_UnitF = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_EVTargetCurrent.VCCU_V2G_EVTargetCurrent_UnitF.value);
- printf("VCCU_V2G_EVTargetCurrent_Unit = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_EVTargetCurrent.VCCU_V2G_EVTargetCurrent_Unit.value);
- printf("VCCU_V2G_EVTargetCurrent_Multi = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_EVTargetCurrent.VCCU_V2G_EVTargetCurrent_Multi.value);
- printf("VCCU_V2G_EVMaximumVoltage_0003 = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_EVMaximumVoltageLimit.VCCU_V2G_EVMaximumVoltage_0003.value);
- printf("VCCU_V2G_EVMaximumVoltage_0001 = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_EVMaximumVoltageLimit.VCCU_V2G_EVMaximumVoltage_0001.value);
- printf("VCCU_V2G_EVMaximumVoltage_0000 = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_EVMaximumVoltageLimit.VCCU_V2G_EVMaximumVoltage_0000.value);
- printf("VCCU_V2G_EVMaximumVoltageLimit = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_EVMaximumVoltageLimit.DATA1.VCCU_V2G_EVMaximumVoltageLimit);
- printf("VCCU_V2G_EVMaximumVoltage_0002 = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_EVMaximumVoltageLimit.DATA1.VCCU_V2G_EVMaximumVoltage_0002);
- printf("VCCU_V2G_EVMaximumCurrent_0003 = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_EVMaximumCurrentLimit.VCCU_V2G_EVMaximumCurrent_0003.value);
- printf("VCCU_V2G_EVMaximumCurrent_0002 = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_EVMaximumCurrentLimit.VCCU_V2G_EVMaximumCurrent_0002.value);
- printf("VCCU_V2G_EVMaximumCurrent_0001 = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_EVMaximumCurrentLimit.VCCU_V2G_EVMaximumCurrent_0001.value);
- printf("VCCU_V2G_EVMaximumCurrentLimit = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_EVMaximumCurrentLimit.DATA1.VCCU_V2G_EVMaximumCurrentLimit);
- printf("VCCU_V2G_EVMaximumCurrent_0000 = %d \n", ShmSysConfigAndInfo->ate.vccu.v2g_EVMaximumCurrentLimit.DATA1.VCCU_V2G_EVMaximumCurrent_0000);
- }
- void getChademoInfo(){
- printf("id03 state = %d \n", ShmSysConfigAndInfo->ate.chademo.id03.state);
- printf("id03 ProximitySignal = %d \n", ShmSysConfigAndInfo->ate.chademo.id03.ProximitySignal);
- printf("id03 PilotVoltage = %d \n", ShmSysConfigAndInfo->ate.chademo.id03.PilotVoltage);
- printf("id03 AlarmCode2 = %d \n", ShmSysConfigAndInfo->ate.chademo.id03.AlarmCode2);
- printf("id03 AlarmCode3 = %d \n", ShmSysConfigAndInfo->ate.chademo.id03.AlarmCode3);
- printf("id03 AlarmCode4 = %d \n", ShmSysConfigAndInfo->ate.chademo.id03.AlarmCode4);
- printf("id03 AlarmCode5 = %d \n", ShmSysConfigAndInfo->ate.chademo.id03.AlarmCode5);
- printf("id03 AlarmCode6 = %d \n", ShmSysConfigAndInfo->ate.chademo.id03.AlarmCode6);
- printf("id06 TotalBatteryCapacity = %d \n", ShmSysConfigAndInfo->ate.chademo.id06.TotalBatteryCapacity);
- printf("id06 Permission = %d \n", ShmSysConfigAndInfo->ate.chademo.id06.Permission);
- printf("id06 MaximumBatteryVoltage = %d \n", ShmSysConfigAndInfo->ate.chademo.id06.MaximumBatteryVoltage);
- printf("id06 MaximumBatteryCurrent = %d \n", ShmSysConfigAndInfo->ate.chademo.id06.MaximumBatteryCurrent);
- printf("id06 MaxChargingTimeMin = %d \n", ShmSysConfigAndInfo->ate.chademo.id06.MaxChargingTimeMin);
- printf("id07 PresentInputVoltage = %d \n", ShmSysConfigAndInfo->ate.chademo.id07.PresentInputVoltage);
- printf("id07 PresentInputCurrent = %d \n", ShmSysConfigAndInfo->ate.chademo.id07.PresentInputCurrent);
- printf("id08 RequireVoltage = %d \n", ShmSysConfigAndInfo->ate.chademo.id08.RequireVoltage);
- printf("id08 RequireCurrent = %d \n", ShmSysConfigAndInfo->ate.chademo.id08.RequireCurrent);
- printf("id08 PresentBattVoltage = %d \n", ShmSysConfigAndInfo->ate.chademo.id08.PresentBattVoltage);
- printf("id08 MinimumChargeCurrent = %d \n", ShmSysConfigAndInfo->ate.chademo.id08.MinimumChargeCurrent);
- printf("id08 ChargeAllow = %d \n", ShmSysConfigAndInfo->ate.chademo.id08.ChargeAllow);
- printf("id09_ack ChargingMode = %d \n", ShmSysConfigAndInfo->ate.chademo.id09_ack.ChargingMode);
- printf("id09_ack DcEvState = %d \n", ShmSysConfigAndInfo->ate.chademo.id09_ack.DcEvState);
- printf("id09_ack EvsePresentOutputCurrent = %d \n", ShmSysConfigAndInfo->ate.chademo.id09_ack.EvsePresentOutputCurrent);
- printf("id09_ack EvsePresentOutputVoltage = %d \n", ShmSysConfigAndInfo->ate.chademo.id09_ack.EvsePresentOutputVoltage);
- printf("id09_ack RemainingTimeSec = %d \n", ShmSysConfigAndInfo->ate.chademo.id09_ack.RemainingTimeSec);
- printf("id0A_ack EvseMinChargeVoltage = %d \n", ShmSysConfigAndInfo->ate.chademo.id0A_ack.EvseMaxChargeCurrent);
- printf("id0A_ack EvseMaxChargeVoltage = %d \n", ShmSysConfigAndInfo->ate.chademo.id0A_ack.EvseMaxChargeVoltage);
- printf("id0A_ack EvseMinChargeCurrent = %d \n", ShmSysConfigAndInfo->ate.chademo.id0A_ack.EvseMinChargeCurrent);
- printf("id0A_ack EvseMinChargeCurrent = %d \n", ShmSysConfigAndInfo->ate.chademo.id0A_ack.EvseMinChargeVoltage);
- printf("id0B AlarmCode1 = %d \n", ShmSysConfigAndInfo->ate.chademo.id0B.AlarmCode1);
- printf("id0B AlarmCode2 = %d \n", ShmSysConfigAndInfo->ate.chademo.id0B.AlarmCode2);
- printf("id0B AlarmCode3 = %d \n", ShmSysConfigAndInfo->ate.chademo.id0B.AlarmCode3);
- printf("id0B AlarmCode4 = %d \n", ShmSysConfigAndInfo->ate.chademo.id0B.AlarmCode4);
- printf("id0B AlarmCode5 = %d \n", ShmSysConfigAndInfo->ate.chademo.id0B.AlarmCode5);
- printf("id0B AlarmCode6 = %d \n", ShmSysConfigAndInfo->ate.chademo.id0B.AlarmCode6);
- printf("id0B EvStopReason = %d \n", ShmSysConfigAndInfo->ate.chademo.id0B.EvStopReason);
- printf("id0D_ack soc = %d \n", ShmSysConfigAndInfo->ate.chademo.id0D_ack.soc);
- printf("id0D_ack soc = %d \n", ShmSysConfigAndInfo->ate.chademo.id0D_ack.K1K2OnOff);
- printf("id0D_req K1K2Status = %d \n", ShmSysConfigAndInfo->ate.chademo.id0D_req.K1K2Status);
- printf("id0D_req Soc = %d \n", ShmSysConfigAndInfo->ate.chademo.id0D_req.Soc);
- printf("relaystatus = %d \n", ShmSysConfigAndInfo->ate.chademo.relaystatus);
- }
- void getChromaInfo(){
- printf("EVStatus = %d \n", ShmSysConfigAndInfo->ate.chroma.evstaus.data);
- printf("Connector_2 TargetVoltage = %d \n", ShmSysConfigAndInfo->ate.chroma.ate_Connector_2.TargetVoltage);
- printf("Connector_2 TargetCurrent = %d \n", ShmSysConfigAndInfo->ate.chroma.ate_Connector_2.TargetCurrent);
- printf("Connector_2 PresentVoltage = %d \n", ShmSysConfigAndInfo->ate.chroma.ate_Connector_2.PresentVoltage);
- printf("Connector_2 PresentCurrent = %d \n", ShmSysConfigAndInfo->ate.chroma.ate_Connector_2.PresentCurrent);
- printf("Connector_1 TargetVoltage = %d \n", ShmSysConfigAndInfo->ate.chroma.ate_Connector_1.TargetVoltage);
- printf("Connector_1 TargetCurrent = %d \n", ShmSysConfigAndInfo->ate.chroma.ate_Connector_1.TargetCurrent);
- printf("Connector_1 PresentVoltage = %d \n", ShmSysConfigAndInfo->ate.chroma.ate_Connector_1.PresentVoltage);
- printf("Connector_1 PresentCurrent = %d \n", ShmSysConfigAndInfo->ate.chroma.ate_Connector_1.PresentCurrent);
- printf("Boot_Notification1 = %d \n", ShmSysConfigAndInfo->ate.chroma.bootNotification.boo1);
- printf("Boot_Notification2 = %d \n", ShmSysConfigAndInfo->ate.chroma.bootNotification.boo2);
- }
- void setModeChange(char *v1){
- if(strcmp(v1, "-1") == 0 || strcmp(v1, "") == 0 ){
- printf("mode change = %d \n", ShmSysConfigAndInfo->ate.ateMode);
- }else{
- int value = atoi(v1);
- ShmSysConfigAndInfo->ate.ateMode = value;
- printf("setModeChange = %d ", ShmSysConfigAndInfo->ate.ateMode);
- }
- }
- int main()
- {
- if(InitShareMemory() == FAIL)
- {
- printf ("InitShareMemory = FAIL \n");
- if(ShmStatusCodeData != NULL)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory=1;
- }
- sleep(5);
- return 0;
- }
- for(;;)
- {
- char word[256];
- char newString[7][20];
- int i,j,ctr;
- fgets(word, sizeof(word), stdin);
- j=0; ctr=0;
- strcpy(newString[1], "-1");
- strcpy(newString[2], "-1");
- for (i = 0; i <= (strlen(word)); i++)
- {
- if (word[i] == ' ' || word[i] == '\0' || word[i] == 10)
- {
- newString[ctr][j] = '\0';
- ctr++;
- j = 0;
- }
- else
- {
- newString[ctr][j] = word[i];
- j++;
- }
- }
- //printf("=====%s %s\n", newString[0], newString[1]);
- if(strcmp(newString[0], "stop") == 0)
- {
- //if (strcmp(newString[1], "-1") == 0 || strcmp(newString[1], "") == 0)
- //continue;
- // 槍狀態
- StopATE(newString[1]);
- continue;
- }else if(strcmp(newString[0], "targetCurrent") == 0){//
- targetCurrent(newString[1]);
- continue;
- }else if(strcmp(newString[0], "targetVoltage") == 0){//
- targetVoltage(newString[1]);
- continue;
- }else if(strcmp(newString[0], "maximumCurrent") == 0){//
- maximumCurrent(newString[1]);
- continue;
- }else if(strcmp(newString[0], "maximumVoltage") == 0){//
- maximumVoltage(newString[1]);
- continue;
- }else if(strcmp(newString[0], "presentVoltage") == 0){//
- presentVoltage(newString[1]);
- continue;
- }else if(strcmp(newString[0], "linkVoltage") == 0){//
- linkVoltage(newString[1]);
- continue;
- }else if(strcmp(newString[0], "contactorVoltage") == 0){//
- contactorVoltage(newString[1]);
- continue;
- }else if(strcmp(newString[0], "chademoPrmission") == 0){
- //SetChargingPermission(newString[1], newString[2], newString[3], newString[4]);
- setChademoPrmission(newString[1]);
- continue;
- }else if(strcmp(newString[0], "totalBatteryCap") == 0){
- setTotalBatteryCap(newString[1]);
- continue;
- }else if(strcmp(newString[0], "maxBatteryCurrent") == 0){
- setMaxBatteryCurrent(newString[1]);
- continue;
- }else if(strcmp(newString[0], "maxBatteryVoltage") == 0){
- setMaxBatteryVoltage(newString[1]);
- continue;
- }else if(strcmp(newString[0], "requireVoltage") == 0){
- SetRequireVoltage(newString[1]);
- continue;
- }else if(strcmp(newString[0], "requireCurrent") == 0){
- SetRequireCurrent(newString[1]);
- continue;
- }else if(strcmp(newString[0], "presentBattVoltage") == 0){
- SetPresentBattVoltage(newString[1]);
- continue;
- }else if(strcmp(newString[0], "minimumChargeCurrent") == 0){//
- SetMinimumChargeCurrent(newString[1]);
- continue;
- }else if(strcmp(newString[0], "soc") == 0){//
- SetSoc(newString[1]);
- continue;
- }else if(strcmp(newString[0], "relay") == 0){//
- SetRelay(newString[1]);
- continue;
- }else if(strcmp(newString[0], "cstate") == 0){//
- SetState(newString[1]);
- continue;
- }else if(strcmp(newString[0], "startstate") == 0){//
- SetStartState(newString[1]);
- continue;
- }else if(strcmp(newString[0], "crelaystate") == 0){//
- SetRelayState(newString[1]);
- continue;
- }else if(strcmp(newString[0], "ccstate") == 0){//
- SetCState(newString[1]);
- continue;
- }else if(strcmp(newString[0], "vccuinfo") == 0){//
- getVCCUInfo();
- continue;
- }else if(strcmp(newString[0], "chademoinfo") == 0){//
- getChademoInfo();
- continue;
- }else if(strcmp(newString[0], "chromainfo") == 0){//
- getChromaInfo();
- continue;
- }else if(strcmp(newString[0], "modeChange") == 0){//
- setModeChange(newString[1]);
- continue;
- }else if(strcmp(newString[0], "ateState") == 0){//
- SetATEState(newString[1]);
- continue;
- }
- printf ("%s\n", msg);
- usleep(100000);
- }
- return(0);
- }
|