DESERT 3.5.1
Loading...
Searching...
No Matches
uw-mac-TLohi.cpp
Go to the documentation of this file.
1//
2// Copyright (c) 2017 Regents of the SIGNET lab, University of Padova.
3// All rights reserved.
4//
5// Redistribution and use in source and binary forms, with or without
6// modification, are permitted provided that the following conditions
7// are met:
8// 1. Redistributions of source code must retain the above copyright
9// notice, this list of conditions and the following disclaimer.
10// 2. Redistributions in binary form must reproduce the above copyright
11// notice, this list of conditions and the following disclaimer in the
12// documentation and/or other materials provided with the distribution.
13// 3. Neither the name of the University of Padova (SIGNET lab) nor the
14// names of its contributors may be used to endorse or promote products
15// derived from this software without specific prior written permission.
16//
17// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
21// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
24// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28//
29
39#include "uw-mac-TLohi.h"
40#include "wake-up-pkt-hdr.h"
41#include "uw-phy-WakeUp.h"
42#include <clmsg-discovery.h>
43#include <mac.h>
44#include <cmath>
45#include <iostream>
46#include <iomanip>
47#include <rng.h>
48
50
51extern packet_t PT_TLOHI;
52
54
58static class TLOHIPktClass : public PacketHeaderClass
59{
60public:
65 : PacketHeaderClass("PacketHeader/TLOHI", sizeof(hdr_tlohi))
66 {
67 this->bind();
68 bind_offset(&hdr_tlohi::offset_);
69 }
71
75static class TLOHIModuleClass : public TclClass
76{
77public:
82 : TclClass("Module/UW/TLOHI")
83 {
84 }
89 TclObject *
90 create(int, const char *const *)
91 {
92 return (new MMacTLOHI());
93 }
95
96void
98{
99 switch (module->curr_state) {
100
101 case (STATE_WAIT_ACK): {
102
103 if (module->debug_)
104 cout << NOW << " MMacTLOHI(" << module->addr
105 << ") timer expire() current state = "
106 << module->status_info[module->curr_state]
107 << " ACK not received, next state = "
108 << module->status_info[STATE_WAIT_END_CR] << endl;
109
110 module->last_reason = REASON_ACK_TIMEOUT;
111 if (module->curr_tx_rounds < module->max_tx_rounds)
112 module->stateTxData();
113 else
114 module->stateIdle();
115 } break;
116
117 case (STATE_WAIT_END_CR): {
118
119 if (module->debug_)
120 cout << NOW << " MMacTLOHI(" << module->addr
121 << ") timer expire() current state = "
122 << module->status_info[module->curr_state]
123 << " CR expired, next state = "
124 << module->status_info[STATE_IDLE] << endl;
125
126 module->last_reason = REASON_CR_END;
127 module->stateIdle();
128 } break;
129
130 case (STATE_BACKOFF): {
131
132 if (module->debug_)
133 cout << NOW << " MMacTLOHI(" << module->addr
134 << ") timer expire() current state = "
135 << module->status_info[module->curr_state]
136 << " backoff expired, next state = "
137 << module->status_info[STATE_START_CONTENTION] << endl;
138
139 module->last_reason = REASON_BACKOFF_TIMEOUT;
140 module->stateStartContention();
141 } break;
142
143 case (STATE_WAIT_XACK): {
144
145 if (module->debug_)
146 cout << NOW << " MMacTLOHI(" << module->addr
147 << ") timer expire() current state = "
148 << module->status_info[module->curr_state]
149 << " xACK not received, next state = "
150 << module->status_info[STATE_RECONTEND_WINDOW] << endl;
151
152 module->last_reason = REASON_XACK_TIMEOUT;
153 module->stateRecontendWindow();
154 } break;
155
157
158 if (module->debug_)
159 cout << NOW << " MMacTLOHI(" << module->addr
160 << ") timer expire() current state = "
161 << module->status_info[module->curr_state]
162 << " contention ended, next state = "
163 << module->status_info[STATE_COUNT_CONTENDERS] << endl;
164
165 module->last_reason = REASON_WAIT_CR_END;
166 module->stateCountContenders();
167 } break;
168
169 case (STATE_SLEEP): {
170
171 if (module->debug_)
172 cout << NOW << " MMacTLOHI(" << module->addr
173 << ") timer expire() current state = "
174 << module->status_info[module->curr_state]
175 << " sleep period expired, next state = "
176 << module->status_info[STATE_RECONTEND_WINDOW] << endl;
177
178 module->last_reason = REASON_SLEEP_TIMEOUT;
179 module->stateRecontendWindow();
180 } break;
181
182 case (STATE_RECONTEND_WINDOW): {
183
184 if (module->debug_)
185 cout << NOW << " MMacTLOHI(" << module->addr
186 << ") timer expire() current state = "
187 << module->status_info[module->curr_state]
188 << " recontend window expired, next state = "
189 << module->status_info[STATE_IDLE] << endl;
190
191 module->last_reason = REASON_RECONTEND_END;
192 module->stateIdle();
193 } break;
194
195 default: {
196 cout << NOW << " MMacTLOHI(" << module->addr
197 << ") timer expire() logical error, current state = "
198 << module->status_info[module->curr_state] << endl;
199 exit(1);
200 } break;
201 }
202}
203
204void
206{
207 if (module->debug_)
208 cout << NOW << " MMacTLOHI(" << module->addr
209 << ") data timer expire() turning off DATA PHY."
210 << " Current state = " << module->status_info[module->curr_state]
211 << endl;
212
213 // module->Mac2PhyTurnOff(module->data_phy_id);
214}
215
217// int MMacTLOHI::u_data_id;
218bool MMacTLOHI::initialized = false;
219
220map<TLOHI_STATUS, string> MMacTLOHI::status_info;
221map<TLOHI_REASON_STATUS, string> MMacTLOHI::reason_info;
222map<TLOHI_PKT_TYPE, string> MMacTLOHI::pkt_type_info;
223
225 : timer(this)
226 , data_phy_timer(this)
227 , txsn(1)
228 , data_phy_id(NOT_SET)
229 , tone_phy_id(NOT_SET)
230 , CR_duration(NOT_SET)
231 , session_distance(SESSION_DISTANCE_NOT_SET)
232 , curr_dest_addr(NOT_SET)
233 , backoff_duration(NOT_SET)
234 , backoff_start_time(NOT_SET)
235 , backoff_remaining(NOT_SET)
236 , last_data_id_tx(NOT_SET)
237 , last_data_id_rx(NOT_SET)
238 , curr_data_pkt(0)
239 , curr_contenders(0)
240 , tone_pkts_tx(0)
241 , tone_pkts_rx(0)
242 , curr_tx_tries(0)
243 , curr_tx_rounds(0)
244 , u_data_id(0)
245 , TxActive(false)
246 , session_active(false)
247 , backoff_pending(false)
248 , tone_transmitted(false)
249 , mphy_ids_initialized(false)
250 , print_transitions(false)
251 , has_buffer_queue(false)
252 , curr_state(STATE_IDLE)
253 , prev_state(STATE_IDLE)
254 , ack_mode(NO_ACK_MODE)
255 , op_mode(AGGRESSIVE_UNSYNC_MODE)
256{
257 u_pkt_id = 0;
258
259 bind("max_prop_delay", (double *) &max_prop_delay);
260 bind("HDR_size", (int *) &HDR_size);
261 bind("ACK_size", (int *) &ACK_size);
262 bind("max_tx_rounds", (int *) &max_tx_rounds);
263 bind("wait_costant", (double *) &wait_costant);
264 bind("debug_", (int *) &debug_); // degug mode
265 bind("max_payload", (int *) &max_payload);
266 bind("recontend_time", (double *) &recontend_time);
267 bind("tone_data_delay", (double *) &tone_data_delay);
268 bind("max_tx_tries", (double *) &max_tx_tries);
269 bind("buffer_pkts", (int *) &buffer_pkts);
270
271 if (max_tx_tries <= 0)
272 max_tx_tries = HUGE_VAL;
273 if (buffer_pkts > 0)
274 has_buffer_queue = true;
275
276 tcl_modulation.clear();
277}
278
282
283// TCL command interpreter
284int
285MMacTLOHI::command(int argc, const char *const *argv)
286{
287 Tcl &tcl = Tcl::instance();
288 if (argc == 3) {
289 if (strcasecmp(argv[1], "addTonePhy") == 0) {
290
291 MPhy_WakeUp *tone_phy =
292 dynamic_cast<MPhy_WakeUp *>(TclObject::lookup(argv[2]));
293
294 if (!tone_phy)
295 return TCL_ERROR;
296 else {
297 tone_phy_id = tone_phy->getId();
298
299 if (debug_)
300 cout << NOW << " MMacTLOHI(" << addr
301 << ")::command() addTonePhy called, tone_phy_id = "
302 << tone_phy_id << endl;
303
304 return TCL_OK;
305 }
306 } else if (strcasecmp(argv[1], "addDataPhy") == 0) {
307
308 MPhy *data_phy = dynamic_cast<MPhy *>(TclObject::lookup(argv[2]));
309
310 if (!data_phy)
311 return TCL_ERROR;
312 else {
313 data_phy_id = data_phy->getId();
314
315 if (debug_)
316 cout << NOW << " MMacTLOHI(" << addr
317 << ")::command() addDataPhy called, data_phy_id = "
318 << data_phy_id << endl;
319
320 initData();
321 return TCL_OK;
322 }
323 } else if (strcasecmp(argv[1], "setDataName") == 0) {
324 tcl_modulation = argv[2];
325 return TCL_OK;
326 } else if (strcasecmp(argv[1], "setMacAddr") == 0) {
327 addr = atoi(argv[2]);
328 if (debug_)
329 cout << "T-LOHI MAC address of current node is " << addr
330 << endl;
331 return TCL_OK;
332 }
333 } else if (argc == 2) {
334 if (strcasecmp(argv[1], "setAckMode") == 0) {
336 return TCL_OK;
337 } else if (strcasecmp(argv[1], "setNoAckMode") == 0) {
339 return TCL_OK;
340 } else if (strcasecmp(argv[1], "setConservativeUnsyncMode") == 0) {
341 checkPhyInit();
344 return TCL_OK;
345 } else if (strcasecmp(argv[1], "setAggressiveUnsyncMode") == 0) {
346 checkPhyInit();
349 return TCL_OK;
350 }
351 /* else if(strcasecmp(argv[1], "setSyncMode") == 0)
352 {
353 checkPhyInit();
354 op_mode = SYNC_MODE;
355 CR_duration = max_prop_delay + computeTxTime(TONE_PKT);
356 return TCL_OK;
357 }*/
358 else if (strcasecmp(argv[1], "initialize") == 0) {
359 if (initialized == false)
360 initInfo();
361 initMphyIds();
363 fout.open("/tmp/TLOHIstateTransitions.txt", ios_base::app);
364 return TCL_OK;
365 } else if (strcasecmp(argv[1], "printTransitions") == 0) {
366 print_transitions = true;
367 return TCL_OK;
368 } else if (strcasecmp(argv[1], "getCRTime") == 0) {
369 tcl.resultf("%f", getCRduration());
370 return TCL_OK;
371 }
372 // stats functions
373 else if (strcasecmp(argv[1], "getQueueSize") == 0) {
374 tcl.resultf("%d", Q.size());
375 return TCL_OK;
376 } else if (strcasecmp(argv[1], "getTonePktsTx") == 0) {
377 tcl.resultf("%d", getTonePktsTx());
378 return TCL_OK;
379 } else if (strcasecmp(argv[1], "getTonePktsRx") == 0) {
380 tcl.resultf("%d", getTonePktsRx());
381 return TCL_OK;
382 } else if (strcasecmp(argv[1], "getUpLayersDataRx") == 0) {
383 tcl.resultf("%d", getUpLayersDataPktsRx());
384 return TCL_OK;
385 }
386 }
387 return MMac::command(argc, argv);
388}
389
390int
392{
393 switch (m->type()) {
394
395 // case whatever:
396 // return 0;
397 // break;
398
399 default:
400 return Module::crLayCommand(m);
401 }
402}
403
404void
406{
407 if ((mphy_ids_initialized == false) || (initialized == false)) {
408 cout << "MMacTLOHI(" << addr
409 << ")::command() initialized command not called, aborting..."
410 << endl;
411 exit(1);
412 }
413}
414
415void
417{
418 if (ack_mode == ACK_MODE)
422 else
425
426 // sleep_timeout = 3 * max_prop_delay + computeTxTime(ACK_PKT) +
427 // computeTxTime(DATA_PKT)
428 // +
429 // 2*computeTxTime(TONE_PKT)
430 // +
431 // wait_costant;
432
436
437 if (max_tx_tries <= 0)
438 max_tx_tries = HUGE_VAL;
439 if (buffer_pkts > 0)
440 has_buffer_queue = true;
441
442 if (debug_)
443 cout << NOW << " MMacTLOHI(" << addr
444 << ")::initData() sleep_timeout = " << sleep_timeout
445 << ", DATA_listen_timeout = " << DATA_listen_timeout << endl;
446}
447
448void
450{
451
452 initialized = true;
453
454 if ((print_transitions) && (system(NULL))) {
455 system("rm -f /tmp/TLOHIstateTransitions.txt");
456 system("touch /tmp/TLOHIstateTransitions.txt");
457 }
458
459 status_info[STATE_IDLE] = "Idle state";
460 status_info[STATE_BACKOFF] = "Backoff state";
461 status_info[STATE_START_CONTENTION] = "Start of Contention Round state";
462 /* status_info[STATE_END_CR] = "End of Contention Round state"; */
463 status_info[STATE_TX_DATA] = "Transmit DATA state";
464 status_info[STATE_SLEEP] = "Sleep state";
465 status_info[STATE_WAIT_END_CR] = "Wait a Contention Round state";
466 status_info[STATE_TX_ACK] = "Transmit ACK state";
467 status_info[STATE_WAIT_ACK] = "Wait for ACK state";
468 status_info[STATE_DATA_RECEIVED] = "DATA received state";
469 status_info[STATE_ACK_RECEIVED] = "ACK received state";
471 "Wait for the end of Contention state";
472 status_info[STATE_COUNT_CONTENDERS] = "Count contenders state";
473 status_info[STATE_RECONTEND_WINDOW] = "Recontend backoff state";
474 status_info[STATE_WAIT_XACK] = "Wait for xACK state";
475
476 reason_info[REASON_TONE_TX] = "Tone transmitted";
477 reason_info[REASON_DATA_PENDING] = "DATA pending from upper layers";
478 reason_info[REASON_TONE_RX] = "Tone received";
479 reason_info[REASON_WAIT_CR_END] = "End of Contention Round";
480 reason_info[REASON_NO_CONTENDERS] = "No contenders found";
481 reason_info[REASON_CONTENDERS] = "Contenders found";
482 reason_info[REASON_DATA_RX] = "DATA received";
483 reason_info[REASON_DATA_TX] = "DATA transmitted";
484 reason_info[REASON_ACK_TX] = "ACK tranmsitted";
485 reason_info[REASON_ACK_RX] = "ACK received";
486 reason_info[REASON_RECONTEND_END] = "Recontend backoff expired";
487 reason_info[REASON_BACKOFF_TIMEOUT] = "Backoff expired";
488 reason_info[REASON_ACK_TIMEOUT] = "ACK timeout";
489 reason_info[REASON_SLEEP_TIMEOUT] = "SLEEP expired";
490 reason_info[REASON_CR_END] = "Recontention CR expired";
491 reason_info[REASON_DATA_EMPTY] = "DATA queue empty";
492 reason_info[REASON_XACK_TIMEOUT] = "xACK timeout";
493 reason_info[REASON_XDATA_RX] = "xDATA received";
494 reason_info[REASON_XACK_RX] = "xACK received";
495 reason_info[REASON_MAX_TX_TRIES] = "DATA dropped due to max tx rounds";
496
497 pkt_type_info[TONE_PKT] = "TONE pkt";
498 pkt_type_info[ACK_PKT] = "ACK pkt";
499 pkt_type_info[DATA_PKT] = "DATA pkt";
500 pkt_type_info[DATAMAX_PKT] = "MAX payload DATA pkt";
501}
502
503void
505{
506 if (tcl_modulation.size() == 0) {
507 cout << NOW << " MMacTLOHI(" << addr
508 << ")::initMphyIds() Error, data phy name not set" << endl;
509 exit(1);
510 }
511
512 ClMsgDiscovery m;
513 m.addSenderData((const PlugIn *) this,
514 getLayer(),
515 getId(),
516 getStackId(),
517 name(),
518 getTag());
519 sendSyncClMsgUp(&m);
520 sendSyncClMsgDown(&m);
521
522 // if (debug_) m.printReplyData();
523
524 DiscoveryStorage lower_layer = m.findLayer(getLayer() - 1);
525
526 // if (debug_) lower_layer.printData();
527
528 DiscoveryStorage tone_phy_db =
529 lower_layer.findTclName("Module/MPhy/Underwater/WKUP");
530 DiscoveryStorage data_phy_db =
531 lower_layer.findTclName(tcl_modulation.c_str());
532
533 // if (debug_) {
534 // tone_phy_db.printData();
535 // data_phy_db.printData();
536 // }
537
538 if (tone_phy_db.getSize() == 1)
539 tone_phy_id = (*tone_phy_db.begin()).first;
540 if (data_phy_db.getSize() == 1)
541 data_phy_id = (*data_phy_db.begin()).first;
542
543 // cout << "MMacTLOHI(" << addr << ")::initMphyIds() tone_phy id = " <<
544 // tone_phy_id << endl
545 // << "MMacTLOHI(" << addr << ")::initMphyIds() data_phy id = " <<
546 // data_phy_id << endl;
547
548 // waitForUser();
549
550 initData();
551
553}
554
555void
563
564double
566{
567 double duration;
568 Packet *temp_data_pkt;
569 int dest_addr;
570
571 if (type == DATA_PKT) {
572 if (!Q.empty()) {
573 temp_data_pkt = (Q.front())->copy();
574 hdr_cmn *ch = HDR_CMN(temp_data_pkt);
575 ch->size() = HDR_size + ch->size();
576 } else {
577 temp_data_pkt = Packet::alloc();
578 hdr_cmn *ch = HDR_CMN(temp_data_pkt);
579 ch->size() = HDR_size + max_payload;
580 }
581 dest_addr = data_phy_id;
582 } else if (type == ACK_PKT) {
583 temp_data_pkt = Packet::alloc();
584 hdr_cmn *ch = HDR_CMN(temp_data_pkt);
585 ch->size() = ACK_size;
586 dest_addr = data_phy_id;
587 } else if (type == TONE_PKT) {
588 temp_data_pkt = Packet::alloc();
589 hdr_cmn *ch = HDR_CMN(temp_data_pkt);
590 ch->size() = 1;
591 ch->ptype() = PT_WKUP;
592 dest_addr = tone_phy_id;
593 }
594 duration = Mac2PhyTxDuration(dest_addr, temp_data_pkt);
595 Packet::free(temp_data_pkt);
596 return (duration);
597}
598
599void
608
609void
611{
612 incrTotalBackoffTimes();
613 double random = RNG::defaultrng()->uniform_double();
614
615 while (random == 0) { // se random == 0 lo rigenero
616 random = RNG::defaultrng()->uniform_double();
617 }
618
619 backoff_duration = random * CR_duration * max(1, curr_contenders);
620 backoffSumDuration(backoff_duration);
621 curr_contenders = 0;
622
623 if (debug_) {
624 cout << NOW << " MMacTLOHI(" << addr
625 << ")::getBackoffTime() backoff time = " << backoff_duration
626 << " s" << endl;
627 // waitForUser();
628 }
629}
630
631void
633{
634 if (((has_buffer_queue == true) && (Q.size() < buffer_pkts)) ||
635 (has_buffer_queue == false)) {
636
637 initPkt(p, DATA_PKT);
638 Q.push(p);
639 incrUpperDataRx();
640 waitStartTime();
641
642 if ((curr_state == STATE_IDLE) &&
643 (session_active == false)) // se sono libero comincio contention
644 {
647
648 // if (debug_)
649 // cerr << showpoint << NOW << " " << __PRETTY_FUNCTION__
650 // << " mac busy => enqueueing packet" << endl;
651 } else {
652 // if (debug_)
653 // cerr << showpoint << NOW << " " << __PRETTY_FUNCTION__
654 // << " transmitting packet" << endl;
655 //
656 }
657 } else {
658 incrDiscardedPktsTx();
660 // Packet::free(p);
661 }
662}
663
664void
666{
667 hdr_cmn *ch = hdr_cmn::access(p);
668 hdr_tlohi *tlohih = HDR_TLOHI(p);
669 hdr_mac *mach = HDR_MAC(p);
670
671 tlohih->sn = txsn;
672 txsn++;
673 tlohih->ts = NOW;
674 tlohih->pkt_type = type;
675
676 int curr_size = ch->size();
677
678 if (type != DATA_PKT) {
679 ch->timestamp() = tlohih->ts;
680 ch->ptype() = PT_TLOHI;
681 } else { // incapsulamento dei dati
682 tlohih->orig_type = ch->ptype();
683 ch->ptype() = PT_TLOHI;
684 tlohih->data_sn = u_data_id++;
685 }
686
687 switch (type) {
688
689 case (TONE_PKT): {
690 ch->ptype() = PT_WKUP;
691 ch->size() = 1;
692 ch->uid() = u_pkt_id++;
693 mach->set(MF_CONTROL, addr, curr_dest_addr);
694 } break;
695
696 case (DATA_PKT): {
697 ch->size() = curr_size + HDR_size;
698 mach->macSA() = addr;
699 } break;
700
701 case (ACK_PKT): {
702 ch->size() = ACK_size;
703 ch->uid() = u_pkt_id++;
704 mach->set(MF_CONTROL, addr, curr_dest_addr);
705 } break;
706 }
707}
708
709int
710MMacTLOHI::countContenders(double time_interval)
711{
712 int contenders_no = 0;
713
714 // if ( time_interval < computeTxTime(TONE_PKT) ) time_interval = 0;
715
716 if (time_interval > 0) {
717 double contenders = time_interval / computeTxTime(TONE_PKT);
718 double decimal = contenders - floor(contenders);
719 if (decimal < 0.5)
720 contenders_no = floor(contenders);
721 else
722 contenders_no = ceil(contenders);
723 }
724 // if (contenders_no > 0) contenders_no--;
725
726 if (debug_)
727 cout << NOW << " MMacTLOHI(" << addr
728 << ")::countContenders() time interval = " << setprecision(12)
729 << scientific << time_interval << fixed
730 << " [s]; contenders = " << contenders_no << endl;
731 // waitForUser();
732
733 return (contenders_no);
734}
735
736void
738{ // si occupa dei cambi stato
739
740 TxActive = false;
741
742 switch (curr_state) {
743
744 case (STATE_TX_DATA): {
745 // TONE already transmitted ==> DATA tx
746 if (tone_transmitted == true) {
747 tone_transmitted = false;
748 /* timer.resched(tone_data_delay);*/
749 txData();
750 return;
751 }
752
753 // TONE && DATA transmitted
755
756 if (ack_mode == ACK_MODE) {
757
758 if (debug_)
759 cout << NOW << " MMacTLOHI(" << addr
760 << ")::Phy2MacEndTx() DATA sent, from "
761 << status_info[curr_state] << " to "
762 << status_info[STATE_WAIT_ACK] << endl;
763
764 stateWaitAck();
765 } else {
766
767 if (debug_)
768 cout << NOW << " MMacTLOHI(" << addr
769 << ")::Phy2MacEndTx() DATA sent, from "
770 << status_info[curr_state] << " to "
771 << status_info[STATE_IDLE] << endl;
772
773 stateIdle();
774 }
775 } break;
776
777 case (STATE_TX_ACK): {
778 // TONE already transmitted ==> ACK tx
779 if (tone_transmitted == true) {
780 tone_transmitted = false;
781 txAck();
782 return;
783 }
784
786
787 if (debug_ > 0)
788 cout << NOW << " MMacTLOHI(" << addr
789 << ")::Phy2MacEndTx() ACK sent, from "
790 << status_info[curr_state] << " to "
792
794 } break;
795
796 case (STATE_START_CONTENTION): {
798
799 if (debug_ > 0)
800 cout << NOW << " MMacTLOHI(" << addr
801 << ")::Phy2MacEndTx() TONE sent, from "
802 << status_info[curr_state] << " to "
804
806 } break;
807
808 default: {
809 cout << NOW << " MMacTLOHI(" << addr
810 << ")::Phy2MacEndTx() logical error, current state = "
811 << status_info[curr_state] << endl;
812 exit(1);
813 } break;
814 }
815}
816
817void
819{
820 // if (debug_) cerr << showpoint << NOW << " " << __PRETTY_FUNCTION__
821 // << endl;
822
823 hdr_cmn *ch = HDR_CMN(p);
824 hdr_MPhy *ph = HDR_MPHY(p);
825
826 if ((ch->ptype() == PT_TLOHI) // if the data PHY signal an incoming pkt
827 &&
828 (((HDR_TLOHI(p))->pkt_type == DATA_PKT) ||
829 ((HDR_TLOHI(p))->pkt_type == ACK_PKT))) {
830 data_phy_timer.resched(ph->duration + wait_costant);
831
832 if (debug_)
833 cout << NOW << " MMacTLOHI(" << addr
834 << ")::Phy2MacStartRx() receiving a DATA or ACK pkt,"
835 << " rescheduling data_phy closure" << endl;
836 // waitForUser();
837 }
838}
839
840void
842{
843 // if (debug_) cerr << showpoint << NOW << " " << __PRETTY_FUNCTION__ <<
844 // endl;
845 hdr_cmn *ch = HDR_CMN(p);
846 packet_t rx_pkt_type = ch->ptype();
847
848 if ((rx_pkt_type != PT_TLOHI) && (rx_pkt_type != PT_WKUP)) {
850 return;
851 }
852
853 hdr_mac *mach = HDR_MAC(p);
854 hdr_MPhy *ph = HDR_MPHY(p);
855 hdr_tlohi *tlohih;
856
857 TLOHI_PKT_TYPE tlohi_pkt_type;
858
859 int source_mac = mach->macSA();
860 int dest_mac = mach->macDA();
861
862 double gen_time = ph->txtime;
863 double received_time = ph->rxtime;
864 double diff_time = received_time - gen_time;
865
866 double distance = diff_time * prop_speed;
867 double tone_time_interval = 0;
868
869 if (rx_pkt_type == PT_WKUP)
870 rxTone(p);
871 else if (ch->error()) {
872 // drop(p, 1, "ERR");
873 Packet::free(p);
874 return;
875 // Mac2PhyTurnOff(data_phy_id); // turn off data PHY
876 } else {
877 tlohih = HDR_TLOHI(p);
878 tlohi_pkt_type = tlohih->pkt_type;
879
880 if (debug_)
881 cout << NOW << " MMacTLOHI(" << addr << ")::Phy2MacEndRx() "
883 << ", received a pkt type = " << pkt_type_info[tlohi_pkt_type]
884 << ", src addr = " << mach->macSA()
885 << " dest addr = " << mach->macDA()
886 << ", estimated distance between nodes = " << distance << " m "
887 << endl;
888
889 switch (curr_state) {
890
891 // fallthrough!! STATE_IDLE == STATE_SLEEP
892 case (STATE_IDLE):
893
894 case (STATE_SLEEP): {
895 if ((tlohih->pkt_type == DATA_PKT) &&
896 (dest_mac == addr)) { // DATA pkt for me
897 setDestAddr(source_mac);
899 } else if ((tlohih->pkt_type == DATA_PKT) &&
900 (dest_mac != addr)) { // xDATA pkt
901 incrXDataPktsRx();
902 setDestAddr(source_mac); // we lock on this pkt for xACK
903 // purposes
904 Packet::free(p);
906 if (ack_mode == ACK_MODE)
908 else
910 } else if ((tlohih->pkt_type == ACK_PKT) &&
911 (dest_mac != addr)) { // xACK pkt
912 incrXAckPktsRx();
913
914 Packet::free(p);
917 } else {
918 Packet::free(p);
919 }
920 } break;
921
922 case (STATE_WAIT_XACK): {
923 if ((tlohih->pkt_type == ACK_PKT) && (dest_mac != addr) &&
924 (dest_mac == curr_dest_addr)) { // xACK pkt
925 incrXAckPktsRx();
926
927 Packet::free(p);
929 // ACK rx ==> turn data_phy OFF
930 // Mac2PhyTurnOff(data_phy_id);
932 } else if ((tlohih->pkt_type == DATA_PKT) &&
933 (dest_mac != curr_dest_addr)) { // xDATA pkt
934 incrXDataPktsRx();
935 setDestAddr(source_mac); // we chain-lock on this pkt for
936 // xACK purposes
937 Packet::free(p);
940 } else if ((tlohih->pkt_type == DATA_PKT) &&
941 (dest_mac == addr)) { // DATA pkt for me
942 setDestAddr(source_mac);
944 } else {
945 Packet::free(p);
946 }
947 } break;
948
949 case (STATE_WAIT_ACK): {
950 if ((tlohih->pkt_type == ACK_PKT) &&
951 (dest_mac == addr)) { // ACK pkt
952 incrAckPktsRx();
953
954 Packet::free(p);
956 // ACK rx ==> turn data_phy OFF
957
958 queuePop(true);
959 // Mac2PhyTurnOff(data_phy_id); // we can turn
960 // off data_phy
961 stateIdle();
962 } else {
963 Packet::free(p);
964 }
965 } break;
966
967 default: {
968
969 if (debug_)
970 cout << NOW << " MMacTLOHI(" << addr
971 << ")::Phy2MacEndRx() unkown State, dropping pkt"
972 << endl;
973
975 // Packet::free(p);
976 return;
977 } break;
978 }
979 // Mac2PhyTurnOff(data_phy_id); // turn off data PHY
980 }
981}
982
983void
985{
986 hdr_cmn *ch = HDR_CMN(p);
987
988 if (debug_)
989 cout << NOW << " MMacTLOHI(" << addr << ")::Phy2MacEndRx() "
991 << ", received a TONE pkt: error = " << ch->error() << endl;
992
993 hdr_wkup *wkuph = HDR_WKUP(p);
994
995 // if an error occurs in the pkt received we must subtract a tone duration
996 double tone_time_interval = 0;
997
998 if (ch->error())
999 tone_time_interval = wkuph->endRx_time - wkuph->startRx_time -
1001 else
1002 tone_time_interval = wkuph->endRx_time - wkuph->startRx_time;
1003
1006
1007 Packet::free(p);
1008
1009 switch (curr_state) {
1010
1011 // fallthrough
1012 case (STATE_BACKOFF):
1013
1014 case (STATE_WAIT_END_CR):
1015
1016 case (STATE_IDLE): {
1017
1018 if (debug_ > 0)
1019 cout << NOW << " MMacTLOHI(" << addr
1020 << ")::Phy2MacEndRx() TONE rx. From "
1021 << status_info[curr_state] << " to "
1022 << status_info[STATE_SLEEP] << endl;
1023
1024 checkDataPhy();
1025 stateSleep();
1026 } break;
1027
1029
1031
1032 int contenders = countContenders(tone_time_interval);
1033 curr_contenders += contenders;
1034
1035 if (debug_ > 0)
1036 cout << NOW << " MMacTLOHI(" << addr
1037 << ")::Phy2MacEndRx() contenders number = " << contenders
1038 << " ; current contenters = " << curr_contenders << endl;
1039
1040 } break;
1041
1042 case (STATE_WAIT_XACK):
1043
1044 case (STATE_SLEEP): {
1045 checkDataPhy();
1046 // refreshReason(REASON_TONE_RX);
1047 stateSleep();
1048 } break;
1049
1050 case (STATE_WAIT_ACK): {
1051 checkDataPhy();
1052 } break;
1053
1054 default: {
1055
1056 if (debug_)
1057 cout << NOW << " MMacTLOHI(" << addr << ")::Phy2MacEndRx() "
1058 << "wrong state " << status_info[curr_state] << endl;
1059
1060 // drop(p,1,TLOHI_DROP_REASON_WRONG_STATE);
1061 // Packet::free(p);
1062 // return;
1063
1064 } break;
1065 }
1066}
1067
1068void
1070{
1071}
1072
1073void
1075{
1076}
1077
1078void
1080{
1081 Packet *tone_pkt = Packet::alloc();
1082 initPkt(tone_pkt, TONE_PKT);
1083
1084 TxActive = true;
1085 tone_transmitted = true;
1087 Mac2PhyStartTx(tone_phy_id, tone_pkt);
1088}
1089
1090void
1092{
1093 Packet *data_pkt = curr_data_pkt->copy(); // copio pkt
1094
1095 if ((ack_mode == NO_ACK_MODE))
1096 queuePop(true);
1097
1098 // initPkt(data_pkt , DATA_PKT);
1099
1100 TxActive = true;
1101 incrDataPktsTx();
1104 Mac2PhyTurnOn(data_phy_id);
1105 Mac2PhyStartTx(data_phy_id, data_pkt);
1106}
1107
1108void
1110{
1111 Packet *ack_pkt = Packet::alloc();
1112 initPkt(ack_pkt, ACK_PKT);
1113
1114 TxActive = true;
1115 incrAckPktsTx();
1116
1117 Mac2PhyTurnOn(data_phy_id);
1118 Mac2PhyStartTx(data_phy_id, ack_pkt);
1119}
1120
1121void
1123{
1124 Mac2PhyTurnOn(data_phy_id);
1126 // data_phy_timer.resched(sleep_timeout + wait_costant);
1127}
1128
1129void
1131{
1132 timer.force_cancel();
1134
1137
1138 session_active = false;
1139 resetSession();
1140
1141 if (!Q.empty()) {
1142 if (HDR_TLOHI(Q.front())->data_sn != last_data_id_tx) {
1144 curr_tx_tries = 0;
1145 last_data_id_tx = HDR_TLOHI(Q.front())->data_sn;
1146 }
1150 } else {
1151 queuePop(false); // FALSE
1152 incrDroppedPktsTx();
1153
1155
1156 if (debug_)
1157 cout << NOW << " MMacTLOHI(" << addr
1158 << ")::stateIdle() curr_tx_tries " << curr_tx_tries
1159 << " > max_tx_tries = " << max_tx_tries << endl;
1160 // waitForUser();
1161
1162 stateIdle();
1163 }
1164 }
1165}
1166
1167void
1169{
1170 session_active = true;
1171
1172 // Mac2PhyTurnOff(data_phy_id);
1173
1174 timer.force_cancel();
1176
1179
1180 curr_data_pkt = Q.front();
1181 hdr_mac *mach = HDR_MAC(curr_data_pkt);
1182 curr_dest_addr = mach->macDA(); // indirizzo destinazione
1183
1184 txTone();
1185}
1186
1187void
1189{
1190 timer.force_cancel();
1192
1193 backoff_pending = true;
1194
1196
1197 backoff_start_time = NOW;
1198 timer.resched(backoff_duration);
1199
1202}
1203
1204void
1206{
1207 timer.resched(CR_duration);
1208
1209 // Mac2PhyTurnOff(data_phy_id);
1210
1212
1215}
1216
1217void
1219{
1220 timer.force_cancel();
1221
1222 // Mac2PhyTurnOff(data_phy_id);
1223
1225
1228
1229 if (curr_contenders == 0) {
1231 stateTxData();
1232 } else {
1234 stateBackoff();
1235 }
1236}
1237
1238void
1240{
1241 timer.resched(CR_duration);
1242
1244
1247}
1248
1249void
1251{
1252 timer.resched(sleep_timeout);
1254
1257}
1258
1259void
1261{
1262 timer.force_cancel();
1264
1267
1268 txTone();
1269 // tone_transmitted = false;
1270 // txData();
1271}
1272
1273void
1275{
1276 timer.force_cancel();
1278
1281
1282 // timer.resched(2*max_prop_delay + computeTxTime(TONE_PKT));
1283 timer.resched(ACK_timeout + wait_costant);
1284}
1285
1286void
1288{
1289 timer.force_cancel();
1291
1294
1297 // timer.resched(ACK_timeout);
1298}
1299
1300void
1302{
1303 timer.force_cancel();
1305
1308
1309 // txTone();
1310 tone_transmitted = false; // seems awkward but if put to true tlohi would
1311 // send two ack pkts. check EndTx
1312 txAck();
1313}
1314
1315void
1317{
1318 timer.force_cancel();
1320
1323
1324 double random = RNG::defaultrng()->uniform_double();
1325
1326 while (random == 0)
1327 random = RNG::defaultrng()->uniform_double();
1328
1329 double recontend_duration = recontend_time * random;
1330
1331 if (!Q.empty())
1332 timer.resched(recontend_duration);
1333 else {
1335 stateIdle();
1336 }
1337}
1338
1339void
1341{
1342 timer.force_cancel();
1345
1348
1349 // tolgo type tlohi e metto quello originale
1350 incrDataPktsRx();
1351 hdr_cmn *ch = hdr_cmn::access(data_pkt);
1352 hdr_tlohi *tlohih = HDR_TLOHI(data_pkt);
1353 ch->ptype() = tlohih->orig_type;
1354 ch->size() = ch->size() - HDR_size;
1355
1356 sendUp(data_pkt); // mando agli strati superiori il pkt
1357
1358 if (ack_mode == ACK_MODE)
1359 stateTxAck();
1360 else
1362}
1363
1364void
1366{
1367 if (debug_)
1368 cout << NOW << " MMacTLOHI(" << addr << ")::printStateInfo() "
1369 << "from " << status_info[prev_state] << " to "
1371 << ". Reason: " << reason_info[last_reason] << endl;
1372
1373 if (curr_state == STATE_BACKOFF) {
1374 fout << left << setw(10) << NOW << " MMacTLOHI(" << addr
1375 << ")::printStateInfo() "
1376 << "from " << status_info[prev_state] << " to "
1378 << ". Reason: " << reason_info[last_reason]
1379 << ". Backoff duration = " << delay << endl;
1380 } else {
1381 fout << left << setw(10) << NOW << " MMacTLOHI(" << addr
1382 << ")::printStateInfo() "
1383 << "from " << status_info[prev_state] << " to "
1385 << ". Reason: " << reason_info[last_reason] << endl;
1386 }
1387}
1388
1389void
1391{
1392 std::string response;
1393 std::cout << "Press Enter to continue";
1394 std::getline(std::cin, response);
1395}
virtual void expire(Event *e)
Event method called when the timer expire.
Class that represents the T-LOHI MAC protocol for a node.
virtual double getCRduration()
Returns the duration of the Contention Round, where the nodes contend the channel.
virtual void initMphyIds()
Initializes the ID of the PHY layer for tone and Data.
virtual int command(int argc, const char *const *argv)
TCL command interpreter.
double tone_data_delay
Not used anymore.
virtual void stateWaitXAck()
The node has just received a DATA packet intended for another node.
int curr_dest_addr
Current destination MAC address.
ofstream fout
Object that handle the output file for the state transition of the protocol.
virtual void exitBackoff()
Reset the timer for Backoff (i.e.
static map< TLOHI_STATUS, string > status_info
Map between the state and the textual description of the state.
int buffer_pkts
Buffer capacity in number of packets.
virtual int getTonePktsRx()
returns the number of tones received in the simulation
virtual void stateDataReceived(Packet *data_pkt)
A data packet is received.
queue< Packet * > Q
MAC queue used for packet scheduling.
int u_data_id
simulation-unique data packet ID
virtual void stateSleep()
Simulate the sleep modality of the PHY layer of the node, while the node is waiting for the DATA.
virtual void Phy2MacEndRx(Packet *p)
Method called when the Phy Layer finish to receive a Packet.
virtual void stateWaitEndContention()
The nodes waits the end of Contention listening the channel for possible contenders.
double backoff_start_time
Timestamp of the backoff start time.
virtual void recvFromUpperLayers(Packet *p)
Receives the packet from the upper layer (e.g.
bool mphy_ids_initialized
Flag that indicates if the IDs of the PHY layers is stored.
double wait_costant
Additive factor in the calculation of ACK timer.
Timer timer
timer for Contention Round
virtual void incrTonePktsTx()
Increments the number of the TONE sended.
virtual void incrCurrTxRounds()
Increments the number of times a packet has been transmitted.
virtual void stateTxAck()
The node transmit the ACK packet for a received DATA packet (in ACK_MODE modality)
virtual void rxAck(Packet *p)
Method that receive an ACK packet.
virtual int getUpLayersDataPktsRx()
TLOHI_MODE op_mode
Operational mode of the protocol.
virtual void refreshReason(TLOHI_REASON_STATUS reason)
Refresh the reason for the change of state of the protocol.
virtual void incrTonePktsRx()
Increments the number of the TONE received.
virtual void waitForUser()
Used for debug purposes (permits a step-by-step behaviour of the protocol.
static map< TLOHI_PKT_TYPE, string > pkt_type_info
Map between the pkt-type and the description of the packet.
static map< TLOHI_REASON_STATUS, string > reason_info
Map between the reason for state transitions and the description of this reason.
virtual int countContenders(double time)
Returns the number of Contenders in this Contention Round based on the number of tones received.
virtual void rxTone(Packet *p)
Method that receives a Tone.
virtual int getTonePktsTx()
returns the number of tones transmitted in the simulation
bool TxActive
Flag that indicates if a transmission is occuring.
virtual void txTone()
Send the Tone to the tone PHY layer.
virtual void stateIdle()
IDLE state of the protocol.
virtual void initData()
Initializes the information of the protocol related to the data PHY layers (i.e.
int ACK_size
Size of the ACK packet in bytes.
int txsn
Transmitted data serial number.
bool print_transitions
Flat that indicates if the modality in which the protocol write in a file the state transitions is ac...
static bool initialized
Flag that indicates if the protocol is initialized.
bool has_buffer_queue
Flag that indicates whether the node has a buffer queue.
virtual void queuePop(bool flag)
Pop the first element of the data packets queue.
int curr_contenders
Number of contenders in current Contention Round.
virtual void Phy2MacEndTx(const Packet *p)
Method called when the PHY layer finish to transmit the packet.
TLOHI_ACK_MODE ack_mode
ACK mode of the protocol.
double DATA_listen_timeout
Time needed for the reception of a DATA packet.
virtual double computeTxTime(TLOHI_PKT_TYPE type)
Computes the Transmission Time of a Packet using a CrLayer Message to ask the PHY to perform this cal...
virtual void stateStartContention()
The node starts the Contention sending a Tone.
virtual void printStateInfo(double delay=0)
Initializes the protocol at the beginning of the simulation.
double session_distance
Distance between transmitter and receiver in this session.
static int u_pkt_id
simulation-unique packet ID
double CR_duration
Contention Round Duration.
virtual void initPkt(Packet *p, TLOHI_PKT_TYPE pkt_type)
Init the packet with the MAC address of the receiver and the sender, the size of the packet and the t...
virtual void checkPhyInit()
Checks if the PHY layers (for DATA and TONE) are initialized.
virtual int crLayCommand(ClMessage *m)
Cross-Layer messages interpreter.
virtual void txData()
Send a DATA packet to the data PHY layer.
virtual void stateTxData()
The node has won the CR.
virtual void checkDataPhy()
Checks if the PHY layer for Data is active.
TLOHI_REASON_STATUS last_reason
Last reason for state transition of the protocol.
double max_prop_delay
Maximum propagation delay in the network.
virtual void stateWaitCR()
Set the duration of the timer of the duration of the Contention Round.
int max_tx_rounds
Maximum transmission round for one packet.
bool backoff_pending
Flag that indicates if a backoff timer is pending.
TLOHI_STATUS prev_state
Previous state of the protocol.
virtual void stateBackoff()
The node is in Backoff state.
virtual void incrCurrTxTries()
Increments the number of tries for the transmission of a packet.
virtual void stateWaitAck()
The node has just sent a DATA packet.
TLOHI_STATUS curr_state
Current state of the protocol.
int data_phy_id
ID of the DATA PHY layer.
virtual void refreshState(TLOHI_STATUS state)
Refresh the state of the protocol.
int curr_tx_rounds
Number of current transmission round.
string tcl_modulation
Type of modulation adopted for data PHY layer.
Packet * curr_data_pkt
Pointer to the current data packet.
int max_payload
Maximum Data payload dimension in number of bytes.
int tone_phy_id
ID of the tone PHY layer.
MMacTLOHI()
Constructor of the class.
virtual void initInfo()
Initializes the map between the protocol states and the textual description of these states.
double sleep_timeout
Duration of the sleep phase for the PHY layer.
double recontend_time
Time needed for the recontention.
int HDR_size
Dimension of the header added by T-LOHI in bytes.
virtual void rxElse(Packet *p)
Receives other types of packets.
virtual void txAck()
Send a ACK packet of the data PHY layer.
DataTimer data_phy_timer
Timer that describe the time needed to receive the packet (i.e.
virtual void stateRecontendWindow()
Calculate the duration of the RecontendWindow.
double backoff_duration
Duration of the backoff timer.
int curr_tx_tries
Number of current transmission tries.
virtual void stateCountContenders()
The node counts the contenders in the CR.
bool tone_transmitted
Flag that indicates if a tone has been transmitted.
virtual void resetSession()
Resets the variable related to the Session (i.e.
double ACK_timeout
Time needed for the reception of a ACK packet.
virtual void setDestAddr(int mac_addr)
Store the MAC address of the destination for this session.
double max_tx_tries
Maximum transmission tries for one packet.
int last_data_id_tx
Last data packet received ID.
bool session_active
Flag that indicates if a Session is active.
virtual void Phy2MacStartRx(const Packet *p)
Method called when the Phy Layer start to receive a Packet.
virtual void getBackoffTime()
Performs the calculation of the Backoff timer.
double backoff_remaining
Remaining time of the backoff (if the timer has been freezed)
virtual ~MMacTLOHI()
Destructor of the class.
Class that describes the WakeUp PHY layer for T-LOHI MAC protocol.
Class that represent the binding with the tcl configuration script.
TclObject * create(int, const char *const *)
Create the TCL object needed for the tcl language interpretation.
TLOHIModuleClass()
Constructor of the class.
Class the describe the PacketHeader for T-LOHI header.
TLOHIPktClass()
Constructor of the class.
virtual void expire(Event *e)
Event method called when the timer expire.
Struct that defines the header of T-LOHI in the packets.
int data_sn
DATA packet sequence number.
double ts
packet timestamp, i.e., its generation time)
TLOHI_PKT_TYPE pkt_type
T-LOHI packet type.
static int offset_
Required by PacketManager Header.
packet_t orig_type
Original type of the packet (i.e.
int sn
sequence number of this packet
Header of the Wake Up Tone.
double startRx_time
Start Reception Time.
double endRx_time
End Reception Time.
@ NO_ACK_MODE
@ NOT_SET
@ SESSION_DISTANCE_NOT_SET
TLOHIPktClass class_tlohi_pkt
TLOHIModuleClass class_module_tlohi
Provides the declaration of uw-mac-TLohi MAC protocol.
#define HDR_TLOHI(P)
static const int prop_speed
typical sound speed in underwater scenario
@ ACK_MODE
@ NO_ACK_MODE
TLOHI_PKT_TYPE
Enumeration that indicates the possibile type of packets in T-LOHI MAC protocol.
@ TONE_PKT
@ DATAMAX_PKT
@ ACK_PKT
@ DATA_PKT
#define TLOHI_DROP_REASON_BUFFER_FULL
@ STATE_COUNT_CONTENDERS
@ STATE_WAIT_END_CONTENTION
@ STATE_WAIT_XACK
@ STATE_TX_DATA
@ STATE_WAIT_END_CR
@ STATE_DATA_RECEIVED
@ STATE_RECONTEND_WINDOW
@ STATE_IDLE
@ STATE_SLEEP
@ STATE_START_CONTENTION
@ STATE_BACKOFF
@ STATE_ACK_RECEIVED
@ STATE_TX_ACK
@ STATE_WAIT_ACK
#define TLOHI_DROP_REASON_UNKNOWN_TYPE
@ AGGRESSIVE_UNSYNC_MODE
@ CONSERVATIVE_UNSYNC_MODE
#define TLOHI_DROP_REASON_WRONG_STATE
@ REASON_DATA_EMPTY
@ REASON_BACKOFF_TIMEOUT
@ REASON_ACK_TIMEOUT
@ REASON_XDATA_RX
@ REASON_NO_CONTENDERS
@ REASON_CONTENDERS
@ REASON_XACK_TIMEOUT
@ REASON_DATA_PENDING
@ REASON_MAX_TX_TRIES
@ REASON_ACK_TX
@ REASON_RECONTEND_END
@ REASON_SLEEP_TIMEOUT
@ REASON_XACK_RX
@ REASON_TONE_RX
@ REASON_DATA_RX
@ REASON_TONE_TX
@ REASON_DATA_TX
@ REASON_CR_END
@ REASON_ACK_RX
@ REASON_WAIT_CR_END
Provides the declaration of WakeUp PHY.
@ NOT_SET
Definition uwaloha.cpp:44
@ SESSION_DISTANCE_NOT_SET
Definition uwaloha.cpp:44
Provides the definition of the Wake Up Tone Packet Header.
#define HDR_WKUP(P)