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
MTSLog.h@7:683dba5d576f, 2015-08-17 (annotated)
- Committer:
- Mike Fiore
- Date:
- Mon Aug 17 16:18:29 2015 -0500
- Revision:
- 7:683dba5d576f
- Parent:
- 1:9f30fbe9e9c1
update to version 0.0.7
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Mike Fiore |
1:9f30fbe9e9c1 | 1 | /************************************************ |
| Mike Fiore |
1:9f30fbe9e9c1 | 2 | * MultiTech MTDOT Library |
| Mike Fiore |
1:9f30fbe9e9c1 | 3 | * Copyright (c) 2015 MultiTech Systems |
| Mike Fiore |
1:9f30fbe9e9c1 | 4 | * |
| Mike Fiore |
1:9f30fbe9e9c1 | 5 | * See LICENSE file for license information |
| Mike Fiore |
1:9f30fbe9e9c1 | 6 | ***********************************************/ |
| Mike Fiore |
1:9f30fbe9e9c1 | 7 | |
| Mike Fiore |
1:9f30fbe9e9c1 | 8 | #ifndef MTSLOG_H |
| Mike Fiore |
1:9f30fbe9e9c1 | 9 | #define MTSLOG_H |
| Mike Fiore |
1:9f30fbe9e9c1 | 10 | |
| Mike Fiore |
1:9f30fbe9e9c1 | 11 | #ifdef MTS_DEBUG |
| Mike Fiore |
1:9f30fbe9e9c1 | 12 | #define logFatal(format, ...) \ |
| Mike Fiore |
7:683dba5d576f | 13 | mts::MTSLog::printMessage(mts::MTSLog::FATAL_LEVEL, "%s:%s:%s| [%s] " format "\r\n", __FILE__, __func__, __LINE__, mts::MTSLog::FATAL_LABEL, ##__VA_ARGS__) |
| Mike Fiore |
1:9f30fbe9e9c1 | 14 | #define logError(format, ...) \ |
| Mike Fiore |
7:683dba5d576f | 15 | mts::MTSLog::printMessage(mts::MTSLog::ERROR_LEVEL, "%s:%s:%s| [%s] " format "\r\n", __FILE__, __func__, __LINE__, mts::MTSLog::ERROR_LABEL, ##__VA_ARGS__) |
| Mike Fiore |
1:9f30fbe9e9c1 | 16 | #define logWarning(format, ...) \ |
| Mike Fiore |
7:683dba5d576f | 17 | mts::MTSLog::printMessage(mts::MTSLog::WARNING_LEVEL, "%s:%s:%s| [%s] " format "\r\n", __FILE__, __func__, __LINE__, mts::MTSLog::WARNING_LABEL, ##__VA_ARGS__) |
| Mike Fiore |
1:9f30fbe9e9c1 | 18 | #define logInfo(format, ...) \ |
| Mike Fiore |
7:683dba5d576f | 19 | mts::MTSLog::printMessage(mts::MTSLog::INFO_LEVEL, "%s:%s:%s| [%s] " format "\r\n", __FILE__, __func__, __LINE__, mts::MTSLog::INFO_LABEL, ##__VA_ARGS__) |
| Mike Fiore |
1:9f30fbe9e9c1 | 20 | #define logDebug(format, ...) \ |
| Mike Fiore |
7:683dba5d576f | 21 | mts::MTSLog::printMessage(mts::MTSLog::DEBUG_LEVEL, "%s:%s:%s| [%s] " format "\r\n", __FILE__, __func__, __LINE__, mts::MTSLog::DEBUG_LABEL, ##__VA_ARGS__) |
| Mike Fiore |
1:9f30fbe9e9c1 | 22 | #define logTrace(format, ...) \ |
| Mike Fiore |
7:683dba5d576f | 23 | mts::MTSLog::printMessage(mts::MTSLog::TRACE_LEVEL, "%s:%s:%s| [%s] " format "\r\n", __FILE__, __func__, __LINE__, mts::MTSLog::TRACE_LABEL, ##__VA_ARGS__) |
| Mike Fiore |
1:9f30fbe9e9c1 | 24 | #else |
| Mike Fiore |
1:9f30fbe9e9c1 | 25 | #define logFatal(format, ...) \ |
| Mike Fiore |
7:683dba5d576f | 26 | mts::MTSLog::printMessage(mts::MTSLog::FATAL_LEVEL, "[%s] " format "\r\n", mts::MTSLog::FATAL_LABEL, ##__VA_ARGS__) |
| Mike Fiore |
1:9f30fbe9e9c1 | 27 | #define logError(format, ...) \ |
| Mike Fiore |
7:683dba5d576f | 28 | mts::MTSLog::printMessage(mts::MTSLog::ERROR_LEVEL, "[%s] " format "\r\n", mts::MTSLog::ERROR_LABEL, ##__VA_ARGS__) |
| Mike Fiore |
1:9f30fbe9e9c1 | 29 | #define logWarning(format, ...) \ |
| Mike Fiore |
7:683dba5d576f | 30 | mts::MTSLog::printMessage(mts::MTSLog::WARNING_LEVEL, "[%s] " format "\r\n", mts::MTSLog::WARNING_LABEL, ##__VA_ARGS__) |
| Mike Fiore |
1:9f30fbe9e9c1 | 31 | #define logInfo(format, ...) \ |
| Mike Fiore |
7:683dba5d576f | 32 | mts::MTSLog::printMessage(mts::MTSLog::INFO_LEVEL, "[%s] " format "\r\n", mts::MTSLog::INFO_LABEL, ##__VA_ARGS__) |
| Mike Fiore |
1:9f30fbe9e9c1 | 33 | #define logDebug(format, ...) \ |
| Mike Fiore |
7:683dba5d576f | 34 | mts::MTSLog::printMessage(mts::MTSLog::DEBUG_LEVEL, "[%s] " format "\r\n", mts::MTSLog::DEBUG_LABEL, ##__VA_ARGS__) |
| Mike Fiore |
1:9f30fbe9e9c1 | 35 | #define logTrace(format, ...) \ |
| Mike Fiore |
7:683dba5d576f | 36 | mts::MTSLog::printMessage(mts::MTSLog::TRACE_LEVEL, "[%s] " format "\r\n", mts::MTSLog::TRACE_LABEL, ##__VA_ARGS__) |
| Mike Fiore |
1:9f30fbe9e9c1 | 37 | #endif |
| Mike Fiore |
1:9f30fbe9e9c1 | 38 | |
| Mike Fiore |
1:9f30fbe9e9c1 | 39 | namespace mts { |
| Mike Fiore |
1:9f30fbe9e9c1 | 40 | |
| Mike Fiore |
1:9f30fbe9e9c1 | 41 | class MTSLog |
| Mike Fiore |
1:9f30fbe9e9c1 | 42 | { |
| Mike Fiore |
1:9f30fbe9e9c1 | 43 | public: |
| Mike Fiore |
1:9f30fbe9e9c1 | 44 | |
| Mike Fiore |
1:9f30fbe9e9c1 | 45 | /** Enum of log levels. |
| Mike Fiore |
1:9f30fbe9e9c1 | 46 | */ |
| Mike Fiore |
1:9f30fbe9e9c1 | 47 | enum logLevel { |
| Mike Fiore |
1:9f30fbe9e9c1 | 48 | NONE_LEVEL = 0, |
| Mike Fiore |
1:9f30fbe9e9c1 | 49 | FATAL_LEVEL = 1, |
| Mike Fiore |
1:9f30fbe9e9c1 | 50 | ERROR_LEVEL = 2, |
| Mike Fiore |
1:9f30fbe9e9c1 | 51 | WARNING_LEVEL = 3, |
| Mike Fiore |
1:9f30fbe9e9c1 | 52 | INFO_LEVEL = 4, |
| Mike Fiore |
1:9f30fbe9e9c1 | 53 | DEBUG_LEVEL = 5, |
| Mike Fiore |
1:9f30fbe9e9c1 | 54 | TRACE_LEVEL = 6 |
| Mike Fiore |
1:9f30fbe9e9c1 | 55 | }; |
| Mike Fiore |
1:9f30fbe9e9c1 | 56 | |
| Mike Fiore |
1:9f30fbe9e9c1 | 57 | /** Print log message. |
| Mike Fiore |
1:9f30fbe9e9c1 | 58 | */ |
| Mike Fiore |
1:9f30fbe9e9c1 | 59 | static void printMessage(int level, const char* format, ...); |
| Mike Fiore |
1:9f30fbe9e9c1 | 60 | |
| Mike Fiore |
1:9f30fbe9e9c1 | 61 | /** Determine if the given level is currently printable. |
| Mike Fiore |
1:9f30fbe9e9c1 | 62 | */ |
| Mike Fiore |
1:9f30fbe9e9c1 | 63 | static bool printable(int level); |
| Mike Fiore |
1:9f30fbe9e9c1 | 64 | |
| Mike Fiore |
1:9f30fbe9e9c1 | 65 | /** Set log level |
| Mike Fiore |
1:9f30fbe9e9c1 | 66 | * Messages with lower priority than the current level will not be printed. |
| Mike Fiore |
1:9f30fbe9e9c1 | 67 | * If the level is set to NONE, no messages will print. |
| Mike Fiore |
1:9f30fbe9e9c1 | 68 | */ |
| Mike Fiore |
1:9f30fbe9e9c1 | 69 | static void setLogLevel(int level); |
| Mike Fiore |
1:9f30fbe9e9c1 | 70 | |
| Mike Fiore |
1:9f30fbe9e9c1 | 71 | /** Get the current log level. |
| Mike Fiore |
1:9f30fbe9e9c1 | 72 | */ |
| Mike Fiore |
1:9f30fbe9e9c1 | 73 | static int getLogLevel(); |
| Mike Fiore |
1:9f30fbe9e9c1 | 74 | |
| Mike Fiore |
1:9f30fbe9e9c1 | 75 | /** Get string representation of the current log level. |
| Mike Fiore |
1:9f30fbe9e9c1 | 76 | */ |
| Mike Fiore |
1:9f30fbe9e9c1 | 77 | static const char* getLogLevelString(); |
| Mike Fiore |
1:9f30fbe9e9c1 | 78 | |
| Mike Fiore |
1:9f30fbe9e9c1 | 79 | static const char* NONE_LABEL; |
| Mike Fiore |
1:9f30fbe9e9c1 | 80 | static const char* FATAL_LABEL; |
| Mike Fiore |
1:9f30fbe9e9c1 | 81 | static const char* ERROR_LABEL; |
| Mike Fiore |
1:9f30fbe9e9c1 | 82 | static const char* WARNING_LABEL; |
| Mike Fiore |
1:9f30fbe9e9c1 | 83 | static const char* INFO_LABEL; |
| Mike Fiore |
1:9f30fbe9e9c1 | 84 | static const char* DEBUG_LABEL; |
| Mike Fiore |
1:9f30fbe9e9c1 | 85 | static const char* TRACE_LABEL; |
| Mike Fiore |
1:9f30fbe9e9c1 | 86 | |
| Mike Fiore |
1:9f30fbe9e9c1 | 87 | private: |
| Mike Fiore |
1:9f30fbe9e9c1 | 88 | |
| Mike Fiore |
1:9f30fbe9e9c1 | 89 | /** Constructor |
| Mike Fiore |
1:9f30fbe9e9c1 | 90 | */ |
| Mike Fiore |
1:9f30fbe9e9c1 | 91 | MTSLog(); |
| Mike Fiore |
1:9f30fbe9e9c1 | 92 | |
| Mike Fiore |
1:9f30fbe9e9c1 | 93 | static int currentLevel; |
| Mike Fiore |
1:9f30fbe9e9c1 | 94 | |
| Mike Fiore |
1:9f30fbe9e9c1 | 95 | }; |
| Mike Fiore |
1:9f30fbe9e9c1 | 96 | |
| Mike Fiore |
1:9f30fbe9e9c1 | 97 | } |
| Mike Fiore |
1:9f30fbe9e9c1 | 98 | |
| Mike Fiore |
1:9f30fbe9e9c1 | 99 | #endif |

