1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 'Use for communications regarding the NXT filesystem and such ***ADVANCED USERS ONLY***'
16
21
23 tgram = _create(opcode)
24 tgram.add_filename(fname)
25 return tgram
26
28 tgram = _create(opcode)
29 tgram.add_u8(handle)
30 return tgram
31
33 return _create_with_file(opcode, fname)
34
40
42 tgram = _create_with_file(opcode, fname)
43 tgram.add_u32(n_bytes)
44 return tgram
45
50
51 -def read(opcode, handle, n_bytes):
52 tgram = _create_with_handle(opcode, handle)
53 tgram.add_u16(n_bytes)
54 return tgram
55
62
63 -def write(opcode, handle, data):
64 tgram = _create_with_handle(opcode, handle)
65 tgram.add_string(len(data), data)
66 return tgram
67
73
74 -def close(opcode, handle):
75 return _create_with_handle(opcode, handle)
76
81
83 return _create_with_file(opcode, fname)
84
90
92 return _create_with_file(opcode, fname)
93
100
102 return _create_with_handle(opcode, handle)
103
105 return _create(opcode)
106
108 tgram.check_status()
109 prot_minor = tgram.parse_u8()
110 prot_major = tgram.parse_u8()
111 prot_version = (prot_major, prot_minor)
112 fw_minor = tgram.parse_u8()
113 fw_major = tgram.parse_u8()
114 fw_version = (fw_major, fw_minor)
115 return (prot_version, fw_version)
116
118 tgram = _create_with_file(opcode, fname)
119 tgram.add_u32(n_bytes)
120 return tgram
121
123 return _create_with_file(opcode, fname)
124
129
131 tgram = _create_with_file(opcode, fname)
132 tgram.add_u32(n_bytes)
133 return tgram
134
136 return _create_with_file(opcode, fname)
137
143
145 return _create_with_file(opcode, mname)
146
155
157 return _create_with_handle(opcode, handle)
158
160 return _create_with_handle(opcode, handle)
161
163 tgram = _create(opcode)
164 tgram.add_u32(mod_id)
165 tgram.add_u16(offset)
166 tgram.add_u16(n_bytes)
167 return tgram
168
175
177 tgram = _create(opcode)
178 tgram.add_u32(mod_id)
179 tgram.add_u16(offset)
180 tgram.add_u16(len(content))
181 tgram.add_string(len(content), content)
182 return tgram
183
189
191
192 tgram = _create(opcode)
193 tgram.add_string(19, "Let's dance: SAMBA\0")
194 return tgram
195
201
203 tgram = _create(opcode)
204
205 tgram.add_string(len(bname), bname)
206 return tgram
207
210
212 return _create(opcode)
213
229
231 return _create(opcode)
232
235
237 tgram = _create(opcode)
238 tgram.add_u8(buf_num)
239 return tgram
240
246
248 tgram = _create(opcode)
249 tgram.add_u8(buf_num)
250 tgram.add_u8(n_bytes)
251 return tgram
252
259
261
262 return _create(opcode)
263
266
267 OPCODES = {
268 0x80: (open_read, _parse_open_read),
269 0x81: (open_write, _parse_open_write),
270 0x82: (read, _parse_read),
271 0x83: (write, _parse_write),
272 0x84: (close, _parse_close),
273 0x85: (delete, _parse_delete),
274 0x86: (find_first, _parse_find),
275 0x87: (find_next, _parse_find),
276 0x88: (get_firmware_version, _parse_get_firmware_version),
277 0x89: (open_write_linear, _parse_open_write),
278 0x8A: (open_read_linear, _parse_open_read_linear),
279 0x8B: (open_write_data, _parse_open_write),
280 0x8C: (open_append_data, _parse_open_append_data),
281 0x90: (request_first_module, _parse_request_module),
282 0x91: (request_next_module, _parse_request_module),
283 0x92: (close_module_handle, _parse_close),
284 0x94: (read_io_map, _parse_read_io_map),
285 0x95: (write_io_map, _parse_write_io_map),
286 0x97: (boot, _parse_boot),
287 0x98: (set_brick_name, _parse_set_brick_name),
288 0x9B: (get_device_info, _parse_get_device_info),
289 0xA0: (delete_user_flash, _parse_delete_user_flash),
290 0xA1: (poll_command_length, _parse_poll_command_length),
291 0xA2: (poll_command, _parse_poll_command),
292 0xA4: (bluetooth_factory_reset, _parse_bluetooth_factory_reset),
293 }
294