|
| 1 | +--- ext-switchev-iso15118/iso15118/evcc/controller/interface.py |
| 2 | ++++ source/build/dist/libexec/everest/3rd_party/josev/iso15118/evcc/controller/interface.py |
| 3 | +@@ -109,6 +109,15 @@ |
| 4 | + raise NotImplementedError |
| 5 | + |
| 6 | + @abstractmethod |
| 7 | ++ async def get_selected_auth_option( |
| 8 | ++ self, protocol: Protocol |
| 9 | ++ ) -> AuthEnum: |
| 10 | ++ """ |
| 11 | ++ Gets the auth transfer mode requested for the current charging session. |
| 12 | ++ """ |
| 13 | ++ raise NotImplementedError |
| 14 | ++ |
| 15 | ++ @abstractmethod |
| 16 | + async def get_energy_transfer_mode( |
| 17 | + self, protocol: Protocol |
| 18 | + ) -> EnergyTransferModeEnum: |
| 19 | +--- ext-switchev-iso15118/iso15118/evcc/controller/simulator.py |
| 20 | ++++ source/build/dist/libexec/everest/3rd_party/josev/iso15118/evcc/controller/simulator.py |
| 21 | +@@ -53,6 +53,7 @@ |
| 22 | + SAScheduleTupleEntry as SAScheduleTupleEntryDINSPEC, |
| 23 | + ) |
| 24 | + from iso15118.shared.messages.enums import ( |
| 25 | ++ AuthEnum, |
| 26 | + ControlMode, |
| 27 | + DCEVErrorCode, |
| 28 | + EnergyTransferModeEnum, |
| 29 | +@@ -233,11 +234,18 @@ |
| 30 | + logger.error(f"Invalid protocol '{protocol}', can't determine EVCCID") |
| 31 | + raise InvalidProtocolError |
| 32 | + |
| 33 | ++ async def get_selected_auth_option( |
| 34 | ++ self, protocol: Protocol |
| 35 | ++ ) -> AuthEnum: |
| 36 | ++ """Overrides EVControllerInterface.get_selected_auth_option().""" |
| 37 | ++ return AuthEnum(EVEREST_EV_STATE.PaymentOption) |
| 38 | ++ |
| 39 | + async def get_energy_transfer_mode( |
| 40 | + self, protocol: Protocol |
| 41 | + ) -> EnergyTransferModeEnum: |
| 42 | + """Overrides EVControllerInterface.get_energy_transfer_mode().""" |
| 43 | + return EnergyTransferModeEnum(EVEREST_EV_STATE.EnergyTransferMode) |
| 44 | ++ |
| 45 | + |
| 46 | + async def get_supported_energy_services(self) -> List[ServiceV20]: |
| 47 | + """Overrides EVControllerInterface.get_energy_transfer_service().""" |
| 48 | +--- ext-switchev-iso15118/iso15118/evcc/states/iso15118_2_states.py |
| 49 | ++++ source/build/dist/libexec/everest/3rd_party/josev/iso15118/evcc/states/iso15118_2_states.py |
| 50 | +@@ -193,8 +193,9 @@ |
| 51 | + self.stop_state_machine("ChargeService not offered") |
| 52 | + return |
| 53 | + |
| 54 | +- self.select_auth_mode(service_discovery_res.auth_option_list.auth_options) |
| 55 | ++ logger.warn("received auth options list %s" % service_discovery_res.auth_option_list.auth_options) |
| 56 | + await self.select_services(service_discovery_res) |
| 57 | ++ await self.select_auth_mode(service_discovery_res.auth_option_list.auth_options) |
| 58 | + await self.select_energy_transfer_mode() |
| 59 | + |
| 60 | + charge_service: ChargeService = service_discovery_res.charge_service |
| 61 | +@@ -262,12 +263,13 @@ |
| 62 | + self.comm_session.selected_energy_mode.value.startswith("AC") |
| 63 | + ) |
| 64 | + |
| 65 | +- def select_auth_mode(self, auth_option_list: List[AuthEnum]): |
| 66 | ++ async def select_auth_mode(self, auth_option_list: List[AuthEnum]): |
| 67 | + """ |
| 68 | + Check if an authorization mode (aka payment option in ISO 15118-2) was |
| 69 | + saved from a previously paused communication session and reuse for |
| 70 | + resumed session, otherwise request from EV controller. |
| 71 | + """ |
| 72 | ++ logger.warn("V2G_PAYMENT: in function received auth options list %s" % auth_option_list) |
| 73 | + if evcc_settings.ev_session_context.selected_auth_option: |
| 74 | + logger.debug( |
| 75 | + "Reusing authorization option " |
| 76 | +@@ -279,15 +281,30 @@ |
| 77 | + ) |
| 78 | + evcc_settings.ev_session_context.selected_auth_option = None |
| 79 | + else: |
| 80 | +- # Choose Plug & Charge (pnc) or External Identification Means (eim) |
| 81 | +- # as the selected authorization option. The car manufacturer might |
| 82 | +- # have a mechanism to determine a user-defined or default |
| 83 | +- # authorization option. This implementation favors pnc, but |
| 84 | +- # feel free to change if need be. |
| 85 | +- if AuthEnum.PNC_V2 in auth_option_list and self.comm_session.is_tls: |
| 86 | +- self.comm_session.selected_auth_option = AuthEnum.PNC_V2 |
| 87 | ++ logger.warn("V2G_PAYMENT: about to read value from state") |
| 88 | ++ self.comm_session.selected_auth_option = ( |
| 89 | ++ await self.comm_session.ev_controller.get_selected_auth_option( |
| 90 | ++ Protocol.ISO_15118_2 |
| 91 | ++ ) |
| 92 | ++ ) |
| 93 | ++ logger.warn("V2G_PAYMENT: in function read value from state %s" % self.comm_session.selected_auth_option) |
| 94 | ++ if self.comm_session.selected_auth_option is not None: |
| 95 | ++ logger.debug( |
| 96 | ++ "V2G_PAYMENT: Found Payment Option %s passed in from the PyJoseV module, using it" % self.comm_session.selected_auth_option |
| 97 | ++ ) |
| 98 | + else: |
| 99 | +- self.comm_session.selected_auth_option = AuthEnum.EIM_V2 |
| 100 | ++ logger.debug( |
| 101 | ++ "V2G_PAYMENT: No previous paused session, no PaymentOption set, using TLS flag %s to decide auth method" % self.comm_session.is_tls |
| 102 | ++ ) |
| 103 | ++ # Choose Plug & Charge (pnc) or External Identification Means (eim) |
| 104 | ++ # as the selected authorization option. The car manufacturer might |
| 105 | ++ # have a mechanism to determine a user-defined or default |
| 106 | ++ # authorization option. This implementation favors pnc, but |
| 107 | ++ # feel free to change if need be. |
| 108 | ++ if AuthEnum.PNC_V2 in auth_option_list and self.comm_session.is_tls: |
| 109 | ++ self.comm_session.selected_auth_option = AuthEnum.PNC_V2 |
| 110 | ++ else: |
| 111 | ++ self.comm_session.selected_auth_option = AuthEnum.EIM_V2 |
| 112 | + |
| 113 | + async def select_services(self, service_discovery_res: ServiceDiscoveryRes): |
| 114 | + """ |
0 commit comments