-
Notifications
You must be signed in to change notification settings - Fork 6
/
CommandMsg.java
623 lines (539 loc) · 17.1 KB
/
CommandMsg.java
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
/**
* This class is automatically generated by mig. DO NOT EDIT THIS FILE.
* This class implements a Java interface to the 'CommandMsg'
* message type.
*/
public class CommandMsg extends net.tinyos.message.Message {
/** The default size of this message type in bytes. */
public static final int DEFAULT_MESSAGE_SIZE = 17;
/** The Active Message type associated with this message. */
public static final int AM_TYPE = 14;
/** Create a new CommandMsg of size 17. */
public CommandMsg() {
super(DEFAULT_MESSAGE_SIZE);
amTypeSet(AM_TYPE);
}
/** Create a new CommandMsg of the given data_length. */
public CommandMsg(int data_length) {
super(data_length);
amTypeSet(AM_TYPE);
}
/**
* Create a new CommandMsg with the given data_length
* and base offset.
*/
public CommandMsg(int data_length, int base_offset) {
super(data_length, base_offset);
amTypeSet(AM_TYPE);
}
/**
* Create a new CommandMsg using the given byte array
* as backing store.
*/
public CommandMsg(byte[] data) {
super(data);
amTypeSet(AM_TYPE);
}
/**
* Create a new CommandMsg using the given byte array
* as backing store, with the given base offset.
*/
public CommandMsg(byte[] data, int base_offset) {
super(data, base_offset);
amTypeSet(AM_TYPE);
}
/**
* Create a new CommandMsg using the given byte array
* as backing store, with the given base offset and data length.
*/
public CommandMsg(byte[] data, int base_offset, int data_length) {
super(data, base_offset, data_length);
amTypeSet(AM_TYPE);
}
/**
* Create a new CommandMsg embedded in the given message
* at the given base offset.
*/
public CommandMsg(net.tinyos.message.Message msg, int base_offset) {
super(msg, base_offset, DEFAULT_MESSAGE_SIZE);
amTypeSet(AM_TYPE);
}
/**
* Create a new CommandMsg embedded in the given message
* at the given base offset and length.
*/
public CommandMsg(net.tinyos.message.Message msg, int base_offset, int data_length) {
super(msg, base_offset, data_length);
amTypeSet(AM_TYPE);
}
/**
/* Return a String representation of this message. Includes the
* message type name and the non-indexed field values.
*/
public String toString() {
String s = "Message <CommandMsg> \n";
try {
s += " [command_code=0x"+Long.toHexString(get_command_code())+"]\n";
} catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
try {
s += " [command_version=0x"+Long.toHexString(get_command_version())+"]\n";
} catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
try {
s += " [command_id=0x"+Long.toHexString(get_command_id())+"]\n";
} catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
try {
s += " [reply_on_command=0x"+Long.toHexString(get_reply_on_command())+"]\n";
} catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
try {
s += " [reply_on_command_id=0x"+Long.toHexString(get_reply_on_command_id())+"]\n";
} catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
try {
s += " [command_data=0x"+Long.toHexString(get_command_data())+"]\n";
} catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
try {
s += " [command_data_next=";
for (int i = 0; i < 4; i++) {
s += "0x"+Long.toHexString(getElement_command_data_next(i) & 0xffff)+" ";
}
s += "]\n";
} catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
return s;
}
// Message-type-specific access methods appear below.
/////////////////////////////////////////////////////////
// Accessor methods for field: command_code
// Field type: short, unsigned
// Offset (bits): 0
// Size (bits): 8
/////////////////////////////////////////////////////////
/**
* Return whether the field 'command_code' is signed (false).
*/
public static boolean isSigned_command_code() {
return false;
}
/**
* Return whether the field 'command_code' is an array (false).
*/
public static boolean isArray_command_code() {
return false;
}
/**
* Return the offset (in bytes) of the field 'command_code'
*/
public static int offset_command_code() {
return (0 / 8);
}
/**
* Return the offset (in bits) of the field 'command_code'
*/
public static int offsetBits_command_code() {
return 0;
}
/**
* Return the value (as a short) of the field 'command_code'
*/
public short get_command_code() {
return (short)getUIntBEElement(offsetBits_command_code(), 8);
}
/**
* Set the value of the field 'command_code'
*/
public void set_command_code(short value) {
setUIntBEElement(offsetBits_command_code(), 8, value);
}
/**
* Return the size, in bytes, of the field 'command_code'
*/
public static int size_command_code() {
return (8 / 8);
}
/**
* Return the size, in bits, of the field 'command_code'
*/
public static int sizeBits_command_code() {
return 8;
}
/////////////////////////////////////////////////////////
// Accessor methods for field: command_version
// Field type: short, unsigned
// Offset (bits): 8
// Size (bits): 8
/////////////////////////////////////////////////////////
/**
* Return whether the field 'command_version' is signed (false).
*/
public static boolean isSigned_command_version() {
return false;
}
/**
* Return whether the field 'command_version' is an array (false).
*/
public static boolean isArray_command_version() {
return false;
}
/**
* Return the offset (in bytes) of the field 'command_version'
*/
public static int offset_command_version() {
return (8 / 8);
}
/**
* Return the offset (in bits) of the field 'command_version'
*/
public static int offsetBits_command_version() {
return 8;
}
/**
* Return the value (as a short) of the field 'command_version'
*/
public short get_command_version() {
return (short)getUIntBEElement(offsetBits_command_version(), 8);
}
/**
* Set the value of the field 'command_version'
*/
public void set_command_version(short value) {
setUIntBEElement(offsetBits_command_version(), 8, value);
}
/**
* Return the size, in bytes, of the field 'command_version'
*/
public static int size_command_version() {
return (8 / 8);
}
/**
* Return the size, in bits, of the field 'command_version'
*/
public static int sizeBits_command_version() {
return 8;
}
/////////////////////////////////////////////////////////
// Accessor methods for field: command_id
// Field type: int, unsigned
// Offset (bits): 16
// Size (bits): 16
/////////////////////////////////////////////////////////
/**
* Return whether the field 'command_id' is signed (false).
*/
public static boolean isSigned_command_id() {
return false;
}
/**
* Return whether the field 'command_id' is an array (false).
*/
public static boolean isArray_command_id() {
return false;
}
/**
* Return the offset (in bytes) of the field 'command_id'
*/
public static int offset_command_id() {
return (16 / 8);
}
/**
* Return the offset (in bits) of the field 'command_id'
*/
public static int offsetBits_command_id() {
return 16;
}
/**
* Return the value (as a int) of the field 'command_id'
*/
public int get_command_id() {
return (int)getUIntBEElement(offsetBits_command_id(), 16);
}
/**
* Set the value of the field 'command_id'
*/
public void set_command_id(int value) {
setUIntBEElement(offsetBits_command_id(), 16, value);
}
/**
* Return the size, in bytes, of the field 'command_id'
*/
public static int size_command_id() {
return (16 / 8);
}
/**
* Return the size, in bits, of the field 'command_id'
*/
public static int sizeBits_command_id() {
return 16;
}
/////////////////////////////////////////////////////////
// Accessor methods for field: reply_on_command
// Field type: short, unsigned
// Offset (bits): 32
// Size (bits): 8
/////////////////////////////////////////////////////////
/**
* Return whether the field 'reply_on_command' is signed (false).
*/
public static boolean isSigned_reply_on_command() {
return false;
}
/**
* Return whether the field 'reply_on_command' is an array (false).
*/
public static boolean isArray_reply_on_command() {
return false;
}
/**
* Return the offset (in bytes) of the field 'reply_on_command'
*/
public static int offset_reply_on_command() {
return (32 / 8);
}
/**
* Return the offset (in bits) of the field 'reply_on_command'
*/
public static int offsetBits_reply_on_command() {
return 32;
}
/**
* Return the value (as a short) of the field 'reply_on_command'
*/
public short get_reply_on_command() {
return (short)getUIntBEElement(offsetBits_reply_on_command(), 8);
}
/**
* Set the value of the field 'reply_on_command'
*/
public void set_reply_on_command(short value) {
setUIntBEElement(offsetBits_reply_on_command(), 8, value);
}
/**
* Return the size, in bytes, of the field 'reply_on_command'
*/
public static int size_reply_on_command() {
return (8 / 8);
}
/**
* Return the size, in bits, of the field 'reply_on_command'
*/
public static int sizeBits_reply_on_command() {
return 8;
}
/////////////////////////////////////////////////////////
// Accessor methods for field: reply_on_command_id
// Field type: int, unsigned
// Offset (bits): 40
// Size (bits): 16
/////////////////////////////////////////////////////////
/**
* Return whether the field 'reply_on_command_id' is signed (false).
*/
public static boolean isSigned_reply_on_command_id() {
return false;
}
/**
* Return whether the field 'reply_on_command_id' is an array (false).
*/
public static boolean isArray_reply_on_command_id() {
return false;
}
/**
* Return the offset (in bytes) of the field 'reply_on_command_id'
*/
public static int offset_reply_on_command_id() {
return (40 / 8);
}
/**
* Return the offset (in bits) of the field 'reply_on_command_id'
*/
public static int offsetBits_reply_on_command_id() {
return 40;
}
/**
* Return the value (as a int) of the field 'reply_on_command_id'
*/
public int get_reply_on_command_id() {
return (int)getUIntBEElement(offsetBits_reply_on_command_id(), 16);
}
/**
* Set the value of the field 'reply_on_command_id'
*/
public void set_reply_on_command_id(int value) {
setUIntBEElement(offsetBits_reply_on_command_id(), 16, value);
}
/**
* Return the size, in bytes, of the field 'reply_on_command_id'
*/
public static int size_reply_on_command_id() {
return (16 / 8);
}
/**
* Return the size, in bits, of the field 'reply_on_command_id'
*/
public static int sizeBits_reply_on_command_id() {
return 16;
}
/////////////////////////////////////////////////////////
// Accessor methods for field: command_data
// Field type: int, unsigned
// Offset (bits): 56
// Size (bits): 16
/////////////////////////////////////////////////////////
/**
* Return whether the field 'command_data' is signed (false).
*/
public static boolean isSigned_command_data() {
return false;
}
/**
* Return whether the field 'command_data' is an array (false).
*/
public static boolean isArray_command_data() {
return false;
}
/**
* Return the offset (in bytes) of the field 'command_data'
*/
public static int offset_command_data() {
return (56 / 8);
}
/**
* Return the offset (in bits) of the field 'command_data'
*/
public static int offsetBits_command_data() {
return 56;
}
/**
* Return the value (as a int) of the field 'command_data'
*/
public int get_command_data() {
return (int)getUIntBEElement(offsetBits_command_data(), 16);
}
/**
* Set the value of the field 'command_data'
*/
public void set_command_data(int value) {
setUIntBEElement(offsetBits_command_data(), 16, value);
}
/**
* Return the size, in bytes, of the field 'command_data'
*/
public static int size_command_data() {
return (16 / 8);
}
/**
* Return the size, in bits, of the field 'command_data'
*/
public static int sizeBits_command_data() {
return 16;
}
/////////////////////////////////////////////////////////
// Accessor methods for field: command_data_next
// Field type: int[], unsigned
// Offset (bits): 72
// Size of each element (bits): 16
/////////////////////////////////////////////////////////
/**
* Return whether the field 'command_data_next' is signed (false).
*/
public static boolean isSigned_command_data_next() {
return false;
}
/**
* Return whether the field 'command_data_next' is an array (true).
*/
public static boolean isArray_command_data_next() {
return true;
}
/**
* Return the offset (in bytes) of the field 'command_data_next'
*/
public static int offset_command_data_next(int index1) {
int offset = 72;
if (index1 < 0 || index1 >= 4) throw new ArrayIndexOutOfBoundsException();
offset += 0 + index1 * 16;
return (offset / 8);
}
/**
* Return the offset (in bits) of the field 'command_data_next'
*/
public static int offsetBits_command_data_next(int index1) {
int offset = 72;
if (index1 < 0 || index1 >= 4) throw new ArrayIndexOutOfBoundsException();
offset += 0 + index1 * 16;
return offset;
}
/**
* Return the entire array 'command_data_next' as a int[]
*/
public int[] get_command_data_next() {
int[] tmp = new int[4];
for (int index0 = 0; index0 < numElements_command_data_next(0); index0++) {
tmp[index0] = getElement_command_data_next(index0);
}
return tmp;
}
/**
* Set the contents of the array 'command_data_next' from the given int[]
*/
public void set_command_data_next(int[] value) {
for (int index0 = 0; index0 < value.length; index0++) {
setElement_command_data_next(index0, value[index0]);
}
}
/**
* Return an element (as a int) of the array 'command_data_next'
*/
public int getElement_command_data_next(int index1) {
return (int)getUIntBEElement(offsetBits_command_data_next(index1), 16);
}
/**
* Set an element of the array 'command_data_next'
*/
public void setElement_command_data_next(int index1, int value) {
setUIntBEElement(offsetBits_command_data_next(index1), 16, value);
}
/**
* Return the total size, in bytes, of the array 'command_data_next'
*/
public static int totalSize_command_data_next() {
return (64 / 8);
}
/**
* Return the total size, in bits, of the array 'command_data_next'
*/
public static int totalSizeBits_command_data_next() {
return 64;
}
/**
* Return the size, in bytes, of each element of the array 'command_data_next'
*/
public static int elementSize_command_data_next() {
return (16 / 8);
}
/**
* Return the size, in bits, of each element of the array 'command_data_next'
*/
public static int elementSizeBits_command_data_next() {
return 16;
}
/**
* Return the number of dimensions in the array 'command_data_next'
*/
public static int numDimensions_command_data_next() {
return 1;
}
/**
* Return the number of elements in the array 'command_data_next'
*/
public static int numElements_command_data_next() {
return 4;
}
/**
* Return the number of elements in the array 'command_data_next'
* for the given dimension.
*/
public static int numElements_command_data_next(int dimension) {
int array_dims[] = { 4, };
if (dimension < 0 || dimension >= 1) throw new ArrayIndexOutOfBoundsException();
if (array_dims[dimension] == 0) throw new IllegalArgumentException("Array dimension "+dimension+" has unknown size");
return array_dims[dimension];
}
}