Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of libmDot-custom by
Information
Library has been updated to mbed 5.x
The LoRaWAN Certification test mode implementation is built-in to libmDot code. When a start test mode packet is received the library will not return until test mode has ended.
Warning
This library is currently in BETA release. Unresolved issues may be experienced. Software is provided as is with no expectation of support of bug fixes in the future. Please report issues found through the mbed website or directly to support.multitech.com.
Changing of channel plan parameters may cause the device to no longer respect local RF regulations. Please use caution and respect your local regulations.
In AT Command Firmware remove line 803.
CommandTerminal/CommandTerminal.cpp
delete[] info->RxBuffer;
Likewise, if your application is handling events from the library asynchronously.
Creating new channel plans
Copy EU868 or US915 custom channel plan as a starting point
Import programmDot_AT_firmware_CUSTOM
AT Firmware with custom channel plan support
EU868 provides a framework for a DYNAMIC channel plan with duty-cycle limitations
US915 provides a framework for a FIXED channel plan
RADIO_POWERS are measured output in dBm for each radio tx power setting.
Additional MAC Commands can be implemented by overriding the HandleMacCommand function.
Steps
- Setup datarates, duty-cycle bands and channels in ChannelPlan_* constructor
- Modify GetJoinDatarate and CalculateJoinBackoff to change join datarates and backoff
- Customize HandleJoinAccept datarates
- Use GetRxWindow(int) to define how the device open Rx window 1 and 2
- GetNextChannel will pick a channel from the enabled channel at the current datarate before each TX
Diff: ChannelPlan.h
- Revision:
- 23:3830a5f61f09
- Parent:
- 21:f77f883a080e
--- a/ChannelPlan.h Mon Oct 31 14:18:29 2016 +0000
+++ b/ChannelPlan.h Fri Jan 06 17:21:04 2017 +0000
@@ -7,7 +7,7 @@
*
* @author Jason Reiss
* @date 10-31-2015
- * @brief lora::ChannelPlan provides an interface for LoRaWAN channel plans
+ * @brief lora::ChannelPlan provides an interface for LoRaWAN channel schemes
*
* @details
*
@@ -95,7 +95,21 @@
* Get channel at index
* @return Channel
*/
- virtual Channel GetChannel(int8_t index);
+ virtual Channel GetChannel(uint8_t index);
+
+ /**
+ * Add a downlink channel to the ChannelPlan
+ * Set to 0 to use the default uplink channel frequency
+ * @param index of channel, use -1 to add to end
+ * @param channel settings to add
+ */
+ virtual uint8_t AddDownlinkChannel(int8_t index, Channel channel);
+
+ /**
+ * Get channel at index
+ * @return Channel
+ */
+ virtual Channel GetDownlinkChannel(uint8_t index);
/**
* Set number of datarates in ChannelPlan
@@ -331,6 +345,12 @@
virtual std::vector<uint32_t> GetChannels();
/**
+ * Get the downlink channels in use by current channel plan
+ * @return channel frequencies
+ */
+ virtual std::vector<uint32_t> GetDownlinkChannels();
+
+ /**
* Get the channel datarate ranges in use by current channel plan
* @return channel datarate ranges
*/
@@ -428,14 +448,37 @@
*/
virtual void MacEvent();
+ /**
+ * Called before Mac layer handles command buffer.
+ * Use to add custom or new mac command handling
+ * @return LORA_OK
+ */
+ virtual uint8_t HandleMacCommands(uint8_t* payload, uint8_t index, uint8_t end_index);
+
virtual void DecrementDatarate();
virtual void IncrementDatarate();
- virtual uint8_t HandleMacCommands(uint8_t* payload, uint8_t index, uint8_t end_index);
-
+ virtual std::string GetPlanName();
virtual uint8_t GetPlanType();
- virtual uint32_t GetMinimumFrequency();
- virtual uint32_t GetMaximumFrequency();
+ virtual uint32_t GetMinFrequency();
+ virtual uint32_t GetMaxFrequency();
+
+ virtual uint8_t GetMinDatarate();
+ virtual uint8_t GetMaxDatarate();
+ virtual uint8_t GetMinDatarateOffset();
+ virtual uint8_t GetMaxDatarateOffset();
+
+ virtual uint8_t GetMinRx2Datarate();
+ virtual uint8_t GetMaxRx2Datarate();
+ virtual uint8_t GetMaxTxPower();
+
+ virtual uint32_t GetLBT_TimeMs();
+ virtual void SetLBT_TimeMs(uint32_t ms);
+
+ virtual int32_t GetLBT_Threshold();
+ virtual void SetLBT_Threshold(int32_t rssi);
+
+ bool ListenBeforeTalk();
protected:
@@ -448,6 +491,7 @@
std::vector<Datarate> _datarates; //!< List of datarates
std::vector<Channel> _channels; //!< List of channels for transmit
+ std::vector<Channel> _dlChannels; //!< List of channels for receive if changed from default
std::vector<DutyBand> _dutyBands; //!< List of duty bands to limit radio time on air
@@ -479,6 +523,9 @@
uint8_t _numChans125k; //!< Number of 125K channels in plan
uint8_t _numChans500k; //!< Number of 500K channels in plan
+ uint32_t _LBT_TimeMs; //!<
+ int32_t _LBT_Threshold; //!<
+
std::vector<uint16_t> _channelMask; //!< Bit mask for currently enabled channels
Timer _dutyCycleTimer; //!< Timer for tracking time-off-air
@@ -510,6 +557,7 @@
static const uint8_t AU915_MAX_PAYLOAD_SIZE_REPEATER[]; //!< List of repeater compatible max payload sizes for each datarate
PlanType _type;
+ std::string _planName;
};
}

