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.
Diff: mDotEvent.h
- Revision:
- 176:e8835022d431
- Parent:
- 172:7ec44396a51b
- Child:
- 180:a78812699800
--- a/mDotEvent.h Wed Sep 05 12:58:49 2018 -0500
+++ b/mDotEvent.h Wed Sep 05 14:18:55 2018 -0500
@@ -72,8 +72,7 @@
ServerTimeSeconds(0U),
AckReceived(false),
DuplicateRx(false),
- TxNbRetries(0),
- _sleep_cb(NULL)
+ TxNbRetries(0)
{
memset(&_flags, 0, sizeof(LoRaMacEventFlags));
memset(&_info, 0, sizeof(LoRaMacEventInfo));
@@ -125,10 +124,6 @@
virtual void TxStart() {
logDebug("mDotEvent - TxStart");
-
- // Fire auto sleep cfg event if enabled
- if (_sleep_cb)
- _sleep_cb(mDot::AUTO_SLEEP_EVT_CFG);
}
virtual void TxDone(uint8_t dr) {
@@ -148,10 +143,6 @@
_info.TxDatarate = dr;
_info.Status = LORAMAC_EVENT_INFO_STATUS_OK;
Notify();
-
- // If configured, we can sleep until the rx window opens
- if (_sleep_cb)
- _sleep_cb(mDot::AUTO_SLEEP_EVT_TXDONE);
}
void Notify() {
@@ -173,9 +164,6 @@
_flags.Bits.JoinAccept = 1;
_info.Status = LORAMAC_EVENT_INFO_STATUS_OK;
Notify();
-
- if (_sleep_cb)
- _sleep_cb(mDot::AUTO_SLEEP_EVT_CLEANUP);
}
virtual void JoinFailed(uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr) {
@@ -185,9 +173,6 @@
_flags.Bits.JoinAccept = 1;
_info.Status = LORAMAC_EVENT_INFO_STATUS_JOIN_FAIL;
Notify();
-
- if (_sleep_cb)
- _sleep_cb(mDot::AUTO_SLEEP_EVT_CLEANUP);
}
virtual void MissedAck(uint8_t retries) {
@@ -233,9 +218,6 @@
virtual void RxDone(uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr, lora::DownlinkControl ctrl, uint8_t slot) {
logDebug("mDotEvent - RxDone");
-
- if (_sleep_cb)
- _sleep_cb(mDot::AUTO_SLEEP_EVT_CLEANUP);
}
virtual void BeaconRx(uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr) {
@@ -287,14 +269,6 @@
_flags.Bits.RxSlot = slot;
_info.Status = LORAMAC_EVENT_INFO_STATUS_RX_TIMEOUT;
Notify();
-
- if (_sleep_cb) {
- // If this is the first rx window we can sleep until the next one
- if (slot == 1)
- _sleep_cb(mDot::AUTO_SLEEP_EVT_RX1_TIMEOUT);
- else
- _sleep_cb(mDot::AUTO_SLEEP_EVT_CLEANUP);
- }
}
virtual void RxError(uint8_t slot) {
@@ -306,23 +280,12 @@
_flags.Bits.RxSlot = slot;
_info.Status = LORAMAC_EVENT_INFO_STATUS_RX_ERROR;
Notify();
-
- if (_sleep_cb)
- _sleep_cb(mDot::AUTO_SLEEP_EVT_CLEANUP);
}
virtual uint8_t MeasureBattery(void) {
return 255;
}
- void AttachSleepCallback(Callback<void(mDot::AutoSleepEvent_t)> cb) {
- _sleep_cb = cb;
- }
-
- void DetachSleepCallback() {
- _sleep_cb = NULL;
- }
-
bool LinkCheckAnsReceived;
uint8_t DemodMargin;
uint8_t NbGateways;
@@ -355,9 +318,6 @@
}
private:
- /* Hook to inject a sleep method in between receive windows */
- Callback<void(mDot::AutoSleepEvent_t)> _sleep_cb;
-
LoRaMacEventFlags _flags;
LoRaMacEventInfo _info;