-
Notifications
You must be signed in to change notification settings - Fork 915
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
97 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#include "MeshPacketClient.h" | ||
|
||
void MeshPacketClient::init(void) | ||
{ | ||
PacketClient::init(); | ||
} | ||
|
||
MeshPacketClient::MeshPacketClient() {} | ||
|
||
bool MeshPacketClient::connect(void) | ||
{ | ||
PacketClient::connect(); | ||
} | ||
|
||
bool MeshPacketClient::disconnect(void) | ||
{ | ||
PacketClient::disconnect(); | ||
} | ||
|
||
bool MeshPacketClient::isConnected(void) | ||
{ | ||
return PacketClient::isConnected(); | ||
} | ||
|
||
bool MeshPacketClient::send(meshtastic_ToRadio &&to) | ||
{ | ||
static uint32_t id = 0; | ||
PacketClient::sendPacket(DataPacket<meshtastic_ToRadio>(++id, to)); | ||
} | ||
|
||
meshtastic_FromRadio MeshPacketClient::receive(void) | ||
{ | ||
auto p = receivePacket()->move(); | ||
if (p) { | ||
return static_cast<DataPacket<meshtastic_FromRadio> *>(p.get())->getData(); | ||
} else { | ||
return meshtastic_FromRadio(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#pragma once | ||
|
||
#include "mesh-pb-constants.h" | ||
#include "sharedMem/PacketClient.h" | ||
|
||
/** | ||
* @brief This is a wrapper class for the PaketClient to avoid dealing with DataPackets | ||
* in the application code. | ||
* | ||
*/ | ||
class MeshPacketClient : public PacketClient | ||
{ | ||
public: | ||
MeshPacketClient(); | ||
virtual void init(void); | ||
virtual bool connect(void); | ||
virtual bool disconnect(void); | ||
virtual bool isConnected(void); | ||
|
||
virtual bool send(meshtastic_ToRadio &&to); | ||
virtual meshtastic_FromRadio receive(void); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#pragma once | ||
|
||
#include "mesh-pb-constants.h" | ||
#include "sharedMem/PacketServer.h" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters