mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-10-06 09:58:03 +00:00
* misc
This commit is contained in:
@@ -473,7 +473,7 @@ void MyMesh::queueMessage(const ContactInfo &from, uint8_t txt_type, mesh::Packe
|
||||
}
|
||||
|
||||
if (_listener) {
|
||||
_listener->onMessageRecv(from, txt_type, sender_timestamp, path_len, text);
|
||||
_listener->onMessageRecv(pkt, from, txt_type, sender_timestamp, text);
|
||||
_listener->onQueueSizeChanged(offline_queue_len);
|
||||
}
|
||||
}
|
||||
@@ -593,7 +593,7 @@ void MyMesh::onChannelMessageRecv(const mesh::GroupChannel &channel, mesh::Packe
|
||||
if (!getChannel(channel_idx, channel_details)) {
|
||||
strcpy(channel_details.name, "Unknown");
|
||||
}
|
||||
_listener->onChannelMessageRecv(channel_details, path_len, text);
|
||||
_listener->onChannelMessageRecv(pkt, channel_details, text);
|
||||
_listener->onQueueSizeChanged(offline_queue_len);
|
||||
}
|
||||
}
|
||||
@@ -632,7 +632,7 @@ void MyMesh::onChannelDataRecv(const mesh::GroupChannel &channel, mesh::Packet *
|
||||
_serial->writeFrame(frame, 1);
|
||||
}
|
||||
if (_listener) {
|
||||
_listener->onChannelDataRecv(channel, pkt, data_type, data, data_len);
|
||||
_listener->onChannelDataRecv(pkt, channel, data_type, data, data_len);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -91,20 +91,21 @@ class MyMesh : public BaseChatMesh, public DataStoreHost {
|
||||
public:
|
||||
class Listener {
|
||||
public:
|
||||
virtual void onMessageRecv(const ContactInfo &from, uint8_t txt_type, uint32_t sender_timestamp, uint8_t path_len, const char* text) = 0;
|
||||
virtual void onChannelMessageRecv(ChannelDetails& channel_details, uint8_t path_len, const char* text) = 0;
|
||||
virtual void onMessageRecv(mesh::Packet *pkt, const ContactInfo &from, uint8_t txt_type, uint32_t sender_timestamp, const char* text) = 0;
|
||||
virtual void onChannelMessageRecv(mesh::Packet *pkt, ChannelDetails& channel_details, const char* text) = 0;
|
||||
virtual void onQueueSizeChanged(int msgcount) = 0;
|
||||
virtual void onDiscoveredContact(ContactInfo &contact, bool is_new, uint8_t path_len, const uint8_t* path) { }
|
||||
virtual void onControlDataRecv(const mesh::Packet* packet) { }
|
||||
virtual void onChannelDataRecv(const mesh::GroupChannel &channel, mesh::Packet *pkt, uint16_t data_type,
|
||||
virtual void onControlDataRecv(const mesh::Packet* pkt) { }
|
||||
virtual void onChannelDataRecv(mesh::Packet *pkt, const mesh::GroupChannel &channel, uint16_t data_type,
|
||||
const uint8_t *data, size_t data_len) { }
|
||||
virtual void onACKRecv(uint32_t ack_crc) { }
|
||||
virtual uint8_t onUnhandledRequest(const ContactInfo &contact, uint32_t sender_timestamp, const uint8_t *data,
|
||||
uint8_t len, uint8_t *reply) { return 0; /* unknown request type */ }
|
||||
virtual void onUnhandledResponse(const ContactInfo &from, uint32_t tag, const uint8_t* data, uint8_t len) { }
|
||||
virtual void onTraceRecv(mesh::Packet *packet, uint32_t tag, uint32_t auth_code, uint8_t flags,
|
||||
virtual void onTraceRecv(mesh::Packet *pkt, uint32_t tag, uint32_t auth_code, uint8_t flags,
|
||||
const uint8_t *path_snrs, const uint8_t *path_hashes, uint8_t path_len) { }
|
||||
virtual void onRawDataRecv(mesh::Packet *packet) { }
|
||||
virtual void onRawDataRecv(mesh::Packet *pkt) { }
|
||||
virtual ~Listener() { }
|
||||
};
|
||||
|
||||
MyMesh(mesh::Radio &radio, mesh::RNG &rng, mesh::RTCClock &rtc, SimpleMeshTables &tables, DataStore& store);
|
||||
|
||||
@@ -786,10 +786,11 @@ switch(t){
|
||||
#endif
|
||||
}
|
||||
|
||||
void UITask::onMessageRecv(const ContactInfo &from, uint8_t txt_type, uint32_t sender_timestamp, uint8_t path_len, const char* text) {
|
||||
void UITask::onMessageRecv(mesh::Packet *pkt, const ContactInfo &from, uint8_t txt_type, uint32_t sender_timestamp, const char* text) {
|
||||
// we only want to show text messages on display, not cli data
|
||||
if (!(txt_type == TXT_TYPE_PLAIN || txt_type == TXT_TYPE_SIGNED_PLAIN)) return;
|
||||
|
||||
uint8_t path_len = pkt->isRouteFlood() ? pkt->path_len : 0xFF;
|
||||
((MsgPreviewScreen *) msg_preview)->addPreview(path_len, from.name, text);
|
||||
setCurrScreen(msg_preview);
|
||||
|
||||
@@ -808,7 +809,8 @@ void UITask::onMessageRecv(const ContactInfo &from, uint8_t txt_type, uint32_t s
|
||||
}
|
||||
}
|
||||
|
||||
void UITask::onChannelMessageRecv(ChannelDetails& channel_details, uint8_t path_len, const char* text) {
|
||||
void UITask::onChannelMessageRecv(mesh::Packet *pkt, ChannelDetails& channel_details, const char* text) {
|
||||
uint8_t path_len = pkt->isRouteFlood() ? pkt->path_len : 0xFF;
|
||||
((MsgPreviewScreen *) msg_preview)->addPreview(path_len, channel_details.name, text);
|
||||
setCurrScreen(msg_preview);
|
||||
|
||||
@@ -842,7 +844,7 @@ void UITask::onDiscoveredContact(ContactInfo &contact, bool is_new, uint8_t path
|
||||
|
||||
void UITask::onControlDataRecv(const mesh::Packet* packet) {
|
||||
#if UI_DISCOVER_SCREEN
|
||||
if (packet->payload_len >= 12 && (packet->payload[0] & 0xF0) == CTL_TYPE_NODE_DISCOVER_RESP) {
|
||||
if (packet->payload_len >= 14 && (packet->payload[0] & 0xF0) == CTL_TYPE_NODE_DISCOVER_RESP) {
|
||||
((HomeScreen *) home)->handleDiscoverResponse(packet);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -22,6 +22,10 @@
|
||||
#include "../AbstractUITask.h"
|
||||
#include "../NodePrefs.h"
|
||||
|
||||
#ifdef UI_NO_DISCOVER_SCREEN
|
||||
#error "UI_NO_DISCOVER_SCREEN is obsolete - use -D UI_DISCOVER_SCREEN=0 instead"
|
||||
#endif
|
||||
|
||||
#ifndef UI_DISCOVER_SCREEN
|
||||
#define UI_DISCOVER_SCREEN 1
|
||||
#endif
|
||||
@@ -111,11 +115,11 @@ public:
|
||||
void toggleGPS();
|
||||
|
||||
// MyMesh::Listener
|
||||
void onMessageRecv(const ContactInfo &from, uint8_t txt_type, uint32_t sender_timestamp, uint8_t path_len, const char* text) override;
|
||||
void onChannelMessageRecv(ChannelDetails& channel_details, uint8_t path_len, const char* text) override;
|
||||
void onMessageRecv(mesh::Packet *pkt, const ContactInfo &from, uint8_t txt_type, uint32_t sender_timestamp, const char* text) override;
|
||||
void onChannelMessageRecv(mesh::Packet *pkt, ChannelDetails& channel_details, const char* text) override;
|
||||
void onQueueSizeChanged(int offline_queue_size) override;
|
||||
void onDiscoveredContact(ContactInfo &contact, bool is_new, uint8_t path_len, const uint8_t* path) override;
|
||||
void onControlDataRecv(const mesh::Packet* packet) override;
|
||||
void onControlDataRecv(const mesh::Packet* pkt) override;
|
||||
|
||||
// from AbstractUITask
|
||||
void notify(UIEventType t = UIEventType::none) override;
|
||||
|
||||
@@ -139,7 +139,7 @@ void UITask::clearMsgPreview() {
|
||||
_need_refresh = true;
|
||||
}
|
||||
|
||||
void UITask::onMessageRecv(const ContactInfo &from, uint8_t txt_type, uint32_t sender_timestamp, uint8_t path_len, const char* text) {
|
||||
void UITask::onMessageRecv(mesh::Packet *pkt, const ContactInfo &from, uint8_t txt_type, uint32_t sender_timestamp, const char* text) {
|
||||
// we only want to show text messages on display, not cli data
|
||||
if (!(txt_type == TXT_TYPE_PLAIN || txt_type == TXT_TYPE_SIGNED_PLAIN)) return;
|
||||
|
||||
@@ -147,6 +147,7 @@ void UITask::onMessageRecv(const ContactInfo &from, uint8_t txt_type, uint32_t s
|
||||
vibration.trigger(); // vibrate even while the app is connected (honors quiet + cooldown)
|
||||
#endif
|
||||
|
||||
uint8_t path_len = pkt->isRouteFlood() ? pkt->path_len : 0xFF;
|
||||
if (path_len == 0xFF) {
|
||||
sprintf(_origin, "(F) %s", from.name);
|
||||
} else {
|
||||
@@ -168,11 +169,12 @@ void UITask::onMessageRecv(const ContactInfo &from, uint8_t txt_type, uint32_t s
|
||||
}
|
||||
}
|
||||
|
||||
void UITask::onChannelMessageRecv(ChannelDetails& channel_details, uint8_t path_len, const char* text) {
|
||||
void UITask::onChannelMessageRecv(mesh::Packet *pkt, ChannelDetails& channel_details, const char* text) {
|
||||
#ifdef HAS_DRV2605
|
||||
vibration.trigger(); // vibrate even while the app is connected (honors quiet + cooldown)
|
||||
#endif
|
||||
|
||||
uint8_t path_len = pkt->isRouteFlood() ? pkt->path_len : 0xFF;
|
||||
if (path_len == 0xFF) {
|
||||
sprintf(_origin, "(F) %s", channel_details.name);
|
||||
} else {
|
||||
|
||||
@@ -71,8 +71,8 @@ public:
|
||||
void clearMsgPreview();
|
||||
|
||||
// MyMesh::Listener
|
||||
void onMessageRecv(const ContactInfo &from, uint8_t txt_type, uint32_t sender_timestamp, uint8_t path_len, const char* text) override;
|
||||
void onChannelMessageRecv(ChannelDetails& channel_details, uint8_t path_len, const char* text) override;
|
||||
void onMessageRecv(mesh::Packet *pkt, const ContactInfo &from, uint8_t txt_type, uint32_t sender_timestamp, const char* text) override;
|
||||
void onChannelMessageRecv(mesh::Packet *pkt, ChannelDetails& channel_details, const char* text) override;
|
||||
void onQueueSizeChanged(int offline_queue_size) override;
|
||||
void onDiscoveredContact(ContactInfo &contact, bool is_new, uint8_t path_len, const uint8_t* path) override;
|
||||
|
||||
|
||||
@@ -510,7 +510,7 @@ void UITask::onQueueSizeChanged(int msgcount) {
|
||||
}
|
||||
}
|
||||
|
||||
void UITask::onMessageRecv(const ContactInfo &from, uint8_t txt_type, uint32_t sender_timestamp, uint8_t path_len, const char* text) {
|
||||
void UITask::onMessageRecv(mesh::Packet *pkt, const ContactInfo &from, uint8_t txt_type, uint32_t sender_timestamp, const char* text) {
|
||||
// we only want to show text messages on display, not cli data
|
||||
if (!(txt_type == TXT_TYPE_PLAIN || txt_type == TXT_TYPE_SIGNED_PLAIN)) return;
|
||||
|
||||
@@ -528,7 +528,7 @@ void UITask::onMessageRecv(const ContactInfo &from, uint8_t txt_type, uint32_t s
|
||||
}
|
||||
}
|
||||
|
||||
void UITask::onChannelMessageRecv(ChannelDetails& channel_details, uint8_t path_len, const char* text) {
|
||||
void UITask::onChannelMessageRecv(mesh::Packet *pkt, ChannelDetails& channel_details, const char* text) {
|
||||
if (_display != NULL) {
|
||||
if (!_display->isOn() && !hasConnection()) {
|
||||
_display->turnOn();
|
||||
|
||||
@@ -99,8 +99,8 @@ public:
|
||||
void toggleGPS();
|
||||
|
||||
// MyMesh::Listener
|
||||
void onMessageRecv(const ContactInfo &from, uint8_t txt_type, uint32_t sender_timestamp, uint8_t path_len, const char* text) override;
|
||||
void onChannelMessageRecv(ChannelDetails& channel_details, uint8_t path_len, const char* text) override;
|
||||
void onMessageRecv(mesh::Packet *pkt, const ContactInfo &from, uint8_t txt_type, uint32_t sender_timestamp, const char* text) override;
|
||||
void onChannelMessageRecv(mesh::Packet *pkt, ChannelDetails& channel_details, const char* text) override;
|
||||
void onQueueSizeChanged(int offline_queue_size) override;
|
||||
void onDiscoveredContact(ContactInfo &contact, bool is_new, uint8_t path_len, const uint8_t* path) override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user