"plugin(s)" renamed to "module(s)" in comments and debug

This commit is contained in:
Jm Casler
2022-02-27 00:29:05 -08:00
parent 86e767eec2
commit 3a04a0ee7a
24 changed files with 78 additions and 78 deletions

View File

@@ -67,8 +67,8 @@ uint8_t imgBattery[16] = {0xFF, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
// Threshold values for the GPS lock accuracy bar display
uint32_t dopThresholds[5] = {2000, 1000, 500, 200, 100};
// At some point, we're going to ask all of the plugins if they would like to display a screen frame
// we'll need to hold onto pointers for the plugins that can draw a frame.
// At some point, we're going to ask all of the modules if they would like to display a screen frame
// we'll need to hold onto pointers for the modules that can draw a frame.
std::vector<MeshPlugin *> pluginFrames;
// Stores the last 4 of our hardware ID, to make finding the device for pairing easier
@@ -189,7 +189,7 @@ static void drawPluginFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int
// frame, then we want this to be `0`
plugin_frame = state->transitionFrameTarget;
} else {
// otherwise, just display the plugin frame that's aligned with the current frame
// otherwise, just display the module frame that's aligned with the current frame
plugin_frame = state->currentFrame;
// DEBUG_MSG("Screen is not in transition. Frame: %d\n\n", plugin_frame);
}
@@ -259,7 +259,7 @@ static void drawCriticalFaultFrame(OLEDDisplay *display, OLEDDisplayUiState *sta
display->drawString(0 + x, FONT_HEIGHT_MEDIUM + y, "For help, please post on\nmeshtastic.discourse.group");
}
// Ignore messages orginating from phone (from the current node 0x0) unless range test or store and forward plugin are enabled
// Ignore messages orginating from phone (from the current node 0x0) unless range test or store and forward module are enabled
static bool shouldDrawMessage(const MeshPacket *packet)
{
return packet->from != 0 && !radioConfig.preferences.range_test_plugin_enabled &&
@@ -827,7 +827,7 @@ void Screen::setup()
if (textMessagePlugin)
textMessageObserver.observe(textMessagePlugin);
// Plugins can notify screen about refresh
// Modules can notify screen about refresh
MeshPlugin::observeUIEvents(&uiFrameEventObserver);
}
@@ -977,7 +977,7 @@ void Screen::setFrames()
showingNormalScreen = true;
pluginFrames = MeshPlugin::GetMeshPluginsWithUIFrames();
DEBUG_MSG("Showing %d plugin frames\n", pluginFrames.size());
DEBUG_MSG("Showing %d module frames\n", pluginFrames.size());
int totalFrameCount = MAX_NUM_NODES + NUM_EXTRA_FRAMES + pluginFrames.size();
DEBUG_MSG("Total frame count: %d\n", totalFrameCount);
@@ -998,13 +998,13 @@ void Screen::setFrames()
normalFrames[numframes++] = drawPluginFrame;
}
DEBUG_MSG("Added plugins. numframes: %d\n", numframes);
DEBUG_MSG("Added modules. numframes: %d\n", numframes);
// If we have a critical fault, show it first
if (myNodeInfo.error_code)
normalFrames[numframes++] = drawCriticalFaultFrame;
// If we have a text message - show it next, unless it's a phone message and we aren't using any special plugins
// If we have a text message - show it next, unless it's a phone message and we aren't using any special modules
if (devicestate.has_rx_text_message && shouldDrawMessage(&devicestate.rx_text_message)) {
normalFrames[numframes++] = drawTextMessageFrame;
}

View File

@@ -537,7 +537,7 @@ void setup()
service.init();
// Now that the mesh service is created, create any plugins
// Now that the mesh service is created, create any modules
setupPlugins();
// Do this after service.init (because that clears error_code)

View File

@@ -11,7 +11,7 @@ std::vector<MeshPlugin *> *MeshPlugin::plugins;
const MeshPacket *MeshPlugin::currentRequest;
/**
* If any of the current chain of plugins has already sent a reply, it will be here. This is useful to allow
* If any of the current chain of modules has already sent a reply, it will be here. This is useful to allow
* the RoutingPlugin to avoid sending redundant acks
*/
MeshPacket *MeshPlugin::currentReply;
@@ -29,7 +29,7 @@ void MeshPlugin::setup() {}
MeshPlugin::~MeshPlugin()
{
assert(0); // FIXME - remove from list of plugins once someone needs this feature
assert(0); // FIXME - remove from list of modules once someone needs this feature
}
MeshPacket *MeshPlugin::allocAckNak(Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex)
@@ -68,10 +68,10 @@ MeshPacket *MeshPlugin::allocErrorResponse(Routing_Error err, const MeshPacket *
void MeshPlugin::callPlugins(const MeshPacket &mp, RxSource src)
{
// DEBUG_MSG("In call plugins\n");
// DEBUG_MSG("In call modules\n");
bool pluginFound = false;
// We now allow **encrypted** packets to pass through the plugins
// We now allow **encrypted** packets to pass through the modules
bool isDecoded = mp.which_payloadVariant == MeshPacket_decoded_tag;
currentReply = NULL; // No reply yet
@@ -85,7 +85,7 @@ void MeshPlugin::callPlugins(const MeshPacket &mp, RxSource src)
pi.currentRequest = &mp;
/// We only call plugins that are interested in the packet (and the message is destined to us or we are promiscious)
/// We only call modules that are interested in the packet (and the message is destined to us or we are promiscious)
bool wantsPacket = (isDecoded || pi.encryptedOk) && (pi.isPromiscuous || toUs) && pi.wantPacket(&mp);
if ((src == RX_SRC_LOCAL) && !(pi.loopbackOk)) {
@@ -104,7 +104,7 @@ void MeshPlugin::callPlugins(const MeshPacket &mp, RxSource src)
Channel *ch = isDecoded ? &channels.getByIndex(mp.channel) : NULL;
/// Is the channel this packet arrived on acceptable? (security check)
/// Note: we can't know channel names for encrypted packets, so those are NEVER sent to boundChannel plugins
/// Note: we can't know channel names for encrypted packets, so those are NEVER sent to boundChannel modules
/// Also: if a packet comes in on the local PC interface, we don't check for bound channels, because it is TRUSTED and it needs to
/// to be able to fetch the initial admin packets without yet knowing any channels.
@@ -128,7 +128,7 @@ void MeshPlugin::callPlugins(const MeshPacket &mp, RxSource src)
ProcessMessage handled = pi.handleReceived(mp);
// Possibly send replies (but only if the message was directed to us specifically, i.e. not for promiscious
// sniffing) also: we only let the one plugin send a reply, once that happens, remaining plugins are not
// sniffing) also: we only let the one module send a reply, once that happens, remaining modules are not
// considered
// NOTE: we send a reply *even if the (non broadcast) request was from us* which is unfortunate but necessary
@@ -178,7 +178,7 @@ void MeshPlugin::callPlugins(const MeshPacket &mp, RxSource src)
}
if (!pluginFound)
DEBUG_MSG("No plugins interested in portnum=%d, src=%s\n",
DEBUG_MSG("No modules interested in portnum=%d, src=%s\n",
mp.decoded.portnum,
(src == RX_SRC_LOCAL) ? "LOCAL":"REMOTE");
}
@@ -201,8 +201,8 @@ void MeshPlugin::sendResponse(const MeshPacket &req)
setReplyTo(r, req);
currentReply = r;
} else {
// Ignore - this is now expected behavior for routing plugin (because it ignores some replies)
// DEBUG_MSG("WARNING: Client requested response but this plugin did not provide\n");
// Ignore - this is now expected behavior for routing module (because it ignores some replies)
// DEBUG_MSG("WARNING: Client requested response but this module did not provide\n");
}
}
@@ -264,7 +264,7 @@ AdminMessageHandleResult MeshPlugin::handleAdminMessageForAllPlugins(const MeshP
if (h == AdminMessageHandleResult::HANDLED_WITH_RESPONSE)
{
// In case we have a response it always has priority.
DEBUG_MSG("Reply prepared by plugin '%s' of variant: %d\n",
DEBUG_MSG("Reply prepared by module '%s' of variant: %d\n",
pi.name,
response->which_variant);
handled = h;

View File

@@ -22,8 +22,8 @@ enum class ProcessMessage
};
/**
* Used by plugins to return the result of the AdminMessage handling.
* If request is handled, then plugin should return HANDLED,
* Used by modules to return the result of the AdminMessage handling.
* If request is handled, then module should return HANDLED,
* If response is also prepared for the request, then HANDLED_WITH_RESPONSE
* should be returned.
*/
@@ -42,15 +42,15 @@ typedef struct _UIFrameEvent {
bool needRedraw;
} UIFrameEvent;
/** A baseclass for any mesh "plugin".
/** A baseclass for any mesh "module".
*
* A plugin allows you to add new features to meshtastic device code, without needing to know messaging details.
* A module allows you to add new features to meshtastic device code, without needing to know messaging details.
*
* A key concept for this is that your plugin should use a particular "portnum" for each message type you want to receive
* A key concept for this is that your module should use a particular "portnum" for each message type you want to receive
* and handle.
*
* Interally we use plugins to implement the core meshtastic text messaging and gps position sharing features. You
* can use these classes as examples for how to write your own custom plugin. See here: (FIXME)
* Interally we use modules to implement the core meshtastic text messaging and gps position sharing features. You
* can use these classes as examples for how to write your own custom module. See here: (FIXME)
*/
class MeshPlugin
{
@@ -78,17 +78,17 @@ class MeshPlugin
protected:
const char *name;
/** Most plugins only care about packets that are destined for their node (i.e. broadcasts or has their node as the specific
/** Most modules only care about packets that are destined for their node (i.e. broadcasts or has their node as the specific
recipient) But some plugs might want to 'sniff' packets that are merely being routed (passing through the current node). Those
plugins can set this to true and their handleReceived() will be called for every packet.
modules can set this to true and their handleReceived() will be called for every packet.
*/
bool isPromiscuous = false;
/** Also receive a copy of LOCALLY GENERATED messages - most plugins should leave
/** Also receive a copy of LOCALLY GENERATED messages - most modules should leave
* this setting disabled - see issue #877 */
bool loopbackOk = false;
/** Most plugins only understand decrypted packets. For plugins that also want to see encrypted packets, they should set this
/** Most modules only understand decrypted packets. For modules that also want to see encrypted packets, they should set this
* flag */
bool encryptedOk = false;
@@ -101,11 +101,11 @@ class MeshPlugin
const char *boundChannel = NULL;
/**
* If this plugin is currently handling a request currentRequest will be preset
* If this module is currently handling a request currentRequest will be preset
* to the packet with the request. This is mostly useful for reply handlers.
*
* Note: this can be static because we are guaranteed to be processing only one
* plugin at a time.
* plumodulegin at a time.
*/
static const MeshPacket *currentRequest;
@@ -115,7 +115,7 @@ class MeshPlugin
MeshPacket *myReply = NULL;
/**
* Initialize your plugin. This setup function is called once after all hardware and mesh protocol layers have
* Initialize your module. This setup function is called once after all hardware and mesh protocol layers have
* been initialized
*/
virtual void setup();
@@ -165,7 +165,7 @@ class MeshPlugin
private:
/**
* If any of the current chain of plugins has already sent a reply, it will be here. This is useful to allow
* If any of the current chain of modules has already sent a reply, it will be here. This is useful to allow
* the RoutingPlugin to avoid sending redundant acks
*/
static MeshPacket *currentReply;

View File

@@ -2,10 +2,10 @@
#include "SinglePortPlugin.h"
/**
* A base class for mesh plugins that assume that they are sending/receiving one particular protobuf based
* A base class for mesh modules that assume that they are sending/receiving one particular protobuf based
* payload. Using one particular app ID.
*
* If you are using protobufs to encode your packets (recommended) you can use this as a baseclass for your plugin
* If you are using protobufs to encode your packets (recommended) you can use this as a baseclass for your module
* and avoid a bunch of boilerplate code.
*/
template <class T> class ProtobufPlugin : protected SinglePortPlugin
@@ -67,7 +67,7 @@ template <class T> class ProtobufPlugin : protected SinglePortPlugin
if (pb_decode_from_bytes(p.payload.bytes, p.payload.size, fields, &scratch))
decoded = &scratch;
else
DEBUG_MSG("Error decoding protobuf plugin!\n");
DEBUG_MSG("Error decoding protobuf module!\n");
}
return handleReceivedProtobuf(mp, decoded) ? ProcessMessage::STOP : ProcessMessage::CONTINUE;

View File

@@ -376,7 +376,7 @@ void Router::handleReceived(MeshPacket *p, RxSource src)
printPacket("packet decoding failed (no PSK?)", p);
}
// call plugins here
// call modules here
MeshPlugin::callPlugins(*p, src);
}

View File

@@ -85,7 +85,7 @@ class Router : protected concurrency::OSThread
/**
* Should this incoming filter be dropped?
*
* FIXME, move this into the new RoutingPlugin and do the filtering there using the regular plugin logic
* FIXME, move this into the new RoutingPlugin and do the filtering there using the regular module logic
*
* Called immedately on receiption, before any further processing.
* @return true to abandon the packet

View File

@@ -3,7 +3,7 @@
#include "Router.h"
/**
* Most plugins are only interested in sending/receving one particular portnum. This baseclass simplifies that common
* Most modules are only interested in sending/receving one particular portnum. This baseclass simplifies that common
* case.
*/
class SinglePortPlugin : public MeshPlugin

View File

@@ -197,7 +197,7 @@ int32_t CannedMessagePlugin::runOnce()
(this->runState == CANNED_MESSAGE_RUN_STATE_ACTIVE)
&& (millis() - this->lastTouchMillis) > INACTIVATE_AFTER_MS)
{
// Reset plugin
// Reset module
DEBUG_MSG("Reset due the lack of activity.\n");
e.frameChanged = true;
this->currentMessageIndex = -1;
@@ -321,7 +321,7 @@ void CannedMessagePlugin::loadProtoForPlugin()
}
/**
* @brief Save the plugin config to file.
* @brief Save the module config to file.
*
* @return true On success.
* @return false On error.

View File

@@ -13,7 +13,7 @@
Documentation:
https://github.com/meshtastic/Meshtastic-device/blob/master/docs/software/modules/ExternalNotificationModule.md
This plugin supports:
This module supports:
https://github.com/meshtastic/Meshtastic-device/issues/654
@@ -55,7 +55,7 @@ uint32_t externalTurnedOn = 0;
int32_t ExternalNotificationPlugin::runOnce()
{
/*
Uncomment the preferences below if you want to use the plugin
Uncomment the preferences below if you want to use the module
without having to configure it from the PythonAPI or WebUI.
*/

View File

@@ -2,7 +2,7 @@
/*
* To developers:
* Use this to enable / disable features in your plugin that you don't want to risk checking into GitHub.
* Use this to enable / disable features in your module that you don't want to risk checking into GitHub.
*
*/

View File

@@ -20,7 +20,7 @@
#endif
/**
* Create plugin instances here. If you are adding a new plugin, you must 'new' it here (or somewhere else)
* Create module instances here. If you are adding a new module, you must 'new' it here (or somewhere else)
*/
void setupPlugins()
{
@@ -30,7 +30,7 @@ void setupPlugins()
positionPlugin = new PositionPlugin();
textMessagePlugin = new TextMessagePlugin();
// Note: if the rest of meshtastic doesn't need to explicitly use your plugin, you do not need to assign the instance
// Note: if the rest of meshtastic doesn't need to explicitly use your module, you do not need to assign the instance
// to a global variable.
new RemoteHardwarePlugin();
@@ -57,6 +57,6 @@ void setupPlugins()
// new StoreForwardPlugin();
#endif
// NOTE! This plugin must be added LAST because it likes to check for replies from other plugins and avoid sending extra acks
// NOTE! This module must be added LAST because it likes to check for replies from other modules and avoid sending extra acks
routingPlugin = new RoutingPlugin();
}

View File

@@ -1,6 +1,6 @@
#pragma once
/**
* Create plugin instances here. If you are adding a new plugin, you must 'new' it here (or somewhere else)
* Create module instances here. If you are adding a new module, you must 'new' it here (or somewhere else)
*/
void setupPlugins();

View File

@@ -2,7 +2,7 @@
#include "ProtobufPlugin.h"
/**
* NodeInfo plugin for sending/receiving NodeInfos into the mesh
* NodeInfo module for sending/receiving NodeInfos into the mesh
*/
class NodeInfoPlugin : public ProtobufPlugin<User>, private concurrency::OSThread
{

View File

@@ -3,7 +3,7 @@
#include "concurrency/OSThread.h"
/**
* Position plugin for sending/receiving positions into the mesh
* Position module for sending/receiving positions into the mesh
*/
class PositionPlugin : public ProtobufPlugin<Position>, private concurrency::OSThread
{

View File

@@ -4,7 +4,7 @@
#include "concurrency/OSThread.h"
/**
* A plugin that provides easy low-level remote access to device hardware.
* A module that provides easy low-level remote access to device hardware.
*/
class RemoteHardwarePlugin : public ProtobufPlugin<HardwareMessage>, private concurrency::OSThread
{

View File

@@ -3,7 +3,7 @@
/**
* A simple example plugin that just replies with "Message received" to any message it receives.
* A simple example module that just replies with "Message received" to any message it receives.
*/
class ReplyPlugin : public SinglePortPlugin
{
@@ -15,7 +15,7 @@ class ReplyPlugin : public SinglePortPlugin
protected:
/** For reply plugin we do all of our processing in the (normally optional)
/** For reply module we do all of our processing in the (normally optional)
* want_replies handling
*/
virtual MeshPacket *allocReply() override;

View File

@@ -12,7 +12,7 @@ bool RoutingPlugin::handleReceivedProtobuf(const MeshPacket &mp, Routing *r)
printPacket("Routing sniffing", &mp);
router->sniffReceived(&mp, r);
// FIXME - move this to a non promsicious PhoneAPI plugin?
// FIXME - move this to a non promsicious PhoneAPI module?
// Note: we are careful not to send back packets that started with the phone back to the phone
if ((mp.to == NODENUM_BROADCAST || mp.to == nodeDB.getNodeNum()) && (mp.from != 0)) {
printPacket("Delivering rx packet", &mp);

View File

@@ -3,7 +3,7 @@
#include "Channels.h"
/**
* Routing plugin for router control messages
* Routing module for router control messages
*/
class RoutingPlugin : public ProtobufPlugin<Routing>
{

View File

@@ -46,7 +46,7 @@ int32_t TelemetryPlugin::runOnce()
{
#ifndef PORTDUINO
/*
Uncomment the preferences below if you want to use the plugin
Uncomment the preferences below if you want to use the module
without having to configure it from the PythonAPI or WebUI.
*/
/*
@@ -65,7 +65,7 @@ int32_t TelemetryPlugin::runOnce()
if (!(radioConfig.preferences.telemetry_module_measurement_enabled ||
radioConfig.preferences.telemetry_module_screen_enabled)) {
// If this plugin is not enabled, and the user doesn't want the display screen don't waste any OSThread time on it
// If this module is not enabled, and the user doesn't want the display screen don't waste any OSThread time on it
return (INT32_MAX);
}
@@ -75,7 +75,7 @@ int32_t TelemetryPlugin::runOnce()
if (radioConfig.preferences.telemetry_module_measurement_enabled) {
DEBUG_MSG("Telemetry: Initializing\n");
// it's possible to have this plugin enabled, only for displaying values on the screen.
// it's possible to have this module enabled, only for displaying values on the screen.
// therefore, we should only enable the sensor loop if measurement is also enabled
switch (radioConfig.preferences.telemetry_module_sensor_type) {
@@ -93,14 +93,14 @@ int32_t TelemetryPlugin::runOnce()
case RadioConfig_UserPreferences_TelemetrySensorType_MCP9808:
return mcp9808Sensor.runOnce();
default:
DEBUG_MSG("Telemetry: Invalid sensor type selected; Disabling plugin");
DEBUG_MSG("Telemetry: Invalid sensor type selected; Disabling module");
return (INT32_MAX);
break;
}
}
return (INT32_MAX);
} else {
// if we somehow got to a second run of this plugin with measurement disabled, then just wait forever
// if we somehow got to a second run of this module with measurement disabled, then just wait forever
if (!radioConfig.preferences.telemetry_module_measurement_enabled)
return (INT32_MAX);
// this is not the first time OSThread library has called this function
@@ -229,7 +229,7 @@ bool TelemetryPlugin::handleReceivedProtobuf(const MeshPacket &mp, Telemetry *p)
{
if (!(radioConfig.preferences.telemetry_module_measurement_enabled ||
radioConfig.preferences.telemetry_module_screen_enabled)) {
// If this plugin is not enabled in any capacity, don't handle the packet, and allow other plugins to consume
// If this module is not enabled in any capacity, don't handle the packet, and allow other modules to consume
return false;
}
@@ -277,7 +277,7 @@ bool TelemetryPlugin::sendOurTelemetry(NodeNum dest, bool wantReplies)
mcp9808Sensor.getMeasurement(&m);
break;
default:
DEBUG_MSG("Telemetry: Invalid sensor type selected; Disabling plugin");
DEBUG_MSG("Telemetry: Invalid sensor type selected; Disabling module");
return false;
}

View File

@@ -32,7 +32,7 @@ int32_t RangeTestPlugin::runOnce()
#ifndef NO_ESP32
/*
Uncomment the preferences below if you want to use the plugin
Uncomment the preferences below if you want to use the module
without having to configure it from the PythonAPI or WebUI.
*/

View File

@@ -15,12 +15,12 @@
Default is to use RX GPIO 16 and TX GPIO 17.
Need help with this plugin? Post your question on the Meshtastic Discourse:
Need help with this module? Post your question on the Meshtastic Discourse:
https://meshtastic.discourse.group
Basic Usage:
1) Enable the plugin by setting serialplugin_enabled to 1.
1) Enable the module by setting serialplugin_enabled to 1.
2) Set the pins (serialplugin_rxd / serialplugin_rxd) for your preferred RX and TX GPIO pins.
On tbeam, recommend to use:
RXD 35
@@ -39,7 +39,7 @@
- This won't happen any time soon.
KNOWN PROBLEMS
* Until the plugin is initilized by the startup sequence, the TX pin is in a floating
* Until the module is initilized by the startup sequence, the TX pin is in a floating
state. Device connected to that pin may see this as "noise".
* Will not work on NRF and the Linux device targets.

View File

@@ -296,7 +296,7 @@ ProcessMessage StoreForwardPlugin::handleReceived(const MeshPacket &mp)
ProcessMessage StoreForwardPlugin::handleReceivedProtobuf(const MeshPacket &mp, StoreAndForward *p)
{
if (!radioConfig.preferences.store_forward_plugin_enabled) {
// If this plugin is not enabled in any capacity, don't handle the packet, and allow other plugins to consume
// If this module is not enabled in any capacity, don't handle the packet, and allow other modules to consume
return ProcessMessage::CONTINUE;
}