diff --git a/src/protocols/PhysicalLayer/PhysicalLayer.cpp b/src/protocols/PhysicalLayer/PhysicalLayer.cpp index 5c9b697c..b244b856 100644 --- a/src/protocols/PhysicalLayer/PhysicalLayer.cpp +++ b/src/protocols/PhysicalLayer/PhysicalLayer.cpp @@ -289,6 +289,19 @@ float PhysicalLayer::getSNR() { return(RADIOLIB_ERR_UNSUPPORTED); } +uint32_t PhysicalLayer::getTimeOnAir(size_t len) { + (void)len; + return(0); +} + +int16_t PhysicalLayer::startChannelScan() { + return(RADIOLIB_ERR_UNSUPPORTED); +} + +int16_t PhysicalLayer::getChannelScanResult() { + return(RADIOLIB_ERR_UNSUPPORTED); +} + int16_t PhysicalLayer::scanChannel() { return(RADIOLIB_ERR_UNSUPPORTED); } @@ -441,6 +454,14 @@ void PhysicalLayer::clearPacketSentAction() { } +void PhysicalLayer::setChannelScanAction(void (*func)(void)) { + (void)func; +} + +void PhysicalLayer::clearChannelScanAction() { + +} + #if defined(RADIOLIB_INTERRUPT_TIMING) void PhysicalLayer::setInterruptSetup(void (*func)(uint32_t)) { Module* mod = getMod(); diff --git a/src/protocols/PhysicalLayer/PhysicalLayer.h b/src/protocols/PhysicalLayer/PhysicalLayer.h index ef5dd93e..ba7df212 100644 --- a/src/protocols/PhysicalLayer/PhysicalLayer.h +++ b/src/protocols/PhysicalLayer/PhysicalLayer.h @@ -302,6 +302,26 @@ class PhysicalLayer { */ virtual float getSNR(); + /*! + \brief Get expected time-on-air for a given size of payload + \param len Payload length in bytes. + \returns Expected time-on-air in microseconds. + */ + virtual uint32_t getTimeOnAir(size_t len); + + /*! + \brief Interrupt-driven channel activity detection method. interrupt will be activated + when packet is detected. Must be implemented in module class. + \returns \ref status_codes + */ + virtual int16_t startChannelScan(); + + /*! + \brief Read the channel scan result + \returns \ref status_codes + */ + virtual int16_t getChannelScanResult(); + /*! \brief Check whether the current communication channel is free or occupied. Performs CAD for LoRa modules, or RSSI measurement for FSK modules. @@ -409,6 +429,17 @@ class PhysicalLayer { \brief Clears interrupt service routine to call when a packet is sent. */ virtual void clearPacketSentAction(); + + /*! + \brief Sets interrupt service routine to call when a channel scan is finished. + \param func ISR to call. + */ + virtual void setChannelScanAction(void (*func)(void)); + + /*! + \brief Clears interrupt service routine to call when a channel scan is finished. + */ + virtual void clearChannelScanAction(); #if defined(RADIOLIB_INTERRUPT_TIMING)