Package ckbot :: Module rb
[hide private]
[frames] | no frames]

Source Code for Module ckbot.rb

 1  RB_NMT = 0x00 
 2  RB_COMMAND = 0x0100 
 3  RB_SENSOR = 0x0200 
 4  RB_USART = 0X0300 
 5  RB_NEIGHBOR = 0X0400 
 6  RB_DICT_RESP = 0x0500         
 7  RB_DICT_REQ = 0x0600 
 8  RB_HEARTBEAT = 0x0700     
 9   
10   
11  RB_CS_READ = 0x40 
12  RB_CS_WRITE = 0x20 
13   
14  RB_CS_START = 0x01 
15  RB_CS_STOP = 0x02 
16  RB_CS_RESET = 129 
17   
18  permissions = {0x01: 'Read Only',  
19                 0x02: 'Write Only',  
20                 0x03: 'Read Write'}  
21   
22  RB_PERM_READ = 0x01 
23  RB_PERM_WRITE = 0x02 
24   
25  types = {0x41: 'BOOLEAN', 
26           0x42: 'SINT8', 
27           0x43: 'SINT16', 
28           0x44: 'SINT32', 
29           0x45: 'UINT8', 
30           0x46: 'UINT16', 
31           0x47: 'UINT32', 
32           0x48: 'FLOAT32', 
33           0x49: 'STRING32', 
34           0x51: 'FLOAT64', 
35           0x55: 'SINT64', 
36           0x5B: 'UINT64', 
37           0x60: 'PM_CONFIG', 
38           0x61: 'PM_MAPPING', 
39           0x63: 'IDENTITY'} 
40   
41  for k,v in types.iteritems(): 
42    exec('RB_%s = %d' % (v,k)) 
43     
44  DTYPES = { 0x41 : (bool,'B','bool',1),  
45             0x42 : (int,'b','sint8',1),  
46             0x43 : (int,'h','sint16',2), 
47             0x44 : (int, 'i', 'sint32',4), 
48             0x45 : (int,'B','uint8',1),  
49             0x46 : (int,'H','uint16',2), 
50             0x47 : (long, 'I', 'uint32',4), 
51             0x48 : (float, 'f', 'float32',4), 
52             0x49 : (str, 's', 'string32',32), 
53             0x50 : (float, 'f', 'float64',8), 
54             0x55 : (long, 'I', 'sint64',8), 
55             0x5B : (long,'I','uint64',8), 
56             0x60 : (int, 'I', 'pm_config',4), 
57             0x61 : (long, 'I', 'pm_mapping',1013), 
58             0x63 : (int, 'B', 'identity',1) 
59             } 
60   
61 -def decode_boolean(data):
62 pass
63
64 -def decode_sint8(data):
65 pass
66
67 -def decode_sint16(data):
68 pass
69 70 decode = {'BOOLEAN': decode_boolean, 71 'SINT8': decode_sint8, 72 'SINT16': decode_sint16} 73 #ETC. 74