expo-ble模块测试demo 联调BLE模块, 文件发送通过校验,去除多余的ANI文件缓存步骤

This commit is contained in:
Yudi Xiao
2025-12-11 18:33:28 +08:00
parent eab4d172e6
commit e3ee0f607c
7 changed files with 82 additions and 82 deletions

View File

@@ -1,7 +1,7 @@
import {BleManager, Device, Characteristic, BleError as PlxError, ScanOptions} from 'react-native-ble-plx';
import {Platform, PermissionsAndroid} from 'react-native';
import {BleManager, Device, Characteristic, ScanOptions} from 'react-native-ble-plx';
import {Platform} from 'react-native';
import {BleDevice, ConnectionState, BleError, ScanResult} from './types';
import {BLE_UUIDS} from "@/ble";
import {BLE_UUIDS} from "../protocol/Constants";
export class BleClient {
private static instance: BleClient;

View File

@@ -1,30 +1,30 @@
import { Device, BleError as PlxBleError } from 'react-native-ble-plx';
import {Device} from 'react-native-ble-plx';
export interface BleScanInfo {
rawData?: ArrayBuffer;
rssi: number;
isEnableConnect: boolean;
rawData?: ArrayBuffer;
rssi: number;
isEnableConnect: boolean;
}
export type BleDevice = Device & {
scanInfo?: BleScanInfo;
connected?: boolean;
scanInfo?: BleScanInfo;
connected?: boolean;
};
export enum ConnectionState {
DISCONNECTED = 'disconnected',
CONNECTING = 'connecting',
CONNECTED = 'connected',
DISCONNECTING = 'disconnecting',
DISCONNECTED = 'disconnected',
CONNECTING = 'connecting',
CONNECTED = 'connected',
DISCONNECTING = 'disconnecting',
}
export interface BleError {
errorCode: number;
message: string;
attErrorCode?: number | null;
iosErrorCode?: number | null;
androidErrorCode?: number | null;
reason?: string | null;
errorCode: number;
message: string;
attErrorCode?: number | null;
iosErrorCode?: number | null;
androidErrorCode?: number | null;
reason?: string | null;
}
export interface ScanResult {