forked from innoveit/react-native-ble-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
109 lines (70 loc) · 3.12 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
export interface advertisingAndroid {
localName: string;
isConnectable: boolean;
manufacturerData: {
bytes: ArrayBuffer;
data: string;
}
}
export interface advertisingIOS {
kCBAdvDataChannel: number;
kCBAdvDataIsConnectable: number;
kCBAdvDataLocalName: string;
kCBAdvDataManufacturerData: {
bytes: any;
data: string;
}
}
export interface PeripheralInfo {
id: string;
name: string;
rssi: number;
advertising: advertisingAndroid | advertisingIOS;
}
export interface DidUpdateStateArgs {
state: string;
}
export interface StartOptions {
showAlert?: boolean;
restoreIdentifierKey?: string;
forceLegacy?: boolean;
}
export function start(options?: StartOptions): Promise<void>;
export interface ScanningOptions {
numberOfMatches?: number;
matchMode?: number;
scanMode?: number;
}
export function scan(serviceUUIDs: string[], seconds: number, allowDuplicates: boolean, scanningOptions?: ScanningOptions): Promise<void>;
export function stopScan(): Promise<void>;
export function connect(peripheralId: string): Promise<void>;
export function disconnect(peripheralId: string): Promise<void>;
// Android only
export function enableBluetooth(): Promise<void>;
// Android only
export function enableBluetoothAsAdmin(): Promise<void>;
// Android only
export function disableBluetoothAsAdmin(): 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<ArrayBuffer>;
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<string>;
// Android only (API 21+)
export function requestConnectionPriority(peripheralId: string, connectionPriority: 0 | 1 | 2): Promise<boolean>;
// Android only (API 21+)
export function requestMTU(peripheralId: string, mtu: number): Promise<number>;
// ServiceUUIDS: iOS only
export function retrieveServices(peripheralId: string, serviceUUIDS?: string[]): Promise<PeripheralInfo>;
export function refreshCache(peripheralId: string): Promise<PeripheralInfo>;
export function getConnectedPeripherals(serviceUUIDs: string[]): Promise<PeripheralInfo[]>;
export function createBond(peripheralId: string): Promise<void>;
export function removeBond(peripheralId: string): Promise<void>;
// Android Only
export function getBondedPeripherals(): Promise<PeripheralInfo[]>;
export function getDiscoveredPeripherals(): Promise<PeripheralInfo[]>;
//Android only
export function removePeripheral(peripheralId: string): Promise<void>
export function isPeripheralConnected(peripheralId: string, serviceUUIDS?: string[]): Promise<boolean>