Files
ZephCore/zephcore/helpers/ContactInfo.h
T
liquidraver 3de179f9bc joystick UI: lock-screen info, BLE-aware unread, mirror local sends
- Lock overlay: show battery % + unread count between title and unlock
  sequence; ui_invalidate_battery_cache() on screen wake forces a fresh
  ADC sample so the user sees current data immediately
- UnreadScreen::addPreview gains initially_read; received msgs pass
  _ble_connected (don't count unread when phone is syncing); sent msgs
  pass true (you sent it, you know it)
- CompanionMesh::queueLocalSent{Contact,Channel}Message + PUSH_CODE_MSG_WAITING
  on wio-originated sends so a connected phone app sees them via the
  normal offline-queue flow (path_len = OUT_PATH_SENT marker)
- OUT_PATH_SENT moved back from joystick_defs.h to ContactInfo.h
  (now a wire-format value, not UI-only)
2026-05-21 09:37:24 +02:00

42 lines
1.0 KiB
C++

/*
* SPDX-License-Identifier: Apache-2.0
* ContactInfo - contact/peer info for mesh
*/
#pragma once
#include <mesh/Mesh.h>
#include <mesh/MeshCore.h>
#define OUT_PATH_UNKNOWN 0xFF
/* Marker used in BLE offline-queue frames to indicate the message was sent
* by THIS device (not received). Also reused by the joystick UI's local
* message-preview structs for the same purpose. Not a routing value —
* never appears in over-the-air packet path_len fields. */
#define OUT_PATH_SENT 0xFE
struct ContactInfo {
mesh::Identity id;
char name[32];
uint8_t type;
uint8_t flags;
uint8_t out_path_len;
mutable bool shared_secret_valid;
uint8_t out_path[MAX_PATH_SIZE];
uint32_t last_advert_timestamp;
uint32_t lastmod;
int32_t gps_lat, gps_lon;
uint32_t sync_since;
const uint8_t *getSharedSecret(const mesh::LocalIdentity &self_id) const {
if (!shared_secret_valid) {
self_id.calcSharedSecret(shared_secret, id.pub_key);
shared_secret_valid = true;
}
return shared_secret;
}
private:
mutable uint8_t shared_secret[PUB_KEY_SIZE];
};