Skip to content

Commit

Permalink
Report session stop reason
Browse files Browse the repository at this point in the history
  • Loading branch information
shalinnijel2 committed Oct 27, 2023
1 parent 755e6fb commit d7b3738
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions iso15118/secc/controller/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -871,3 +871,10 @@ def ready_to_charge(self) -> bool:
ready to start charging.
"""
raise NotImplementedError

@abstractmethod
async def session_ended(self, current_state: str, reason: str):
"""
Indicate the reason for stopping charging.
"""
raise NotImplementedError
10 changes: 10 additions & 0 deletions iso15118/secc/controller/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1144,3 +1144,13 @@ def ready_to_charge(self) -> bool:
Overrides EVSEControllerInterface.ready_to_charge().
"""
return True

async def session_ended(self, current_state: str, reason: str):
"""
Reports the state and reason where the session ended.
@param current_state: The current SDP/SAP/DIN/ISO15118-2/ISO15118-20 state.
@param reason: Reason for ending the session.
@param last_message: The last message that was either sent/received.
"""
logger.info(f"Session ended in {current_state} ({reason}).")
1 change: 1 addition & 0 deletions iso15118/shared/comm_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ async def stop(self, reason: str):
if hasattr(self.comm_session, "evse_controller"):
evse_controller = self.comm_session.evse_controller
await evse_controller.update_data_link(terminate_or_pause)
await evse_controller.session_ended(str(self.current_state), reason)
logger.info(f"{terminate_or_pause}d the data link")
await asyncio.sleep(3)
try:
Expand Down

0 comments on commit d7b3738

Please sign in to comment.