Go to the documentation of this file.
13 #ifndef DEFAULTRF_INTERFACE_H_
14 #define DEFAULTRF_INTERFACE_H_
68 RFInterface(
const uint8_t maxFrameLength,
const RFIType interfaceType,
const bool canCheckInterference,
const uint8_t maxChannelNumber,
const uint8_t minChannelNumber,
const uint8_t maxPowerValue,
const uint8_t minPowerValue,
const bool canSetSpeed,
const uint32_t baseFrequency, ThreadLock *_lock);
77 virtual bool init() = 0;
101 virtual bool send(uint8_t* data, uint8_t dataSize) = 0;
112 virtual bool recv(uint8_t* data, uint8_t& dataSize, int8_t& rssi) = 0;
126 virtual bool sleep() = 0;
133 virtual bool wakeUp() = 0;
156 virtual bool setPower(uint8_t power) = 0;
186 virtual void handle() = 0;
209 virtual uint8_t
scanChannels(uint8_t startChannel, uint8_t endChannel, uint8_t retries = 50,
OSTREAM *stream = NULL) = 0;
227 virtual uint8_t
scanChannels(uint8_t startChannel, uint8_t endChannel,
OSTREAM *stream = NULL) = 0;
241 #ifndef RF_NO_INTERNAL_TMP_BUFFER
302 virtual uint32_t millis() = 0;
303 virtual uint32_t micros() = 0;
304 virtual uint64_t micros64() = 0;
305 virtual void delay(uint32_t time) = 0;
306 virtual void delayMicroseconds(uint32_t time) = 0;
307 virtual std::chrono::nanoseconds PauseSimulationTimer() = 0;
308 virtual void ResumeSimulationTimer() = 0;
309 virtual std::mutex& GetStreamMutex() = 0;
310 virtual std::mutex& GetMutex() = 0;
311 virtual bool isLogOnly() = 0;
312 virtual void logTableChange(std::string& descriptor, TableChangeType changeType,
const char* data) = 0;
virtual bool hasError()=0
Override this method to check if radio has some error or is not connected to MCU. If this method retu...
Structure, which holds network scan result.
Definition: meshPacketFlags.h:452
virtual uint8_t * getInternalTemporaryBuffer()=0
Gets pointer to internal temporary buffer with size of MaxFrameLength. This buffer can be used for te...
Radio frequency interface, that helps to use meshNet with different radios or communication types....
Definition: RFInterface.h:48
const uint32_t BaseFrequency
Frequency of channel 0 in kHz.
Definition: RFInterface.h:292
virtual bool interruptHandle()=0
This method has to be done, when ReceiveInterrupt happened.
virtual uint32_t getChannelsWidth()=0
Gets width of each channels in kHz.
ThreadLock * lock
Thread lock, that is used to lock current methods.
Definition: RFInterface.h:297
virtual bool setReceiveInterruptCallback(void(*InterruptCallback)(void))=0
Override this method to set receive message interrupt method. If interrupt cannot be set or is not su...
const uint8_t MaxPowerValue
Maximum power level value. When this value is equal or lower than MinPowerValue, radio output power c...
Definition: RFInterface.h:277
virtual bool send(uint8_t *data, uint8_t dataSize)=0
Override this method to send data through radio.
virtual void printDetails(OSTREAM *stream)=0
This method is used to print radio details to stream (usually to Serial port). Method is also called,...
const bool CanCheckInterference
True when interference can be checked.
Definition: RFInterface.h:262
RFIType
Interface type. Each derivation of RFInterface class has it's own type.
Definition: RFInterface.h:22
const uint8_t MaxFrameLength
RF_NO_INTERNAL_TMP_BUFFER.
Definition: RFInterface.h:252
RFInterface(const uint8_t maxFrameLength, const RFIType interfaceType, const bool canCheckInterference, const uint8_t maxChannelNumber, const uint8_t minChannelNumber, const uint8_t maxPowerValue, const uint8_t minPowerValue, const bool canSetSpeed, const uint32_t baseFrequency, ThreadLock *_lock)
Constructor - has to be overridden and parameters have to be set in overridden constructor.
Definition: RFInterface.cpp:4
const uint8_t MinChannelNumber
Minimum channel number. When this value is equal or higher than MaxChannelNumber, radio channel canno...
Definition: RFInterface.h:272
virtual bool setPower(uint8_t power)=0
Override this method to set radio output power. If radio output power cannot be set,...
virtual bool checkInterference()=0
Override this method to check, if there is currently an interference in the air. If interference chec...
virtual bool deInit()=0
Override this method to de-initialize radio and communication with it.
virtual bool setChannel(uint8_t channel)=0
Override this method to set radio channel. If channels cannot be set on selected radio,...
const uint8_t MinPowerValue
Minimum power level value. When this value is equal or higher than MaxPowerValue, radio output power ...
Definition: RFInterface.h:282
#define OSTREAM
Definition: meshConfig.h:41
virtual bool scanChannelsWorking()=0
Checks if channel scan is processed now.
virtual bool recv(uint8_t *data, uint8_t &dataSize, int8_t &rssi)=0
Override this method to read data from radio buffer.
virtual bool sleep()=0
Override this method to temporary power off the radio. If the radio cannot sleep, just return true.
virtual ~RFInterface()=0
Definition: RFInterface.cpp:19
virtual void handle()=0
This method is included in meshNet::handle() method and it is included in main loop.
@ RFI_NONE
Definition: RFInterface.h:24
const uint8_t MaxChannelNumber
Maximum channel number. When this value is equal or lower than MinChannelNumber, radio channel cannot...
Definition: RFInterface.h:267
const bool CanSetSpeed
True when speed (data rate) can be set.
Definition: RFInterface.h:287
virtual bool init()=0
Override this method to initialize radio and communication with it.
@ RFI_NRF24L01
Definition: RFInterface.h:26
virtual bool setFullSpeed(bool enableFullSpeed)=0
Override this method to set full or slow speed (data rate). If speed cannot be set,...
const RFIType InterfaceType
Interface type, see RFIType.
Definition: RFInterface.h:257
virtual uint8_t scanChannels(uint8_t startChannel, uint8_t endChannel, uint8_t retries=50, OSTREAM *stream=NULL)=0
This method has to scan all free channels and returns channel with minimum interferences....
virtual bool wakeUp()=0
Override this method to temporary power on (wake up) the radio from sleep. If the radio cannot sleep,...
This file contains classes and structures which can be used to handling mesh frames.
virtual uint8_t available()=0
Override this method to get raw size of received frame in bytes.