I don't like this formatting but I need trunk to STFU

This commit is contained in:
Ben Meadors
2023-01-18 14:51:48 -06:00
parent b218ea9ec7
commit 9046dacec8
39 changed files with 802 additions and 780 deletions

View File

@@ -157,7 +157,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
if (info) {
LOG_INFO("Sending nodeinfo: num=0x%x, lastseen=%u, id=%s, name=%s\n", info->num, info->last_heard, info->user.id,
info->user.long_name);
info->user.long_name);
fromRadioScratch.which_payload_variant = FromRadio_node_info_tag;
fromRadioScratch.node_info = *info;
// Stay in current state until done sending nodeinfos
@@ -364,7 +364,7 @@ bool PhoneAPI::available()
case STATE_SEND_MODULECONFIG:
case STATE_SEND_COMPLETE_ID:
return true;
case STATE_SEND_NODEINFO:
if (!nodeInfoForPhone)
nodeInfoForPhone = nodeDB.readNextInfo();

View File

@@ -16,14 +16,15 @@
* Eventually there should be once instance of this class for each live connection (because it has a bit of state
* for that connection)
*/
class PhoneAPI : public Observer<uint32_t> // FIXME, we shouldn't be inheriting from Observer, instead use CallbackObserver as a member
class PhoneAPI
: public Observer<uint32_t> // FIXME, we shouldn't be inheriting from Observer, instead use CallbackObserver as a member
{
enum State {
STATE_SEND_NOTHING, // Initial state, don't send anything until the client starts asking for config
STATE_SEND_MY_INFO, // send our my info record
STATE_SEND_NODEINFO, // states progress in this order as the device sends to to the client
STATE_SEND_CHANNELS, // Send all channels
STATE_SEND_CONFIG, // Replacement for the old Radioconfig
STATE_SEND_NOTHING, // Initial state, don't send anything until the client starts asking for config
STATE_SEND_MY_INFO, // send our my info record
STATE_SEND_NODEINFO, // states progress in this order as the device sends to to the client
STATE_SEND_CHANNELS, // Send all channels
STATE_SEND_CONFIG, // Replacement for the old Radioconfig
STATE_SEND_MODULECONFIG, // Send Module specific config
STATE_SEND_COMPLETE_ID,
STATE_SEND_PACKETS // send packets or debug strings
@@ -65,7 +66,7 @@ class PhoneAPI : public Observer<uint32_t> // FIXME, we shouldn't be inheriting
// Call this when the client drops the connection, resets the state to STATE_SEND_NOTHING
// Unregisters our observer. A closed connection **can** be reopened by calling init again.
virtual void close();
/**
* Handle a ToRadio protobuf
* @return true true if a packet was queued for sending (so that caller can yield)
@@ -95,7 +96,7 @@ class PhoneAPI : public Observer<uint32_t> // FIXME, we shouldn't be inheriting
/** the last msec we heard from the client on the other side of this link */
uint32_t lastContactMsec = 0;
/// Hookable to find out when connection changes
virtual void onConnectionChanged(bool connected) {}

View File

@@ -1,9 +1,9 @@
#pragma once
#include "mesh/generated/meshtastic/mesh.pb.h"
#include "mesh/generated/meshtastic/localonly.pb.h"
#include "mesh/generated/meshtastic/deviceonly.pb.h"
#include "mesh/generated/meshtastic/admin.pb.h"
#include "mesh/generated/meshtastic/deviceonly.pb.h"
#include "mesh/generated/meshtastic/localonly.pb.h"
#include "mesh/generated/meshtastic/mesh.pb.h"
// this file defines constants which come from mesh.options
@@ -11,8 +11,8 @@
#define member_size(type, member) sizeof(((type *)0)->member)
/// max number of packets which can be waiting for delivery to android - note, this value comes from mesh.options protobuf
// FIXME - max_count is actually 32 but we save/load this as one long string of preencoded MeshPacket bytes - not a big array in RAM
// #define MAX_RX_TOPHONE (member_size(DeviceState, receive_queue) / member_size(DeviceState, receive_queue[0]))
// FIXME - max_count is actually 32 but we save/load this as one long string of preencoded MeshPacket bytes - not a big array in
// RAM #define MAX_RX_TOPHONE (member_size(DeviceState, receive_queue) / member_size(DeviceState, receive_queue[0]))
#define MAX_RX_TOPHONE 32
/// max number of nodes allowed in the mesh
@@ -36,7 +36,7 @@ bool writecb(pb_ostream_t *stream, const uint8_t *buf, size_t count);
/** is_in_repeated is a macro/function that returns true if a specified word appears in a repeated protobuf array.
* It relies on the following naming conventions from nanopb:
*
*
* pb_size_t ignore_incoming_count;
* uint32_t ignore_incoming[3];
*/