Reformatting code
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,4 @@
|
||||
#ifndef MYMESH_H
|
||||
#define MYMESH_H
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <Mesh.h>
|
||||
@@ -26,13 +25,14 @@
|
||||
#include <SPIFFS.h>
|
||||
#endif
|
||||
|
||||
#include <helpers/ArduinoHelpers.h>
|
||||
#include <helpers/StaticPoolPacketManager.h>
|
||||
#include <helpers/SimpleMeshTables.h>
|
||||
#include <helpers/IdentityStore.h>
|
||||
#include <helpers/BaseSerialInterface.h>
|
||||
#include "NodePrefs.h"
|
||||
|
||||
#include <RTClib.h>
|
||||
#include <helpers/ArduinoHelpers.h>
|
||||
#include <helpers/BaseSerialInterface.h>
|
||||
#include <helpers/IdentityStore.h>
|
||||
#include <helpers/SimpleMeshTables.h>
|
||||
#include <helpers/StaticPoolPacketManager.h>
|
||||
#include <target.h>
|
||||
|
||||
/* ---------------------------------- CONFIGURATION ------------------------------------- */
|
||||
@@ -78,71 +78,6 @@
|
||||
|
||||
#define PUBLIC_GROUP_PSK "izOH6cXN6mrJ5e26oRXNcg=="
|
||||
|
||||
#define CMD_APP_START 1
|
||||
#define CMD_SEND_TXT_MSG 2
|
||||
#define CMD_SEND_CHANNEL_TXT_MSG 3
|
||||
#define CMD_GET_CONTACTS 4 // with optional 'since' (for efficient sync)
|
||||
#define CMD_GET_DEVICE_TIME 5
|
||||
#define CMD_SET_DEVICE_TIME 6
|
||||
#define CMD_SEND_SELF_ADVERT 7
|
||||
#define CMD_SET_ADVERT_NAME 8
|
||||
#define CMD_ADD_UPDATE_CONTACT 9
|
||||
#define CMD_SYNC_NEXT_MESSAGE 10
|
||||
#define CMD_SET_RADIO_PARAMS 11
|
||||
#define CMD_SET_RADIO_TX_POWER 12
|
||||
#define CMD_RESET_PATH 13
|
||||
#define CMD_SET_ADVERT_LATLON 14
|
||||
#define CMD_REMOVE_CONTACT 15
|
||||
#define CMD_SHARE_CONTACT 16
|
||||
#define CMD_EXPORT_CONTACT 17
|
||||
#define CMD_IMPORT_CONTACT 18
|
||||
#define CMD_REBOOT 19
|
||||
#define CMD_GET_BATTERY_VOLTAGE 20
|
||||
#define CMD_SET_TUNING_PARAMS 21
|
||||
#define CMD_DEVICE_QEURY 22
|
||||
#define CMD_EXPORT_PRIVATE_KEY 23
|
||||
#define CMD_IMPORT_PRIVATE_KEY 24
|
||||
#define CMD_SEND_RAW_DATA 25
|
||||
#define CMD_SEND_LOGIN 26
|
||||
#define CMD_SEND_STATUS_REQ 27
|
||||
#define CMD_HAS_CONNECTION 28
|
||||
#define CMD_LOGOUT 29 // 'Disconnect'
|
||||
#define CMD_GET_CONTACT_BY_KEY 30
|
||||
#define CMD_GET_CHANNEL 31
|
||||
#define CMD_SET_CHANNEL 32
|
||||
#define CMD_SIGN_START 33
|
||||
#define CMD_SIGN_DATA 34
|
||||
#define CMD_SIGN_FINISH 35
|
||||
#define CMD_SEND_TRACE_PATH 36
|
||||
#define CMD_SET_DEVICE_PIN 37
|
||||
#define CMD_SET_OTHER_PARAMS 38
|
||||
#define CMD_SEND_TELEMETRY_REQ 39
|
||||
#define CMD_GET_CUSTOM_VARS 40
|
||||
#define CMD_SET_CUSTOM_VAR 41
|
||||
|
||||
#define RESP_CODE_OK 0
|
||||
#define RESP_CODE_ERR 1
|
||||
#define RESP_CODE_CONTACTS_START 2 // first reply to CMD_GET_CONTACTS
|
||||
#define RESP_CODE_CONTACT 3 // multiple of these (after CMD_GET_CONTACTS)
|
||||
#define RESP_CODE_END_OF_CONTACTS 4 // last reply to CMD_GET_CONTACTS
|
||||
#define RESP_CODE_SELF_INFO 5 // reply to CMD_APP_START
|
||||
#define RESP_CODE_SENT 6 // reply to CMD_SEND_TXT_MSG
|
||||
#define RESP_CODE_CONTACT_MSG_RECV 7 // a reply to CMD_SYNC_NEXT_MESSAGE (ver < 3)
|
||||
#define RESP_CODE_CHANNEL_MSG_RECV 8 // a reply to CMD_SYNC_NEXT_MESSAGE (ver < 3)
|
||||
#define RESP_CODE_CURR_TIME 9 // a reply to CMD_GET_DEVICE_TIME
|
||||
#define RESP_CODE_NO_MORE_MESSAGES 10 // a reply to CMD_SYNC_NEXT_MESSAGE
|
||||
#define RESP_CODE_EXPORT_CONTACT 11
|
||||
#define RESP_CODE_BATTERY_VOLTAGE 12 // a reply to a CMD_GET_BATTERY_VOLTAGE
|
||||
#define RESP_CODE_DEVICE_INFO 13 // a reply to CMD_DEVICE_QEURY
|
||||
#define RESP_CODE_PRIVATE_KEY 14 // a reply to CMD_EXPORT_PRIVATE_KEY
|
||||
#define RESP_CODE_DISABLED 15
|
||||
#define RESP_CODE_CONTACT_MSG_RECV_V3 16 // a reply to CMD_SYNC_NEXT_MESSAGE (ver >= 3)
|
||||
#define RESP_CODE_CHANNEL_MSG_RECV_V3 17 // a reply to CMD_SYNC_NEXT_MESSAGE (ver >= 3)
|
||||
#define RESP_CODE_CHANNEL_INFO 18 // a reply to CMD_GET_CHANNEL
|
||||
#define RESP_CODE_SIGN_START 19
|
||||
#define RESP_CODE_SIGNATURE 20
|
||||
#define RESP_CODE_CUSTOM_VARS 21
|
||||
|
||||
// these are _pushed_ to client app at any time
|
||||
#define PUSH_CODE_ADVERT 0x80
|
||||
#define PUSH_CODE_PATH_UPDATED 0x81
|
||||
@@ -199,20 +134,24 @@ protected:
|
||||
void onDiscoveredContact(ContactInfo &contact, bool is_new) override;
|
||||
void onContactPathUpdated(const ContactInfo &contact) override;
|
||||
bool processAck(const uint8_t *data) override;
|
||||
void queueMessage(const ContactInfo& from, uint8_t txt_type, mesh::Packet* pkt,
|
||||
uint32_t sender_timestamp, const uint8_t* extra, int extra_len, const char *text);
|
||||
void queueMessage(const ContactInfo &from, uint8_t txt_type, mesh::Packet *pkt, uint32_t sender_timestamp,
|
||||
const uint8_t *extra, int extra_len, const char *text);
|
||||
|
||||
void onMessageRecv(const ContactInfo& from, mesh::Packet* pkt, uint32_t sender_timestamp, const char *text) override;
|
||||
void onCommandDataRecv(const ContactInfo& from, mesh::Packet* pkt, uint32_t sender_timestamp, const char *text) override;
|
||||
void onMessageRecv(const ContactInfo &from, mesh::Packet *pkt, uint32_t sender_timestamp,
|
||||
const char *text) override;
|
||||
void onCommandDataRecv(const ContactInfo &from, mesh::Packet *pkt, uint32_t sender_timestamp,
|
||||
const char *text) override;
|
||||
void onSignedMessageRecv(const ContactInfo &from, mesh::Packet *pkt, uint32_t sender_timestamp,
|
||||
const uint8_t *sender_prefix, const char *text) override;
|
||||
void onChannelMessageRecv(const mesh::GroupChannel& channel, mesh::Packet* pkt, uint32_t timestamp, const char *text) override;
|
||||
void onChannelMessageRecv(const mesh::GroupChannel &channel, mesh::Packet *pkt, uint32_t timestamp,
|
||||
const char *text) override;
|
||||
|
||||
uint8_t onContactRequest(const ContactInfo& contact, uint32_t sender_timestamp, const uint8_t* data, uint8_t len, uint8_t* reply) override;
|
||||
uint8_t onContactRequest(const ContactInfo &contact, uint32_t sender_timestamp, const uint8_t *data,
|
||||
uint8_t len, uint8_t *reply) override;
|
||||
void onContactResponse(const ContactInfo &contact, const uint8_t *data, uint8_t len) override;
|
||||
void onRawDataRecv(mesh::Packet *packet) override;
|
||||
void onTraceRecv(mesh::Packet* packet, uint32_t tag, uint32_t auth_code, uint8_t flags, const uint8_t* path_snrs,
|
||||
const uint8_t* path_hashes, uint8_t path_len) override;
|
||||
void onTraceRecv(mesh::Packet *packet, uint32_t tag, uint32_t auth_code, uint8_t flags,
|
||||
const uint8_t *path_snrs, const uint8_t *path_hashes, uint8_t path_len) override;
|
||||
|
||||
uint32_t calcFloodTimeoutMillisFor(uint32_t pkt_airtime_millis) const override;
|
||||
uint32_t calcDirectTimeoutMillisFor(uint32_t pkt_airtime_millis, uint8_t path_len) const override;
|
||||
@@ -280,4 +219,3 @@ extern MyMesh the_mesh;
|
||||
#ifdef DISPLAY_CLASS
|
||||
extern UITask ui_task;
|
||||
#endif
|
||||
#endif // MYMESH_H
|
||||
@@ -1,6 +1,4 @@
|
||||
#ifndef NODE_PREFS_H
|
||||
#define NODE_PREFS_H
|
||||
|
||||
#pragma once
|
||||
#include <cstdint> // For uint8_t, uint32_t
|
||||
|
||||
#define TELEM_MODE_DENY 0
|
||||
@@ -23,5 +21,3 @@ struct NodePrefs { // persisted to file
|
||||
float rx_delay_base;
|
||||
uint32_t ble_pin;
|
||||
};
|
||||
|
||||
#endif // NODE_PREFS_H
|
||||
@@ -1,6 +1,4 @@
|
||||
#ifndef UI_TASK_H
|
||||
#define UI_TASK_H
|
||||
|
||||
#pragma once
|
||||
#include <MeshCore.h>
|
||||
#include <helpers/ui/DisplayDriver.h>
|
||||
#include <stddef.h>
|
||||
@@ -9,18 +7,10 @@
|
||||
#include <helpers/ui/buzzer.h>
|
||||
#endif
|
||||
|
||||
#include "NodePrefs.h"
|
||||
#include "Button.h"
|
||||
#include "NodePrefs.h"
|
||||
|
||||
enum class UIEventType
|
||||
{
|
||||
none,
|
||||
contactMessage,
|
||||
channelMessage,
|
||||
roomMessage,
|
||||
newContactMessage,
|
||||
ack
|
||||
};
|
||||
enum class UIEventType { none, contactMessage, channelMessage, roomMessage, newContactMessage, ack };
|
||||
|
||||
class UITask {
|
||||
DisplayDriver *_display;
|
||||
@@ -55,14 +45,14 @@ class UITask {
|
||||
void handleButtonTriplePress();
|
||||
void handleButtonLongPress();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
UITask(mesh::MainBoard* board) : _board(board), _display(NULL) {
|
||||
UITask(mesh::MainBoard *board) : _board(board), _display(NULL)
|
||||
{
|
||||
_next_refresh = 0;
|
||||
_connected = false;
|
||||
}
|
||||
void begin(DisplayDriver* display, NodePrefs* node_prefs, const char* build_date, const char* firmware_version, uint32_t pin_code);
|
||||
void begin(DisplayDriver *display, NodePrefs *node_prefs, const char *build_date,
|
||||
const char *firmware_version, uint32_t pin_code);
|
||||
|
||||
void setHasConnection(bool connected) { _connected = connected; }
|
||||
bool hasDisplay() const { return _display != NULL; }
|
||||
@@ -73,4 +63,3 @@ public:
|
||||
void shutdown(bool restart = false);
|
||||
void loop();
|
||||
};
|
||||
#endif //UI_TASK_H
|
||||
Reference in New Issue
Block a user