print("Value:",val[i])
return ids,val,line
-
# section: process_string {{{1
######################################################
def process_string(line,le,size1,size2):
for i in range(0,size2):
val[i],line=readbyte(line)
string=''.join(chr(i) for i in val)
-
+ string=string[:-1]
if size1>0 and size2>0:
- print("Id:",ids,"Value:",val,"String:",repr(string[:-1]))
+ print("Id:",ids,"Value:",val,"String:",repr(string))
elif size1>0:
print("Id:",ids)
elif size2>0:
- print("Value:",val,"String:",repr(string[:-1]))
- return ids,string,line
+ print("Value:",val,"String:",repr(string))
+ return ids,val,line
# section: process_object {{{1
######################################################
-def process_object(line,le):
+def process_object(line,le,size1,size2):
+ ids=[0]*size1
+ val=[0]*size2
+ if size1>0:
+ ids,line=readbyte(line)
+ for i in range(0,size2):
+ val[i],line=readbyte(line)
+ if size1>0 and size2>0:
+ print("Id:",ids,"Value:",val)
+ elif size1>0:
+ print("Id:",ids)
+ elif size2>0:
+ print("Value:",val)
return ids,val,line
-
# section: process_crc {{{-1
######################################################
def process_crc(line):
elif cl==7 and (ds==gf.DATA_REQUEST or ds==gf.DATA_MESSAGE) and os==gf.OS_SET:
ids7,val7,line=process_string(line,ale,1,ale-1)
# section: class 10 {{{2
-# elif cl==10:
-# ids10,val10,line=process_object(line,ale)
+ elif cl==10 and ds==gf.DATA_REQUEST and os==gf.OS_GET:
+ ids10,val10,line=process_object(line,ale,1,0)
+ elif cl==10 and ds==gf.DATA_REPLY and os==gf.OS_GET:
+ ids10,val10,line=process_object(line,ale,0,ale)
+ elif cl==10 and (ds==gf.DATA_REQUEST or ds==gf.DATA_MESSAGE) and os==gf.OS_SET:
+ ids10,val10,line=process_object(line,ale,1,ale-1)
# section: class 11 {{{2
elif cl==11 and ds==gf.DATA_REQUEST and os==gf.OS_GET:
ids11,val11,line=process_data(line,ale,1,0)