Files
ZephCore/zephcore/helpers/ContactInfo.h
T
2026-02-26 15:40:51 +01:00

37 lines
754 B
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
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];
};