Basic MAC data interface for LoRa transceiver
Dependents: LoRaBaseStation LoRaTerminal
Diff: AlohaTransceiver.cpp
- Revision:
- 26:e87c8d345644
- Parent:
- 25:bcd1cee4e5a8
- Child:
- 27:463688e3bd12
--- a/AlohaTransceiver.cpp Sat Sep 03 01:03:30 2016 +0000 +++ b/AlohaTransceiver.cpp Sat Sep 03 01:11:42 2016 +0000 @@ -157,24 +157,24 @@ { // create new frame instance AlohaFrame frame(Buffer, BufferSize); - - // schedule the ack frame immediatly after the data frame is received - if (frame.getType() == AlohaFrame::Aloha_Data) - { - sendAck(&frame); - } - else if (frame.getType() == AlohaFrame::Aloha_ACK) - { -#ifdef DEBUG_ALOHA - printf("TXACK::SEQID:0x%x\r\n", frame.getSequenceID()); -#endif - } - + // check destination // if the destination is the device id, then processing, otherwise drop the packet and continue // listening if (frame.getDestinationAddress() == (deviceId & 0x0f)) { + // schedule the ack frame immediatly after the data frame is received + if (frame.getType() == AlohaFrame::Aloha_Data) + { + sendAck(&frame); + } + else if (frame.getType() == AlohaFrame::Aloha_ACK) + { +#ifdef DEBUG_ALOHA + printf("RXACK::SEQID:0x%x\r\n", frame.getSequenceID()); +#endif + } + // check registered callback function // execute callback functions if registered uint8_t type = frame.getType(); @@ -231,10 +231,6 @@ { AlohaFrame *frame = AlohaTxQueue.dequeue(); -#ifdef DEBUG_ALOHA - printf("\r\nTXDATA:ADDR:0x%x, SEQID:0x%x\r\n", frame->getDestinationAddress(), frame->getSequenceID()); -#endif - // create a buffer for transmit uint8_t frame_length = frame->getPayloadLength() + FIXED_BYTE; uint8_t buffer[frame_length]; // 4 fix fields