forked from yudi_xiao/expo-ble-app-demo
expo-ble模块测试demo 增加图片缩放处理
This commit is contained in:
parent
07a66f3923
commit
b6fc903105
|
|
@ -437,7 +437,10 @@ export const useBleExplorer = () => {
|
||||||
|
|
||||||
if (!isJpeg) {
|
if (!isJpeg) {
|
||||||
console.debug(`Converting image to JPEG...`);
|
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 imageRef = await context.renderAsync();
|
||||||
const result = await imageRef.saveAsync({
|
const result = await imageRef.saveAsync({
|
||||||
compress: 1,
|
compress: 1,
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,8 @@
|
||||||
"buffer": "^5.7.0"
|
"buffer": "^5.7.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/react": "^18.0.0",
|
"@types/react": "^19.0.0",
|
||||||
"@types/react-native": "^0.70.0",
|
"@types/react-native": "^0.80.0",
|
||||||
"typescript": "^5.0.0"
|
"typescript": "^5.0.0"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ export const BLE_UUIDS = {
|
||||||
WRITE_CHARACTERISTIC: '000002c5-0000-1000-8000-00805f9b34fb',
|
WRITE_CHARACTERISTIC: '000002c5-0000-1000-8000-00805f9b34fb',
|
||||||
READ_CHARACTERISTIC: '000002c6-0000-1000-8000-00805f9b34fb',
|
READ_CHARACTERISTIC: '000002c6-0000-1000-8000-00805f9b34fb',
|
||||||
REQUEST_MTU: 512,
|
REQUEST_MTU: 512,
|
||||||
|
SCREEN_SIZE: 360
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export const FRAME_CONSTANTS = {
|
export const FRAME_CONSTANTS = {
|
||||||
|
|
@ -14,7 +15,7 @@ export const FRAME_CONSTANTS = {
|
||||||
MAX_DATA_SIZE: 496,
|
MAX_DATA_SIZE: 496,
|
||||||
HEADER_SIZE: 8,
|
HEADER_SIZE: 8,
|
||||||
FOOTER_SIZE: 1,
|
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;
|
} as const;
|
||||||
|
|
||||||
export type FRAME_HEAD = typeof FRAME_CONSTANTS.HEAD_DEVICE_TO_APP | typeof FRAME_CONSTANTS.HEAD_APP_TO_DEVICE;
|
export type FRAME_HEAD = typeof FRAME_CONSTANTS.HEAD_DEVICE_TO_APP | typeof FRAME_CONSTANTS.HEAD_APP_TO_DEVICE;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue