forked from innoveit/react-native-ble-manager
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.d.ts
128 lines (115 loc) · 3.33 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
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>;
/// Android only
export function startNotificationUseBuffer(
peripheralID: string,
serviceUUID: string,
characteristicUUID: string,
buffer: number
): 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<Peripheral[]>;
export function getDiscoveredPeripherals(): Promise<Peripheral[]>;
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,
peripheralPin?: string
): Promise<void>;
export function removeBond(peripheralID: string): Promise<void>;
export function getBondedPeripherals(): Promise<Peripheral[]>;
export function removePeripheral(peripheralID: string): Promise<void>;
export interface PeripheralInfo {}
export function retrieveServices(
peripheralID: string,
serviceUUIDs?: string[]
): Promise<PeripheralInfo>;
}