Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lorawan-add-linkcheckreq #208

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion src/LoRaWan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,25 @@ bool LoRaWanClass::transferPacketWithConfirmed(unsigned char *buffer, unsigned c
return false;
}

bool LoRaWanClass::transferPacketLinkCheckReq(unsigned char timeout)
{
while(SerialLoRa.available())SerialLoRa.read();

sendCommand("AT+MSG\r\n");

memset(_buffer, 0, BEFFER_LENGTH_MAX);
readBuffer(_buffer, BEFFER_LENGTH_MAX, timeout);
#if _DEBUG_SERIAL_
SerialUSB.print(_buffer);
#endif
dutycycle = false;
if(strstr(_buffer, "+MSG: No band")){
dutycycle = true;
}
if(strstr(_buffer, "+MSG: Done"))return true;
return false;
}

short LoRaWanClass::receivePacket(char *buffer, short length, short *rssi)
{
char *ptr;
Expand Down Expand Up @@ -1042,4 +1061,4 @@ short LoRaWanClass::sendCommandAndWaitForResponse(char* command, char *response,
}


LoRaWanClass lora;
LoRaWanClass lora;
9 changes: 7 additions & 2 deletions src/LoRaWan.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,12 @@ class LoRaWanClass
* \return Return bool. Ture : Confirmed ACK, false : Confirmed NOT ACK
*/
bool transferPacketWithConfirmed(unsigned char *buffer, unsigned char length, unsigned char timeout = DEFAULT_TIMEOUT);

/**
* \brief Perform a LinkCheck request
*
* \return Return bool. True : Confirmed ACK, false : Confirmed NOT ACK
*/
bool transferPacketLinkCheckReq(unsigned char timeout = DEFAULT_TIMEOUT);
/**
* \brief Receive the data
*
Expand Down Expand Up @@ -498,4 +503,4 @@ class LoRaWanClass
extern LoRaWanClass lora;


#endif
#endif