forked from TionAPI/tion_python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtion.py
More file actions
43 lines (36 loc) · 943 Bytes
/
tion.py
File metadata and controls
43 lines (36 loc) · 943 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import abc
class tion:
@abc.abstractmethod
def _send_request(self, request: bytearray) -> bytearray:
""" Send request to device
Args:
request : array of bytes to send to device
Returns:
array of bytes with device response
"""
pass
@abc.abstractmethod
def _decode_response(self, response: bytearray) -> dict:
""" Decode response from device
Args:
response: array of bytes with data from device, taken from _send_request
Returns:
dictionary with device response
"""
pass
@abc.abstractmethod
def _encode_request(self, request: dict) -> bytearray:
""" Encode dictionary of request to byte array
Args:
request: dictionry with request
Returns:
Byte array for sending to device
"""
pass
@abc.abstractmethod
def get() -> dict:
""" Get device information
Returns:
dictionay with device paramters
"""
pass