Message history with delivery tracking (GET /api/messages) (#8)
CI / build + unit (push) Successful in 32s
CI / build + unit (push) Successful in 32s
This commit was merged in pull request #8.
This commit is contained in:
@@ -12,6 +12,8 @@ export const BROADCAST_ADDR = 0xffffffff;
|
||||
export const PORT_TEXT_MESSAGE_APP = 1;
|
||||
// verified against installed @meshtastic/protobufs Portnums.PortNum.POSITION_APP
|
||||
export const PORT_POSITION_APP = 3;
|
||||
// verified against installed @meshtastic/protobufs Portnums.PortNum.ROUTING_APP
|
||||
export const PORT_ROUTING_APP = 5;
|
||||
|
||||
const START1 = 0x94;
|
||||
const START2 = 0xc3;
|
||||
@@ -71,6 +73,23 @@ export async function decodePosition(
|
||||
return fromBinary(P.Mesh.PositionSchema, bytes);
|
||||
}
|
||||
|
||||
/** ROUTING_APP packets carry a serialized meshtastic.Routing in Data.payload (ACK/NACK for want_ack sends). */
|
||||
export async function decodeRouting(
|
||||
bytes: Uint8Array,
|
||||
): Promise<import('@meshtastic/protobufs').Mesh.Routing> {
|
||||
const P = await loadProto();
|
||||
return fromBinary(P.Mesh.RoutingSchema, bytes);
|
||||
}
|
||||
|
||||
/** Human-readable name for a Routing.Error code (from the installed @meshtastic/protobufs enum), `reason <n>` fallback. */
|
||||
export async function describeRoutingError(code: number): Promise<string> {
|
||||
const P = await loadProto();
|
||||
const hit = Object.entries(P.Mesh.Routing_Error).find(
|
||||
([, v]) => typeof v === 'number' && v === code,
|
||||
);
|
||||
return hit ? String(hit[0]) : `reason ${code}`;
|
||||
}
|
||||
|
||||
let hwModelNames: Map<number, string> | null = null;
|
||||
/** Reverse lookup of meshtastic.HardwareModel (enum value -> name), loaded once. */
|
||||
export async function loadHwModelNames(): Promise<Map<number, string>> {
|
||||
|
||||
Reference in New Issue
Block a user