-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
437a46b
commit 04c6f7c
Showing
3 changed files
with
220 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
"""Module for Skoda vehicle capability class.""" | ||
from __future__ import annotations | ||
from typing import TYPE_CHECKING | ||
|
||
from enum import IntEnum | ||
|
||
from carconnectivity.objects import GenericObject | ||
from carconnectivity.attributes import StringAttribute | ||
|
||
if TYPE_CHECKING: | ||
from carconnectivity_connectors.skoda.vehicle import SkodaVehicle | ||
|
||
|
||
class Capability(GenericObject): | ||
""" | ||
Represents a capability of a Skoda vehicle. | ||
""" | ||
|
||
def __init__(self, capability_id: str, vehicle: SkodaVehicle) -> None: | ||
if vehicle is None: | ||
raise ValueError('Cannot create capability without vehicle') | ||
if id is None: | ||
raise ValueError('Capability ID cannot be None') | ||
super().__init__(object_id=capability_id, parent=vehicle) | ||
self.capability_id = StringAttribute("id", self, capability_id) | ||
self.statuses = list[Capability.Status] | ||
self.enabled = True | ||
|
||
def __str__(self) -> str: | ||
return_string = f'{self.capability_id}' | ||
return return_string | ||
|
||
class Status(IntEnum): | ||
""" | ||
Enum for capability status. | ||
""" | ||
UNKNOWN = 0 | ||
DEACTIVATED = 1001 | ||
INITIALLY_DISABLED = 1003 | ||
DISABLED_BY_USER = 1004 | ||
OFFLINE_MODE = 1005 | ||
WORKSHOP_MODE = 1006 | ||
MISSING_OPERATION = 1007 | ||
MISSING_SERVICE = 1008 | ||
PLAY_PROTECTION = 1009 | ||
POWER_BUDGET_REACHED = 1010 | ||
DEEP_SLEEP = 1011 | ||
LOCATION_DATA_DISABLED = 1013 | ||
LICENSE_INACTIVE = 2001 | ||
LICENSE_EXPIRED = 2002 | ||
MISSING_LICENSE = 2003 | ||
USER_NOT_VERIFIED = 3001 | ||
TERMS_AND_CONDITIONS_NOT_ACCEPTED = 3002 | ||
INSUFFICIENT_RIGHTS = 3003 | ||
CONSENT_MISSING = 3004 | ||
LIMITED_FEATURE = 3005 | ||
AUTH_APP_CERT_ERROR = 3006 | ||
STATUS_UNSUPPORTED = 4001 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
"""Module for vehicle classes.""" | ||
from __future__ import annotations | ||
from typing import TYPE_CHECKING | ||
|
||
from carconnectivity.vehicle import GenericVehicle, ElectricVehicle, CombustionVehicle, HybridVehicle | ||
|
||
if TYPE_CHECKING: | ||
from typing import Optional | ||
from carconnectivity.garage import Garage | ||
from carconnectivity_connectors.skoda.capability import Capability | ||
from carconnectivity_connectors.base.connector import BaseConnector | ||
|
||
|
||
class SkodaVehicle(GenericVehicle): # pylint: disable=too-many-instance-attributes | ||
""" | ||
A class to represent a generic Skoda vehicle. | ||
Attributes: | ||
----------- | ||
vin : StringAttribute | ||
The vehicle identification number (VIN) of the vehicle. | ||
license_plate : StringAttribute | ||
The license plate of the vehicle. | ||
""" | ||
def __init__(self, vin: Optional[str] = None, garage: Optional[Garage] = None, managing_connector: Optional[BaseConnector] = None, | ||
origin: Optional[SkodaVehicle] = None) -> None: | ||
super().__init__(vin=vin, garage=garage, origin=origin) | ||
if origin is not None: | ||
super().__init__(vin=vin, garage=garage, origin=origin, managing_connector=managing_connector) | ||
self.capabilities = origin.capabilities | ||
else: | ||
self.capabilities: dict[str, Capability] = {} | ||
|
||
def __str__(self) -> str: | ||
return_string: str = super().__str__() | ||
if self.capabilities is not None and len(self.capabilities) > 0: | ||
return_string += 'Capabilities:\n' | ||
for capability in self.capabilities.values(): | ||
return_string += f'\t{capability}\n' | ||
return return_string | ||
|
||
|
||
class SkodaElectricVehicle(ElectricVehicle, SkodaVehicle): | ||
""" | ||
Represents a Skoda electric vehicle. | ||
""" | ||
def __init__(self, vin: Optional[str] = None, garage: Optional[Garage] = None, managing_connector: Optional[BaseConnector] = None, | ||
origin: Optional[GenericVehicle] = None) -> None: | ||
if origin is not None: | ||
super().__init__(origin=origin) | ||
else: | ||
super().__init__(vin=vin, garage=garage, managing_connector=managing_connector) | ||
|
||
|
||
class SkodaCombustionVehicle(CombustionVehicle, SkodaVehicle): | ||
""" | ||
Represents a Skoda combustion vehicle. | ||
""" | ||
def __init__(self, vin: Optional[str] = None, garage: Optional[Garage] = None, managing_connector: Optional[BaseConnector] = None, | ||
origin: Optional[GenericVehicle] = None) -> None: | ||
if origin is not None: | ||
super().__init__(origin=origin) | ||
else: | ||
super().__init__(vin=vin, garage=garage, managing_connector=managing_connector) | ||
|
||
|
||
class SkodaHybridVehicle(HybridVehicle, SkodaVehicle): | ||
""" | ||
Represents a Skoda hybrid vehicle. | ||
""" | ||
def __init__(self, vin: Optional[str] = None, garage: Optional[Garage] = None, managing_connector: Optional[BaseConnector] = None, | ||
origin: Optional[GenericVehicle] = None) -> None: | ||
if origin is not None: | ||
super().__init__(origin=origin) | ||
else: | ||
super().__init__(vin=vin, garage=garage, managing_connector=managing_connector) |