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.
Files changed (78) hide show
  1. package/app.plugin.cjs +1 -0
  2. package/lib/commonjs/BleManagerCompatFactory.d.ts +56 -0
  3. package/lib/commonjs/BleManagerCompatFactory.d.ts.map +1 -0
  4. package/lib/commonjs/BleManagerCompatFactory.js +201 -0
  5. package/lib/commonjs/BleManagerCompatFactory.js.map +1 -0
  6. package/lib/commonjs/BleManagerFactory.d.ts +31 -0
  7. package/lib/commonjs/BleManagerFactory.d.ts.map +1 -0
  8. package/lib/commonjs/BleManagerFactory.js +81 -0
  9. package/lib/commonjs/BleManagerFactory.js.map +1 -0
  10. package/lib/commonjs/compatibility/constants.d.ts +50 -0
  11. package/lib/commonjs/compatibility/constants.d.ts.map +1 -0
  12. package/lib/commonjs/compatibility/constants.js +58 -0
  13. package/lib/commonjs/compatibility/constants.js.map +1 -0
  14. package/lib/commonjs/compatibility/deviceWrapper.d.ts +100 -0
  15. package/lib/commonjs/compatibility/deviceWrapper.d.ts.map +1 -0
  16. package/lib/commonjs/compatibility/deviceWrapper.js +268 -0
  17. package/lib/commonjs/compatibility/deviceWrapper.js.map +1 -0
  18. package/lib/commonjs/compatibility/enums.d.ts +39 -0
  19. package/lib/commonjs/compatibility/enums.d.ts.map +1 -0
  20. package/lib/commonjs/compatibility/enums.js +179 -0
  21. package/lib/commonjs/compatibility/enums.js.map +1 -0
  22. package/lib/commonjs/compatibility/index.d.ts +13 -0
  23. package/lib/commonjs/compatibility/index.d.ts.map +1 -0
  24. package/lib/commonjs/compatibility/index.js +41 -0
  25. package/lib/commonjs/compatibility/index.js.map +1 -0
  26. package/lib/commonjs/compatibility/serviceData.d.ts +52 -0
  27. package/lib/commonjs/compatibility/serviceData.d.ts.map +1 -0
  28. package/lib/commonjs/compatibility/serviceData.js +80 -0
  29. package/lib/commonjs/compatibility/serviceData.js.map +1 -0
  30. package/lib/commonjs/errors/BleError.d.ts +60 -0
  31. package/lib/commonjs/errors/BleError.d.ts.map +1 -0
  32. package/lib/commonjs/errors/BleError.js +125 -0
  33. package/lib/commonjs/errors/BleError.js.map +1 -0
  34. package/lib/commonjs/index.d.ts +11 -0
  35. package/lib/commonjs/index.d.ts.map +1 -0
  36. package/lib/commonjs/index.js +42 -0
  37. package/lib/commonjs/index.js.map +1 -0
  38. package/lib/commonjs/specs/BleManager.nitro.d.ts +45 -0
  39. package/lib/commonjs/specs/BleManager.nitro.d.ts.map +1 -0
  40. package/lib/commonjs/specs/BleManager.nitro.js +3 -0
  41. package/lib/commonjs/specs/BleManager.nitro.js.map +1 -0
  42. package/lib/commonjs/specs/Characteristic.nitro.d.ts +27 -0
  43. package/lib/commonjs/specs/Characteristic.nitro.d.ts.map +1 -0
  44. package/lib/commonjs/specs/Characteristic.nitro.js +3 -0
  45. package/lib/commonjs/specs/Characteristic.nitro.js.map +1 -0
  46. package/lib/commonjs/specs/Descriptor.nitro.d.ts +18 -0
  47. package/lib/commonjs/specs/Descriptor.nitro.d.ts.map +1 -0
  48. package/lib/commonjs/specs/Descriptor.nitro.js +3 -0
  49. package/lib/commonjs/specs/Descriptor.nitro.js.map +1 -0
  50. package/lib/commonjs/specs/Device.nitro.d.ts +38 -0
  51. package/lib/commonjs/specs/Device.nitro.d.ts.map +1 -0
  52. package/lib/commonjs/specs/Device.nitro.js +3 -0
  53. package/lib/commonjs/specs/Device.nitro.js.map +1 -0
  54. package/lib/commonjs/specs/Service.nitro.d.ts +20 -0
  55. package/lib/commonjs/specs/Service.nitro.d.ts.map +1 -0
  56. package/lib/commonjs/specs/Service.nitro.js +3 -0
  57. package/lib/commonjs/specs/Service.nitro.js.map +1 -0
  58. package/lib/commonjs/specs/types.d.ts +229 -0
  59. package/lib/commonjs/specs/types.d.ts.map +1 -0
  60. package/lib/commonjs/specs/types.js +150 -0
  61. package/lib/commonjs/specs/types.js.map +1 -0
  62. package/lib/commonjs/utils/base64.d.ts +26 -0
  63. package/lib/commonjs/utils/base64.d.ts.map +1 -0
  64. package/lib/commonjs/utils/base64.js +88 -0
  65. package/lib/commonjs/utils/base64.js.map +1 -0
  66. package/lib/commonjs/utils/index.d.ts +3 -0
  67. package/lib/commonjs/utils/index.d.ts.map +1 -0
  68. package/lib/commonjs/utils/index.js +19 -0
  69. package/lib/commonjs/utils/index.js.map +1 -0
  70. package/lib/commonjs/utils/uuid.d.ts +10 -0
  71. package/lib/commonjs/utils/uuid.d.ts.map +1 -0
  72. package/lib/commonjs/utils/uuid.js +41 -0
  73. package/lib/commonjs/utils/uuid.js.map +1 -0
  74. package/package.json +9 -4
  75. package/plugin/build/index.d.ts +2 -2
  76. package/plugin/build/index.js +1 -1
  77. package/plugin/build/withBleNitro.d.ts +1 -1
  78. package/plugin/build/withBleNitro.js +1 -1
@@ -0,0 +1,268 @@
1
+ "use strict";
2
+ /**
3
+ * Device wrapper for compatibility
4
+ *
5
+ * Wraps Nitro Device objects to provide the original react-native-ble-plx API
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.DescriptorWrapper = exports.CharacteristicWrapper = exports.ServiceWrapper = exports.DeviceWrapper = void 0;
9
+ const serviceData_js_1 = require("./serviceData.js");
10
+ const enums_js_1 = require("./enums.js");
11
+ /**
12
+ * Device wrapper that provides react-native-ble-plx compatibility
13
+ * Maps Nitro device properties to the expected API surface
14
+ */
15
+ class DeviceWrapper {
16
+ constructor(nitroDevice) {
17
+ this.nitroDevice = nitroDevice;
18
+ }
19
+ // Device identification
20
+ get id() {
21
+ return this.nitroDevice.id;
22
+ }
23
+ // Map deviceName back to name for compatibility
24
+ get name() {
25
+ return this.nitroDevice.deviceName || null;
26
+ }
27
+ get rssi() {
28
+ return this.nitroDevice.rssi || null;
29
+ }
30
+ get mtu() {
31
+ return this.nitroDevice.mtu;
32
+ }
33
+ // Advertisement data
34
+ get manufacturerData() {
35
+ return this.nitroDevice.manufacturerData || null;
36
+ }
37
+ get rawScanRecord() {
38
+ return this.nitroDevice.rawScanRecord;
39
+ }
40
+ // Convert ServiceDataEntry[] back to { [uuid: string]: Base64 }
41
+ get serviceData() {
42
+ return (0, serviceData_js_1.serviceDataArrayToMap)(this.nitroDevice.serviceData || null);
43
+ }
44
+ get serviceUUIDs() {
45
+ return this.nitroDevice.serviceUUIDs || null;
46
+ }
47
+ get localName() {
48
+ return this.nitroDevice.localName || null;
49
+ }
50
+ get txPowerLevel() {
51
+ return this.nitroDevice.txPowerLevel || null;
52
+ }
53
+ get solicitedServiceUUIDs() {
54
+ return this.nitroDevice.solicitedServiceUUIDs || null;
55
+ }
56
+ get isConnectable() {
57
+ return this.nitroDevice.isConnectable || null;
58
+ }
59
+ get overflowServiceUUIDs() {
60
+ return this.nitroDevice.overflowServiceUUIDs || null;
61
+ }
62
+ // Connection management methods
63
+ async requestConnectionPriority(connectionPriority, transactionId) {
64
+ const result = await this.nitroDevice.requestConnectionPriority(connectionPriority, transactionId);
65
+ return new DeviceWrapper(result);
66
+ }
67
+ async readRSSI(transactionId) {
68
+ const result = await this.nitroDevice.readRSSI(transactionId);
69
+ return new DeviceWrapper(result);
70
+ }
71
+ async requestMTU(mtu, transactionId) {
72
+ const result = await this.nitroDevice.requestMTU(mtu, transactionId);
73
+ return new DeviceWrapper(result);
74
+ }
75
+ async connect(options) {
76
+ var _a, _b, _c;
77
+ // Provide defaults for required fields in Nitro interface
78
+ const connectionOptions = {
79
+ autoConnect: (_a = options === null || options === void 0 ? void 0 : options.autoConnect) !== null && _a !== void 0 ? _a : false,
80
+ requestMTU: (_b = options === null || options === void 0 ? void 0 : options.requestMTU) !== null && _b !== void 0 ? _b : 23,
81
+ timeout: (_c = options === null || options === void 0 ? void 0 : options.timeout) !== null && _c !== void 0 ? _c : 0,
82
+ };
83
+ const result = await this.nitroDevice.connect(connectionOptions);
84
+ return new DeviceWrapper(result);
85
+ }
86
+ async cancelConnection() {
87
+ const result = await this.nitroDevice.cancelConnection();
88
+ return new DeviceWrapper(result);
89
+ }
90
+ async isConnected() {
91
+ return await this.nitroDevice.isConnected();
92
+ }
93
+ onDisconnected(listener) {
94
+ return this.nitroDevice.onDisconnected((error, device) => {
95
+ listener(error, new DeviceWrapper(device));
96
+ });
97
+ }
98
+ // Service discovery
99
+ async discoverAllServicesAndCharacteristics(transactionId) {
100
+ const result = await this.nitroDevice.discoverAllServicesAndCharacteristics(transactionId);
101
+ return new DeviceWrapper(result);
102
+ }
103
+ async services() {
104
+ const services = await this.nitroDevice.services();
105
+ return services.map((service) => new ServiceWrapper(service, this.nitroDevice));
106
+ }
107
+ // Characteristic operations
108
+ async characteristicsForService(serviceUUID) {
109
+ const characteristics = await this.nitroDevice.characteristicsForService(serviceUUID);
110
+ return characteristics.map((char) => new CharacteristicWrapper(char, this.nitroDevice));
111
+ }
112
+ async readCharacteristicForService(serviceUUID, characteristicUUID, transactionId) {
113
+ const result = await this.nitroDevice.readCharacteristicForService(serviceUUID, characteristicUUID, transactionId);
114
+ return new CharacteristicWrapper(result, this.nitroDevice);
115
+ }
116
+ async writeCharacteristicWithResponseForService(serviceUUID, characteristicUUID, valueBase64, transactionId) {
117
+ const result = await this.nitroDevice.writeCharacteristicWithResponseForService(serviceUUID, characteristicUUID, valueBase64, transactionId);
118
+ return new CharacteristicWrapper(result, this.nitroDevice);
119
+ }
120
+ async writeCharacteristicWithoutResponseForService(serviceUUID, characteristicUUID, valueBase64, transactionId) {
121
+ const result = await this.nitroDevice.writeCharacteristicWithoutResponseForService(serviceUUID, characteristicUUID, valueBase64, transactionId);
122
+ return new CharacteristicWrapper(result, this.nitroDevice);
123
+ }
124
+ monitorCharacteristicForService(serviceUUID, characteristicUUID, listener, transactionId, subscriptionType) {
125
+ const nitroSubscriptionType = subscriptionType
126
+ ? (0, enums_js_1.normalizeCharacteristicSubscriptionType)(subscriptionType)
127
+ : undefined;
128
+ return this.nitroDevice.monitorCharacteristicForService(serviceUUID, characteristicUUID, (error, characteristic) => {
129
+ listener(error, characteristic ? new CharacteristicWrapper(characteristic, this.nitroDevice) : null);
130
+ }, transactionId, nitroSubscriptionType);
131
+ }
132
+ // Descriptor operations
133
+ async descriptorsForService(serviceUUID, characteristicUUID) {
134
+ const descriptors = await this.nitroDevice.descriptorsForService(serviceUUID, characteristicUUID);
135
+ return descriptors.map((desc) => new DescriptorWrapper(desc, this.nitroDevice));
136
+ }
137
+ async readDescriptorForService(serviceUUID, characteristicUUID, descriptorUUID, transactionId) {
138
+ const result = await this.nitroDevice.readDescriptorForService(serviceUUID, characteristicUUID, descriptorUUID, transactionId);
139
+ return new DescriptorWrapper(result, this.nitroDevice);
140
+ }
141
+ async writeDescriptorForService(serviceUUID, characteristicUUID, descriptorUUID, valueBase64, transactionId) {
142
+ const result = await this.nitroDevice.writeDescriptorForService(serviceUUID, characteristicUUID, descriptorUUID, valueBase64, transactionId);
143
+ return new DescriptorWrapper(result, this.nitroDevice);
144
+ }
145
+ }
146
+ exports.DeviceWrapper = DeviceWrapper;
147
+ /**
148
+ * Service wrapper for compatibility
149
+ */
150
+ class ServiceWrapper {
151
+ constructor(nativeService, nitroDevice) {
152
+ this.nativeService = nativeService;
153
+ this.nitroDevice = nitroDevice;
154
+ }
155
+ get id() {
156
+ return this.nativeService.id;
157
+ }
158
+ get uuid() {
159
+ return this.nativeService.uuid;
160
+ }
161
+ get deviceID() {
162
+ return this.nativeService.deviceID;
163
+ }
164
+ get isPrimary() {
165
+ return this.nativeService.isPrimary;
166
+ }
167
+ // Delegate to device methods
168
+ async characteristics() {
169
+ const device = new DeviceWrapper(this.nitroDevice);
170
+ return await device.characteristicsForService(this.uuid);
171
+ }
172
+ async readCharacteristic(characteristicUUID, transactionId) {
173
+ const device = new DeviceWrapper(this.nitroDevice);
174
+ return await device.readCharacteristicForService(this.uuid, characteristicUUID, transactionId);
175
+ }
176
+ }
177
+ exports.ServiceWrapper = ServiceWrapper;
178
+ /**
179
+ * Characteristic wrapper for compatibility
180
+ */
181
+ class CharacteristicWrapper {
182
+ constructor(nativeCharacteristic, nitroDevice) {
183
+ this.nativeCharacteristic = nativeCharacteristic;
184
+ this.nitroDevice = nitroDevice;
185
+ }
186
+ get id() {
187
+ return this.nativeCharacteristic.id;
188
+ }
189
+ get uuid() {
190
+ return this.nativeCharacteristic.uuid;
191
+ }
192
+ get serviceID() {
193
+ return this.nativeCharacteristic.serviceID;
194
+ }
195
+ get serviceUUID() {
196
+ return this.nativeCharacteristic.serviceUUID;
197
+ }
198
+ get deviceID() {
199
+ return this.nativeCharacteristic.deviceID;
200
+ }
201
+ get isReadable() {
202
+ return this.nativeCharacteristic.isReadable;
203
+ }
204
+ get isWritableWithResponse() {
205
+ return this.nativeCharacteristic.isWritableWithResponse;
206
+ }
207
+ get isWritableWithoutResponse() {
208
+ return this.nativeCharacteristic.isWritableWithoutResponse;
209
+ }
210
+ get isNotifiable() {
211
+ return this.nativeCharacteristic.isNotifiable;
212
+ }
213
+ get isNotifying() {
214
+ return this.nativeCharacteristic.isNotifying;
215
+ }
216
+ get isIndicatable() {
217
+ return this.nativeCharacteristic.isIndicatable;
218
+ }
219
+ get value() {
220
+ return this.nativeCharacteristic.value;
221
+ }
222
+ // Delegate to device methods
223
+ async read(transactionId) {
224
+ const device = new DeviceWrapper(this.nitroDevice);
225
+ return await device.readCharacteristicForService(this.serviceUUID, this.uuid, transactionId);
226
+ }
227
+ }
228
+ exports.CharacteristicWrapper = CharacteristicWrapper;
229
+ /**
230
+ * Descriptor wrapper for compatibility
231
+ */
232
+ class DescriptorWrapper {
233
+ constructor(nativeDescriptor, nitroDevice) {
234
+ this.nativeDescriptor = nativeDescriptor;
235
+ this.nitroDevice = nitroDevice;
236
+ }
237
+ get id() {
238
+ return this.nativeDescriptor.id;
239
+ }
240
+ get uuid() {
241
+ return this.nativeDescriptor.uuid;
242
+ }
243
+ get characteristicID() {
244
+ return this.nativeDescriptor.characteristicID;
245
+ }
246
+ get characteristicUUID() {
247
+ return this.nativeDescriptor.characteristicUUID;
248
+ }
249
+ get serviceID() {
250
+ return this.nativeDescriptor.serviceID;
251
+ }
252
+ get serviceUUID() {
253
+ return this.nativeDescriptor.serviceUUID;
254
+ }
255
+ get deviceID() {
256
+ return this.nativeDescriptor.deviceID;
257
+ }
258
+ get value() {
259
+ return this.nativeDescriptor.value;
260
+ }
261
+ // Delegate to device methods
262
+ async read(transactionId) {
263
+ const device = new DeviceWrapper(this.nitroDevice);
264
+ return await device.readDescriptorForService(this.serviceUUID, this.characteristicUUID, this.uuid, transactionId);
265
+ }
266
+ }
267
+ exports.DescriptorWrapper = DescriptorWrapper;
268
+ //# sourceMappingURL=deviceWrapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deviceWrapper.js","sourceRoot":"","sources":["../../../src/compatibility/deviceWrapper.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAkBH,qDAAyD;AACzD,yCAIoB;AAEpB;;;GAGG;AACH,MAAa,aAAa;IACxB,YAAoB,WAA8B;QAA9B,gBAAW,GAAX,WAAW,CAAmB;IAAG,CAAC;IAEtD,wBAAwB;IACxB,IAAI,EAAE;QACJ,OAAO,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;IAC7B,CAAC;IAED,gDAAgD;IAChD,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,WAAW,CAAC,UAAU,IAAI,IAAI,CAAC;IAC7C,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,IAAI,IAAI,CAAC;IACvC,CAAC;IAED,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC;IAC9B,CAAC;IAED,qBAAqB;IACrB,IAAI,gBAAgB;QAClB,OAAO,IAAI,CAAC,WAAW,CAAC,gBAAgB,IAAI,IAAI,CAAC;IACnD,CAAC;IAED,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC;IACxC,CAAC;IAED,gEAAgE;IAChE,IAAI,WAAW;QACb,OAAO,IAAA,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@@ -0,0 +1,39 @@
1
+ /**
2
+ * React Native BLE Plx Compatible Enums and Types
3
+ *
4
+ * These match the exact types from react-native-ble-plx for drop-in compatibility.
5
+ * This module provides conversion between Nitro's numeric enums and react-native-ble-plx types.
6
+ */
7
+ import { State as NitroState, LogLevel as NitroLogLevel, CharacteristicSubscriptionType as NitroCharacteristicSubscriptionType, RefreshGattMoment as NitroRefreshGattMoment } from '../specs/types.js';
8
+ export declare enum State {
9
+ Unknown = "Unknown",
10
+ Resetting = "Resetting",
11
+ Unsupported = "Unsupported",
12
+ Unauthorized = "Unauthorized",
13
+ PoweredOff = "PoweredOff",
14
+ PoweredOn = "PoweredOn"
15
+ }
16
+ export declare enum LogLevel {
17
+ None = "None",
18
+ Verbose = "Verbose",
19
+ Debug = "Debug",
20
+ Info = "Info",
21
+ Warning = "Warning",
22
+ Error = "Error"
23
+ }
24
+ export type CharacteristicSubscriptionType = 'notification' | 'indication';
25
+ export type RefreshGattMoment = 'OnConnected';
26
+ export declare function stateToString(state: NitroState): State;
27
+ export declare function logLevelToString(logLevel: NitroLogLevel): LogLevel;
28
+ export declare function characteristicSubscriptionTypeToString(type: NitroCharacteristicSubscriptionType): CharacteristicSubscriptionType;
29
+ export declare function refreshGattMomentToString(_moment: NitroRefreshGattMoment): RefreshGattMoment;
30
+ export declare function stringToState(stateString: State | string): NitroState;
31
+ export declare function stringToLogLevel(logLevelString: LogLevel | string): NitroLogLevel;
32
+ export declare function stringToCharacteristicSubscriptionType(typeString: CharacteristicSubscriptionType | string): NitroCharacteristicSubscriptionType;
33
+ export declare function stringToRefreshGattMoment(_momentString: RefreshGattMoment): NitroRefreshGattMoment;
34
+ export declare function normalizeState(state: NitroState | State | string): NitroState;
35
+ export declare function normalizeLogLevel(logLevel: NitroLogLevel | LogLevel | string): NitroLogLevel;
36
+ export declare function normalizeCharacteristicSubscriptionType(type: NitroCharacteristicSubscriptionType | CharacteristicSubscriptionType | string): NitroCharacteristicSubscriptionType;
37
+ export declare function normalizeRefreshGattMoment(_moment: NitroRefreshGattMoment | RefreshGattMoment | string): NitroRefreshGattMoment;
38
+ export declare function isStringEnumValue(value: any): boolean;
39
+ //# sourceMappingURL=enums.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../../src/compatibility/enums.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,KAAK,IAAI,UAAU,EACnB,QAAQ,IAAI,aAAa,EACzB,8BAA8B,IAAI,mCAAmC,EACrE,iBAAiB,IAAI,sBAAsB,EAC5C,MAAM,mBAAmB,CAAC;AAG3B,oBAAY,KAAK;IACf,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,WAAW,gBAAgB;IAC3B,YAAY,iBAAiB;IAC7B,UAAU,eAAe;IACzB,SAAS,cAAc;CACxB;AAED,oBAAY,QAAQ;IAClB,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,KAAK,UAAU;CAChB;AAGD,MAAM,MAAM,8BAA8B,GAAG,cAAc,GAAG,YAAY,CAAC;AAC3E,MAAM,MAAM,iBAAiB,GAAG,aAAa,CAAC;AAG9C,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,GAAG,KAAK,CAUtD;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,aAAa,GAAG,QAAQ,CAUlE;AAED,wBAAgB,sCAAsC,CACpD,IAAI,EAAE,mCAAmC,GACxC,8BAA8B,CAMhC;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,sBAAsB,GAAG,iBAAiB,CAE5F;AAGD,wBAAgB,aAAa,CAAC,WAAW,EAAE,KAAK,GAAG,MAAM,GAAG,UAAU,CAuBrE;AAED,wBAAgB,gBAAgB,CAAC,cAAc,EAAE,QAAQ,GAAG,MAAM,GAAG,aAAa,CAuBjF;AAED,wBAAgB,sCAAsC,CACpD,UAAU,EAAE,8BAA8B,GAAG,MAAM,GAClD,mCAAmC,CASrC;AAED,wBAAgB,yBAAyB,CAAC,aAAa,EAAE,iBAAiB,GAAG,sBAAsB,CAElG;AAGD,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,UAAU,CAU7E;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,aAAa,GAAG,QAAQ,GAAG,MAAM,GAAG,aAAa,CAU5F;AAED,wBAAgB,uCAAuC,CACrD,IAAI,EAAE,mCAAmC,GAAG,8BAA8B,GAAG,MAAM,GAClF,mCAAmC,CAMrC;AAED,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,sBAAsB,GAAG,iBAAiB,GAAG,MAAM,GAC3D,sBAAsB,CAExB;AAGD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAErD"}
@@ -0,0 +1,179 @@
1
+ "use strict";
2
+ /**
3
+ * React Native BLE Plx Compatible Enums and Types
4
+ *
5
+ * These match the exact types from react-native-ble-plx for drop-in compatibility.
6
+ * This module provides conversion between Nitro's numeric enums and react-native-ble-plx types.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.LogLevel = exports.State = void 0;
10
+ exports.stateToString = stateToString;
11
+ exports.logLevelToString = logLevelToString;
12
+ exports.characteristicSubscriptionTypeToString = characteristicSubscriptionTypeToString;
13
+ exports.refreshGattMomentToString = refreshGattMomentToString;
14
+ exports.stringToState = stringToState;
15
+ exports.stringToLogLevel = stringToLogLevel;
16
+ exports.stringToCharacteristicSubscriptionType = stringToCharacteristicSubscriptionType;
17
+ exports.stringToRefreshGattMoment = stringToRefreshGattMoment;
18
+ exports.normalizeState = normalizeState;
19
+ exports.normalizeLogLevel = normalizeLogLevel;
20
+ exports.normalizeCharacteristicSubscriptionType = normalizeCharacteristicSubscriptionType;
21
+ exports.normalizeRefreshGattMoment = normalizeRefreshGattMoment;
22
+ exports.isStringEnumValue = isStringEnumValue;
23
+ // Import Nitro's numeric enums with aliases to avoid naming conflicts
24
+ const types_js_1 = require("../specs/types.js");
25
+ // Define exact string enums and types matching react-native-ble-plx
26
+ var State;
27
+ (function (State) {
28
+ State["Unknown"] = "Unknown";
29
+ State["Resetting"] = "Resetting";
30
+ State["Unsupported"] = "Unsupported";
31
+ State["Unauthorized"] = "Unauthorized";
32
+ State["PoweredOff"] = "PoweredOff";
33
+ State["PoweredOn"] = "PoweredOn";
34
+ })(State || (exports.State = State = {}));
35
+ var LogLevel;
36
+ (function (LogLevel) {
37
+ LogLevel["None"] = "None";
38
+ LogLevel["Verbose"] = "Verbose";
39
+ LogLevel["Debug"] = "Debug";
40
+ LogLevel["Info"] = "Info";
41
+ LogLevel["Warning"] = "Warning";
42
+ LogLevel["Error"] = "Error";
43
+ })(LogLevel || (exports.LogLevel = LogLevel = {}));
44
+ // Conversion functions from Nitro numeric enums to react-native-ble-plx string enums/types
45
+ function stateToString(state) {
46
+ var _a;
47
+ const mapping = {
48
+ [types_js_1.State.Unknown]: State.Unknown,
49
+ [types_js_1.State.Resetting]: State.Resetting,
50
+ [types_js_1.State.Unsupported]: State.Unsupported,
51
+ [types_js_1.State.Unauthorized]: State.Unauthorized,
52
+ [types_js_1.State.PoweredOff]: State.PoweredOff,
53
+ [types_js_1.State.PoweredOn]: State.PoweredOn,
54
+ };
55
+ return (_a = mapping[state]) !== null && _a !== void 0 ? _a : State.Unknown;
56
+ }
57
+ function logLevelToString(logLevel) {
58
+ var _a;
59
+ const mapping = {
60
+ [types_js_1.LogLevel.None]: LogLevel.None,
61
+ [types_js_1.LogLevel.Verbose]: LogLevel.Verbose,
62
+ [types_js_1.LogLevel.Debug]: LogLevel.Debug,
63
+ [types_js_1.LogLevel.Info]: LogLevel.Info,
64
+ [types_js_1.LogLevel.Warning]: LogLevel.Warning,
65
+ [types_js_1.LogLevel.Error]: LogLevel.Error,
66
+ };
67
+ return (_a = mapping[logLevel]) !== null && _a !== void 0 ? _a : LogLevel.None;
68
+ }
69
+ function characteristicSubscriptionTypeToString(type) {
70
+ var _a;
71
+ const mapping = {
72
+ [types_js_1.CharacteristicSubscriptionType.Notification]: 'notification',
73
+ [types_js_1.CharacteristicSubscriptionType.Indication]: 'indication',
74
+ };
75
+ return (_a = mapping[type]) !== null && _a !== void 0 ? _a : 'notification';
76
+ }
77
+ function refreshGattMomentToString(_moment) {
78
+ return 'OnConnected'; // Only one value exists
79
+ }
80
+ // Conversion functions from react-native-ble-plx string enums/types to Nitro numeric enums
81
+ function stringToState(stateString) {
82
+ switch (stateString) {
83
+ case State.Unknown:
84
+ case 'Unknown':
85
+ return types_js_1.State.Unknown;
86
+ case State.Resetting:
87
+ case 'Resetting':
88
+ return types_js_1.State.Resetting;
89
+ case State.Unsupported:
90
+ case 'Unsupported':
91
+ return types_js_1.State.Unsupported;
92
+ case State.Unauthorized:
93
+ case 'Unauthorized':
94
+ return types_js_1.State.Unauthorized;
95
+ case State.PoweredOff:
96
+ case 'PoweredOff':
97
+ return types_js_1.State.PoweredOff;
98
+ case State.PoweredOn:
99
+ case 'PoweredOn':
100
+ return types_js_1.State.PoweredOn;
101
+ default:
102
+ return types_js_1.State.Unknown;
103
+ }
104
+ }
105
+ function stringToLogLevel(logLevelString) {
106
+ switch (logLevelString) {
107
+ case LogLevel.None:
108
+ case 'None':
109
+ return types_js_1.LogLevel.None;
110
+ case LogLevel.Verbose:
111
+ case 'Verbose':
112
+ return types_js_1.LogLevel.Verbose;
113
+ case LogLevel.Debug:
114
+ case 'Debug':
115
+ return types_js_1.LogLevel.Debug;
116
+ case LogLevel.Info:
117
+ case 'Info':
118
+ return types_js_1.LogLevel.Info;
119
+ case LogLevel.Warning:
120
+ case 'Warning':
121
+ return types_js_1.LogLevel.Warning;
122
+ case LogLevel.Error:
123
+ case 'Error':
124
+ return types_js_1.LogLevel.Error;
125
+ default:
126
+ return types_js_1.LogLevel.None;
127
+ }
128
+ }
129
+ function stringToCharacteristicSubscriptionType(typeString) {
130
+ switch (typeString) {
131
+ case 'notification':
132
+ return types_js_1.CharacteristicSubscriptionType.Notification;
133
+ case 'indication':
134
+ return types_js_1.CharacteristicSubscriptionType.Indication;
135
+ default:
136
+ return types_js_1.CharacteristicSubscriptionType.Notification;
137
+ }
138
+ }
139
+ function stringToRefreshGattMoment(_momentString) {
140
+ return types_js_1.RefreshGattMoment.OnConnected;
141
+ }
142
+ // Generic converter that handles both string and numeric enum values
143
+ function normalizeState(state) {
144
+ if (typeof state === 'string') {
145
+ return stringToState(state);
146
+ }
147
+ // If it's already a NitroState (numeric), return as-is
148
+ if (typeof state === 'number') {
149
+ return state;
150
+ }
151
+ // If it's a string State enum value, convert it
152
+ return stringToState(state);
153
+ }
154
+ function normalizeLogLevel(logLevel) {
155
+ if (typeof logLevel === 'string') {
156
+ return stringToLogLevel(logLevel);
157
+ }
158
+ // If it's already a NitroLogLevel (numeric), return as-is
159
+ if (typeof logLevel === 'number') {
160
+ return logLevel;
161
+ }
162
+ // If it's a string LogLevel enum value, convert it
163
+ return stringToLogLevel(logLevel);
164
+ }
165
+ function normalizeCharacteristicSubscriptionType(type) {
166
+ if (typeof type === 'string') {
167
+ return stringToCharacteristicSubscriptionType(type);
168
+ }
169
+ // If it's already a NitroCharacteristicSubscriptionType (numeric), return as-is
170
+ return type;
171
+ }
172
+ function normalizeRefreshGattMoment(_moment) {
173
+ return types_js_1.RefreshGattMoment.OnConnected; // Only one value exists
174
+ }
175
+ // Helper function to detect if a value is a string enum vs numeric enum
176
+ function isStringEnumValue(value) {
177
+ return typeof value === 'string';
178
+ }
179
+ //# sourceMappingURL=enums.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enums.js","sourceRoot":"","sources":["../../../src/compatibility/enums.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAkCH,sCAUC;AAED,4CAUC;AAED,wFAQC;AAED,8DAEC;AAGD,sCAuBC;AAED,4CAuBC;AAED,wFAWC;AAED,8DAEC;AAGD,wCAUC;AAED,8CAUC;AAED,0FAQC;AAED,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O,aAAa,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IACD,uDAAuD;IACvD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAmB,CAAC;IAC7B,CAAC;IACD,gDAAgD;IAChD,OAAO,aAAa,CAAC,KAAe,CAAC,CAAC;AACxC,CAAC;AAED,SAAgB,iBAAiB,CAAC,QAA2C;IAC3E,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACjC,OAAO,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;IACD,0DAA0D;IAC1D,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACjC,OAAO,QAAyB,CAAC;IACnC,CAAC;IACD,mDAAmD;IACnD,OAAO,gBAAgB,CAAC,QAAkB,CAAC,CAAC;AAC9C,CAAC;AAED,SAAgB,uCAAuC,CACrD,IAAmF;IAEnF,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,OAAO,sCAAsC,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;IACD,gFAAgF;IAChF,OAAO,IAA2C,CAAC;AACrD,CAAC;AAED,SAAgB,0BAA0B,CACxC,OAA4D;IAE5D,OAAO,4BAAsB,CAAC,WAAW,CAAC,CAAC,wBAAwB;AACrE,CAAC;AAED,wEAAwE;AACxE,SAAgB,iBAAiB,CAAC,KAAU;IAC1C,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;AACnC,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Compatibility layer for react-native-ble-nitro
3
+ *
4
+ * This module provides compatibility shims and converters to maintain
5
+ * 100% API compatibility with react-native-ble-plx while working with
6
+ * Nitro's type system constraints.
7
+ */
8
+ export * from './serviceData.js';
9
+ export * from './deviceWrapper.js';
10
+ export * from './constants.js';
11
+ export { stateToString, stringToState, logLevelToString, stringToLogLevel, characteristicSubscriptionTypeToString, stringToCharacteristicSubscriptionType, normalizeState, normalizeLogLevel, normalizeCharacteristicSubscriptionType, State, LogLevel } from './enums.js';
12
+ export type { CharacteristicSubscriptionType, RefreshGattMoment } from './enums.js';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/compatibility/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAG/B,OAAO,EACL,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,sCAAsC,EACtC,sCAAsC,EACtC,cAAc,EACd,iBAAiB,EACjB,uCAAuC,EACvC,KAAK,EACL,QAAQ,EACT,MAAM,YAAY,CAAC;AAGpB,YAAY,EACV,8BAA8B,EAC9B,iBAAiB,EAClB,MAAM,YAAY,CAAC"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ /**
3
+ * Compatibility layer for react-native-ble-nitro
4
+ *
5
+ * This module provides compatibility shims and converters to maintain
6
+ * 100% API compatibility with react-native-ble-plx while working with
7
+ * Nitro's type system constraints.
8
+ */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
21
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.LogLevel = exports.State = exports.normalizeCharacteristicSubscriptionType = exports.normalizeLogLevel = exports.normalizeState = exports.stringToCharacteristicSubscriptionType = exports.characteristicSubscriptionTypeToString = exports.stringToLogLevel = exports.logLevelToString = exports.stringToState = exports.stateToString = void 0;
25
+ __exportStar(require("./serviceData.js"), exports);
26
+ __exportStar(require("./deviceWrapper.js"), exports);
27
+ __exportStar(require("./constants.js"), exports);
28
+ // Explicitly export enum utilities and enums to avoid conflicts
29
+ var enums_js_1 = require("./enums.js");
30
+ Object.defineProperty(exports, "stateToString", { enumerable: true, get: function () { return enums_js_1.stateToString; } });
31
+ Object.defineProperty(exports, "stringToState", { enumerable: true, get: function () { return enums_js_1.stringToState; } });
32
+ Object.defineProperty(exports, "logLevelToString", { enumerable: true, get: function () { return enums_js_1.logLevelToString; } });
33
+ Object.defineProperty(exports, "stringToLogLevel", { enumerable: true, get: function () { return enums_js_1.stringToLogLevel; } });
34
+ Object.defineProperty(exports, "characteristicSubscriptionTypeToString", { enumerable: true, get: function () { return enums_js_1.characteristicSubscriptionTypeToString; } });
35
+ Object.defineProperty(exports, "stringToCharacteristicSubscriptionType", { enumerable: true, get: function () { return enums_js_1.stringToCharacteristicSubscriptionType; } });
36
+ Object.defineProperty(exports, "normalizeState", { enumerable: true, get: function () { return enums_js_1.normalizeState; } });
37
+ Object.defineProperty(exports, "normalizeLogLevel", { enumerable: true, get: function () { return enums_js_1.normalizeLogLevel; } });
38
+ Object.defineProperty(exports, "normalizeCharacteristicSubscriptionType", { enumerable: true, get: function () { return enums_js_1.normalizeCharacteristicSubscriptionType; } });
39
+ Object.defineProperty(exports, "State", { enumerable: true, get: function () { return enums_js_1.State; } });
40
+ Object.defineProperty(exports, "LogLevel", { enumerable: true, get: function () { return enums_js_1.LogLevel; } });
41
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/compatibility/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;AAEH,mDAAiC;AACjC,qDAAmC;AACnC,iDAA+B;AAE/B,gEAAgE;AAChE,uCAYoB;AAXlB,yGAAA,aAAa,OAAA;AACb,yGAAA,aAAa,OAAA;AACb,4GAAA,gBAAgB,OAAA;AAChB,4GAAA,gBAAgB,OAAA;AAChB,kIAAA,sCAAsC,OAAA;AACtC,kIAAA,sCAAsC,OAAA;AACtC,0GAAA,cAAc,OAAA;AACd,6GAAA,iBAAiB,OAAA;AACjB,mIAAA,uCAAuC,OAAA;AACvC,iGAAA,KAAK,OAAA;AACL,oGAAA,QAAQ,OAAA"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Service Data compatibility layer
3
+ *
4
+ * Provides conversion between Nitro's structured ServiceDataEntry[] format
5
+ * and the original { [uuid: string]: Base64 } format from react-native-ble-plx
6
+ */
7
+ import type { ServiceDataEntry, UUID, Base64 } from '../specs/types.js';
8
+ /**
9
+ * Convert ServiceDataEntry array to the original index signature format
10
+ */
11
+ export declare function serviceDataArrayToMap(entries: ServiceDataEntry[] | null): {
12
+ [uuid: string]: Base64;
13
+ } | null;
14
+ /**
15
+ * Convert the original index signature format to ServiceDataEntry array
16
+ */
17
+ export declare function serviceDataMapToArray(map: {
18
+ [uuid: string]: Base64;
19
+ } | null): ServiceDataEntry[] | null;
20
+ /**
21
+ * Merge two service data maps (used in device updates)
22
+ */
23
+ export declare function mergeServiceDataMaps(existing: {
24
+ [uuid: string]: Base64;
25
+ } | null, updates: {
26
+ [uuid: string]: Base64;
27
+ } | null): {
28
+ [uuid: string]: Base64;
29
+ } | null;
30
+ /**
31
+ * Merge two service data arrays (used in native updates)
32
+ */
33
+ export declare function mergeServiceDataArrays(existing: ServiceDataEntry[] | null, updates: ServiceDataEntry[] | null): ServiceDataEntry[] | null;
34
+ /**
35
+ * Check if service data contains a specific service UUID
36
+ */
37
+ export declare function hasServiceUUID(serviceData: {
38
+ [uuid: string]: Base64;
39
+ } | null, uuid: UUID): boolean;
40
+ /**
41
+ * Get service data for a specific UUID
42
+ */
43
+ export declare function getServiceData(serviceData: {
44
+ [uuid: string]: Base64;
45
+ } | null, uuid: UUID): Base64 | null;
46
+ /**
47
+ * Get all service UUIDs from service data
48
+ */
49
+ export declare function getServiceUUIDs(serviceData: {
50
+ [uuid: string]: Base64;
51
+ } | null): UUID[];
52
+ //# sourceMappingURL=serviceData.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serviceData.d.ts","sourceRoot":"","sources":["../../../src/compatibility/serviceData.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAExE;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,gBAAgB,EAAE,GAAG,IAAI,GAAG;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GAAG,IAAI,CAU3G;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GAAG,IAAI,GAAG,gBAAgB,EAAE,GAAG,IAAI,CASvG;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GAAG,IAAI,EAC3C,OAAO,EAAE;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GAAG,IAAI,GACzC;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GAAG,IAAI,CAMnC;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,IAAI,EACnC,OAAO,EAAE,gBAAgB,EAAE,GAAG,IAAI,GACjC,gBAAgB,EAAE,GAAG,IAAI,CAK3B;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE;IAAE,CAAC,IAAI,E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