Basic MAC data interface for LoRa transceiver
Dependents: LoRaBaseStation LoRaTerminal
Diff: AlohaTransceiver.cpp
- Revision:
- 33:810074d10fcf
- Parent:
- 32:b7d87c5f647c
- Child:
- 34:14b1472a79e4
--- a/AlohaTransceiver.cpp Sat Sep 03 04:51:26 2016 +0000 +++ b/AlohaTransceiver.cpp Sat Sep 03 05:01:19 2016 +0000 @@ -199,8 +199,7 @@ uint8_t foreign_seqid = frame->getSequenceID(); // compare the local sequence id and foreign sequence id for specific host - // if same then set the flag - if (seqid[src_addr] == foreign_seqid) + if (seqid[src_addr] <= foreign_seqid) { setAckedFlag(src_addr); } @@ -274,15 +273,19 @@ for (size_t i = 0; i < AlohaTxQueue.getCounter(); i++) { AlohaFrame *frame = AlohaTxQueue.dequeue(); - uint8_t type = frame->getType(); - + // determined by the type of the frame, only data frame need to be cleared before transmitting - switch (type) + switch (frame->getType()) { // ack frame can transmit directly case AlohaFrame::Aloha_ACK: { sendFrame(frame); + + // block the next transmission until previous transmission is done + clearTxDoneFlag(); + + // free memory delete frame; break; @@ -317,7 +320,10 @@ } default: + { + delete frame; break; + } } } }