mirror of
https://github.com/meshtastic/firmware.git
synced 2025-05-01 03:39:18 +00:00
begin moving position stuff into plugin
This commit is contained in:
parent
5138aff4b2
commit
7737123d0f
@ -4,7 +4,9 @@ You probably don't care about this section - skip to the next one.
|
|||||||
|
|
||||||
For app cleanup:
|
For app cleanup:
|
||||||
|
|
||||||
* add app handlers in device code (make new app framework)
|
* require a recent python api to talk to these new device loads
|
||||||
|
* on android for received positions handle either old or new positions
|
||||||
|
* on android side send old or new positions as needed
|
||||||
* move positions into regular data packets (use new app framework)
|
* move positions into regular data packets (use new app framework)
|
||||||
* move user info into regular data packets (use new app framework)
|
* move user info into regular data packets (use new app framework)
|
||||||
* test that positions, text messages and user info still work
|
* test that positions, text messages and user info still work
|
||||||
|
2
proto
2
proto
@ -1 +1 @@
|
|||||||
Subproject commit 7c1016b8a01d4d019c4239fe46624dee7bde22c7
|
Subproject commit 9a7ffbecc72a11904bd4e85d086956e4e77eed6d
|
@ -22,7 +22,7 @@ MeshPlugin::~MeshPlugin()
|
|||||||
|
|
||||||
void MeshPlugin::callPlugins(const MeshPacket &mp)
|
void MeshPlugin::callPlugins(const MeshPacket &mp)
|
||||||
{
|
{
|
||||||
DEBUG_MSG("In call plugins\n");
|
// DEBUG_MSG("In call plugins\n");
|
||||||
for (auto i = plugins->begin(); i != plugins->end(); ++i) {
|
for (auto i = plugins->begin(); i != plugins->end(); ++i) {
|
||||||
auto &pi = **i;
|
auto &pi = **i;
|
||||||
if (pi.wantPortnum(mp.decoded.data.portnum)) {
|
if (pi.wantPortnum(mp.decoded.data.portnum)) {
|
||||||
|
@ -26,6 +26,11 @@ class MeshPlugin
|
|||||||
|
|
||||||
virtual ~MeshPlugin();
|
virtual ~MeshPlugin();
|
||||||
|
|
||||||
|
/** For use only by MeshService
|
||||||
|
*/
|
||||||
|
static void callPlugins(const MeshPacket &mp);
|
||||||
|
|
||||||
|
protected:
|
||||||
/**
|
/**
|
||||||
* Initialize your plugin. This setup function is called once after all hardware and mesh protocol layers have
|
* Initialize your plugin. This setup function is called once after all hardware and mesh protocol layers have
|
||||||
* been initialized
|
* been initialized
|
||||||
@ -42,8 +47,4 @@ class MeshPlugin
|
|||||||
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
|
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
|
||||||
*/
|
*/
|
||||||
virtual bool handleReceived(const MeshPacket &mp) { return false; }
|
virtual bool handleReceived(const MeshPacket &mp) { return false; }
|
||||||
|
|
||||||
/** For use only by MeshService
|
|
||||||
*/
|
|
||||||
static void callPlugins(const MeshPacket &mp);
|
|
||||||
};
|
};
|
@ -297,7 +297,6 @@ void MeshService::sendOurPosition(NodeNum dest, bool wantReplies)
|
|||||||
|
|
||||||
int MeshService::onGPSChanged(const meshtastic::GPSStatus *unused)
|
int MeshService::onGPSChanged(const meshtastic::GPSStatus *unused)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Update our local node info with our position (even if we don't decide to update anyone else)
|
// Update our local node info with our position (even if we don't decide to update anyone else)
|
||||||
MeshPacket *p = router->allocForSending();
|
MeshPacket *p = router->allocForSending();
|
||||||
p->decoded.which_payload = SubPacket_position_tag;
|
p->decoded.which_payload = SubPacket_position_tag;
|
||||||
|
@ -18,16 +18,16 @@ typedef enum _PortNum {
|
|||||||
PortNum_UNKNOWN_APP = 0,
|
PortNum_UNKNOWN_APP = 0,
|
||||||
PortNum_TEXT_MESSAGE_APP = 1,
|
PortNum_TEXT_MESSAGE_APP = 1,
|
||||||
PortNum_GPIO_APP = 2,
|
PortNum_GPIO_APP = 2,
|
||||||
PortNum_GPS_POSITION_APP = 3,
|
PortNum_POSITION_APP = 3,
|
||||||
PortNum_MESH_USERINFO_APP = 4,
|
PortNum_MESH_USERINFO_APP = 4,
|
||||||
PortNum_IP_TUNNEL_APP = 5,
|
PortNum_PRIVATE_APP = 256,
|
||||||
PortNum_PRIVATE_APP = 256
|
PortNum_IP_TUNNEL_APP = 1024
|
||||||
} PortNum;
|
} PortNum;
|
||||||
|
|
||||||
/* Helper constants for enums */
|
/* Helper constants for enums */
|
||||||
#define _PortNum_MIN PortNum_UNKNOWN_APP
|
#define _PortNum_MIN PortNum_UNKNOWN_APP
|
||||||
#define _PortNum_MAX PortNum_PRIVATE_APP
|
#define _PortNum_MAX PortNum_IP_TUNNEL_APP
|
||||||
#define _PortNum_ARRAYSIZE ((PortNum)(PortNum_PRIVATE_APP+1))
|
#define _PortNum_ARRAYSIZE ((PortNum)(PortNum_IP_TUNNEL_APP+1))
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
13
src/plugins/PositionPlugin.cpp
Normal file
13
src/plugins/PositionPlugin.cpp
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#include "configuration.h"
|
||||||
|
#include "PositionPlugin.h"
|
||||||
|
#include "NodeDB.h"
|
||||||
|
|
||||||
|
PositionPlugin positionPlugin;
|
||||||
|
|
||||||
|
bool PositionPlugin::handleReceived(const MeshPacket &mp)
|
||||||
|
{
|
||||||
|
auto &p = mp.decoded.data;
|
||||||
|
DEBUG_MSG("Received position from=0x%0x, id=%d, msg=%.*s\n", mp.from, mp.id, p.payload.size, p.payload.bytes);
|
||||||
|
|
||||||
|
return false; // Let others look at this message also if they want
|
||||||
|
}
|
@ -7,12 +7,12 @@
|
|||||||
class TextMessagePlugin : public MeshPlugin, public Observable<const MeshPacket *>
|
class TextMessagePlugin : public MeshPlugin, public Observable<const MeshPacket *>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** Constructor
|
/** Constructor
|
||||||
* name is for debugging output
|
* name is for debugging output
|
||||||
*/
|
*/
|
||||||
TextMessagePlugin() : MeshPlugin("text") {}
|
TextMessagePlugin() : MeshPlugin("text") {}
|
||||||
|
|
||||||
|
protected:
|
||||||
/**
|
/**
|
||||||
* @return true if you want to receive the specified portnum
|
* @return true if you want to receive the specified portnum
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user