react-native-ble-nitro 1.0.0-beta.2 → 1.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app.plugin.cjs +1 -0
- package/lib/commonjs/BleManagerCompatFactory.d.ts +56 -0
- package/lib/commonjs/BleManagerCompatFactory.d.ts.map +1 -0
- package/lib/commonjs/BleManagerCompatFactory.js +201 -0
- package/lib/commonjs/BleManagerCompatFactory.js.map +1 -0
- package/lib/commonjs/BleManagerFactory.d.ts +31 -0
- package/lib/commonjs/BleManagerFactory.d.ts.map +1 -0
- package/lib/commonjs/BleManagerFactory.js +81 -0
- package/lib/commonjs/BleManagerFactory.js.map +1 -0
- package/lib/commonjs/compatibility/constants.d.ts +50 -0
- package/lib/commonjs/compatibility/constants.d.ts.map +1 -0
- package/lib/commonjs/compatibility/constants.js +58 -0
- package/lib/commonjs/compatibility/constants.js.map +1 -0
- package/lib/commonjs/compatibility/deviceWrapper.d.ts +100 -0
- package/lib/commonjs/compatibility/deviceWrapper.d.ts.map +1 -0
- package/lib/commonjs/compatibility/deviceWrapper.js +268 -0
- package/lib/commonjs/compatibility/deviceWrapper.js.map +1 -0
- package/lib/commonjs/compatibility/enums.d.ts +39 -0
- package/lib/commonjs/compatibility/enums.d.ts.map +1 -0
- package/lib/commonjs/compatibility/enums.js +179 -0
- package/lib/commonjs/compatibility/enums.js.map +1 -0
- package/lib/commonjs/compatibility/index.d.ts +13 -0
- package/lib/commonjs/compatibility/index.d.ts.map +1 -0
- package/lib/commonjs/compatibility/index.js +41 -0
- package/lib/commonjs/compatibility/index.js.map +1 -0
- package/lib/commonjs/compatibility/serviceData.d.ts +52 -0
- package/lib/commonjs/compatibility/serviceData.d.ts.map +1 -0
- package/lib/commonjs/compatibility/serviceData.js +80 -0
- package/lib/commonjs/compatibility/serviceData.js.map +1 -0
- package/lib/commonjs/errors/BleError.d.ts +60 -0
- package/lib/commonjs/errors/BleError.d.ts.map +1 -0
- package/lib/commonjs/errors/BleError.js +125 -0
- package/lib/commonjs/errors/BleError.js.map +1 -0
- package/lib/commonjs/index.d.ts +11 -0
- package/lib/commonjs/index.d.ts.map +1 -0
- package/lib/commonjs/index.js +42 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/specs/BleManager.nitro.d.ts +45 -0
- package/lib/commonjs/specs/BleManager.nitro.d.ts.map +1 -0
- package/lib/commonjs/specs/BleManager.nitro.js +3 -0
- package/lib/commonjs/specs/BleManager.nitro.js.map +1 -0
- package/lib/commonjs/specs/Characteristic.nitro.d.ts +27 -0
- package/lib/commonjs/specs/Characteristic.nitro.d.ts.map +1 -0
- package/lib/commonjs/specs/Characteristic.nitro.js +3 -0
- package/lib/commonjs/specs/Characteristic.nitro.js.map +1 -0
- package/lib/commonjs/specs/Descriptor.nitro.d.ts +18 -0
- package/lib/commonjs/specs/Descriptor.nitro.d.ts.map +1 -0
- package/lib/commonjs/specs/Descriptor.nitro.js +3 -0
- package/lib/commonjs/specs/Descriptor.nitro.js.map +1 -0
- package/lib/commonjs/specs/Device.nitro.d.ts +38 -0
- package/lib/commonjs/specs/Device.nitro.d.ts.map +1 -0
- package/lib/commonjs/specs/Device.nitro.js +3 -0
- package/lib/commonjs/specs/Device.nitro.js.map +1 -0
- package/lib/commonjs/specs/Service.nitro.d.ts +20 -0
- package/lib/commonjs/specs/Service.nitro.d.ts.map +1 -0
- package/lib/commonjs/specs/Service.nitro.js +3 -0
- package/lib/commonjs/specs/Service.nitro.js.map +1 -0
- package/lib/commonjs/specs/types.d.ts +229 -0
- package/lib/commonjs/specs/types.d.ts.map +1 -0
- package/lib/commonjs/specs/types.js +150 -0
- package/lib/commonjs/specs/types.js.map +1 -0
- package/lib/commonjs/utils/base64.d.ts +26 -0
- package/lib/commonjs/utils/base64.d.ts.map +1 -0
- package/lib/commonjs/utils/base64.js +88 -0
- package/lib/commonjs/utils/base64.js.map +1 -0
- package/lib/commonjs/utils/index.d.ts +3 -0
- package/lib/commonjs/utils/index.d.ts.map +1 -0
- package/lib/commonjs/utils/index.js +19 -0
- package/lib/commonjs/utils/index.js.map +1 -0
- package/lib/commonjs/utils/uuid.d.ts +10 -0
- package/lib/commonjs/utils/uuid.d.ts.map +1 -0
- package/lib/commonjs/utils/uuid.js +41 -0
- package/lib/commonjs/utils/uuid.js.map +1 -0
- package/package.json +9 -4
- package/plugin/build/index.d.ts +2 -2
- package/plugin/build/index.js +1 -1
- package/plugin/build/withBleNitro.d.ts +1 -1
- package/plugin/build/withBleNitro.js +1 -1
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
export type Base64 = string;
|
|
2
|
+
export type UUID = string;
|
|
3
|
+
export type Identifier = number;
|
|
4
|
+
export type DeviceId = string;
|
|
5
|
+
export type TransactionId = string;
|
|
6
|
+
export declare enum RefreshGattMoment {
|
|
7
|
+
OnConnected = 0
|
|
8
|
+
}
|
|
9
|
+
export declare enum CharacteristicSubscriptionType {
|
|
10
|
+
Notification = 0,
|
|
11
|
+
Indication = 1
|
|
12
|
+
}
|
|
13
|
+
export interface ServiceDataEntry {
|
|
14
|
+
uuid: UUID;
|
|
15
|
+
data: Base64;
|
|
16
|
+
}
|
|
17
|
+
export declare enum State {
|
|
18
|
+
Unknown = 0,
|
|
19
|
+
Resetting = 1,
|
|
20
|
+
Unsupported = 2,
|
|
21
|
+
Unauthorized = 3,
|
|
22
|
+
PoweredOff = 4,
|
|
23
|
+
PoweredOn = 5
|
|
24
|
+
}
|
|
25
|
+
export declare enum LogLevel {
|
|
26
|
+
None = 0,
|
|
27
|
+
Verbose = 1,
|
|
28
|
+
Debug = 2,
|
|
29
|
+
Info = 3,
|
|
30
|
+
Warning = 4,
|
|
31
|
+
Error = 5
|
|
32
|
+
}
|
|
33
|
+
export declare enum ScanMode {
|
|
34
|
+
Opportunistic = -1,
|
|
35
|
+
LowPower = 0,
|
|
36
|
+
Balanced = 1,
|
|
37
|
+
LowLatency = 2
|
|
38
|
+
}
|
|
39
|
+
export declare enum ScanCallbackType {
|
|
40
|
+
AllMatches = 1,
|
|
41
|
+
FirstMatch = 2,
|
|
42
|
+
MatchLost = 4
|
|
43
|
+
}
|
|
44
|
+
export declare enum ConnectionPriority {
|
|
45
|
+
Balanced = 0,
|
|
46
|
+
High = 1,
|
|
47
|
+
LowPower = 2
|
|
48
|
+
}
|
|
49
|
+
export declare enum BleErrorCode {
|
|
50
|
+
UnknownError = 0,
|
|
51
|
+
BluetoothManagerDestroyed = 1,
|
|
52
|
+
OperationCancelled = 2,
|
|
53
|
+
OperationTimedOut = 3,
|
|
54
|
+
OperationStartFailed = 4,
|
|
55
|
+
InvalidIdentifiers = 5,
|
|
56
|
+
BluetoothUnsupported = 100,
|
|
57
|
+
BluetoothUnauthorized = 101,
|
|
58
|
+
BluetoothPoweredOff = 102,
|
|
59
|
+
BluetoothInUnknownState = 103,
|
|
60
|
+
BluetoothResetting = 104,
|
|
61
|
+
BluetoothStateChangeFailed = 105,
|
|
62
|
+
DeviceConnectionFailed = 200,
|
|
63
|
+
DeviceDisconnected = 201,
|
|
64
|
+
DeviceRSSIReadFailed = 202,
|
|
65
|
+
DeviceAlreadyConnected = 203,
|
|
66
|
+
DeviceNotFound = 204,
|
|
67
|
+
DeviceNotConnected = 205,
|
|
68
|
+
DeviceMTUChangeFailed = 206,
|
|
69
|
+
ServicesDiscoveryFailed = 300,
|
|
70
|
+
IncludedServicesDiscoveryFailed = 301,
|
|
71
|
+
ServiceNotFound = 302,
|
|
72
|
+
ServicesNotDiscovered = 303,
|
|
73
|
+
CharacteristicsDiscoveryFailed = 400,
|
|
74
|
+
CharacteristicWriteFailed = 401,
|
|
75
|
+
CharacteristicReadFailed = 402,
|
|
76
|
+
CharacteristicNotifyChangeFailed = 403,
|
|
77
|
+
CharacteristicNotFound = 404,
|
|
78
|
+
CharacteristicsNotDiscovered = 405,
|
|
79
|
+
CharacteristicInvalidDataFormat = 406,
|
|
80
|
+
DescriptorsDiscoveryFailed = 500,
|
|
81
|
+
DescriptorWriteFailed = 501,
|
|
82
|
+
DescriptorReadFailed = 502,
|
|
83
|
+
DescriptorNotFound = 503,
|
|
84
|
+
DescriptorsNotDiscovered = 504,
|
|
85
|
+
DescriptorInvalidDataFormat = 505,
|
|
86
|
+
DescriptorWriteNotAllowed = 506,
|
|
87
|
+
ScanStartFailed = 600,
|
|
88
|
+
LocationServicesDisabled = 601
|
|
89
|
+
}
|
|
90
|
+
export declare enum BleATTErrorCode {
|
|
91
|
+
Success = 0,
|
|
92
|
+
InvalidHandle = 1,
|
|
93
|
+
ReadNotPermitted = 2,
|
|
94
|
+
WriteNotPermitted = 3,
|
|
95
|
+
InvalidPdu = 4,
|
|
96
|
+
InsufficientAuthentication = 5,
|
|
97
|
+
RequestNotSupported = 6,
|
|
98
|
+
InvalidOffset = 7,
|
|
99
|
+
InsufficientAuthorization = 8,
|
|
100
|
+
PrepareQueueFull = 9,
|
|
101
|
+
AttributeNotFound = 10,
|
|
102
|
+
AttributeNotLong = 11,
|
|
103
|
+
InsufficientEncryptionKeySize = 12,
|
|
104
|
+
InvalidAttributeValueLength = 13,
|
|
105
|
+
UnlikelyError = 14,
|
|
106
|
+
InsufficientEncryption = 15,
|
|
107
|
+
UnsupportedGroupType = 16,
|
|
108
|
+
InsufficientResources = 17
|
|
109
|
+
}
|
|
110
|
+
export declare enum BleIOSErrorCode {
|
|
111
|
+
Unknown = 0,
|
|
112
|
+
InvalidParameters = 1,
|
|
113
|
+
InvalidHandle = 2,
|
|
114
|
+
NotConnected = 3,
|
|
115
|
+
OutOfSpace = 4,
|
|
116
|
+
OperationCancelled = 5,
|
|
117
|
+
ConnectionTimeout = 6,
|
|
118
|
+
PeripheralDisconnected = 7,
|
|
119
|
+
UuidNotAllowed = 8,
|
|
120
|
+
AlreadyAdvertising = 9,
|
|
121
|
+
ConnectionFailed = 10,
|
|
122
|
+
ConnectionLimitReached = 11,
|
|
123
|
+
UnknownDevice = 12
|
|
124
|
+
}
|
|
125
|
+
export declare enum BleAndroidErrorCode {
|
|
126
|
+
NoResources = 128,
|
|
127
|
+
InternalError = 129,
|
|
128
|
+
WrongState = 130,
|
|
129
|
+
DbFull = 131,
|
|
130
|
+
Busy = 132,
|
|
131
|
+
Error = 133,
|
|
132
|
+
CmdStarted = 134,
|
|
133
|
+
IllegalParameter = 135,
|
|
134
|
+
Pending = 136,
|
|
135
|
+
AuthFail = 137,
|
|
136
|
+
More = 138,
|
|
137
|
+
InvalidCfg = 139,
|
|
138
|
+
ServiceStarted = 140,
|
|
139
|
+
EncrypedNoMitm = 141,
|
|
140
|
+
NotEncrypted = 142,
|
|
141
|
+
Congested = 143
|
|
142
|
+
}
|
|
143
|
+
export interface ScanOptions {
|
|
144
|
+
allowDuplicates?: boolean;
|
|
145
|
+
scanMode?: ScanMode;
|
|
146
|
+
callbackType?: ScanCallbackType;
|
|
147
|
+
legacyScan?: boolean;
|
|
148
|
+
}
|
|
149
|
+
export interface ConnectionOptions {
|
|
150
|
+
autoConnect: boolean;
|
|
151
|
+
requestMTU: number;
|
|
152
|
+
timeout: number;
|
|
153
|
+
}
|
|
154
|
+
export interface BleManagerOptions {
|
|
155
|
+
restoreStateIdentifier?: string;
|
|
156
|
+
restoreStateFunction?: (restoredState: BleRestoredState | null) => void;
|
|
157
|
+
errorCodesToMessagesMapping?: BleErrorCodeMessageMapping;
|
|
158
|
+
}
|
|
159
|
+
export interface BleRestoredState {
|
|
160
|
+
connectedPeripherals: NativeDevice[];
|
|
161
|
+
}
|
|
162
|
+
export type BleErrorCodeMessageMapping = {
|
|
163
|
+
[key in BleErrorCode]: string;
|
|
164
|
+
};
|
|
165
|
+
export interface NativeDevice {
|
|
166
|
+
id: DeviceId;
|
|
167
|
+
name: string | null;
|
|
168
|
+
rssi: number | null;
|
|
169
|
+
mtu: number;
|
|
170
|
+
manufacturerData: Base64 | null;
|
|
171
|
+
rawScanRecord: Base64;
|
|
172
|
+
serviceData: ServiceDataEntry[] | null;
|
|
173
|
+
serviceUUIDs: UUID[] | null;
|
|
174
|
+
localName: string | null;
|
|
175
|
+
txPowerLevel: number | null;
|
|
176
|
+
solicitedServiceUUIDs: UUID[] | null;
|
|
177
|
+
isConnectable: boolean | null;
|
|
178
|
+
overflowServiceUUIDs: UUID[] | null;
|
|
179
|
+
}
|
|
180
|
+
export interface NativeService {
|
|
181
|
+
id: Identifier;
|
|
182
|
+
uuid: UUID;
|
|
183
|
+
deviceID: DeviceId;
|
|
184
|
+
isPrimary: boolean;
|
|
185
|
+
}
|
|
186
|
+
export interface NativeCharacteristic {
|
|
187
|
+
id: Identifier;
|
|
188
|
+
uuid: UUID;
|
|
189
|
+
serviceID: Identifier;
|
|
190
|
+
serviceUUID: UUID;
|
|
191
|
+
deviceID: DeviceId;
|
|
192
|
+
isReadable: boolean;
|
|
193
|
+
isWritableWithResponse: boolean;
|
|
194
|
+
isWritableWithoutResponse: boolean;
|
|
195
|
+
isNotifiable: boolean;
|
|
196
|
+
isNotifying: boolean;
|
|
197
|
+
isIndicatable: boolean;
|
|
198
|
+
value: Base64 | null;
|
|
199
|
+
}
|
|
200
|
+
export interface NativeDescriptor {
|
|
201
|
+
id: Identifier;
|
|
202
|
+
uuid: UUID;
|
|
203
|
+
characteristicID: Identifier;
|
|
204
|
+
characteristicUUID: UUID;
|
|
205
|
+
serviceID: Identifier;
|
|
206
|
+
serviceUUID: UUID;
|
|
207
|
+
deviceID: DeviceId;
|
|
208
|
+
value: Base64 | null;
|
|
209
|
+
}
|
|
210
|
+
export interface NativeBleError {
|
|
211
|
+
errorCode: BleErrorCode;
|
|
212
|
+
attErrorCode: BleATTErrorCode | null;
|
|
213
|
+
iosErrorCode: BleIOSErrorCode | null;
|
|
214
|
+
androidErrorCode: BleAndroidErrorCode | null;
|
|
215
|
+
reason: string | null;
|
|
216
|
+
deviceID?: string;
|
|
217
|
+
serviceUUID?: string;
|
|
218
|
+
characteristicUUID?: string;
|
|
219
|
+
descriptorUUID?: string;
|
|
220
|
+
internalMessage?: string;
|
|
221
|
+
}
|
|
222
|
+
export interface Subscription {
|
|
223
|
+
remove(): void;
|
|
224
|
+
}
|
|
225
|
+
export type StateListener = (newState: State) => void;
|
|
226
|
+
export type DeviceScanListener = (error: NativeBleError | null, scannedDevice: NativeDevice | null) => void;
|
|
227
|
+
export type DeviceDisconnectedListener = (error: NativeBleError | null, device: NativeDevice | null) => void;
|
|
228
|
+
export type CharacteristicMonitorListener = (error: NativeBleError | null, characteristic: NativeCharacteristic | null) => void;
|
|
229
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/specs/types.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC;AAC5B,MAAM,MAAM,IAAI,GAAG,MAAM,CAAC;AAC1B,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAChC,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAC9B,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AAEnC,oBAAY,iBAAiB;IAC3B,WAAW,IAAI;CAChB;AAED,oBAAY,8BAA8B;IACxC,YAAY,IAAI;IAChB,UAAU,IAAI;CACf;AAID,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAGD,oBAAY,KAAK;IACf,OAAO,IAAI;IACX,SAAS,IAAI;IACb,WAAW,IAAI;IACf,YAAY,IAAI;IAChB,UAAU,IAAI;IACd,SAAS,IAAI;CACd;AAED,oBAAY,QAAQ;IAClB,IAAI,IAAI;IACR,OAAO,IAAI;IACX,KAAK,IAAI;IACT,IAAI,IAAI;IACR,OAAO,IAAI;IACX,KAAK,IAAI;CACV;AAED,oBAAY,QAAQ;IAClB,aAAa,KAAK;IAClB,QAAQ,IAAI;IACZ,QAAQ,IAAI;IACZ,UAAU,IAAI;CACf;AAED,oBAAY,gBAAgB;IAC1B,UAAU,IAAI;IACd,UAAU,IAAI;IAC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-0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BleAndroidErrorCode = exports.BleIOSErrorCode = exports.BleATTErrorCode = exports.BleErrorCode = exports.ConnectionPriority = exports.ScanCallbackType = exports.ScanMode = exports.LogLevel = exports.State = exports.CharacteristicSubscriptionType = exports.RefreshGattMoment = void 0;
|
|
4
|
+
var RefreshGattMoment;
|
|
5
|
+
(function (RefreshGattMoment) {
|
|
6
|
+
RefreshGattMoment[RefreshGattMoment["OnConnected"] = 0] = "OnConnected";
|
|
7
|
+
})(RefreshGattMoment || (exports.RefreshGattMoment = RefreshGattMoment = {}));
|
|
8
|
+
var CharacteristicSubscriptionType;
|
|
9
|
+
(function (CharacteristicSubscriptionType) {
|
|
10
|
+
CharacteristicSubscriptionType[CharacteristicSubscriptionType["Notification"] = 0] = "Notification";
|
|
11
|
+
CharacteristicSubscriptionType[CharacteristicSubscriptionType["Indication"] = 1] = "Indication";
|
|
12
|
+
})(CharacteristicSubscriptionType || (exports.CharacteristicSubscriptionType = CharacteristicSubscriptionType = {}));
|
|
13
|
+
// Enums
|
|
14
|
+
var State;
|
|
15
|
+
(function (State) {
|
|
16
|
+
State[State["Unknown"] = 0] = "Unknown";
|
|
17
|
+
State[State["Resetting"] = 1] = "Resetting";
|
|
18
|
+
State[State["Unsupported"] = 2] = "Unsupported";
|
|
19
|
+
State[State["Unauthorized"] = 3] = "Unauthorized";
|
|
20
|
+
State[State["PoweredOff"] = 4] = "PoweredOff";
|
|
21
|
+
State[State["PoweredOn"] = 5] = "PoweredOn";
|
|
22
|
+
})(State || (exports.State = State = {}));
|
|
23
|
+
var LogLevel;
|
|
24
|
+
(function (LogLevel) {
|
|
25
|
+
LogLevel[LogLevel["None"] = 0] = "None";
|
|
26
|
+
LogLevel[LogLevel["Verbose"] = 1] = "Verbose";
|
|
27
|
+
LogLevel[LogLevel["Debug"] = 2] = "Debug";
|
|
28
|
+
LogLevel[LogLevel["Info"] = 3] = "Info";
|
|
29
|
+
LogLevel[LogLevel["Warning"] = 4] = "Warning";
|
|
30
|
+
LogLevel[LogLevel["Error"] = 5] = "Error";
|
|
31
|
+
})(LogLevel || (exports.LogLevel = LogLevel = {}));
|
|
32
|
+
var ScanMode;
|
|
33
|
+
(function (ScanMode) {
|
|
34
|
+
ScanMode[ScanMode["Opportunistic"] = -1] = "Opportunistic";
|
|
35
|
+
ScanMode[ScanMode["LowPower"] = 0] = "LowPower";
|
|
36
|
+
ScanMode[ScanMode["Balanced"] = 1] = "Balanced";
|
|
37
|
+
ScanMode[ScanMode["LowLatency"] = 2] = "LowLatency";
|
|
38
|
+
})(ScanMode || (exports.ScanMode = ScanMode = {}));
|
|
39
|
+
var ScanCallbackType;
|
|
40
|
+
(function (ScanCallbackType) {
|
|
41
|
+
ScanCallbackType[ScanCallbackType["AllMatches"] = 1] = "AllMatches";
|
|
42
|
+
ScanCallbackType[ScanCallbackType["FirstMatch"] = 2] = "FirstMatch";
|
|
43
|
+
ScanCallbackType[ScanCallbackType["MatchLost"] = 4] = "MatchLost";
|
|
44
|
+
})(ScanCallbackType || (exports.ScanCallbackType = ScanCallbackType = {}));
|
|
45
|
+
var ConnectionPriority;
|
|
46
|
+
(function (ConnectionPriority) {
|
|
47
|
+
ConnectionPriority[ConnectionPriority["Balanced"] = 0] = "Balanced";
|
|
48
|
+
ConnectionPriority[ConnectionPriority["High"] = 1] = "High";
|
|
49
|
+
ConnectionPriority[ConnectionPriority["LowPower"] = 2] = "LowPower";
|
|
50
|
+
})(ConnectionPriority || (exports.ConnectionPriority = ConnectionPriority = {}));
|
|
51
|
+
// Complex error code enums
|
|
52
|
+
var BleErrorCode;
|
|
53
|
+
(function (BleErrorCode) {
|
|
54
|
+
BleErrorCode[BleErrorCode["UnknownError"] = 0] = "UnknownError";
|
|
55
|
+
BleErrorCode[BleErrorCode["BluetoothManagerDestroyed"] = 1] = "BluetoothManagerDestroyed";
|
|
56
|
+
BleErrorCode[BleErrorCode["OperationCancelled"] = 2] = "OperationCancelled";
|
|
57
|
+
BleErrorCode[BleErrorCode["OperationTimedOut"] = 3] = "OperationTimedOut";
|
|
58
|
+
BleErrorCode[BleErrorCode["OperationStartFailed"] = 4] = "OperationStartFailed";
|
|
59
|
+
BleErrorCode[BleErrorCode["InvalidIdentifiers"] = 5] = "InvalidIdentifiers";
|
|
60
|
+
BleErrorCode[BleErrorCode["BluetoothUnsupported"] = 100] = "BluetoothUnsupported";
|
|
61
|
+
BleErrorCode[BleErrorCode["BluetoothUnauthorized"] = 101] = "BluetoothUnauthorized";
|
|
62
|
+
BleErrorCode[BleErrorCode["BluetoothPoweredOff"] = 102] = "BluetoothPoweredOff";
|
|
63
|
+
BleErrorCode[BleErrorCode["BluetoothInUnknownState"] = 103] = "BluetoothInUnknownState";
|
|
64
|
+
BleErrorCode[BleErrorCode["BluetoothResetting"] = 104] = "BluetoothResetting";
|
|
65
|
+
BleErrorCode[BleErrorCode["BluetoothStateChangeFailed"] = 105] = "BluetoothStateChangeFailed";
|
|
66
|
+
BleErrorCode[BleErrorCode["DeviceConnectionFailed"] = 200] = "DeviceConnectionFailed";
|
|
67
|
+
BleErrorCode[BleErrorCode["DeviceDisconnected"] = 201] = "DeviceDisconnected";
|
|
68
|
+
BleErrorCode[BleErrorCode["DeviceRSSIReadFailed"] = 202] = "DeviceRSSIReadFailed";
|
|
69
|
+
BleErrorCode[BleErrorCode["DeviceAlreadyConnected"] = 203] = "DeviceAlreadyConnected";
|
|
70
|
+
BleErrorCode[BleErrorCode["DeviceNotFound"] = 204] = "DeviceNotFound";
|
|
71
|
+
BleErrorCode[BleErrorCode["DeviceNotConnected"] = 205] = "DeviceNotConnected";
|
|
72
|
+
BleErrorCode[BleErrorCode["DeviceMTUChangeFailed"] = 206] = "DeviceMTUChangeFailed";
|
|
73
|
+
BleErrorCode[BleErrorCode["ServicesDiscoveryFailed"] = 300] = "ServicesDiscoveryFailed";
|
|
74
|
+
BleErrorCode[BleErrorCode["IncludedServicesDiscoveryFailed"] = 301] = "IncludedServicesDiscoveryFailed";
|
|
75
|
+
BleErrorCode[BleErrorCode["ServiceNotFound"] = 302] = "ServiceNotFound";
|
|
76
|
+
BleErrorCode[BleErrorCode["ServicesNotDiscovered"] = 303] = "ServicesNotDiscovered";
|
|
77
|
+
BleErrorCode[BleErrorCode["CharacteristicsDiscoveryFailed"] = 400] = "CharacteristicsDiscoveryFailed";
|
|
78
|
+
BleErrorCode[BleErrorCode["CharacteristicWriteFailed"] = 401] = "CharacteristicWriteFailed";
|
|
79
|
+
BleErrorCode[BleErrorCode["CharacteristicReadFailed"] = 402] = "CharacteristicReadFailed";
|
|
80
|
+
BleErrorCode[BleErrorCode["CharacteristicNotifyChangeFailed"] = 403] = "CharacteristicNotifyChangeFailed";
|
|
81
|
+
BleErrorCode[BleErrorCode["CharacteristicNotFound"] = 404] = "CharacteristicNotFound";
|
|
82
|
+
BleErrorCode[BleErrorCode["CharacteristicsNotDiscovered"] = 405] = "CharacteristicsNotDiscovered";
|
|
83
|
+
BleErrorCode[BleErrorCode["CharacteristicInvalidDataFormat"] = 406] = "CharacteristicInvalidDataFormat";
|
|
84
|
+
BleErrorCode[BleErrorCode["DescriptorsDiscoveryFailed"] = 500] = "DescriptorsDiscoveryFailed";
|
|
85
|
+
BleErrorCode[BleErrorCode["DescriptorWriteFailed"] = 501] = "DescriptorWriteFailed";
|
|
86
|
+
BleErrorCode[BleErrorCode["DescriptorReadFailed"] = 502] = "DescriptorReadFailed";
|
|
87
|
+
BleErrorCode[BleErrorCode["DescriptorNotFound"] = 503] = "DescriptorNotFound";
|
|
88
|
+
BleErrorCode[BleErrorCode["DescriptorsNotDiscovered"] = 504] = "DescriptorsNotDiscovered";
|
|
89
|
+
BleErrorCode[BleErrorCode["DescriptorInvalidDataFormat"] = 505] = "DescriptorInvalidDataFormat";
|
|
90
|
+
BleErrorCode[BleErrorCode["DescriptorWriteNotAllowed"] = 506] = "DescriptorWriteNotAllowed";
|
|
91
|
+
BleErrorCode[BleErrorCode["ScanStartFailed"] = 600] = "ScanStartFailed";
|
|
92
|
+
BleErrorCode[BleErrorCode["LocationServicesDisabled"] = 601] = "LocationServicesDisabled";
|
|
93
|
+
})(BleErrorCode || (exports.BleErrorCode = BleErrorCode = {}));
|
|
94
|
+
var BleATTErrorCode;
|
|
95
|
+
(function (BleATTErrorCode) {
|
|
96
|
+
BleATTErrorCode[BleATTErrorCode["Success"] = 0] = "Success";
|
|
97
|
+
BleATTErrorCode[BleATTErrorCode["InvalidHandle"] = 1] = "InvalidHandle";
|
|
98
|
+
BleATTErrorCode[BleATTErrorCode["ReadNotPermitted"] = 2] = "ReadNotPermitted";
|
|
99
|
+
BleATTErrorCode[BleATTErrorCode["WriteNotPermitted"] = 3] = "WriteNotPermitted";
|
|
100
|
+
BleATTErrorCode[BleATTErrorCode["InvalidPdu"] = 4] = "InvalidPdu";
|
|
101
|
+
BleATTErrorCode[BleATTErrorCode["InsufficientAuthentication"] = 5] = "InsufficientAuthentication";
|
|
102
|
+
BleATTErrorCode[BleATTErrorCode["RequestNotSupported"] = 6] = "RequestNotSupported";
|
|
103
|
+
BleATTErrorCode[BleATTErrorCode["InvalidOffset"] = 7] = "InvalidOffset";
|
|
104
|
+
BleATTErrorCode[BleATTErrorCode["InsufficientAuthorization"] = 8] = "InsufficientAuthorization";
|
|
105
|
+
BleATTErrorCode[BleATTErrorCode["PrepareQueueFull"] = 9] = "PrepareQueueFull";
|
|
106
|
+
BleATTErrorCode[BleATTErrorCode["AttributeNotFound"] = 10] = "AttributeNotFound";
|
|
107
|
+
BleATTErrorCode[BleATTErrorCode["AttributeNotLong"] = 11] = "AttributeNotLong";
|
|
108
|
+
BleATTErrorCode[BleATTErrorCode["InsufficientEncryptionKeySize"] = 12] = "InsufficientEncryptionKeySize";
|
|
109
|
+
BleATTErrorCode[BleATTErrorCode["InvalidAttributeValueLength"] = 13] = "InvalidAttributeValueLength";
|
|
110
|
+
BleATTErrorCode[BleATTErrorCode["UnlikelyError"] = 14] = "UnlikelyError";
|
|
111
|
+
BleATTErrorCode[BleATTErrorCode["InsufficientEncryption"] = 15] = "InsufficientEncryption";
|
|
112
|
+
BleATTErrorCode[BleATTErrorCode["UnsupportedGroupType"] = 16] = "UnsupportedGroupType";
|
|
113
|
+
BleATTErrorCode[BleATTErrorCode["InsufficientResources"] = 17] = "InsufficientResources";
|
|
114
|
+
})(BleATTErrorCode || (exports.BleATTErrorCode = BleATTErrorCode = {}));
|
|
115
|
+
var BleIOSErrorCode;
|
|
116
|
+
(function (BleIOSErrorCode) {
|
|
117
|
+
BleIOSErrorCode[BleIOSErrorCode["Unknown"] = 0] = "Unknown";
|
|
118
|
+
BleIOSErrorCode[BleIOSErrorCode["InvalidParameters"] = 1] = "InvalidParameters";
|
|
119
|
+
BleIOSErrorCode[BleIOSErrorCode["InvalidHandle"] = 2] = "InvalidHandle";
|
|
120
|
+
BleIOSErrorCode[BleIOSErrorCode["NotConnected"] = 3] = "NotConnected";
|
|
121
|
+
BleIOSErrorCode[BleIOSErrorCode["OutOfSpace"] = 4] = "OutOfSpace";
|
|
122
|
+
BleIOSErrorCode[BleIOSErrorCode["OperationCancelled"] = 5] = "OperationCancelled";
|
|
123
|
+
BleIOSErrorCode[BleIOSErrorCode["ConnectionTimeout"] = 6] = "ConnectionTimeout";
|
|
124
|
+
BleIOSErrorCode[BleIOSErrorCode["PeripheralDisconnected"] = 7] = "PeripheralDisconnected";
|
|
125
|
+
BleIOSErrorCode[BleIOSErrorCode["UuidNotAllowed"] = 8] = "UuidNotAllowed";
|
|
126
|
+
BleIOSErrorCode[BleIOSErrorCode["AlreadyAdvertising"] = 9] = "AlreadyAdvertising";
|
|
127
|
+
BleIOSErrorCode[BleIOSErrorCode["ConnectionFailed"] = 10] = "ConnectionFailed";
|
|
128
|
+
BleIOSErrorCode[BleIOSErrorCode["ConnectionLimitReached"] = 11] = "ConnectionLimitReached";
|
|
129
|
+
BleIOSErrorCode[BleIOSErrorCode["UnknownDevice"] = 12] = "UnknownDevice";
|
|
130
|
+
})(BleIOSErrorCode || (exports.BleIOSErrorCode = BleIOSErrorCode = {}));
|
|
131
|
+
var BleAndroidErrorCode;
|
|
132
|
+
(function (BleAndroidErrorCode) {
|
|
133
|
+
BleAndroidErrorCode[BleAndroidErrorCode["NoResources"] = 128] = "NoResources";
|
|
134
|
+
BleAndroidErrorCode[BleAndroidErrorCode["InternalError"] = 129] = "InternalError";
|
|
135
|
+
BleAndroidErrorCode[BleAndroidErrorCode["WrongState"] = 130] = "WrongState";
|
|
136
|
+
BleAndroidErrorCode[BleAndroidErrorCode["DbFull"] = 131] = "DbFull";
|
|
137
|
+
BleAndroidErrorCode[BleAndroidErrorCode["Busy"] = 132] = "Busy";
|
|
138
|
+
BleAndroidErrorCode[BleAndroidErrorCode["Error"] = 133] = "Error";
|
|
139
|
+
BleAndroidErrorCode[BleAndroidErrorCode["CmdStarted"] = 134] = "CmdStarted";
|
|
140
|
+
BleAndroidErrorCode[BleAndroidErrorCode["IllegalParameter"] = 135] = "IllegalParameter";
|
|
141
|
+
BleAndroidErrorCode[BleAndroidErrorCode["Pending"] = 136] = "Pending";
|
|
142
|
+
BleAndroidErrorCode[BleAndroidErrorCode["AuthFail"] = 137] = "AuthFail";
|
|
143
|
+
BleAndroidErrorCode[BleAndroidErrorCode["More"] = 138] = "More";
|
|
144
|
+
BleAndroidErrorCode[BleAndroidErrorCode["InvalidCfg"] = 139] = "InvalidCfg";
|
|
145
|
+
BleAndroidErrorCode[BleAndroidErrorCode["ServiceStarted"] = 140] = "ServiceStarted";
|
|
146
|
+
BleAndroidErrorCode[BleAndroidErrorCode["EncrypedNoMitm"] = 141] = "EncrypedNoMitm";
|
|
147
|
+
BleAndroidErrorCode[BleAndroidErrorCode["NotEncrypted"] = 142] = "NotEncrypted";
|
|
148
|
+
BleAndroidErrorCode[BleAndroidErrorCode["Congested"] = 143] = "Congested";
|
|
149
|
+
})(BleAndroidErrorCode || (exports.BleAndroidErrorCode = BleAndroidErrorCode = {}));
|
|
150
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/specs/types.ts"],"names":[],"mappings":";;;AAOA,IAAY,iBAEX;AAFD,WAAY,iBAAiB;IAC3B,uEAAe,CAAA;AACjB,CAAC,EAFW,iBAAiB,iCAAjB,iBAAiB,QAE5B;AAED,IAAY,8BAGX;AAHD,WAAY,8BAA8B;IACxC,mGAAgB,CAAA;IAChB,+FAAc,CAAA;AAChB,CAAC,EAHW,8BAA8B,8CAA9B,8BAA8B,QAGzC;AASD,QAAQ;AACR,IAAY,KAOX;AAPD,WAAY,KAAK;IACf,uCAAW,CAAA;IACX,2CAAa,CAAA;IACb,+CAAe,CAAA;IACf,iDAAgB,CAAA;IAChB,6CAAc,CAAA;IACd,2CAAa,CAAA;AACf,CAAC,EAPW,KAAK,qBAAL,KAAK,QAOhB;AAED,IAAY,QAOX;AAPD,WAAY,QAAQ;IAClB,uCAAQ,CAAA;IACR,6CAAW,CAAA;IACX,yCAAS,CAAA;IACT,uCAAQ,CAAA;IACR,6CAAW,CAAA;IACX,yCAAS,CAAA;AACX,CAAC,EAPW,QAAQ,wBAAR,QAAQ,QAOnB;AAED,IAAY,QAKX;AALD,WAAY,QAAQ;IAClB,0DAAkB,CAAA;IAClB,+CAAY,CAAA;IACZ,+CAAY,CAAA;IACZ,mDAAc,CAAA;AAChB,CAAC,EALW,QAAQ,wBAAR,QAAQ,QAKnB;AAED,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,mEAAc,CAAA;IACd,mEAAc,CAAA;IACd,iEAAa,CAAA;AACf,CAAC,EAJW,gBAAgB,gCAAhB,gBAAgB,QAI3B;AAED,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,mEAAY,CAAA;IACZ,2DAAQ,CAAA;IACR,mEAAY,CAAA;AACd,CAAC,EAJW,kBAAkB,kCAAlB,kBAAkB,QAI7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AgC,CAAA;IAChC,wEAAkB,CAAA;IAClB,0FAA2B,CAAA;IAC3B,sFAAyB,CAAA;IACzB,wFAA0B,CAAA;AAC5B,CAAC,EAnBW,eAAe,+BAAf,eAAe,QAmB1B;AAED,IAAY,eAcX;AAdD,WAAY,eAAe;IACzB,2DAAW,CAAA;IACX,+EAAqB,CAAA;IACrB,uEAAiB,CAAA;IACjB,qEAAgB,CAAA;IAChB,iEAAc,CAAA;IACd,iFAAsB,CAAA;IACtB,+EAAqB,CAAA;IACrB,yFAA0B,CAAA;IAC1B,yEAAkB,CAAA;IAClB,iFAAsB,CAAA;IACtB,8EAAqB,CAAA;IACrB,0FAA2B,CAAA;IAC3B,wEAAkB,CAAA;AACpB,CAAC,EAdW,eAAe,+BAAf,eAAe,QAc1B;AAED,IAAY,mBAiBX;AAjBD,WAAY,mBAAmB;IAC7B,6EAAkB,CAAA;IAClB,iFAAoB,CAAA;IACpB,2EAAiB,CAAA;IACjB,mEAAa,CAAA;IACb,+DAAW,CAAA;IACX,iEAAY,CAAA;IACZ,2EAAiB,CAAA;IACjB,uFAAuB,CAAA;IACvB,qEAAc,CAAA;IACd,uEAAe,CAAA;IACf,+DAAW,CAAA;IACX,2EAAiB,CAAA;IACjB,mFAAqB,CAAA;IACrB,mFAAqB,CAAA;IACrB,+EAAmB,CAAA;IACnB,yEAAgB,CAAA;AAClB,CAAC,EAjBW,mBAAmB,mCAAnB,mBAAmB,QAiB9B"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Base64 } from '../specs/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Utility functions for Base64 encoding/decoding
|
|
4
|
+
* Maintains compatibility with react-native-ble-plx Base64 operations
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Converts a string to Base64
|
|
8
|
+
*/
|
|
9
|
+
export declare function stringToBase64(str: string): Base64;
|
|
10
|
+
/**
|
|
11
|
+
* Converts Base64 to string
|
|
12
|
+
*/
|
|
13
|
+
export declare function base64ToString(base64: Base64): string;
|
|
14
|
+
/**
|
|
15
|
+
* Converts Uint8Array to Base64
|
|
16
|
+
*/
|
|
17
|
+
export declare function uint8ArrayToBase64(uint8Array: Uint8Array): Base64;
|
|
18
|
+
/**
|
|
19
|
+
* Converts Base64 to Uint8Array
|
|
20
|
+
*/
|
|
21
|
+
export declare function base64ToUint8Array(base64: Base64): Uint8Array;
|
|
22
|
+
/**
|
|
23
|
+
* Validates if a string is valid Base64
|
|
24
|
+
*/
|
|
25
|
+
export declare function isValidBase64(str: string): boolean;
|
|
26
|
+
//# sourceMappingURL=base64.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base64.d.ts","sourceRoot":"","sources":["../../../src/utils/base64.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;GAGG;AAEH;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAUlD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAUrD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CASjE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAa7D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAOlD"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stringToBase64 = stringToBase64;
|
|
4
|
+
exports.base64ToString = base64ToString;
|
|
5
|
+
exports.uint8ArrayToBase64 = uint8ArrayToBase64;
|
|
6
|
+
exports.base64ToUint8Array = base64ToUint8Array;
|
|
7
|
+
exports.isValidBase64 = isValidBase64;
|
|
8
|
+
/**
|
|
9
|
+
* Utility functions for Base64 encoding/decoding
|
|
10
|
+
* Maintains compatibility with react-native-ble-plx Base64 operations
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Converts a string to Base64
|
|
14
|
+
*/
|
|
15
|
+
function stringToBase64(str) {
|
|
16
|
+
if (typeof Buffer !== 'undefined') {
|
|
17
|
+
// Node.js environment
|
|
18
|
+
return Buffer.from(str, 'utf8').toString('base64');
|
|
19
|
+
}
|
|
20
|
+
else if (typeof btoa !== 'undefined') {
|
|
21
|
+
// Browser environment
|
|
22
|
+
return btoa(str);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
throw new Error('Base64 encoding not supported in this environment');
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Converts Base64 to string
|
|
30
|
+
*/
|
|
31
|
+
function base64ToString(base64) {
|
|
32
|
+
if (typeof Buffer !== 'undefined') {
|
|
33
|
+
// Node.js environment
|
|
34
|
+
return Buffer.from(base64, 'base64').toString('utf8');
|
|
35
|
+
}
|
|
36
|
+
else if (typeof atob !== 'undefined') {
|
|
37
|
+
// Browser environment
|
|
38
|
+
return atob(base64);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
throw new Error('Base64 decoding not supported in this environment');
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Converts Uint8Array to Base64
|
|
46
|
+
*/
|
|
47
|
+
function uint8ArrayToBase64(uint8Array) {
|
|
48
|
+
if (typeof Buffer !== 'undefined') {
|
|
49
|
+
// Node.js environment
|
|
50
|
+
return Buffer.from(uint8Array).toString('base64');
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
// Browser environment
|
|
54
|
+
const binary = Array.from(uint8Array, byte => String.fromCharCode(byte)).join('');
|
|
55
|
+
return btoa(binary);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Converts Base64 to Uint8Array
|
|
60
|
+
*/
|
|
61
|
+
function base64ToUint8Array(base64) {
|
|
62
|
+
if (typeof Buffer !== 'undefined') {
|
|
63
|
+
// Node.js environment
|
|
64
|
+
return new Uint8Array(Buffer.from(base64, 'base64'));
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
// Browser environment
|
|
68
|
+
const binary = atob(base64);
|
|
69
|
+
const uint8Array = new Uint8Array(binary.length);
|
|
70
|
+
for (let i = 0; i < binary.length; i++) {
|
|
71
|
+
uint8Array[i] = binary.charCodeAt(i);
|
|
72
|
+
}
|
|
73
|
+
return uint8Array;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Validates if a string is valid Base64
|
|
78
|
+
*/
|
|
79
|
+
function isValidBase64(str) {
|
|
80
|
+
try {
|
|
81
|
+
const base64Regex = /^[A-Za-z0-9+/]*={0,2}$/;
|
|
82
|
+
return base64Regex.test(str) && (str.length % 4 === 0);
|
|
83
|
+
}
|
|
84
|
+
catch (_a) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=base64.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base64.js","sourceRoot":"","sources":["../../../src/utils/base64.ts"],"names":[],"mappings":";;AAUA,wCAUC;AAKD,wCAUC;AAKD,gDASC;AAKD,gDAaC;AAKD,sCAOC;AA7ED;;;GAGG;AAEH;;GAEG;AACH,SAAgB,cAAc,CAAC,GAAW;IACxC,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,sBAAsB;QACtB,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACrD,CAAC;SAAM,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE,CAAC;QACvC,sBAAsB;QACtB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;IACnB,CAAC;SAAM,CAAC;QACN,M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C;QAC5B,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACjD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACvC,UAAU,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QACvC,CAAC;QACD,OAAO,UAAU,CAAC;IACpB,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAgB,aAAa,CAAC,GAAW;IACvC,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,wBAAwB,CAAC;QAC7C,OAAO,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;IACzD,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./uuid.js"), exports);
|
|
18
|
+
__exportStar(require("./base64.js"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,8CAA4B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { UUID } from '../specs/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Converts UUID to full 128bit, lowercase format which should be used to compare UUID values.
|
|
4
|
+
* This function maintains 100% compatibility with react-native-ble-plx
|
|
5
|
+
*
|
|
6
|
+
* @param uuid 16bit, 32bit or 128bit UUID.
|
|
7
|
+
* @returns 128bit lowercase UUID.
|
|
8
|
+
*/
|
|
9
|
+
export declare function fullUUID(uuid: UUID): UUID;
|
|
10
|
+
//# sourceMappingURL=uuid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uuid.d.ts","sourceRoot":"","sources":["../../../src/utils/uuid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAE9C;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAmCzC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fullUUID = fullUUID;
|
|
4
|
+
/**
|
|
5
|
+
* Converts UUID to full 128bit, lowercase format which should be used to compare UUID values.
|
|
6
|
+
* This function maintains 100% compatibility with react-native-ble-plx
|
|
7
|
+
*
|
|
8
|
+
* @param uuid 16bit, 32bit or 128bit UUID.
|
|
9
|
+
* @returns 128bit lowercase UUID.
|
|
10
|
+
*/
|
|
11
|
+
function fullUUID(uuid) {
|
|
12
|
+
if (typeof uuid !== 'string') {
|
|
13
|
+
throw new Error('UUID must be a string');
|
|
14
|
+
}
|
|
15
|
+
// Remove dashes and convert to lowercase
|
|
16
|
+
const cleanUuid = uuid.replace(/-/g, '').toLowerCase();
|
|
17
|
+
// 16-bit UUID (4 characters)
|
|
18
|
+
if (cleanUuid.length === 4) {
|
|
19
|
+
return `0000${cleanUuid}-0000-1000-8000-00805f9b34fb`;
|
|
20
|
+
}
|
|
21
|
+
// 32-bit UUID (8 characters)
|
|
22
|
+
if (cleanUuid.length === 8) {
|
|
23
|
+
return `${cleanUuid}-0000-1000-8000-00805f9b34fb`;
|
|
24
|
+
}
|
|
25
|
+
// 128-bit UUID (32 characters)
|
|
26
|
+
if (cleanUuid.length === 32) {
|
|
27
|
+
return [
|
|
28
|
+
cleanUuid.substring(0, 8),
|
|
29
|
+
cleanUuid.substring(8, 12),
|
|
30
|
+
cleanUuid.substring(12, 16),
|
|
31
|
+
cleanUuid.substring(16, 20),
|
|
32
|
+
cleanUuid.substring(20, 32)
|
|
33
|
+
].join('-');
|
|
34
|
+
}
|
|
35
|
+
// Already formatted UUID with dashes
|
|
36
|
+
if (cleanUuid.length === 36 && uuid.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i)) {
|
|
37
|
+
return uuid.toLowerCase();
|
|
38
|
+
}
|
|
39
|
+
throw new Error(`Invalid UUID format: ${uuid}`);
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=uuid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uuid.js","sourceRoot":"","sources":["../../../src/utils/uuid.ts"],"names":[],"mappings":";;AASA,4BAmCC;AA1CD;;;;;;GAMG;AACH,SAAgB,QA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