forked from innoveit/react-native-ble-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
75 lines (62 loc) · 2.83 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
declare module 'react-native-ble-manager' {
export interface Peripheral {
id: string;
rssi: number;
name?: string;
advertising: AdvertisingData;
}
export interface AdvertisingData {
isConnectable?: boolean;
localName?: string;
manufacturerData?: any;
serviceUUIDs?: string[];
txPowerLevel?: number;
}
export interface StartOptions {
showAlert?: boolean
restoreIdentifierKey?: string
queueIdentifierKey?: string
forceLegacy?: boolean
}
export function start(options?: StartOptions): Promise<void>
export interface ScanOptions {
numberOfMatches?: number;
matchMode?: number;
scanMode?: number;
reportDelay?: number;
}
export function scan(serviceUUIDs: string[], seconds: number, allowDuplicates?: boolean, options?: ScanOptions): Promise<void>;
export function stopScan(): Promise<void>;
export function connect(peripheralID: string): Promise<void>
export function disconnect(peripheralID: string, force?:boolean): Promise<void>
export function checkState(): void;
export function startNotification(peripheralID: string, serviceUUID: string, characteristicUUID: string): Promise<void>
export function stopNotification(peripheralID: string, serviceUUID: string, characteristicUUID: string): Promise<void>
export function read(peripheralID: string, serviceUUID: string, characteristicUUID: string): Promise<any>
export function write(peripheralID: string, serviceUUID: string, characteristicUUID: string, data: any, maxByteSize?: number): Promise<void>
export function writeWithoutResponse(peripheralID: string, serviceUUID: string, characteristicUUID: string, data: any, maxByteSize?: number, queueSleepTime?: number): Promise<void>
export function readRSSI(peripheralID: string): Promise<void>
export function getConnectedPeripherals(serviceUUIDs: string[]): Promise<any[]>
export function getDiscoveredPeripherals(): Promise<any[]>
export function isPeripheralConnected(peripheralID: string, serviceUUIDs: string[]): Promise<boolean>
// [Android only API 21+]
export enum ConnectionPriority {
balanced = 0,
high = 1,
low = 2
}
export function requestConnectionPriority(peripheralID: string, connectionPriority: ConnectionPriority): Promise<void>
/// Android only
export function enableBluetooth(): Promise<void>
// [Android only]
export function refreshCache(peripheralID: string): Promise<void>
// [Android only API 21+]
export function requestMTU(peripheralID: string, mtu: number): Promise<void>
export function createBond(peripheralID: string): Promise<void>
export function removeBond(peripheralID: string): Promise<void>
export function getBondedPeripherals(): Promise<void>
export function removePeripheral(peripheralID: string): Promise<void>
export interface PeripheralInfo {
}
export function retrieveServices(peripheralID: string, serviceUUIDs?: string[]): Promise<PeripheralInfo>
}