Skip to content

Commit

Permalink
Merge pull request #12 from okrasolar/master
Browse files Browse the repository at this point in the history
Pull changes from Okra's fork
  • Loading branch information
dmohns authored Feb 29, 2024
2 parents 163e1c2 + 6e265de commit cf99c54
Show file tree
Hide file tree
Showing 27 changed files with 1,069 additions and 96 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ build
build_stm
build_linux
build_mbed
dep

# Ignore the Meson packagecache dir
packagecache
Expand Down
12 changes: 11 additions & 1 deletion cicada/commdevices/atcommdevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
#include "cicada/commdevices/atcommdevice.h"
#include <cinttypes>
#include <cstddef>
#include <cstdio>
#include <cstring>
#include "printf.h"

#define MIN_SPACE_AVAILABLE 22

Expand Down Expand Up @@ -169,3 +169,13 @@ Size ATCommDevice::serialRead(char* data, Size maxSize)

return 0;
}

void ATCommDevice::requestRSSI()
{
_rssi = INT16_MAX;
}

int16_t ATCommDevice::getRSSI()
{
return _rssi;
}
18 changes: 18 additions & 0 deletions cicada/commdevices/atcommdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,22 @@ class ATCommDevice : public IPCommDevice
*/
virtual Size serialRead(char* data, Size maxSize);

/*!
* Request the RSSI (signal strength) from the modem. It can then be
* retreieved with getRSSI();
*/
void requestRSSI();

/*!
* Actually get the value for RSSI (signal strength), which has
* been requested by requestRSSI(). If the signal strength has been
* requested but not yet been retrieved, the returned value will
* be INT16_MAX.
*
* \return RSSI value in dBm, or INT16_MAX if a request is still pending.
*/
int16_t getRSSI();

protected:
void logStates(int8_t sendState, int8_t replyState);
bool handleDisconnect(int8_t nextState);
Expand All @@ -91,6 +107,8 @@ class ATCommDevice : public IPCommDevice
Size _bytesToReceive;
Size _bytesToRead;

int16_t _rssi;

static const char* _okStr;
static const char* _lineEndStr;
static const char* _quoteEndStr;
Expand Down
Loading

0 comments on commit cf99c54

Please sign in to comment.