DLMS-SPODES-client 0.19.22__py3-none-any.whl → 0.19.23__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. DLMS_SPODES_client/FCS16.py +39 -39
  2. DLMS_SPODES_client/__init__.py +12 -12
  3. DLMS_SPODES_client/client.py +2091 -2091
  4. DLMS_SPODES_client/gurux_common/enums/TraceLevel.py +21 -21
  5. DLMS_SPODES_client/gurux_dlms/AesGcmParameter.py +37 -37
  6. DLMS_SPODES_client/gurux_dlms/CountType.py +16 -16
  7. DLMS_SPODES_client/gurux_dlms/GXByteBuffer.py +545 -545
  8. DLMS_SPODES_client/gurux_dlms/GXCiphering.py +196 -196
  9. DLMS_SPODES_client/gurux_dlms/GXDLMS.py +426 -426
  10. DLMS_SPODES_client/gurux_dlms/GXDLMSChippering.py +237 -237
  11. DLMS_SPODES_client/gurux_dlms/GXDLMSChipperingStream.py +977 -977
  12. DLMS_SPODES_client/gurux_dlms/GXDLMSConfirmedServiceError.py +90 -90
  13. DLMS_SPODES_client/gurux_dlms/GXDLMSException.py +139 -139
  14. DLMS_SPODES_client/gurux_dlms/GXDLMSLNParameters.py +33 -33
  15. DLMS_SPODES_client/gurux_dlms/GXDLMSSNParameters.py +21 -21
  16. DLMS_SPODES_client/gurux_dlms/GXDLMSSettings.py +254 -254
  17. DLMS_SPODES_client/gurux_dlms/GXReplyData.py +87 -87
  18. DLMS_SPODES_client/gurux_dlms/HdlcControlFrame.py +9 -9
  19. DLMS_SPODES_client/gurux_dlms/MBusCommand.py +8 -8
  20. DLMS_SPODES_client/gurux_dlms/MBusEncryptionMode.py +27 -27
  21. DLMS_SPODES_client/gurux_dlms/ResponseType.py +8 -8
  22. DLMS_SPODES_client/gurux_dlms/SetResponseType.py +29 -29
  23. DLMS_SPODES_client/gurux_dlms/_HDLCInfo.py +9 -9
  24. DLMS_SPODES_client/gurux_dlms/__init__.py +75 -75
  25. DLMS_SPODES_client/gurux_dlms/enums/Access.py +12 -12
  26. DLMS_SPODES_client/gurux_dlms/enums/ApplicationReference.py +14 -14
  27. DLMS_SPODES_client/gurux_dlms/enums/Authentication.py +41 -41
  28. DLMS_SPODES_client/gurux_dlms/enums/BerType.py +35 -35
  29. DLMS_SPODES_client/gurux_dlms/enums/Command.py +285 -285
  30. DLMS_SPODES_client/gurux_dlms/enums/Definition.py +9 -9
  31. DLMS_SPODES_client/gurux_dlms/enums/ErrorCode.py +46 -46
  32. DLMS_SPODES_client/gurux_dlms/enums/ExceptionServiceError.py +12 -12
  33. DLMS_SPODES_client/gurux_dlms/enums/HardwareResource.py +10 -10
  34. DLMS_SPODES_client/gurux_dlms/enums/HdlcFrameType.py +9 -9
  35. DLMS_SPODES_client/gurux_dlms/enums/Initiate.py +10 -10
  36. DLMS_SPODES_client/gurux_dlms/enums/LoadDataSet.py +13 -13
  37. DLMS_SPODES_client/gurux_dlms/enums/ObjectType.py +306 -306
  38. DLMS_SPODES_client/gurux_dlms/enums/Priority.py +7 -7
  39. DLMS_SPODES_client/gurux_dlms/enums/RequestTypes.py +9 -9
  40. DLMS_SPODES_client/gurux_dlms/enums/Security.py +14 -14
  41. DLMS_SPODES_client/gurux_dlms/enums/Service.py +16 -16
  42. DLMS_SPODES_client/gurux_dlms/enums/ServiceClass.py +9 -9
  43. DLMS_SPODES_client/gurux_dlms/enums/ServiceError.py +8 -8
  44. DLMS_SPODES_client/gurux_dlms/enums/Standard.py +18 -18
  45. DLMS_SPODES_client/gurux_dlms/enums/StateError.py +7 -7
  46. DLMS_SPODES_client/gurux_dlms/enums/Task.py +10 -10
  47. DLMS_SPODES_client/gurux_dlms/enums/VdeStateError.py +10 -10
  48. DLMS_SPODES_client/gurux_dlms/enums/__init__.py +33 -33
  49. DLMS_SPODES_client/gurux_dlms/internal/_GXCommon.py +1673 -1673
  50. DLMS_SPODES_client/logger.py +56 -56
  51. DLMS_SPODES_client/services.py +97 -97
  52. DLMS_SPODES_client/session.py +365 -365
  53. DLMS_SPODES_client/settings.py +48 -48
  54. DLMS_SPODES_client/task.py +1842 -1842
  55. {dlms_spodes_client-0.19.22.dist-info → dlms_spodes_client-0.19.23.dist-info}/METADATA +29 -27
  56. dlms_spodes_client-0.19.23.dist-info/RECORD +61 -0
  57. dlms_spodes_client-0.19.22.dist-info/RECORD +0 -61
  58. {dlms_spodes_client-0.19.22.dist-info → dlms_spodes_client-0.19.23.dist-info}/WHEEL +0 -0
  59. {dlms_spodes_client-0.19.22.dist-info → dlms_spodes_client-0.19.23.dist-info}/entry_points.txt +0 -0
  60. {dlms_spodes_client-0.19.22.dist-info → dlms_spodes_client-0.19.23.dist-info}/top_level.txt +0 -0
@@ -1,90 +1,90 @@
1
- from DLMS_SPODES.enums import ServiceError, ConfirmedServiceError
2
- from .enums.ApplicationReference import ApplicationReference
3
- from .enums.VdeStateError import VdeStateError
4
- from .enums.HardwareResource import HardwareResource
5
- from .enums.Definition import Definition
6
- from .enums.Access import Access
7
- from .enums.Service import Service
8
- from .enums.Initiate import Initiate
9
- from .enums.LoadDataSet import LoadDataSet
10
- from .enums.Task import Task
11
-
12
-
13
- class GXDLMSConfirmedServiceError(Exception):
14
- """
15
- DLMS specific exception class that has error description available from getDescription method.
16
- """
17
-
18
- #
19
- # Constructor for Confirmed ServiceError.
20
- #
21
- # @param service
22
- # @param type
23
- # @param value
24
- #
25
- def __init__(self, service=None, type_=None, value=0):
26
- Exception.__init__(self, "ServiceError " + self.__getConfirmedServiceError(service) + " exception. " + self.__getServiceError(type_) + " " + self.__getServiceErrorValue(type_, value))
27
- self.confirmedServiceError = service
28
- self.serviceError = type_
29
- self.serviceErrorValue = value
30
-
31
- @classmethod
32
- def __getConfirmedServiceError(cls, stateError):
33
- str_ = ""
34
- if stateError == ConfirmedServiceError.INITIATE_ERROR:
35
- str_ = "Initiate Error"
36
- elif stateError == ConfirmedServiceError.READ:
37
- str_ = "Read"
38
- elif stateError == ConfirmedServiceError.WRITE:
39
- str_ = "Write"
40
- return str_
41
-
42
- @classmethod
43
- def __getServiceError(cls, error):
44
- str_ = ""
45
- if error == ServiceError.APPLICATION_REFERENCE:
46
- str_ = "Application reference"
47
- elif error == ServiceError.HARDWARE_RESOURCE:
48
- str_ = "Hardware resource"
49
- elif error == ServiceError.VDE_STATE_ERROR:
50
- str_ = "Vde state error"
51
- elif error == ServiceError.SERVICE:
52
- str_ = "Service"
53
- elif error == ServiceError.DEFINITION:
54
- str_ = "Definition"
55
- elif error == ServiceError.ACCESS:
56
- str_ = "Access"
57
- elif error == ServiceError.INITIATE:
58
- str_ = "Initiate"
59
- elif error == ServiceError.LOAD_DATA_SET:
60
- str_ = "Load dataset"
61
- elif error == ServiceError.TASK:
62
- str_ = "Task"
63
- elif error == ServiceError.OTHER:
64
- str_ = "Other Error"
65
- return str_
66
-
67
- @classmethod
68
- def __getServiceErrorValue(cls, error, value):
69
- str_ = ""
70
- if error == ServiceError.APPLICATION_REFERENCE:
71
- str_ = str(ApplicationReference(value))
72
- elif error == ServiceError.HARDWARE_RESOURCE:
73
- str_ = str(HardwareResource(value))
74
- elif error == ServiceError.VDE_STATE_ERROR:
75
- str_ = str(VdeStateError(value))
76
- elif error == ServiceError.SERVICE:
77
- str_ = str(Service(value))
78
- elif error == ServiceError.DEFINITION:
79
- str_ = str(Definition(value))
80
- elif error == ServiceError.ACCESS:
81
- str_ = str(Access(value))
82
- elif error == ServiceError.INITIATE:
83
- str_ = str(Initiate(value))
84
- elif error == ServiceError.LOAD_DATASET:
85
- str_ = str(LoadDataSet(value))
86
- elif error == ServiceError.TASK:
87
- str_ = str(Task(value))
88
- elif error == ServiceError.OTHER_ERROR:
89
- str_ = str(value)
90
- return str_
1
+ from DLMS_SPODES.enums import ServiceError, ConfirmedServiceError
2
+ from .enums.ApplicationReference import ApplicationReference
3
+ from .enums.VdeStateError import VdeStateError
4
+ from .enums.HardwareResource import HardwareResource
5
+ from .enums.Definition import Definition
6
+ from .enums.Access import Access
7
+ from .enums.Service import Service
8
+ from .enums.Initiate import Initiate
9
+ from .enums.LoadDataSet import LoadDataSet
10
+ from .enums.Task import Task
11
+
12
+
13
+ class GXDLMSConfirmedServiceError(Exception):
14
+ """
15
+ DLMS specific exception class that has error description available from getDescription method.
16
+ """
17
+
18
+ #
19
+ # Constructor for Confirmed ServiceError.
20
+ #
21
+ # @param service
22
+ # @param type
23
+ # @param value
24
+ #
25
+ def __init__(self, service=None, type_=None, value=0):
26
+ Exception.__init__(self, "ServiceError " + self.__getConfirmedServiceError(service) + " exception. " + self.__getServiceError(type_) + " " + self.__getServiceErrorValue(type_, value))
27
+ self.confirmedServiceError = service
28
+ self.serviceError = type_
29
+ self.serviceErrorValue = value
30
+
31
+ @classmethod
32
+ def __getConfirmedServiceError(cls, stateError):
33
+ str_ = ""
34
+ if stateError == ConfirmedServiceError.INITIATE_ERROR:
35
+ str_ = "Initiate Error"
36
+ elif stateError == ConfirmedServiceError.READ:
37
+ str_ = "Read"
38
+ elif stateError == ConfirmedServiceError.WRITE:
39
+ str_ = "Write"
40
+ return str_
41
+
42
+ @classmethod
43
+ def __getServiceError(cls, error):
44
+ str_ = ""
45
+ if error == ServiceError.APPLICATION_REFERENCE:
46
+ str_ = "Application reference"
47
+ elif error == ServiceError.HARDWARE_RESOURCE:
48
+ str_ = "Hardware resource"
49
+ elif error == ServiceError.VDE_STATE_ERROR:
50
+ str_ = "Vde state error"
51
+ elif error == ServiceError.SERVICE:
52
+ str_ = "Service"
53
+ elif error == ServiceError.DEFINITION:
54
+ str_ = "Definition"
55
+ elif error == ServiceError.ACCESS:
56
+ str_ = "Access"
57
+ elif error == ServiceError.INITIATE:
58
+ str_ = "Initiate"
59
+ elif error == ServiceError.LOAD_DATA_SET:
60
+ str_ = "Load dataset"
61
+ elif error == ServiceError.TASK:
62
+ str_ = "Task"
63
+ elif error == ServiceError.OTHER:
64
+ str_ = "Other Error"
65
+ return str_
66
+
67
+ @classmethod
68
+ def __getServiceErrorValue(cls, error, value):
69
+ str_ = ""
70
+ if error == ServiceError.APPLICATION_REFERENCE:
71
+ str_ = str(ApplicationReference(value))
72
+ elif error == ServiceError.HARDWARE_RESOURCE:
73
+ str_ = str(HardwareResource(value))
74
+ elif error == ServiceError.VDE_STATE_ERROR:
75
+ str_ = str(VdeStateError(value))
76
+ elif error == ServiceError.SERVICE:
77
+ str_ = str(Service(value))
78
+ elif error == ServiceError.DEFINITION:
79
+ str_ = str(Definition(value))
80
+ elif error == ServiceError.ACCESS:
81
+ str_ = str(Access(value))
82
+ elif error == ServiceError.INITIATE:
83
+ str_ = str(Initiate(value))
84
+ elif error == ServiceError.LOAD_DATASET:
85
+ str_ = str(LoadDataSet(value))
86
+ elif error == ServiceError.TASK:
87
+ str_ = str(Task(value))
88
+ elif error == ServiceError.OTHER_ERROR:
89
+ str_ = str(value)
90
+ return str_
@@ -1,139 +1,139 @@
1
- from DLMS_SPODES.enums import AssociationResult, AcseServiceUser
2
- from .enums import StateError, ServiceError, ErrorCode
3
-
4
-
5
- class GXDLMSException(Exception):
6
- """
7
- DLMS specific exception class that has error description available from
8
- GetDescription method.
9
- """
10
- def __init__(self, errCode, serviceErr=None):
11
- if isinstance(errCode, StateError) and isinstance(serviceErr, ServiceError):
12
- Exception.__init__(self, "Meter returns " + self.getStateError(errCode) + " exception. " + self.getServiceError(serviceErr))
13
- elif isinstance(errCode, AssociationResult):
14
- Exception.__init__(self, F'Connection is {errCode.name} with {serviceErr.name}')
15
- self.result = errCode
16
- self.diagnostic = serviceErr
17
- else:
18
- Exception.__init__(self, self.getDescription(errCode))
19
- self.errorCode = errCode
20
- self.stateError = None
21
- self.exceptionServiceError = None
22
-
23
- #
24
- # Gets state error description.
25
- #
26
- # @param stateError
27
- # State error enumerator value.
28
- # State error as an string.
29
- #
30
- @classmethod
31
- def getStateError(cls, stateError):
32
- if stateError == StateError.SERVICE_NOT_ALLOWED:
33
- ret = "Service not allowed"
34
- elif stateError == StateError.SERVICE_UNKNOWN:
35
- ret = "Service unknown"
36
- else:
37
- ret = "Invalid error code."
38
- return ret
39
-
40
- #
41
- # Gets service error description.
42
- #
43
- # @param serviceError
44
- # Service error enumerator value.
45
- # Service error as an string.
46
- #
47
- @classmethod
48
- def getServiceError(cls, serviceError):
49
- if serviceError == ServiceError.OPERATION_NOT_POSSIBLE:
50
- ret = "Operation not possible"
51
- elif serviceError == ServiceError.SERVICE_NOT_SUPPORTED:
52
- ret = "Service not supported"
53
- elif serviceError == ServiceError.OTHER_REASON:
54
- ret = "Other reason"
55
- else:
56
- ret = "Invalid error code."
57
- return ret
58
-
59
- #
60
- # Get result as a string.
61
- #
62
- # @param result
63
- # Enumeration value of AssociationResult.
64
- # String description of AssociationResult.
65
- #
66
- @classmethod
67
- def getResult(cls, result):
68
- if result == AssociationResult.REJECTED_PERMANENT:
69
- ret = "permanently rejected"
70
- elif result == AssociationResult.REJECTED_TRANSIENT:
71
- ret = "transient rejected"
72
- else:
73
- ret = "Invalid error code."
74
- return ret
75
-
76
- #
77
- # Get diagnostic as a string.
78
- #
79
- # @param value
80
- # Enumeration value of SourceDiagnostic.
81
- # String description of SourceDiagnostic.
82
- #
83
- @classmethod
84
- def getDiagnostic(cls, value):
85
- if value == AcseServiceUser.NO_REASON_GIVEN:
86
- ret = "No reason is given."
87
- elif value == AcseServiceUser.APPLICATION_CONTEXT_NAME_NOT_SUPPORTED:
88
- ret = "The application context name is not supported."
89
- elif value == AcseServiceUser.NOT_RECOGNISED:
90
- ret = "The authentication mechanism name is not recognized."
91
- elif value == AcseServiceUser.MECHANISM_NAME_REGUIRED:
92
- ret = "Authentication mechanism name is required."
93
- elif value == AcseServiceUser.AUTHENTICATION_FAILURE:
94
- ret = "Authentication failure."
95
- elif value == AcseServiceUser.AUTHENTICATION_REQUIRED:
96
- ret = "Authentication is required."
97
- else:
98
- ret = "Invalid error code."
99
- return ret
100
-
101
- @classmethod
102
- def getDescription(cls, errCode):
103
- if errCode == ErrorCode.REJECTED:
104
- str_ = "Rejected"
105
- elif errCode == ErrorCode.OK:
106
- str_ = ""
107
- elif errCode == ErrorCode.HARDWARE_FAULT:
108
- str_ = "Access Error : Device reports a hardware fault."
109
- elif errCode == ErrorCode.TEMPORARY_FAILURE:
110
- str_ = "Access Error : Device reports a temporary failure."
111
- elif errCode == ErrorCode.READ_WRITE_DENIED:
112
- str_ = "Access Error : Device reports Read-Write denied."
113
- elif errCode == ErrorCode.UNDEFINED_OBJECT:
114
- str_ = "Access Error : Device reports a undefined object."
115
- elif errCode == ErrorCode.INCONSISTENT_CLASS:
116
- str_ = "Access Error : " + "Device reports a inconsistent Class or object."
117
- elif errCode == ErrorCode.UNAVAILABLE_OBJECT:
118
- str_ = "Access Error : Device reports a unavailable object."
119
- elif errCode == ErrorCode.UNMATCHED_TYPE:
120
- str_ = "Access Error : Device reports a unmatched type."
121
- elif errCode == ErrorCode.ACCESS_VIOLATED:
122
- str_ = "Access Error : Device reports scope of access violated."
123
- elif errCode == ErrorCode.DATA_BLOCK_UNAVAILABLE:
124
- str_ = "Access Error : Data Block Unavailable."
125
- elif errCode == ErrorCode.LONG_GET_OR_READ_ABORTED:
126
- str_ = "Access Error : Long Get Or Read Aborted."
127
- elif errCode == ErrorCode.NO_LONG_GET_OR_READ_IN_PROGRESS:
128
- str_ = "Access Error : No Long Get Or Read In Progress."
129
- elif errCode == ErrorCode.LONG_SET_OR_WRITE_ABORTED:
130
- str_ = "Access Error : Long Set Or Write Aborted."
131
- elif errCode == ErrorCode.NO_LONG_SET_OR_WRITE_IN_PROGRESS:
132
- str_ = "Access Error : No Long Set Or Write In Progress."
133
- elif errCode == ErrorCode.DATA_BLOCK_NUMBER_INVALID:
134
- str_ = "Access Error : Data Block Number Invalid."
135
- elif errCode == ErrorCode.OTHER_REASON:
136
- str_ = "Access Error : Other Reason."
137
- else:
138
- str_ = "Access Error : Unknown error."
139
- return str_
1
+ from DLMS_SPODES.enums import AssociationResult, AcseServiceUser
2
+ from .enums import StateError, ServiceError, ErrorCode
3
+
4
+
5
+ class GXDLMSException(Exception):
6
+ """
7
+ DLMS specific exception class that has error description available from
8
+ GetDescription method.
9
+ """
10
+ def __init__(self, errCode, serviceErr=None):
11
+ if isinstance(errCode, StateError) and isinstance(serviceErr, ServiceError):
12
+ Exception.__init__(self, "Meter returns " + self.getStateError(errCode) + " exception. " + self.getServiceError(serviceErr))
13
+ elif isinstance(errCode, AssociationResult):
14
+ Exception.__init__(self, F'Connection is {errCode.name} with {serviceErr.name}')
15
+ self.result = errCode
16
+ self.diagnostic = serviceErr
17
+ else:
18
+ Exception.__init__(self, self.getDescription(errCode))
19
+ self.errorCode = errCode
20
+ self.stateError = None
21
+ self.exceptionServiceError = None
22
+
23
+ #
24
+ # Gets state error description.
25
+ #
26
+ # @param stateError
27
+ # State error enumerator value.
28
+ # State error as an string.
29
+ #
30
+ @classmethod
31
+ def getStateError(cls, stateError):
32
+ if stateError == StateError.SERVICE_NOT_ALLOWED:
33
+ ret = "Service not allowed"
34
+ elif stateError == StateError.SERVICE_UNKNOWN:
35
+ ret = "Service unknown"
36
+ else:
37
+ ret = "Invalid error code."
38
+ return ret
39
+
40
+ #
41
+ # Gets service error description.
42
+ #
43
+ # @param serviceError
44
+ # Service error enumerator value.
45
+ # Service error as an string.
46
+ #
47
+ @classmethod
48
+ def getServiceError(cls, serviceError):
49
+ if serviceError == ServiceError.OPERATION_NOT_POSSIBLE:
50
+ ret = "Operation not possible"
51
+ elif serviceError == ServiceError.SERVICE_NOT_SUPPORTED:
52
+ ret = "Service not supported"
53
+ elif serviceError == ServiceError.OTHER_REASON:
54
+ ret = "Other reason"
55
+ else:
56
+ ret = "Invalid error code."
57
+ return ret
58
+
59
+ #
60
+ # Get result as a string.
61
+ #
62
+ # @param result
63
+ # Enumeration value of AssociationResult.
64
+ # String description of AssociationResult.
65
+ #
66
+ @classmethod
67
+ def getResult(cls, result):
68
+ if result == AssociationResult.REJECTED_PERMANENT:
69
+ ret = "permanently rejected"
70
+ elif result == AssociationResult.REJECTED_TRANSIENT:
71
+ ret = "transient rejected"
72
+ else:
73
+ ret = "Invalid error code."
74
+ return ret
75
+
76
+ #
77
+ # Get diagnostic as a string.
78
+ #
79
+ # @param value
80
+ # Enumeration value of SourceDiagnostic.
81
+ # String description of SourceDiagnostic.
82
+ #
83
+ @classmethod
84
+ def getDiagnostic(cls, value):
85
+ if value == AcseServiceUser.NO_REASON_GIVEN:
86
+ ret = "No reason is given."
87
+ elif value == AcseServiceUser.APPLICATION_CONTEXT_NAME_NOT_SUPPORTED:
88
+ ret = "The application context name is not supported."
89
+ elif value == AcseServiceUser.NOT_RECOGNISED:
90
+ ret = "The authentication mechanism name is not recognized."
91
+ elif value == AcseServiceUser.MECHANISM_NAME_REGUIRED:
92
+ ret = "Authentication mechanism name is required."
93
+ elif value == AcseServiceUser.AUTHENTICATION_FAILURE:
94
+ ret = "Authentication failure."
95
+ elif value == AcseServiceUser.AUTHENTICATION_REQUIRED:
96
+ ret = "Authentication is required."
97
+ else:
98
+ ret = "Invalid error code."
99
+ return ret
100
+
101
+ @classmethod
102
+ def getDescription(cls, errCode):
103
+ if errCode == ErrorCode.REJECTED:
104
+ str_ = "Rejected"
105
+ elif errCode == ErrorCode.OK:
106
+ str_ = ""
107
+ elif errCode == ErrorCode.HARDWARE_FAULT:
108
+ str_ = "Access Error : Device reports a hardware fault."
109
+ elif errCode == ErrorCode.TEMPORARY_FAILURE:
110
+ str_ = "Access Error : Device reports a temporary failure."
111
+ elif errCode == ErrorCode.READ_WRITE_DENIED:
112
+ str_ = "Access Error : Device reports Read-Write denied."
113
+ elif errCode == ErrorCode.UNDEFINED_OBJECT:
114
+ str_ = "Access Error : Device reports a undefined object."
115
+ elif errCode == ErrorCode.INCONSISTENT_CLASS:
116
+ str_ = "Access Error : " + "Device reports a inconsistent Class or object."
117
+ elif errCode == ErrorCode.UNAVAILABLE_OBJECT:
118
+ str_ = "Access Error : Device reports a unavailable object."
119
+ elif errCode == ErrorCode.UNMATCHED_TYPE:
120
+ str_ = "Access Error : Device reports a unmatched type."
121
+ elif errCode == ErrorCode.ACCESS_VIOLATED:
122
+ str_ = "Access Error : Device reports scope of access violated."
123
+ elif errCode == ErrorCode.DATA_BLOCK_UNAVAILABLE:
124
+ str_ = "Access Error : Data Block Unavailable."
125
+ elif errCode == ErrorCode.LONG_GET_OR_READ_ABORTED:
126
+ str_ = "Access Error : Long Get Or Read Aborted."
127
+ elif errCode == ErrorCode.NO_LONG_GET_OR_READ_IN_PROGRESS:
128
+ str_ = "Access Error : No Long Get Or Read In Progress."
129
+ elif errCode == ErrorCode.LONG_SET_OR_WRITE_ABORTED:
130
+ str_ = "Access Error : Long Set Or Write Aborted."
131
+ elif errCode == ErrorCode.NO_LONG_SET_OR_WRITE_IN_PROGRESS:
132
+ str_ = "Access Error : No Long Set Or Write In Progress."
133
+ elif errCode == ErrorCode.DATA_BLOCK_NUMBER_INVALID:
134
+ str_ = "Access Error : Data Block Number Invalid."
135
+ elif errCode == ErrorCode.OTHER_REASON:
136
+ str_ = "Access Error : Other Reason."
137
+ else:
138
+ str_ = "Access Error : Unknown error."
139
+ return str_
@@ -1,33 +1,33 @@
1
- from dataclasses import dataclass
2
- from . import GXDLMSSettings, GXByteBuffer, ResponseType
3
- from .enums import ErrorCode
4
- from DLMS_SPODES.enums import SetRequest, XDLMSAPDU, ACSEAPDU
5
-
6
-
7
- @dataclass
8
- class GXDLMSLNParameters:
9
- settings: GXDLMSSettings
10
- invokeId: int
11
- command: XDLMSAPDU | ACSEAPDU
12
- requestType: ResponseType | SetRequest # | ActionRequestType
13
- attributeDescriptor: GXByteBuffer | None
14
- data: GXByteBuffer | None
15
- # Reply status.
16
- status: ErrorCode | int
17
- windowSize: int = 1
18
- streaming: bool = False
19
- """ Is this last block in send. """
20
-
21
- def __post_init__(self):
22
- self.blockIndex = self.settings.blockIndex
23
- self.blockNumberAck = self.settings.blockNumberAck
24
- self.time = None
25
- """ Send date and time. This is used in Data notification messages. """
26
- self.multipleBlocks = self.settings.is_multiple_block()
27
- """ Are there more data to send or more data to receive"""
28
- self.lastBlock = self.settings.count == self.settings.index
29
- """ Is this last block in send. """
30
- if self.settings:
31
- self.settings.command = self.command
32
- if self.command == XDLMSAPDU.GET_REQUEST and self.requestType != ResponseType.WITH_DATABLOCK:
33
- self.settings.commandType = self.requestType
1
+ from dataclasses import dataclass
2
+ from . import GXDLMSSettings, GXByteBuffer, ResponseType
3
+ from .enums import ErrorCode
4
+ from DLMS_SPODES.enums import SetRequest, XDLMSAPDU, ACSEAPDU
5
+
6
+
7
+ @dataclass
8
+ class GXDLMSLNParameters:
9
+ settings: GXDLMSSettings
10
+ invokeId: int
11
+ command: XDLMSAPDU | ACSEAPDU
12
+ requestType: ResponseType | SetRequest # | ActionRequestType
13
+ attributeDescriptor: GXByteBuffer | None
14
+ data: GXByteBuffer | None
15
+ # Reply status.
16
+ status: ErrorCode | int
17
+ windowSize: int = 1
18
+ streaming: bool = False
19
+ """ Is this last block in send. """
20
+
21
+ def __post_init__(self):
22
+ self.blockIndex = self.settings.blockIndex
23
+ self.blockNumberAck = self.settings.blockNumberAck
24
+ self.time = None
25
+ """ Send date and time. This is used in Data notification messages. """
26
+ self.multipleBlocks = self.settings.is_multiple_block()
27
+ """ Are there more data to send or more data to receive"""
28
+ self.lastBlock = self.settings.count == self.settings.index
29
+ """ Is this last block in send. """
30
+ if self.settings:
31
+ self.settings.command = self.command
32
+ if self.command == XDLMSAPDU.GET_REQUEST and self.requestType != ResponseType.WITH_DATABLOCK:
33
+ self.settings.commandType = self.requestType
@@ -1,21 +1,21 @@
1
- from dataclasses import dataclass
2
- from DLMS_SPODES.enums import VariableAccessSpecification
3
- from . import GXDLMSSettings, GXByteBuffer
4
- from .enums.Command import Command
5
-
6
-
7
- @dataclass
8
- class GXDLMSSNParameters:
9
- settings: GXDLMSSettings
10
- command: Command
11
- count: int
12
- requestType: VariableAccessSpecification
13
- attributeDescriptor: GXByteBuffer
14
- data: GXByteBuffer | None
15
-
16
- def __post_init__(self):
17
- self.blockIndex = self.settings.blockIndex
18
- self.multipleBlocks = False
19
- """ Are there more data to send or more data to receive. """
20
- self.time = None
21
- """ Send date and time. This is used in Data notification messages. """
1
+ from dataclasses import dataclass
2
+ from DLMS_SPODES.enums import VariableAccessSpecification
3
+ from . import GXDLMSSettings, GXByteBuffer
4
+ from .enums.Command import Command
5
+
6
+
7
+ @dataclass
8
+ class GXDLMSSNParameters:
9
+ settings: GXDLMSSettings
10
+ command: Command
11
+ count: int
12
+ requestType: VariableAccessSpecification
13
+ attributeDescriptor: GXByteBuffer
14
+ data: GXByteBuffer | None
15
+
16
+ def __post_init__(self):
17
+ self.blockIndex = self.settings.blockIndex
18
+ self.multipleBlocks = False
19
+ """ Are there more data to send or more data to receive. """
20
+ self.time = None
21
+ """ Send date and time. This is used in Data notification messages. """