Inbox injection endpoint: POST /api/messages + MCP inject_message (#12) (#18)
CI / build + unit (push) Successful in 1m14s
CI / build + unit (push) Successful in 1m14s
This commit was merged in pull request #18.
This commit is contained in:
+8
-2
@@ -115,14 +115,20 @@ export async function loadHwModelNames(): Promise<Map<number, string>> {
|
||||
return hwModelNames;
|
||||
}
|
||||
|
||||
/** Random non-zero uint32 packet id. */
|
||||
export function randomPacketId(): number {
|
||||
let id = Math.floor(Math.random() * 0x100000000) >>> 0;
|
||||
if (id === 0) id = 1; // non-zero uint32
|
||||
return id;
|
||||
}
|
||||
|
||||
export async function buildTextToRadio(
|
||||
to: number,
|
||||
text: string,
|
||||
channelIndex: number,
|
||||
): Promise<{ bytes: Uint8Array; id: number }> {
|
||||
const P = await loadProto();
|
||||
let id = Math.floor(Math.random() * 0x100000000) >>> 0;
|
||||
if (id === 0) id = 1; // non-zero uint32
|
||||
const id = randomPacketId();
|
||||
const meshPacket = create(P.Mesh.MeshPacketSchema, {
|
||||
to,
|
||||
id,
|
||||
|
||||
Reference in New Issue
Block a user