Skip to content

Commit

Permalink
Use IdTagInfo datatype instead of Dict for id_tag_info occurances (#278)
Browse files Browse the repository at this point in the history
The `Authorize.conf` message in the v1.6 spec defines what fields should
be present for an `IdTagInfo`. The dataclass for this already exists in
`datatypes.py`, as of the recently merged #250 PR.

This PR makes use of it by importing the dataclass, and using it instead
of the more losely typed `typing.Dict`.
  • Loading branch information
chan-vince authored Nov 3, 2023
1 parent b858999 commit 09ab8c6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ocpp/v16/call_result.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from dataclasses import dataclass
from typing import Dict, List, Optional

from ocpp.v16.datatypes import IdTagInfo
from ocpp.v16.enums import (
AvailabilityStatus,
CancelReservationStatus,
Expand Down Expand Up @@ -46,7 +47,7 @@

@dataclass
class AuthorizePayload:
id_tag_info: Dict
id_tag_info: IdTagInfo


@dataclass
Expand Down Expand Up @@ -94,7 +95,7 @@ class MeterValuesPayload:
@dataclass
class StartTransactionPayload:
transaction_id: int
id_tag_info: Dict
id_tag_info: IdTagInfo


@dataclass
Expand All @@ -104,7 +105,7 @@ class StatusNotificationPayload:

@dataclass
class StopTransactionPayload:
id_tag_info: Optional[Dict] = None
id_tag_info: Optional[IdTagInfo] = None


# The CALLRESULT messages that flow from Charge Point to Central System are
Expand Down

0 comments on commit 09ab8c6

Please sign in to comment.