Skip to content

Commit

Permalink
Updated imports for v16 datatypes, call and call_result files
Browse files Browse the repository at this point in the history
  • Loading branch information
jainmohit2001 committed Dec 31, 2024
1 parent 2932746 commit 7e6136b
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 117 deletions.
56 changes: 20 additions & 36 deletions ocpp/v16/call.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,7 @@
from dataclasses import dataclass, field
from typing import Dict, List, Optional, Union

from ocpp.v16.datatypes import ChargingProfile
from ocpp.v16.enums import (
AvailabilityType,
CertificateUse,
ChargePointErrorCode,
ChargePointStatus,
ChargingProfilePurposeType,
ChargingRateUnitType,
DiagnosticsStatus,
FirmwareStatus,
Log,
MessageTrigger,
Reason,
ResetType,
UpdateType,
UploadLogStatus,
)
from ocpp.v16 import datatypes, enums

# Most types of CALL messages can originate from only 1 source, either
# from a Charge Point or Central System, but not from both.
Expand Down Expand Up @@ -51,7 +35,7 @@ class CertificateSigned:
@dataclass
class ChangeAvailability:
connector_id: int
type: AvailabilityType
type: enums.AvailabilityType


@dataclass
Expand All @@ -69,7 +53,7 @@ class ClearCache:
class ClearChargingProfile:
id: Optional[int] = None
connector_id: Optional[int] = None
charging_profile_purpose: Optional[ChargingProfilePurposeType] = None
charging_profile_purpose: Optional[enums.ChargingProfilePurposeType] = None
stack_level: Optional[int] = None


Expand All @@ -80,15 +64,15 @@ class DeleteCertificate:

@dataclass
class ExtendedTriggerMessage:
requested_message: MessageTrigger
requested_message: enums.MessageTrigger
connector_id: Optional[int] = None


@dataclass
class GetCompositeSchedule:
connector_id: int
duration: int
charging_rate_unit: Optional[ChargingRateUnitType] = None
charging_rate_unit: Optional[enums.ChargingRateUnitType] = None


@dataclass
Expand All @@ -107,7 +91,7 @@ class GetDiagnostics:

@dataclass
class GetInstalledCertificateIds:
certificate_type: CertificateUse
certificate_type: enums.CertificateUse


@dataclass
Expand All @@ -118,23 +102,23 @@ class GetLocalListVersion:
@dataclass
class GetLog:
log: Dict
log_type: Log
log_type: enums.Log
request_id: int
retries: Optional[int] = None
retry_interval: Optional[int] = None


@dataclass
class InstallCertificate:
certificate_type: CertificateUse
certificate_type: enums.CertificateUse
certificate: str


@dataclass
class RemoteStartTransaction:
id_tag: str
connector_id: Optional[int] = None
charging_profile: Optional[Union[Dict, ChargingProfile]] = None
charging_profile: Optional[Union[Dict, datatypes.ChargingProfile]] = None


@dataclass
Expand All @@ -153,20 +137,20 @@ class ReserveNow:

@dataclass
class Reset:
type: ResetType
type: enums.ResetType


@dataclass
class SendLocalList:
list_version: int
update_type: UpdateType
update_type: enums.UpdateType
local_authorization_list: List = field(default_factory=list)


@dataclass
class SetChargingProfile:
connector_id: int
cs_charging_profiles: Union[ChargingProfile, Dict]
cs_charging_profiles: Union[datatypes.ChargingProfile, Dict]


@dataclass
Expand All @@ -179,7 +163,7 @@ class SignedUpdateFirmware:

@dataclass
class TriggerMessage:
requested_message: MessageTrigger
requested_message: enums.MessageTrigger
connector_id: Optional[int] = None


Expand Down Expand Up @@ -220,12 +204,12 @@ class BootNotification:

@dataclass
class DiagnosticsStatusNotification:
status: DiagnosticsStatus
status: enums.DiagnosticsStatus


@dataclass
class FirmwareStatusNotification:
status: FirmwareStatus
status: enums.FirmwareStatus


@dataclass
Expand All @@ -235,7 +219,7 @@ class Heartbeat:

@dataclass
class LogStatusNotification:
status: UploadLogStatus
status: enums.UploadLogStatus
request_id: int


Expand All @@ -260,7 +244,7 @@ class SignCertificate:

@dataclass
class SignedFirmwareStatusNotification:
status: FirmwareStatus
status: enums.FirmwareStatus
request_id: int


Expand All @@ -278,16 +262,16 @@ class StopTransaction:
meter_stop: int
timestamp: str
transaction_id: int
reason: Optional[Reason] = None
reason: Optional[enums.Reason] = None
id_tag: Optional[str] = None
transaction_data: Optional[List] = None


@dataclass
class StatusNotification:
connector_id: int
error_code: ChargePointErrorCode
status: ChargePointStatus
error_code: enums.ChargePointErrorCode
status: enums.ChargePointStatus
timestamp: Optional[str] = None
info: Optional[str] = None
vendor_id: Optional[str] = None
Expand Down
Loading

0 comments on commit 7e6136b

Please sign in to comment.