response.py
1.4 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
from dataclasses import asdict, dataclass
from json import dumps
@dataclass
class Response:
code: int
msg: str
success: bool
@property
def __dict__(self):
return asdict(self)
@property
def json(self):
return dumps(self.__dict__)
@dataclass
class DeviceDataHeader:
cmd: str
type: int
factory: str
@property
def __dict__(self):
return asdict(self)
@property
def json(self):
return dumps(self.__dict__)
@dataclass
class GasConcentration:
addr: int
type: int
value: float
unit: str
lowAlarmValue: float
highAlarmValue: float
gasRange: float
gasType: int
gasName: str
lastUpdateTime: str
@property
def __dict__(self):
return asdict(self)
@property
def json(self):
return dumps(self.__dict__)
@dataclass
class GasConcentrationDeviceRequest(DeviceDataHeader):
data: GasConcentration
@property
def __dict__(self):
return asdict(self)
@property
def json(self):
return dumps(self.__dict__)
@dataclass
class VideoAnalysis:
addr: int
type: int
channelId: int
channelName: str
eventName: str
base64Image: str
lastUpdateTime: str
@dataclass
class VideoAnalysisRequest(DeviceDataHeader):
data: VideoAnalysis
@property
def __dict__(self):
return asdict(self)
@property
def json(self):
return dumps(self.__dict__)