From b6fc903105aa79ab4e02ef25b4d79b246997f6dd Mon Sep 17 00:00:00 2001 From: Yudi Xiao <463708580@qq.com> Date: Fri, 12 Dec 2025 16:58:57 +0800 Subject: [PATCH] =?UTF-8?q?expo-ble=E6=A8=A1=E5=9D=97=E6=B5=8B=E8=AF=95dem?= =?UTF-8?q?o=20=E5=A2=9E=E5=8A=A0=E5=9B=BE=E7=89=87=E7=BC=A9=E6=94=BE?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ble/hooks/useBleExplorer.ts | 5 ++++- ble/package.json | 4 ++-- ble/protocol/Constants.ts | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ble/hooks/useBleExplorer.ts b/ble/hooks/useBleExplorer.ts index 1c65d95..1599798 100644 --- a/ble/hooks/useBleExplorer.ts +++ b/ble/hooks/useBleExplorer.ts @@ -437,7 +437,10 @@ export const useBleExplorer = () => { if (!isJpeg) { console.debug(`Converting image to JPEG...`); - const context = ImageManipulator.ImageManipulator.manipulate(media.uri); + const context = ImageManipulator.ImageManipulator.manipulate(media.uri).resize({ + width: BLE_UUIDS.SCREEN_SIZE, + height: BLE_UUIDS.SCREEN_SIZE + }); const imageRef = await context.renderAsync(); const result = await imageRef.saveAsync({ compress: 1, diff --git a/ble/package.json b/ble/package.json index 052bffc..90c0d1f 100644 --- a/ble/package.json +++ b/ble/package.json @@ -30,8 +30,8 @@ "buffer": "^5.7.0" }, "devDependencies": { - "@types/react": "^18.0.0", - "@types/react-native": "^0.70.0", + "@types/react": "^19.0.0", + "@types/react-native": "^0.80.0", "typescript": "^5.0.0" }, "files": [ diff --git a/ble/protocol/Constants.ts b/ble/protocol/Constants.ts index 0bdd2e6..7c7dc6f 100644 --- a/ble/protocol/Constants.ts +++ b/ble/protocol/Constants.ts @@ -6,6 +6,7 @@ export const BLE_UUIDS = { WRITE_CHARACTERISTIC: '000002c5-0000-1000-8000-00805f9b34fb', READ_CHARACTERISTIC: '000002c6-0000-1000-8000-00805f9b34fb', REQUEST_MTU: 512, + SCREEN_SIZE: 360 } as const; export const FRAME_CONSTANTS = { @@ -14,7 +15,7 @@ export const FRAME_CONSTANTS = { MAX_DATA_SIZE: 496, HEADER_SIZE: 8, FOOTER_SIZE: 1, - FRAME_INTERVAL: 200, // package transfer idle interval in ms, set 35 ms for ble device have enough time to process data + FRAME_INTERVAL: 35, // package transfer idle interval in ms, set 35 ms for ble device have enough time to process data } as const; export type FRAME_HEAD = typeof FRAME_CONSTANTS.HEAD_DEVICE_TO_APP | typeof FRAME_CONSTANTS.HEAD_APP_TO_DEVICE;