react-native-ble-nitro
Version:
High-performance React Native BLE library built on Nitro Modules - drop-in replacement for react-native-ble-plx
60 lines (59 loc) • 1.95 kB
TypeScript
import { BleErrorCode, BleATTErrorCode, BleIOSErrorCode, BleAndroidErrorCode } from '../specs/types';
import type { NativeBleError, BleErrorCodeMessageMapping } from '../specs/types';
/**
* Default error messages for BLE error codes
* Maintains compatibility with react-native-ble-plx error messages
*/
declare const BleErrorCodeMessage: BleErrorCodeMessageMapping;
/**
* BleError class that maintains 100% compatibility with react-native-ble-plx
* Contains additional properties for platform-independent error handling
*/
export declare class BleError extends Error {
/**
* Platform independent error code
*/
readonly errorCode: BleErrorCode;
/**
* Platform independent error code related to ATT errors
*/
readonly attErrorCode: BleATTErrorCode | null;
/**
* iOS specific error code (if not an ATT error)
*/
readonly iosErrorCode: BleIOSErrorCode | null;
/**
* Android specific error code (if not an ATT error)
*/
readonly androidErrorCode: BleAndroidErrorCode | null;
/**
* Platform specific error message
*/
readonly reason: string | null;
/**
* Device ID associated with error (if applicable)
*/
readonly deviceID?: string;
/**
* Service UUID associated with error (if applicable)
*/
readonly serviceUUID?: string;
/**
* Characteristic UUID associated with error (if applicable)
*/
readonly characteristicUUID?: string;
/**
* Descriptor UUID associated with error (if applicable)
*/
readonly descriptorUUID?: string;
/**
* Internal error message for debugging
*/
readonly internalMessage?: string;
constructor(nativeBleError: NativeBleError | string, errorMessageMapping?: BleErrorCodeMessageMapping);
/**
* Returns a string representation of the error with all relevant information
*/
toString(): string;
}
export { BleErrorCodeMessage };