#N canvas 26 77 1250 833 10;
#X declare -lib mrpeach;
#X obj -15 0 cnv 15 600 240 empty empty empty 20 12 0 14 -262130 -66577
0;
#X obj -15 239 cnv 15 1400 550 empty empty unpackxbee_status: 1 12
0 14 -203904 -159808 0;
#X msg 280 103 verbosity \$1;
#X obj 280 82 hradio 15 1 0 3 empty empty verbosity 0 -8 0 10 -4034
-1 -1 0;
#X obj 330 170 unpackxbee 2;
#X obj 591 6 import mrpeach;
#N canvas 771 111 381 332 META 1;
#X text 22 55 LICENSE GPL v2 or later;
#X text 22 183 AUTHOR Martin Peach;
#X text 22 15 KEYWORDS control network wireless xbee;
#X text 22 203 HELP_PATCH_AUTHORS Martin Peach;
#X text 22 35 NAME unpackxbee;
#X text 22 75 DESCRIPTION [unpackxbee] unpacks packets from xbees in
API modes 1 or 2;
#X text 22 110 INLET_0 list;
#X text 23 125 OUTLET_0 list data;
#X text 23 145 OUTLET_1 list sample frame;
#X text 23 165 OUTLET_2 list status;
#X restore 634 26 pd META;
#X obj 330 130 comport 98 9600;
#X text 27 5 [unpackxbee] is used to unpack API mode 1 or 2 packets
received from xbees. Usually the output of a [comport] object is connected
to the inlet.;
#X text 26 53 Packet status comes out the right \, data is emitted
from the left outlet.;
#X floatatom 174 441 5 0 0 0 - - -;
#X obj 244 322 print unpack5;
#X obj 63 269 route AT_Command_Response;
#X obj 63 305 list split 3;
#X obj 174 343 list trim;
#X symbolatom 191 457 7 0 0 0 - - -;
#X symbolatom 209 474 20 0 0 0 - - -;
#X obj 63 343 unpack 0 0 0;
#X floatatom 63 367 5 0 0 0 - - -;
#X floatatom 97 387 5 0 0 0 - - -;
#X floatatom 132 407 5 0 0 0 - - -;
#X text -11 367 packet type;
#X text 29 387 packet ID;
#X text 54 406 data length;
#X text 61 438 AT command status;
#X text 145 456 addr16;
#X text 165 472 addr64;
#X obj 408 286 route ZigBee_Transmit_Status;
#X floatatom 408 328 5 0 0 0 - - -;
#X floatatom 429 346 5 0 0 0 - - -;
#X text 334 328 packet type;
#X text 361 346 packet ID;
#X symbolatom 450 363 7 0 0 0 - - -;
#X text 407 362 addr16;
#X floatatom 513 415 5 0 0 0 - - -;
#X floatatom 492 398 5 0 0 0 - - -;
#X floatatom 471 381 5 0 0 0 - - -;
#X text 340 379 transmit retry count;
#X text 391 396 delivery status;
#X text 407 413 discovery status;
#X symbolatom 226 491 32 0 0 0 - - -;
#X symbolatom 244 509 7 0 0 0 - - -;
#X symbolatom 297 562 7 0 0 0 - - -;
#X symbolatom 315 580 7 0 0 0 - - -;
#X obj 174 419 unpack 0 s s s s 0 0 s s;
#X floatatom 262 527 5 0 0 0 - - -;
#X floatatom 279 544 5 0 0 0 - - -;
#X text 129 490 Node Identifier;
#X text 197 508 parent;
#X text 187 524 device type;
#X text 199 542 source event;
#X text 242 560 profile;
#X text 237 578 manufacturer;
#X obj 408 308 unpack 0 0 s 0 0 0;
#X obj 596 303 route ZigBee_Receive_Packet;
#X obj 1101 337 print someotherpacket;
#X symbolatom 665 400 7 0 0 0 - - -;
#X symbolatom 642 382 17 0 0 0 - - -;
#X text 619 399 addr16;
#X text 598 380 addr64;
#X floatatom 596 346 5 0 0 0 - - -;
#X text 522 346 packet type;
#X floatatom 689 418 5 0 0 0 - - -;
#X text 590 416 receive options;
#X obj 689 468 tgl 15 0 empty empty acknowledged 17 7 0 10 -4034 -1
-1 0 1;
#X obj 729 488 tgl 15 0 empty empty broadcast 17 7 0 10 -4034 -1 -1
0 1;
#X obj 769 508 tgl 15 0 empty empty encrypted 17 7 0 10 -4034 -1 -1
0 1;
#X obj 809 528 tgl 15 0 empty empty from_end_device 17 7 0 10 -4034
-1 -1 0 1;
#X obj 689 432 & 1;
#X obj 729 432 & 2;
#X obj 769 432 & 32;
#X obj 809 432 & 64;
#X obj 596 324 unpack 0 0 s s 0;
#X floatatom 619 363 5 0 0 0 - - -;
#X text 545 363 data length;
#X obj 491 437 select 0 2 21 33 34 35 36 37;
#X symbolatom 491 634 32 0 0 0 - - -;
#X msg 491 461 set success;
#X msg 656 619 set unknown;
#X msg 511 480 set CCA_failurs;
#X msg 552 520 set Network_ACK_Failure;
#X msg 532 500 set Invalid_Destination_Endpoint;
#X msg 573 540 set Not_Joined_To_Network;
#X msg 592 560 set Self-Addresed;
#X msg 614 579 set Address_Not_Found;
#X msg 635 599 set Route_Not_Found;
#X text 388 633 delivery status:;
#X symbolatom 512 770 32 0 0 0 - - -;
#X msg 593 755 set unknown;
#X obj 512 658 select 0 1 2 3;
#X msg 512 679 set No_Discovery_Overhead;
#X msg 532 698 set Address_Discovery;
#X msg 553 717 set Route_Discovery;
#X msg 573 736 set Address_And_Route_Discovery;
#X text 408 768 discovery status:;
#X obj 856 320 route Remote_Command_Response;
#X floatatom 856 373 5 0 0 0 - - -;
#X floatatom 875 395 5 0 0 0 - - -;
#X text 782 373 packet type;
#X text 807 395 packet ID;
#X floatatom 973 502 5 0 0 0 - - -;
#X symbolatom 895 435 20 0 0 0 - - -;
#X text 851 433 addr64;
#X symbolatom 914 416 7 0 0 0 - - -;
#X symbolatom 934 457 7 0 0 0 - - -;
#X text 888 456 command;
#X floatatom 953 479 5 0 0 0 - - -;
#X text 903 503 data length;
#X text 911 479 status;
#X obj 856 347 unpack 0 0 s s s 0 0;
#X obj 237 390 print AT_response;
#X text 868 415 addr16;
#X obj 1021 383 select 0 1 2 3 4;
#X symbolatom 1021 583 32 0 0 0 - - -;
#X text 978 582 delivery status:;
#X msg 1021 410 set OK;
#X msg 1039 430 set ERROR;
#X msg 1058 449 set Invalid_Command;
#X msg 1077 469 set Invalid_Parameter;
#X msg 1095 492 set Transmission_Failed;
#X obj 174 365 route ND SL;
#X obj 51 532 print SL;
#X obj 330 216 print unpackxbee_data;
#X obj 462 187 print unpackxbee_status;
#X text 645 195 Martin Peach 2013_03_13;
#N canvas 4 77 541 300 sample_frame 0;
#X obj 32 23 inlet;
#X obj 32 76 route D0 D1 D2 D3 D4 D5 D10 D11 D12 A0 A1 A2 A3 A7;
#X obj 26 106 cnv 15 300 50 empty empty Digital_Inputs 20 12 0 14 -204786
-13381 0;
#X obj 26 157 cnv 15 400 90 empty empty Analog_Inputs 20 12 0 14 -232576
-45076 0;
#X obj 29 190 nbx 5 14 -1e+37 1e+37 0 0 empty empty A0 40 8 0 10 -204800
-13330 -159808 0 256;
#X obj 89 190 nbx 5 14 -1e+37 1e+37 0 0 empty empty A1 40 8 0 10 -204800
-13330 -159808 0 256;
#X obj 149 190 nbx 5 14 -1e+37 1e+37 0 0 empty empty A2 40 8 0 10 -204800
-13330 -159808 0 256;
#X obj 209 190 nbx 5 14 -1e+37 1e+37 0 0 empty empty A3 40 8 0 10 -204800
-13330 -159808 0 256;
#X obj 269 190 nbx 5 14 -1e+37 1e+37 0 0 empty empty V+ 40 8 0 10 -204800
-13330 -159808 0 256;
#X obj 32 132 nbx 2 14 -1e+37 1e+37 0 0 empty empty D0 8 20 0 10 -4034
-1 -258113 0 256;
#X obj 72 132 nbx 2 14 -1e+37 1e+37 0 0 empty empty D1 8 20 0 10 -4034
-1 -258113 0 256;
#X obj 102 132 nbx 2 14 -1e+37 1e+37 0 0 empty empty D2 8 20 0 10 -4034
-1 -258113 0 256;
#X obj 132 132 nbx 2 14 -1e+37 1e+37 0 0 empty empty D3 8 20 0 10 -4034
-1 -258113 0 256;
#X obj 162 132 nbx 2 14 -1e+37 1e+37 0 0 empty empty D4 8 20 0 10 -4034
-1 -258113 0 256;
#X obj 192 132 nbx 2 14 -1e+37 1e+37 0 0 empty empty D5 8 20 0 10 -4034
-1 -258113 0 256;
#X obj 222 132 nbx 2 14 -1e+37 1e+37 0 0 empty empty P0 8 20 0 10 -4034
-1 -258113 0 256;
#X obj 252 132 nbx 2 14 -1e+37 1e+37 0 0 empty empty P1 8 20 0 10 -4034
-1 -258113 0 256;
#X obj 282 132 nbx 2 14 -1e+37 1e+37 0 0 empty empty P2 8 20 0 10 -4034
-1 -258113 0 256;
#X obj 29 229 nbx 5 14 -1e+37 1e+37 0 0 empty empty A0_mV 40 8 0 10
-204800 -13330 -159808 0 256;
#X obj 29 209 * 1.17302;
#X obj 109 229 nbx 5 14 -1e+37 1e+37 0 0 empty empty A1_mV 40 8 0 10
-204800 -13330 -159808 0 256;
#X obj 109 209 * 1.17302;
#X obj 189 229 nbx 5 14 -1e+37 1e+37 0 0 empty empty A2_mV 40 8 0 10
-204800 -13330 -159808 0 256;
#X obj 189 209 * 1.17302;
#X obj 269 229 nbx 5 14 -1e+37 1e+37 0 0 empty empty A3_mV 40 8 0 10
-204800 -13330 -159808 0 256;
#X obj 269 209 * 1.17302;
#X obj 349 229 nbx 5 14 -1e+37 1e+37 0 0 empty empty V+_mV 40 8 0 10
-204800 -13330 -159808 0 256;
#X obj 349 209 * 1.17302;
#X obj 32 48 list trim;
#X obj 329 100 print more_sample_frame_stuff;
#X connect 0 0 28 0;
#X connect 1 0 9 0;
#X connect 1 1 10 0;
#X connect 1 2 11 0;
#X connect 1 3 12 0;
#X connect 1 4 13 0;
#X connect 1 5 14 0;
#X connect 1 6 15 0;
#X connect 1 7 16 0;
#X connect 1 8 17 0;
#X connect 1 9 4 0;
#X connect 1 9 19 0;
#X connect 1 10 5 0;
#X connect 1 10 21 0;
#X connect 1 11 6 0;
#X connect 1 11 23 0;
#X connect 1 12 7 0;
#X connect 1 12 25 0;
#X connect 1 13 8 0;
#X connect 1 13 27 0;
#X connect 1 14 29 0;
#X connect 19 0 18 0;
#X connect 21 0 20 0;
#X connect 23 0 22 0;
#X connect 25 0 24 0;
#X connect 27 0 26 0;
#X connect 28 0 1 0;
#X restore 364 197 pd sample_frame;
#X connect 2 0 4 0;
#X connect 3 0 2 0;
#X connect 4 0 122 0;
#X connect 4 1 125 0;
#X connect 4 2 123 0;
#X connect 4 2 12 0;
#X connect 7 0 4 0;
#X connect 12 0 13 0;
#X connect 12 1 27 0;
#X connect 13 0 17 0;
#X connect 13 1 14 0;
#X connect 13 2 11 0;
#X connect 14 0 120 0;
#X connect 17 0 18 0;
#X connect 17 1 19 0;
#X connect 17 2 20 0;
#X connect 27 0 53 0;
#X connect 27 1 54 0;
#X connect 44 0 10 0;
#X connect 44 1 15 0;
#X connect 44 2 16 0;
#X connect 44 3 40 0;
#X connect 44 4 41 0;
#X connect 44 5 45 0;
#X connect 44 6 46 0;
#X connect 44 7 42 0;
#X connect 44 8 43 0;
#X connect 53 0 28 0;
#X connect 53 1 29 0;
#X connect 53 2 32 0;
#X connect 53 3 36 0;
#X connect 53 4 35 0;
#X connect 53 4 75 0;
#X connect 53 5 34 0;
#X connect 53 5 89 0;
#X connect 54 0 72 0;
#X connect 54 1 95 0;
#X connect 62 0 68 0;
#X connect 62 0 69 0;
#X connect 62 0 70 0;
#X connect 62 0 71 0;
#X connect 68 0 64 0;
#X connect 69 0 65 0;
#X connect 70 0 66 0;
#X connect 71 0 67 0;
#X connect 72 0 60 0;
#X connect 72 1 73 0;
#X connect 72 2 57 0;
#X connect 72 3 56 0;
#X connect 72 4 62 0;
#X connect 75 0 77 0;
#X connect 75 1 79 0;
#X connect 75 2 81 0;
#X connect 75 3 80 0;
#X connect 75 4 82 0;
#X connect 75 5 83 0;
#X connect 75 6 84 0;
#X connect 75 7 85 0;
#X connect 75 8 78 0;
#X connect 77 0 76 0;
#X connect 78 0 76 0;
#X connect 79 0 76 0;
#X connect 80 0 76 0;
#X connect 81 0 76 0;
#X connect 82 0 76 0;
#X connect 83 0 76 0;
#X connect 84 0 76 0;
#X connect 85 0 76 0;
#X connect 88 0 87 0;
#X connect 89 0 90 0;
#X connect 89 1 91 0;
#X connect 89 2 92 0;
#X connect 89 3 93 0;
#X connect 89 4 88 0;
#X connect 90 0 87 0;
#X connect 91 0 87 0;
#X connect 92 0 87 0;
#X connect 93 0 87 0;
#X connect 95 0 109 0;
#X connect 95 1 55 0;
#X connect 109 0 96 0;
#X connect 109 1 97 0;
#X connect 109 2 101 0;
#X connect 109 3 103 0;
#X connect 109 4 104 0;
#X connect 109 5 106 0;
#X connect 109 5 112 0;
#X connect 109 6 100 0;
#X connect 112 0 115 0;
#X connect 112 1 116 0;
#X connect 112 2 117 0;
#X connect 112 3 118 0;
#X connect 112 4 119 0;
#X connect 115 0 113 0;
#X connect 116 0 113 0;
#X connect 117 0 113 0;
#X connect 118 0 113 0;
#X connect 119 0 113 0;
#X connect 120 0 44 0;
#X connect 120 1 121 0;
#X connect 120 2 110 0;
