evse_serviceMethods.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  1. /*
  2. * Copyright (C) 2007-2012 Siemens AG
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU Lesser General Public License as published
  6. * by the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. /*******************************************************************
  18. *
  19. * @author Sebastian.Kaebisch.EXT@siemens.com
  20. * @version 0.6
  21. * @contact Joerg.Heuer@siemens.com
  22. *
  23. ********************************************************************/
  24. #include "v2g_serviceMethods.h"
  25. #include "v2g_serviceDataTypes.h"
  26. #include <stdio.h>
  27. static void printBinaryArray(uint8_t* byte, uint32_t len);
  28. int sessionSetup(struct MessageHeaderType* header, struct SessionSetupReqType* param, struct SessionSetupResType* result)
  29. {
  30. printf("EVSE side: sessionSetup called\n" );
  31. printf("\tReceived data:\n");
  32. printf("\tHeader SessionID=");
  33. printBinaryArray(header->SessionID.data,header->SessionID.arraylen.data );
  34. printf("\t\t EVCCID=%d\n",param->EVCCID.data[0]);
  35. /* generate an unique sessionID */
  36. header->SessionID.data[0] = 0;
  37. header->SessionID.data[1] = 0;
  38. header->SessionID.data[2] = 0;
  39. header->SessionID.data[3] = 0;
  40. header->SessionID.data[4] = 0;
  41. header->SessionID.data[5] = 0;
  42. header->SessionID.data[6] = 0;
  43. header->SessionID.data[7] = 10;
  44. header->SessionID.arraylen.data=8;
  45. /* Prepare data for EV */
  46. result->ResponseCode = OK_responseCodeType;
  47. result->EVSEID.data[0]=1;
  48. result->EVSEID.arraylen.data=1;
  49. result->DateTimeNow=123456789;
  50. result->isused.DateTimeNow=1;
  51. return 0;
  52. }
  53. int serviceDiscovery(struct MessageHeaderType* header, struct ServiceDiscoveryReqType* param, struct ServiceDiscoveryResType* result)
  54. {
  55. printf("EVSE side: serviceDiscovery called\n" );
  56. printf("\tReceived data:\n");
  57. printf("\tHeader SessionID=");
  58. printBinaryArray(header->SessionID.data,header->SessionID.arraylen.data );
  59. printf("\t\t ServiceCategory=%d\n", param->ServiceCategory);
  60. result->isused.ServiceList=0; /* we do not provide VAS */
  61. result->ResponseCode= OK_responseCodeType;
  62. result->ChargeService.EnergyTransferType = AC_single_DC_core_EVSESupportedEnergyTransferType;
  63. result->ChargeService.ServiceTag.ServiceID=1; /* ID of the charge service */
  64. result->ChargeService.ServiceTag.ServiceName.data[0]='A';
  65. result->ChargeService.ServiceTag.ServiceName.data[1]='C';
  66. result->ChargeService.ServiceTag.ServiceName.data[2]='_';
  67. result->ChargeService.ServiceTag.ServiceName.data[3]='D';
  68. result->ChargeService.ServiceTag.ServiceName.data[4]='C';
  69. result->ChargeService.ServiceTag.ServiceName.arraylen.data=5;
  70. result->ChargeService.ServiceTag.isused.ServiceName=1;
  71. result->ChargeService.ServiceTag.isused.ServiceCategory=0;
  72. result->ChargeService.ServiceTag.isused.ServiceScope=0;
  73. result->ChargeService.FreeService = 1;
  74. result->PaymentOptions.PaymentOption[0] = ExternalPayment_paymentOptionType; /* EVSE handles the payment */
  75. result->PaymentOptions.arraylen.PaymentOption=1;
  76. return 0;
  77. }
  78. int servicePaymentSelection(struct MessageHeaderType* header, struct ServicePaymentSelectionReqType* param, struct ServicePaymentSelectionResType* result)
  79. {
  80. printf("EVSE side: servicePaymentSelection called\n" );
  81. printf("\tReceived data:\n");
  82. printf("\tHeader SessionID=");
  83. printBinaryArray(header->SessionID.data,header->SessionID.arraylen.data );
  84. if(param->SelectedPaymentOption == ExternalPayment_paymentOptionType)
  85. printf("\t\t SelectedPaymentOption=ExternalPayment\n");
  86. printf("\t\t ServiceID=%d\n",param->SelectedServiceList.SelectedService[0].ServiceID);
  87. result->ResponseCode = OK_responseCodeType;
  88. return 0;
  89. }
  90. int paymentDetails(struct MessageHeaderType* header, struct PaymentDetailsReqType* param, struct PaymentDetailsResType* result)
  91. {
  92. return 0;
  93. }
  94. int chargeParameterDiscovery(struct MessageHeaderType* header, struct ChargeParameterDiscoveryReqType* param, struct ChargeParameterDiscoveryResType* result)
  95. {
  96. struct PhysicalValueType f;
  97. printf("EVSE side: chargeParameterDiscovery called\n" );
  98. printf("\tReceived data:\n");
  99. printf("\t\t EVRequestedEnergyTransferType=%d\n",param->EVRequestedEnergyTransferType);
  100. /* check,if DC or AC is requested */
  101. if(param->EVRequestedEnergyTransferType==DC_core_EVRequestedEnergyTransferType || param->isused.DC_EVChargeParameter==1)
  102. {
  103. printf("\t\t EVStatus:\n");
  104. printf("\t\t\t EVReady=%d\n", param->DC_EVChargeParameter->DC_EVStatus.EVReady);
  105. printf("\t\t\t EVRESSSOC=%d\n", param->DC_EVChargeParameter->DC_EVStatus.EVRESSSOC);
  106. printf("\t\t\t EVErrorCode=%d\n", param->DC_EVChargeParameter->DC_EVStatus.EVErrorCode);
  107. printf("\t\t\t EVRESSConditioning=%d\n", param->DC_EVChargeParameter->DC_EVStatus.EVRESSConditioning);
  108. printf("\t\t\t EVCabinConditioning=%d\n", param->DC_EVChargeParameter->DC_EVStatus.EVCabinConditioning);
  109. printf("\t\t EVMaximumCurrentLimit=%d\n", param->DC_EVChargeParameter->EVMaximumCurrentLimit.Value);
  110. printf("\t\t EVMaximumPowerLimit=%d\n", param->DC_EVChargeParameter->EVMaximumPowerLimit.Value);
  111. printf("\t\t EVMaximumVoltageLimit=%d\n", param->DC_EVChargeParameter->EVMaximumVoltageLimit.Value);
  112. printf("\t\t EVEnergyCapacity=%d\n", param->DC_EVChargeParameter->EVEnergyCapacity.Value);
  113. printf("\t\t EVEnergyRequest=%d\n", param->DC_EVChargeParameter->EVEnergyRequest.Value);
  114. printf("\t\t FullSOC=%d\n", param->DC_EVChargeParameter->FullSOC);
  115. printf("\t\t BulkSOC=%d\n", param->DC_EVChargeParameter->BulkSOC);
  116. result->ResponseCode = OK_responseCodeType;
  117. result->isused.SAScheduleList=0;
  118. result->isused.DC_EVSEChargeParameter = 1;
  119. result->isused.AC_EVSEChargeParameter = 0;
  120. result->DC_EVSEChargeParameter->DC_EVSEStatus.EVSEStatusCode = EVSE_Ready_DC_EVSEStatusCodeType;
  121. result->DC_EVSEChargeParameter->DC_EVSEStatus.EVSEIsolationStatus = Safe_isolationLevelType;
  122. result->DC_EVSEChargeParameter->DC_EVSEStatus.isused.EVSEIsolationStatus = 1;
  123. f.Multiplier = 0;
  124. f.Unit = A_unitSymbolType;
  125. f.Value = 50;
  126. result->DC_EVSEChargeParameter->EVSEMaximumCurrentLimit=f;
  127. f.Unit = W_unitSymbolType;
  128. f.Value = 20000;
  129. result->DC_EVSEChargeParameter->EVSEMaximumPowerLimit=f;
  130. result->DC_EVSEChargeParameter->isused.EVSEMaximumPowerLimit=1;
  131. f.Unit = V_unitSymbolType;
  132. f.Value = 400;
  133. result->DC_EVSEChargeParameter->EVSEMaximumVoltageLimit=f;
  134. f.Unit = A_unitSymbolType;
  135. f.Value = 5;
  136. result->DC_EVSEChargeParameter->EVSEMinimumCurrentLimit=f;
  137. f.Unit = V_unitSymbolType;
  138. f.Value = 200;
  139. result->DC_EVSEChargeParameter->EVSEMinimumVoltageLimit=f;
  140. f.Unit = A_unitSymbolType;
  141. f.Value = 2;
  142. result->DC_EVSEChargeParameter->EVSECurrentRegulationTolerance=f;
  143. result->DC_EVSEChargeParameter->isused.EVSECurrentRegulationTolerance=1;
  144. f.Unit = A_unitSymbolType;
  145. f.Value = 1;
  146. result->DC_EVSEChargeParameter->EVSEPeakCurrentRipple=f;
  147. f.Unit = W_unitSymbolType;
  148. f.Value = 5000;
  149. result->DC_EVSEChargeParameter->EVSEEnergyToBeDelivered=f;
  150. result->DC_EVSEChargeParameter->isused.EVSEEnergyToBeDelivered=1;
  151. /* set up a PMax schedule */
  152. result->isused.SAScheduleList=1;
  153. result->SAScheduleList->SAScheduleTuple[0].SAScheduleTupleID=10;
  154. result->SAScheduleList->SAScheduleTuple[0].isused.SalesTariff=0; /* no tariffs */
  155. /* set up two PMax entries */
  156. result->SAScheduleList->SAScheduleTuple[0].PMaxSchedule.PMaxScheduleID=20;
  157. result->SAScheduleList->SAScheduleTuple[0].PMaxSchedule.PMaxScheduleEntry[0].PMax=20000;
  158. result->SAScheduleList->SAScheduleTuple[0].PMaxSchedule.PMaxScheduleEntry[0].RelativeTimeInterval.start=0;
  159. result->SAScheduleList->SAScheduleTuple[0].PMaxSchedule.PMaxScheduleEntry[1].PMax=0;
  160. result->SAScheduleList->SAScheduleTuple[0].PMaxSchedule.PMaxScheduleEntry[1].RelativeTimeInterval.start=1200; /* 20 min */
  161. result->SAScheduleList->SAScheduleTuple[0].PMaxSchedule.arraylen.PMaxScheduleEntry=2; /* we set up two time entries */
  162. /* set up two PMax entries */
  163. result->SAScheduleList->SAScheduleTuple[1].SAScheduleTupleID=15;
  164. result->SAScheduleList->SAScheduleTuple[1].PMaxSchedule.PMaxScheduleID=30;
  165. result->SAScheduleList->SAScheduleTuple[1].PMaxSchedule.PMaxScheduleEntry[0].PMax=10000;
  166. result->SAScheduleList->SAScheduleTuple[1].PMaxSchedule.PMaxScheduleEntry[0].RelativeTimeInterval.start=0;
  167. result->SAScheduleList->SAScheduleTuple[1].PMaxSchedule.PMaxScheduleEntry[1].PMax=0;
  168. result->SAScheduleList->SAScheduleTuple[1].PMaxSchedule.PMaxScheduleEntry[1].RelativeTimeInterval.start=1800; /* 30 min */
  169. result->SAScheduleList->SAScheduleTuple[1].PMaxSchedule.arraylen.PMaxScheduleEntry=2; /* we set up two time entries */
  170. result->SAScheduleList->arraylen.SAScheduleTuple=2; /* we used only 1 tuple */
  171. } else { /* AC related */
  172. printf("\t\t DepartureTime=%d\n", param->AC_EVChargeParameter->DepartureTime);
  173. printf("\t\t EAmount=%d\n", param->AC_EVChargeParameter->EAmount.Value);
  174. printf("\t\t EVMaxCurrent=%d\n", param->AC_EVChargeParameter->EVMaxCurrent.Value);
  175. printf("\t\t EVMaxVoltage=%d\n", param->AC_EVChargeParameter->EVMaxVoltage.Value);
  176. printf("\t\t EVMinCurrent=%d\n", param->AC_EVChargeParameter->EVMinCurrent.Value);
  177. result->ResponseCode = OK_responseCodeType;
  178. result->isused.AC_EVSEChargeParameter = 1;
  179. result->isused.DC_EVSEChargeParameter = 0;
  180. result->isused.SAScheduleList = 0;
  181. result->AC_EVSEChargeParameter->AC_EVSEStatus.PowerSwitchClosed=1;
  182. result->AC_EVSEChargeParameter->AC_EVSEStatus.RCD=1;
  183. result->AC_EVSEChargeParameter->AC_EVSEStatus.ShutDownTime=12345;
  184. result->AC_EVSEChargeParameter->AC_EVSEStatus.StopCharging=0;
  185. f.Multiplier = 0;
  186. f.Unit = A_unitSymbolType;
  187. f.Value = 100;
  188. result->AC_EVSEChargeParameter->EVSEMaxCurrent=f;
  189. f.Unit = V_unitSymbolType;
  190. f.Value = 200;
  191. result->AC_EVSEChargeParameter->EVSEMaxVoltage=f;
  192. f.Unit = A_unitSymbolType;
  193. f.Value = 300;
  194. result->AC_EVSEChargeParameter->EVSEMinCurrent=f;
  195. }
  196. return 0;
  197. }
  198. int powerDelivery(struct MessageHeaderType* header, struct PowerDeliveryReqType* param, struct PowerDeliveryResType* result)
  199. {
  200. size_t i;
  201. printf("EVSE side: powerDelivery called\n" );
  202. printf("\tReceived data:\n");
  203. printf("\t\t\t ReadyToChargeState=%d\n", param->ReadyToChargeState);
  204. if(param->isused.DC_EVPowerDeliveryParameter)
  205. {
  206. printf("\t\t EVStatus:\n");
  207. printf("\t\t\t EVReady=%d\n", param->DC_EVPowerDeliveryParameter->DC_EVStatus.EVReady);
  208. printf("\t\t\t EVRESSSOC=%d\n", param->DC_EVPowerDeliveryParameter->DC_EVStatus.EVRESSSOC);
  209. printf("\t\t\t EVErrorCode=%d\n", param->DC_EVPowerDeliveryParameter->DC_EVStatus.EVErrorCode);
  210. printf("\t\t\t EVRESSConditioning=%d\n", param->DC_EVPowerDeliveryParameter->DC_EVStatus.EVRESSConditioning);
  211. printf("\t\t\t EVCabinConditioning=%d\n", param->DC_EVPowerDeliveryParameter->DC_EVStatus.EVCabinConditioning);
  212. if(param->isused.ChargingProfile)
  213. {
  214. printf("\t\t\tChargingProfile:\n");
  215. printf("\t\t\t SAScheduleTupleID=%d\n",param->ChargingProfile.SAScheduleTupleID );
  216. for(i=0;i<param->ChargingProfile.arraylen.ProfileEntry;i++)
  217. {
  218. printf("\t\t\t Entry#%d\n",i);
  219. printf("\t\t\t\t ChargingProfileEntryMaxPower=%d\n", param->ChargingProfile.ProfileEntry[i].ChargingProfileEntryMaxPower);
  220. printf("\t\t\t\t ChargingProfileEntryStart=%d\n", param->ChargingProfile.ProfileEntry[i].ChargingProfileEntryStart);
  221. }
  222. }
  223. result->ResponseCode = OK_responseCodeType;
  224. result->DC_EVSEStatus->EVSEIsolationStatus =1;
  225. result->DC_EVSEStatus->isused.EVSEIsolationStatus = 1;
  226. result->DC_EVSEStatus->EVSEStatusCode = EVSE_Ready_DC_EVSEStatusCodeType;
  227. result->isused.DC_EVSEStatus=1;
  228. result->isused.AC_EVSEStatus=0;
  229. } else {
  230. result->ResponseCode = OK_responseCodeType;
  231. result->AC_EVSEStatus->PowerSwitchClosed=1;
  232. result->AC_EVSEStatus->RCD=1;
  233. result->AC_EVSEStatus->ShutDownTime=12345;
  234. result->AC_EVSEStatus->StopCharging=1;
  235. result->isused.AC_EVSEStatus=1;
  236. result->isused.DC_EVSEStatus=0;
  237. }
  238. return 0;
  239. }
  240. int chargingStatus(struct MessageHeaderType* header, struct ChargingStatusReqType* param, struct ChargingStatusResType* result)
  241. {
  242. printf("EVSE side: chargingStatus called\n" );
  243. result->ResponseCode=OK_responseCodeType;
  244. result->EVSEID.data[0]=1;
  245. result->EVSEID.arraylen.data=1;
  246. result->AC_EVSEStatus.PowerSwitchClosed=1;
  247. result->AC_EVSEStatus.RCD=1;
  248. result->AC_EVSEStatus.ShutDownTime=12345;
  249. result->AC_EVSEStatus.StopCharging=1;
  250. result->ReceiptRequired=0;
  251. result->EVSEMaxCurrent.Multiplier = 2;
  252. result->EVSEMaxCurrent.Unit = A_unitSymbolType;
  253. result->EVSEMaxCurrent.Value = 400;
  254. result->isused.EVSEMaxCurrent=1;
  255. result->isused.MeterInfo=1;
  256. result->MeterInfo.MeterID.arraylen.data=1;
  257. result->MeterInfo.MeterID.data[0]=2;
  258. result->MeterInfo.MeterReading.Multiplier = 0;
  259. result->MeterInfo.MeterReading.Unit = A_unitSymbolType;
  260. result->MeterInfo.MeterReading.Value = 500;
  261. result->MeterInfo.MeterStatus = 4321;
  262. result->MeterInfo.TMeter =123456789;
  263. result->MeterInfo.isused.MeterReading = 1;
  264. result->MeterInfo.isused.MeterStatus=1;
  265. result->MeterInfo.isused.TMeter=1;
  266. return 0;
  267. }
  268. int meteringReceipt(struct MessageHeaderType* header, struct MeteringReceiptReqType* param, struct MeteringReceiptResType* result)
  269. {
  270. printf("EVSE side: meteringReceipt called\n" );
  271. printf("\tReceived data:\n");
  272. printf("\t\t SAScheduleTupleID=%d\n", param->SAScheduleTupleID);
  273. printf("\t\t MeterInfo.MeterStatus=%d\n", param->MeterInfo.MeterStatus);
  274. printf("\t\t MeterInfo.MeterID=%d\n", param->MeterInfo.MeterID.data[0]);
  275. printf("\t\t MeterInfo.isused.MeterReading=%d\n", param->MeterInfo.isused.MeterReading);
  276. printf("\t\t MeterReading.Value=%d\n", param->MeterInfo.MeterReading.Value);
  277. printf("\t\t MeterInfo.TMeter=%d\n", param->MeterInfo.TMeter);
  278. result->ResponseCode = OK_responseCodeType;
  279. result->AC_EVSEStatus.PowerSwitchClosed=1;
  280. result->AC_EVSEStatus.RCD=1;
  281. result->AC_EVSEStatus.ShutDownTime=12345;
  282. result->AC_EVSEStatus.StopCharging=1;
  283. return 0;
  284. }
  285. int cableCheck(struct MessageHeaderType* header, struct CableCheckReqType* param, struct CableCheckResType* result)
  286. {
  287. printf("EVSE side: cableCheck called\n" );
  288. printf("\tReceived data:\n");
  289. printf("\t\t EVStatus:\n");
  290. printf("\t\t\t EVReady=%d\n", param->DC_EVStatus.EVReady);
  291. printf("\t\t\t EVRESSSOC=%d\n", param->DC_EVStatus.EVRESSSOC);
  292. printf("\t\t\t EVErrorCode=%d\n", param->DC_EVStatus.EVErrorCode);
  293. printf("\t\t\t EVRESSConditioning=%d\n", param->DC_EVStatus.EVRESSConditioning);
  294. printf("\t\t\t EVCabinConditioning=%d\n", param->DC_EVStatus.EVCabinConditioning);
  295. result->ResponseCode = OK_responseCodeType;
  296. result->DC_EVSEStatus.EVSEIsolationStatus= Safe_isolationLevelType;
  297. result->DC_EVSEStatus.isused.EVSEIsolationStatus = 1;
  298. result->DC_EVSEStatus.EVSEStatusCode = EVSE_Ready_DC_EVSEStatusCodeType;
  299. return 0;
  300. }
  301. int preCharge(struct MessageHeaderType* header, struct PreChargeReqType* param, struct PreChargeResType* result)
  302. {
  303. struct PhysicalValueType float_type;
  304. printf("EVSE side: preCharge called\n" );
  305. printf("\tReceived data:\n");
  306. printf("\t\t EVStatus:\n");
  307. printf("\t\t\t EVReady=%d\n", param->DC_EVStatus.EVReady);
  308. printf("\t\t\t EVRESSSOC=%d\n", param->DC_EVStatus.EVRESSSOC);
  309. printf("\t\t\t EVErrorCode=%d\n", param->DC_EVStatus.EVErrorCode);
  310. printf("\t\t\t EVRESSConditioning=%d\n", param->DC_EVStatus.EVRESSConditioning);
  311. printf("\t\t\t EVCabinConditioning=%d\n", param->DC_EVStatus.EVCabinConditioning);
  312. result->ResponseCode = OK_responseCodeType;
  313. result->DC_EVSEStatus.EVSEIsolationStatus= Safe_isolationLevelType;
  314. result->DC_EVSEStatus.isused.EVSEIsolationStatus = 1;
  315. result->DC_EVSEStatus.EVSEStatusCode = EVSE_Ready_DC_EVSEStatusCodeType;
  316. float_type.Multiplier = 0;
  317. float_type.Unit = V_unitSymbolType;
  318. float_type.Value = 100;
  319. result->EVSEPresentVoltage = float_type;
  320. return 0;
  321. }
  322. int currentDemand(struct MessageHeaderType* header, struct CurrentDemandReqType* param, struct CurrentDemandResType* result)
  323. {
  324. struct PhysicalValueType f;
  325. printf("EVSE side: currentDemand called\n" );
  326. printf("\tReceived data:\n");
  327. printf("\t\t EVStatus:\n");
  328. printf("\t\t\t EVReady=%d\n", param->DC_EVStatus.EVReady);
  329. printf("\t\t\t EVRESSSOC=%d\n", param->DC_EVStatus.EVRESSSOC);
  330. printf("\t\t\t EVErrorCode=%d\n", param->DC_EVStatus.EVErrorCode);
  331. printf("\t\t\t EVRESSConditioning=%d\n", param->DC_EVStatus.EVRESSConditioning);
  332. printf("\t\t\t EVCabinConditioning=%d\n", param->DC_EVStatus.EVCabinConditioning);
  333. printf("\t\t EVTargetCurrent=%d\n", param->EVTargetCurrent.Value);
  334. printf("\t\t EVMaximumVoltageLimit=%d\n", param->EVMaximumVoltageLimit.Value);
  335. printf("\t\t EVMaximumPowerLimit=%d\n", param->EVMaximumPowerLimit.Value);
  336. printf("\t\t EVMaximumCurrentLimit=%d\n", param->EVMaximumCurrentLimit.Value);
  337. printf("\t\t BulkChargingComplete=%d\n", param->BulkChargingComplete);
  338. printf("\t\t ChargingComplete=%d\n", param->ChargingComplete);
  339. printf("\t\t RemainingTimeToFullSoC=%d\n", param->RemainingTimeToFullSoC.Value);
  340. printf("\t\t RemainingTimeToBulkSoC=%d\n", param->RemainingTimeToBulkSoC.Value);
  341. printf("\t\t EVTargetVoltage=%d\n", param->EVTargetVoltage.Value);
  342. result->ResponseCode = OK_responseCodeType;
  343. result->DC_EVSEStatus.EVSEIsolationStatus= Safe_isolationLevelType;
  344. result->DC_EVSEStatus.isused.EVSEIsolationStatus = 1;
  345. result->DC_EVSEStatus.EVSEStatusCode = EVSE_Ready_DC_EVSEStatusCodeType;
  346. f.Multiplier = 0;
  347. f.Unit = V_unitSymbolType;
  348. f.Value = 400;
  349. result->EVSEPresentVoltage=f;
  350. f.Unit = A_unitSymbolType;
  351. f.Value = 45;
  352. result->EVSEPresentCurrent=f;
  353. result->EVSECurrentLimitAchieved=0;
  354. result->EVSEVoltageLimitAchieved=1;
  355. result->EVSEPowerLimitAchieved=0;
  356. f.Unit = V_unitSymbolType;
  357. f.Value = 400;
  358. result->EVSEMaximumVoltageLimit=f;
  359. result->isused.EVSEMaximumVoltageLimit=1;
  360. f.Unit = A_unitSymbolType;
  361. f.Value = 50;
  362. result->EVSEMaximumCurrentLimit=f;
  363. result->isused.EVSEMaximumCurrentLimit=1;
  364. f.Unit = W_unitSymbolType;
  365. f.Value = 20000;
  366. result->EVSEMaximumPowerLimit=f;
  367. result->isused.EVSEMaximumPowerLimit=1;
  368. return 0;
  369. }
  370. int weldingDetection(struct MessageHeaderType* header, struct WeldingDetectionReqType* param, struct WeldingDetectionResType* result)
  371. {
  372. printf("EVSE side: weldingDetection called\n" );
  373. printf("\tReceived data:\n");
  374. printf("\t\t EVStatus:\n");
  375. printf("\t\t\t EVReady=%d\n", param->DC_EVStatus.EVReady);
  376. printf("\t\t\t EVRESSSOC=%d\n", param->DC_EVStatus.EVRESSSOC);
  377. printf("\t\t\t EVErrorCode=%d\n", param->DC_EVStatus.EVErrorCode);
  378. printf("\t\t\t EVRESSConditioning=%d\n", param->DC_EVStatus.EVRESSConditioning);
  379. printf("\t\t\t EVCabinConditioning=%d\n", param->DC_EVStatus.EVCabinConditioning);
  380. result->ResponseCode = OK_responseCodeType;
  381. result->DC_EVSEStatus.EVSEIsolationStatus= Safe_isolationLevelType;
  382. result->DC_EVSEStatus.isused.EVSEIsolationStatus = 1;
  383. result->DC_EVSEStatus.EVSEStatusCode = EVSE_Ready_DC_EVSEStatusCodeType;
  384. result->EVSEPresentVoltage.Value = 123;
  385. result->EVSEPresentVoltage.Unit = V_unitSymbolType;
  386. result->EVSEPresentVoltage.Multiplier = 0;
  387. return 0;
  388. }
  389. int sessionStop(struct MessageHeaderType* header, struct SessionStopType* param, struct SessionStopResType* result)
  390. {
  391. printf("EVSE side: sessionStop called\n" );
  392. result->ResponseCode = OK_responseCodeType;
  393. return 0;
  394. }
  395. int serviceDetail(struct MessageHeaderType* header, struct ServiceDetailReqType* param, struct ServiceDetailResType* result)
  396. {
  397. return 0;
  398. }
  399. int contractAuthentication(struct MessageHeaderType* header, struct ContractAuthenticationReqType* param, struct ContractAuthenticationResType* result)
  400. {
  401. return 0;
  402. }
  403. int certificateUpdate(struct MessageHeaderType* header, struct CertificateUpdateReqType* param, struct CertificateUpdateResType* result)
  404. {
  405. return 0;
  406. }
  407. int certificateInstallation(struct MessageHeaderType* header, struct CertificateInstallationReqType* param, struct CertificateInstallationResType* result)
  408. {
  409. return 0;
  410. }
  411. static void printBinaryArray(uint8_t* byte, uint32_t len) {
  412. unsigned int i;
  413. for(i=0; i<len; i++) {
  414. printf("%d ",byte[i]);
  415. }
  416. printf("\n");
  417. }