diff --git a/deno.lock b/deno.lock index 61edba5b..d4a17972 100644 --- a/deno.lock +++ b/deno.lock @@ -2,12 +2,11 @@ "version": "5", "specifiers": { "jsr:@std/path@^1.1.0": "1.1.0", - "npm:@bufbuild/protobuf@^2.5.2": "2.5.2", - "npm:@jsr/meshtastic__core@2.6.4": "2.6.4", - "npm:@jsr/meshtastic__js@2.6.0-0": "2.6.0-0", - "npm:@jsr/meshtastic__transport-http@*": "0.2.1", - "npm:@jsr/meshtastic__transport-web-bluetooth@*": "0.1.2", - "npm:@jsr/meshtastic__transport-web-serial@*": "0.2.1", + "npm:@bufbuild/protobuf@^2.2.5": "2.5.2", + "npm:@jsr/meshtastic__core@2.6.2": "2.6.2", + "npm:@jsr/meshtastic__transport-http@0.2.1": "0.2.1", + "npm:@jsr/meshtastic__transport-web-bluetooth@0.1.2": "0.1.2", + "npm:@jsr/meshtastic__transport-web-serial@0.2.1": "0.2.1", "npm:@noble/curves@^1.9.2": "1.9.2", "npm:@radix-ui/react-accordion@^1.2.11": "1.2.11_@types+react@19.1.7_@types+react-dom@19.1.6__@types+react@19.1.7_react@19.1.0_react-dom@19.1.0__react@19.1.0", "npm:@radix-ui/react-checkbox@^1.3.2": "1.3.2_@types+react@19.1.7_@types+react-dom@19.1.6__@types+react@19.1.7_react@19.1.0_react-dom@19.1.0__react@19.1.0", @@ -1119,8 +1118,8 @@ "@jridgewell/sourcemap-codec" ] }, - "@jsr/meshtastic__core@2.6.4": { - "integrity": "sha512-1Kz5DK6peFxluHOJR38vFwfgeJzMXTz+3p6TvibjILVhSQC2U1nu8aJbn6w5zhRqS+j79OmtrRvdzL6VNsTkkQ==", + "@jsr/meshtastic__core@2.6.2": { + "integrity": "sha512-mzsxs9hQeVimQd/tj15Ojw5FYY8Iko3EbDviFZoEw3bmXgiySG53GvQsNA9wV13lFbDu96SM3uK/LI3EHMFY9w==", "dependencies": [ "@bufbuild/protobuf", "@jsr/meshtastic__protobufs", @@ -1128,10 +1127,10 @@ "ste-simple-events", "tslog" ], - "tarball": "https://npm.jsr.io/~/11/@jsr/meshtastic__core/2.6.4.tgz" + "tarball": "https://npm.jsr.io/~/11/@jsr/meshtastic__core/2.6.2.tgz" }, - "@jsr/meshtastic__js@2.6.0-0": { - "integrity": "sha512-+xpZpxK6oUIVOuEs7C+LyxRr2druvc7UNNNTK9Rl8ioXj63Jz1uQXlYe2Gj0xjnRAiSQLR7QVaPef21BR/YTxA==", + "@jsr/meshtastic__core@2.6.4": { + "integrity": "sha512-1Kz5DK6peFxluHOJR38vFwfgeJzMXTz+3p6TvibjILVhSQC2U1nu8aJbn6w5zhRqS+j79OmtrRvdzL6VNsTkkQ==", "dependencies": [ "@bufbuild/protobuf", "@jsr/meshtastic__protobufs", @@ -1139,7 +1138,7 @@ "ste-simple-events", "tslog" ], - "tarball": "https://npm.jsr.io/~/11/@jsr/meshtastic__js/2.6.0-0.tgz" + "tarball": "https://npm.jsr.io/~/11/@jsr/meshtastic__core/2.6.4.tgz" }, "@jsr/meshtastic__protobufs@2.6.2": { "integrity": "sha512-bIENtFnUEru28GrAeSdiBS9skp0hN/3HZunMbF/IjvUrXOlx2fptKVj3b+pzjOWnLBZxllrByV/W+XDmrxqJ6g==", @@ -1151,21 +1150,21 @@ "@jsr/meshtastic__transport-http@0.2.1": { "integrity": "sha512-lmQKr3aIINKvtGROU4HchmSVqbZSbkIHqajowRRC8IAjsnR0zNTyxz210QyY4pFUF9hpcW3GRjwq5h/VO2JuGg==", "dependencies": [ - "@jsr/meshtastic__core" + "@jsr/meshtastic__core@2.6.2" ], "tarball": "https://npm.jsr.io/~/11/@jsr/meshtastic__transport-http/0.2.1.tgz" }, "@jsr/meshtastic__transport-web-bluetooth@0.1.2": { "integrity": "sha512-Z+5pv9RXNgY0/crKExOH3pZ6LT0HIXFmnBL7NX5AO2knOFRn+4lmxQEhhmiTTlkUfqyEfAvbjuY5u4mq9TPTdQ==", "dependencies": [ - "@jsr/meshtastic__core" + "@jsr/meshtastic__core@2.6.4" ], "tarball": "https://npm.jsr.io/~/11/@jsr/meshtastic__transport-web-bluetooth/0.1.2.tgz" }, "@jsr/meshtastic__transport-web-serial@0.2.1": { "integrity": "sha512-yumjEGLkAuJYOC3aWKvZzbQqi/LnqaKfNpVCY7Ki7oLtAshNiZrBLiwiFhN7+ZR9FfMdJThyBMqREBDRRWTO1Q==", "dependencies": [ - "@jsr/meshtastic__core" + "@jsr/meshtastic__core@2.6.4" ], "tarball": "https://npm.jsr.io/~/11/@jsr/meshtastic__transport-web-serial/0.2.1.tgz" }, @@ -7557,12 +7556,11 @@ ], "packageJson": { "dependencies": [ - "npm:@bufbuild/protobuf@^2.5.2", - "npm:@jsr/meshtastic__core@2.6.4", - "npm:@jsr/meshtastic__js@2.6.0-0", - "npm:@jsr/meshtastic__transport-http@*", - "npm:@jsr/meshtastic__transport-web-bluetooth@*", - "npm:@jsr/meshtastic__transport-web-serial@*", + "npm:@bufbuild/protobuf@^2.2.5", + "npm:@jsr/meshtastic__core@2.6.2", + "npm:@jsr/meshtastic__transport-http@0.2.1", + "npm:@jsr/meshtastic__transport-web-bluetooth@0.1.2", + "npm:@jsr/meshtastic__transport-web-serial@0.2.1", "npm:@noble/curves@^1.9.2", "npm:@radix-ui/react-accordion@^1.2.11", "npm:@radix-ui/react-checkbox@^1.3.2", diff --git a/package.json b/package.json index de862e5c..c81214ab 100644 --- a/package.json +++ b/package.json @@ -34,12 +34,11 @@ }, "homepage": "https://meshtastic.org", "dependencies": { - "@bufbuild/protobuf": "^2.5.2", - "@meshtastic/core": "npm:@jsr/meshtastic__core@2.6.4", - "@meshtastic/js": "npm:@jsr/meshtastic__js@2.6.0-0", - "@meshtastic/transport-http": "npm:@jsr/meshtastic__transport-http", - "@meshtastic/transport-web-bluetooth": "npm:@jsr/meshtastic__transport-web-bluetooth", - "@meshtastic/transport-web-serial": "npm:@jsr/meshtastic__transport-web-serial", + "@bufbuild/protobuf": "^2.2.5", + "@meshtastic/core": "npm:@jsr/meshtastic__core@2.6.2", + "@meshtastic/transport-http": "npm:@jsr/meshtastic__transport-http@0.2.1", + "@meshtastic/transport-web-bluetooth": "npm:@jsr/meshtastic__transport-web-bluetooth@0.1.2", + "@meshtastic/transport-web-serial": "npm:@jsr/meshtastic__transport-web-serial@0.2.1", "@noble/curves": "^1.9.2", "@radix-ui/react-accordion": "^1.2.11", "@radix-ui/react-checkbox": "^1.3.2", diff --git a/src/components/PageComponents/Connect/BLE.tsx b/src/components/PageComponents/Connect/BLE.tsx index 172f4497..7ab1af7b 100644 --- a/src/components/PageComponents/Connect/BLE.tsx +++ b/src/components/PageComponents/Connect/BLE.tsx @@ -5,7 +5,8 @@ import { useAppStore } from "@core/stores/appStore.ts"; import { useDeviceStore } from "@core/stores/deviceStore.ts"; import { subscribeAll } from "@core/subscriptions.ts"; import { randId } from "@core/utils/randId.ts"; -import { BleConnection, ServiceUuid } from "@meshtastic/js"; +import { TransportWebBluetooth } from "@meshtastic/transport-web-bluetooth"; +import { MeshDevice } from "@meshtastic/core"; import { BluetoothDevice } from "web-bluetooth"; import { useCallback, useEffect, useState } from "react"; import { useMessageStore } from "@core/stores/messageStore/index.ts"; @@ -31,15 +32,13 @@ export const BLE = ( const onConnect = async (bleDevice: BluetoothDevice) => { const id = randId(); + const transport = await TransportWebBluetooth.createFromDevice(bleDevice); const device = addDevice(id); + const connection = new MeshDevice(transport, id); + connection.configure(); setSelectedDevice(id); - const connection = new BleConnection(id); - await connection.connect({ - device: bleDevice, - }); device.addConnection(connection); subscribeAll(device, connection, messageStore); - closeDialog(); }; @@ -72,7 +71,7 @@ export const BLE = ( onClick={async () => { await navigator.bluetooth .requestDevice({ - filters: [{ services: [ServiceUuid] }], + filters: [{ services: [TransportWebBluetooth.ServiceUuid] }], }) .then((device) => { const exists = bleDevices.findIndex((d) => d.id === device.id); diff --git a/src/components/PageComponents/Messages/MessageItem.tsx b/src/components/PageComponents/Messages/MessageItem.tsx index ad6d7af1..ab509741 100644 --- a/src/components/PageComponents/Messages/MessageItem.tsx +++ b/src/components/PageComponents/Messages/MessageItem.tsx @@ -15,7 +15,7 @@ import { MessageState, useMessageStore, } from "@core/stores/messageStore/index.ts"; -import { Protobuf, Types } from "@meshtastic/js"; +import { Protobuf, Types } from "@meshtastic/core"; import { Message } from "@core/stores/messageStore/types.ts"; import { useTranslation } from "react-i18next"; // import { MessageActionsMenu } from "@components/PageComponents/Messages/MessageActionsMenu.tsx"; // TODO: Uncomment when actions menu is implemented diff --git a/src/core/dto/PacketToMessageDTO.ts b/src/core/dto/PacketToMessageDTO.ts index 3694c506..f6d4c575 100644 --- a/src/core/dto/PacketToMessageDTO.ts +++ b/src/core/dto/PacketToMessageDTO.ts @@ -1,7 +1,6 @@ -import type { Types } from "@meshtastic/js"; -import { MessageState, MessageType } from "../stores/messageStore/index.ts"; -import type { Message } from "../stores/messageStore/types.ts"; - +import type { Types } from "@meshtastic/core"; +import { MessageState, MessageType } from "@core/stores/messageStore/index.ts"; +import { Message } from "@core/stores/messageStore/types.ts"; class PacketToMessageDTO { channel: Types.ChannelNumber; to: number; diff --git a/src/pages/Messages.tsx b/src/pages/Messages.tsx index 3c9555d2..6a13fb35 100644 --- a/src/pages/Messages.tsx +++ b/src/pages/Messages.tsx @@ -120,21 +120,6 @@ export const MessagesPage = () => { let messageId: number | undefined; - // type SetMessageStateParams = - // | { - // type: MessageType.Direct; - // nodeA: NodeNum; - // nodeB: NodeNum; - // messageId: MessageId; // ID of the message within that chat - // newState?: MessageState; // Optional new state, defaults to Ack - // } - // | { - // type: MessageType.Broadcast; - // channelId: ChannelId; - // messageId: MessageId; - // newState?: MessageState; // Optional new state, defaults to Ack - // }; - try { messageId = await connection?.sendText( message, @@ -162,7 +147,7 @@ export const MessagesPage = () => { } else { console.warn("sendText completed but messageId is undefined"); } - } catch (e) { + } catch (e: unknown) { console.error("Failed to send message:", e); const failedId = messageId ?? randId(); if (chatType === MessageType.Broadcast) {