forked from MacKentoch/react-native-beacons-manager
-
Notifications
You must be signed in to change notification settings - Fork 1
/
module.types.js
169 lines (145 loc) · 4.82 KB
/
module.types.js
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
// @flow
export type BeaconRegion = {
identifier: string,
uuid: string,
minor?: number,
major?: number,
proximity?: string,
rssi?: number,
// distance:
distance?: number, // android
accuracy?: number, // iOS
};
// iOS only
export type AuthorizationStatus =
| 'authorizedAlways'
| 'authorizedWhenInUse'
| 'denied'
| 'notDetermined'
| 'restricted';
// iOS only
type GetAuthorizationCallback = (status: AuthorizationStatus) => void;
// android only
export const PARSER_IBEACON: string =
'm:0-3=4c000215,i:4-19,i:20-21,i:22-23,p:24-24';
export const PARSER_ESTIMOTE: string =
'm:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24';
export const PARSER_ALTBEACON: string =
'm:2-3=beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25';
export const PARSER_EDDYSTONE_TLM: string =
'x,s:0-1=feaa,m:2-2=20,d:3-3,d:4-5,d:6-7,d:8-11,d:12-15';
export const PARSER_EDDYSTONE_UID: string =
's:0-1=feaa,m:2-2=00,p:3-3:-41,i:4-13,i:14-19';
export const PARSER_EDDYSTONE_URL: string =
's:0-1=feaa,m:2-2=10,p:3-3:-41,i:4-20v';
// android only
export const transmissionSupport: Array<string> = [
'SUPPORTED',
'NOT_SUPPORTED_MIN_SDK',
'NOT_SUPPORTED_BLE',
'DEPRECATED_NOT_SUPPORTED_MULTIPLE_ADVERTISEMENTS',
'NOT_SUPPORTED_CANNOT_GET_ADVERTISER',
'NOT_SUPPORTED_CANNOT_GET_ADVERTISER_MULTIPLE_ADVERTISEMENTS',
];
export type Parser = string | number;
export type BeaconsManagerIOS = {
// specific to iOS:
requestAlwaysAuthorization: () => void,
requestWhenInUseAuthorization: () => void,
allowsBackgroundLocationUpdates: (allow: boolean) => void,
getAuthorizationStatus: (cb: GetAuthorizationCallback) => void,
getMonitoredRegions: (value?: any) => void,
startUpdatingLocation: () => void,
stopUpdatingLocation: () => void,
shouldDropEmptyRanges: (drop: boolean) => void,
// common with android:
startMonitoringForRegion: (region: BeaconRegion) => void,
startRangingBeaconsInRegion: (region: BeaconRegion) => void,
stopMonitoringForRegion: (region: BeaconRegion) => void,
stopRangingBeaconsInRegion: (region: BeaconRegion) => void,
requestStateForRegion: (region: BeaconRegion) => void,
};
export type BeaconsManagerANDROID = {
// specific to android:
setHardwareEqualityEnforced: (flag: boolean) => void,
addParser: (parser: Parser, resolve: () => any, reject: () => any) => void,
addParsersListToDetection: (
parsers: Array<Parser>,
resolve: () => any,
reject: () => any,
) => void,
removeParser: (parser: Parser, resolve: () => any, reject: () => any) => void,
removeParsersListToDetection: (
parsers: Array<Parser>,
resolve: () => any,
reject: () => any,
) => void,
detectIBeacons: () => Promise<any>,
addIBeaconsDetection: () => Promise<any>,
removeIBeaconsDetection: () => Promise<any>,
detectAltBeacons: () => Promise<any>,
addAltBeaconsDetection: () => Promise<any>,
removeAltBeaconsDetection: () => Promise<any>,
detectAltBeacons: () => Promise<any>,
addAltBeaconsDetection: () => Promise<any>,
removeAltBeaconsDetection: () => Promise<any>,
detectEstimotes: () => Promise<any>,
addEstimotesDetection: () => Promise<any>,
removeEstimotesDetection: () => Promise<any>,
detectEddystoneUID: () => Promise<any>,
addEddystoneUIDDetection: () => Promise<any>,
removeEddystoneUIDDetection: () => Promise<any>,
detectEddystoneTLM: () => Promise<any>,
addEddystoneTLMDetection: () => Promise<any>,
removeEddystoneTLMDetection: () => Promise<any>,
detectEddystoneURL: () => Promise<any>,
addEddystoneURLDetection: () => Promise<any>,
removeEddystoneURLDetection: () => Promise<any>,
detectCustomBeaconLayout: () => Promise<any>,
addCustomBeaconLayoutDetection: () => Promise<any>,
removeCustomBeaconLayoutDetection: () => Promise<any>,
setBackgroundScanPeriod: (period: number) => void,
setBackgroundBetweenScanPeriod: (period: number) => void,
setForegroundScanPeriod: (period: number) => void,
setRssiFilter: (filterType: number, avgModifier: number) => void,
getRangedRegions: (value?: any) => void,
ARMA_RSSI_FILTER: string,
RUNNING_AVG_RSSI_FILTER: string,
getMonitoredRegions: (value?: any) => void,
checkTransmissionSupported: (status: any) => any,
// common with iOS:
startMonitoring: (
regionId: string,
uuid: string,
minor?: number,
major?: number,
resolve: () => any,
reject: () => any,
) => void,
startRanging: (
regionId: string,
uuid?: string,
resolve: () => any,
reject: () => any,
) => void,
stopMonitoring: (
regionId: string,
uuid: string,
minor?: number,
major?: number,
resolve: () => any,
reject: () => any,
) => void,
stopRanging: (
regionId: string,
uuid?: string,
resolve: () => any,
reject: () => any,
) => void,
requestStateForRegion: (
regionId: string,
uuid?: string,
minor?: number,
major?: number,
) => void,
};