Skip to content

Commit

Permalink
Clean up tab/space problems
Browse files Browse the repository at this point in the history
  • Loading branch information
mikalhart committed Jun 8, 2013
1 parent 01c6cdc commit e0ad7e5
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 85 deletions.
24 changes: 12 additions & 12 deletions IridiumSBD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,22 +376,22 @@ int IridiumSBD::internalGetSignalQuality(int &quality)
int IridiumSBD::internalMSSTMWorkaround(bool &okToProceed)
{
/*
According to Iridium 9602 Product Bulletin of 7 May 2013, to overcome a system erratum:
According to Iridium 9602 Product Bulletin of 7 May 2013, to overcome a system erratum:
"Before attempting any of the following commands: +SBDDET, +SBDREG, +SBDI, +SBDIX, +SBDIXA the field application
should issue the AT command –MSSTM to the transceiver and evaluate the response to determine if it is valid or not:
"Before attempting any of the following commands: +SBDDET, +SBDREG, +SBDI, +SBDIX, +SBDIXA the field application
should issue the AT command –MSSTM to the transceiver and evaluate the response to determine if it is valid or not:
Valid Response: "---MSSTM: XXXXXXXX" where XXXXXXXX is an eight---digit hexadecimal number.
Valid Response: "---MSSTM: XXXXXXXX" where XXXXXXXX is an eight---digit hexadecimal number.
Invalid Response: "---MSSTM: no network service"
Invalid Response: "---MSSTM: no network service"
If the response is invalid, the field application should wait and recheck system time until a valid response is
obtained before proceeding.
If the response is invalid, the field application should wait and recheck system time until a valid response is
obtained before proceeding.
This will ensure that the Iridium SBD transceiver has received a valid system time before attempting SBD communication.
The Iridium SBD transceiver will receive the valid system time from the Iridium network when it has a good link to the
satellite. Ensuring that the received signal strength reported in response to AT command +CSQ and +CIER is above 2---3 bars
before attempting SBD communication will protect against lockout.
This will ensure that the Iridium SBD transceiver has received a valid system time before attempting SBD communication.
The Iridium SBD transceiver will receive the valid system time from the Iridium network when it has a good link to the
satellite. Ensuring that the received signal strength reported in response to AT command +CSQ and +CIER is above 2---3 bars
before attempting SBD communication will protect against lockout.
*/
char msstmResponseBuf[24];

Expand Down Expand Up @@ -660,7 +660,7 @@ int IridiumSBD::doSBDRB(uint8_t *rxBuffer, size_t *prxBufferSize)
void IridiumSBD::power(bool on)
{
static unsigned long lastPowerOnTime = 0UL;

if (this->sleepPin == -1)
return;

Expand Down
128 changes: 64 additions & 64 deletions IridiumSBD.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,96 +58,96 @@ typedef const __FlashStringHelper *FlashString;
class IridiumSBD
{
public:
int begin();
int sendSBDText(const char *message);
int sendSBDBinary(const uint8_t *txData, size_t txDataSize);
int sendReceiveSBDText(const char *message, uint8_t *rxBuffer, size_t &rxBufferSize);
int sendReceiveSBDBinary(const uint8_t *txData, size_t txDataSize, uint8_t *rxBuffer, size_t &rxBufferSize);
int getSignalQuality(int &quality);

int getWaitingMessageCount();
int sleep();
bool isAsleep();

void setPowerProfile(int profile); // 0 = direct connect (default), 1 = USB
void adjustATTimeout(int seconds); // default value = 20 seconds
void adjustSendReceiveTimeout(int seconds); // default value = 300 seconds
int begin();
int sendSBDText(const char *message);
int sendSBDBinary(const uint8_t *txData, size_t txDataSize);
int sendReceiveSBDText(const char *message, uint8_t *rxBuffer, size_t &rxBufferSize);
int sendReceiveSBDBinary(const uint8_t *txData, size_t txDataSize, uint8_t *rxBuffer, size_t &rxBufferSize);
int getSignalQuality(int &quality);

int getWaitingMessageCount();
int sleep();
bool isAsleep();

void setPowerProfile(int profile); // 0 = direct connect (default), 1 = USB
void adjustATTimeout(int seconds); // default value = 20 seconds
void adjustSendReceiveTimeout(int seconds); // default value = 300 seconds
void setMinimumSignalQuality(int quality); // a number between 1 and 5, default ISBD_DEFAULT_CSQ_MINIMUM
void useMSSTMWorkaround(bool useWorkAround); // true to use workaround from Iridium Alert 5/7

void attachConsole(Stream &stream);
void attachConsole(Stream &stream);
#if ISBD_DIAGS
void attachDiags(Stream &stream);
void attachDiags(Stream &stream);
#endif

IridiumSBD(Stream &str, int sleepPinNo = -1) :
stream(str),
pConsoleStream(NULL),
IridiumSBD(Stream &str, int sleepPinNo = -1) :
stream(str),
pConsoleStream(NULL),
#if ISBD_DIAGS
pDiagsStream(NULL),
pDiagsStream(NULL),
#endif
csqInterval(ISBD_DEFAULT_CSQ_INTERVAL),
sbdixInterval(ISBD_DEFAULT_SBDIX_INTERVAL),
atTimeout(ISBD_DEFAULT_AT_TIMEOUT),
sendReceiveTimeout(ISBD_DEFAULT_SENDRECEIVE_TIME),
remainingMessages(-1),
asleep(true),
reentrant(false),
sleepPin(sleepPinNo),
csqInterval(ISBD_DEFAULT_CSQ_INTERVAL),
sbdixInterval(ISBD_DEFAULT_SBDIX_INTERVAL),
atTimeout(ISBD_DEFAULT_AT_TIMEOUT),
sendReceiveTimeout(ISBD_DEFAULT_SENDRECEIVE_TIME),
remainingMessages(-1),
asleep(true),
reentrant(false),
sleepPin(sleepPinNo),
minimumCSQ(ISBD_DEFAULT_CSQ_MINIMUM),
useWorkaround(true)
{
pinMode(sleepPin, OUTPUT);
}
{
pinMode(sleepPin, OUTPUT);
}

private:
Stream &stream;
Stream *pConsoleStream;
Stream &stream;
Stream *pConsoleStream;
#if ISBD_DIAGS
Stream *pDiagsStream;
Stream *pDiagsStream;
#endif

// Timings
int csqInterval;
int sbdixInterval;
int atTimeout;
int sendReceiveTimeout;

// State variables
int remainingMessages;
bool asleep;
bool reentrant;
int sleepPin;
// Timings
int csqInterval;
int sbdixInterval;
int atTimeout;
int sendReceiveTimeout;

// State variables
int remainingMessages;
bool asleep;
bool reentrant;
int sleepPin;
int minimumCSQ;
bool useWorkaround;

// Internal utilities
bool smartWait(int seconds);
bool waitForATResponse(char *response=NULL, int responseSize=0, const char *prompt=NULL, const char *terminator="OK\r\n");
// Internal utilities
bool smartWait(int seconds);
bool waitForATResponse(char *response=NULL, int responseSize=0, const char *prompt=NULL, const char *terminator="OK\r\n");

int internalBegin();
int internalSendReceiveSBD(const char *txTxtMessage, const uint8_t *txData, size_t txDataSize, uint8_t *rxBuffer, size_t *prxBufferSize);
int internalGetSignalQuality(int &quality);
int internalBegin();
int internalSendReceiveSBD(const char *txTxtMessage, const uint8_t *txData, size_t txDataSize, uint8_t *rxBuffer, size_t *prxBufferSize);
int internalGetSignalQuality(int &quality);
int internalMSSTMWorkaround(bool &okToProceed);
int internalSleep();
int internalSleep();

int doSBDIX(uint16_t &moCode, uint16_t &moMSN, uint16_t &mtCode, uint16_t &mtMSN, uint16_t &mtLen, uint16_t &mtRemaining);
int doSBDRB(uint8_t *rxBuffer, size_t *prxBufferSize); // in/out
void power(bool on);
int doSBDRB(uint8_t *rxBuffer, size_t *prxBufferSize); // in/out
void power(bool on);

void send(FlashString str, bool beginLine = true, bool endLine = true);
void send(const char *str);
void send(uint16_t n);
void send(FlashString str, bool beginLine = true, bool endLine = true);
void send(const char *str);
void send(uint16_t n);

bool cancelled();
bool cancelled();

void dbg(FlashString str);
void dbg(const char *str);
void dbg(uint16_t n);
void dbg(char c);
void dbg(FlashString str);
void dbg(const char *str);
void dbg(uint16_t n);
void dbg(char c);

void console(FlashString str);
void console(const char *str);
void console(const char *str);
void console(uint16_t n);
void console(char c);
void console(char c);
};
14 changes: 7 additions & 7 deletions examples/Beacon/Beacon.ino
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,17 @@ void loop()
if (fixFound)
{
sprintf(outBuffer, "%d%02d%02d%02d%02d%02d,", year, month, day, hour, minute, second);
int len = strlen(outBuffer);
int len = strlen(outBuffer);
PString str(outBuffer + len, sizeof(outBuffer) - len);
str.print(latitude, 6);
str.print(",");
str.print(longitude, 6);
str.print(",");
str.print(altitude / 100);
str.print(",");
str.print(tinygps.f_speed_knots(), 1);
str.print(",");
str.print(tinygps.course() / 100);
str.print(",");
str.print(altitude / 100);
str.print(",");
str.print(tinygps.f_speed_knots(), 1);
str.print(",");
str.print(tinygps.course() / 100);
}

else
Expand Down
4 changes: 2 additions & 2 deletions examples/SendReceive/SendReceive.ino
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ void setup()
Serial.begin(115200);
nss.begin(19200);

// isbd.attachConsole(Serial);
// isbd.attachDiags(Serial);
isbd.attachConsole(Serial);
isbd.attachDiags(Serial);

isbd.begin();

Expand Down

0 comments on commit e0ad7e5

Please sign in to comment.