forked from KayFelicities/698trans
-
Notifications
You must be signed in to change notification settings - Fork 0
/
set_service.py
78 lines (66 loc) · 2.62 KB
/
set_service.py
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
'''set service'''
from shared_functions import * # NOQA
def SetRequestNormal(data):
offset = 0
offset += take_PIID(data[offset:])
offset += take_OAD(data[offset:])
offset += take_Data(data[offset:])
return offset
def SetRequestNormalList(data):
offset = 0
offset += take_PIID(data[offset:])
object_num = get_num_of_SEQUENCE(data[offset:], '对象属性')
offset += 1
config.line_level += 1
for object_count in range(object_num):
end_flag = 1 if object_count == object_num - 1 else 0
offset += take_OAD(data[offset:])
offset += take_Data(data[offset:], end_flag=end_flag)
config.line_level -= 1
return offset
def SetThenGetRequestNormalList(data):
offset = 0
offset += take_PIID(data[offset:])
object_num = get_num_of_SEQUENCE(data[offset:], '设置后读取对象属性')
offset += 1
config.line_level += 1
for object_count in range(object_num):
end_flag = 1 if object_count == object_num - 1 else 0
offset += take_OAD(data[offset:], '设置的对象属性:')
offset += take_Data(data[offset:], '数据:')
offset += take_OAD(data[offset:], '读取的对象属性:')
offset += take_unsigned(data[offset:], '延时读取时间:')
config.line_level -= 1
return offset
def SetResponseNormal(data):
offset = 0
offset += take_PIID_ACD(data[offset:])
offset += take_OAD(data[offset:])
offset += take_DAR(data[offset:], '设置执行结果')
return offset
def SetResponseNormalList(data):
offset = 0
offset += take_PIID_ACD(data[offset:])
set_result_num = get_num_of_SEQUENCE(data[offset:], '对象属性设置结果')
offset += 1
config.line_level += 1
for set_result_count in range(set_result_num):
end_flag = 1 if set_result_count == set_result_num - 1 else 0
offset += take_OAD(data[offset:])
offset += take_DAR(data[offset:], '设置执行结果', end_flag=end_flag)
config.line_level -= 1
return offset
def SetThenGetResponseNormalList(data):
offset = 0
offset += take_PIID_ACD(data[offset:])
set_result_num = get_num_of_SEQUENCE(data[offset:], '对象属性设置后读取结果')
offset += 1
config.line_level += 1
for set_result_count in range(set_result_num):
end_flag = 1 if set_result_count == set_result_num - 1 else 0
offset += take_OAD(data[offset:])
offset += take_DAR(data[offset:], '设置执行结果', level=config.line_level)
offset += take_OAD(data[offset:])
offset += take_Get_Result(data[offset:], end_flag=end_flag)
config.line_level -= 1
return offset