react-native-bluebreeze 0.0.1 → 0.0.3

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 (81) hide show
  1. package/android/build.gradle +8 -17
  2. package/android/generated/java/com/bluebreeze/NativeBlueBreezeSpec.java +17 -9
  3. package/android/generated/jni/RNBlueBreezeSpec-generated.cpp +21 -14
  4. package/android/generated/jni/react/renderer/components/RNBlueBreezeSpec/RNBlueBreezeSpecJSI-generated.cpp +19 -12
  5. package/android/generated/jni/react/renderer/components/RNBlueBreezeSpec/RNBlueBreezeSpecJSI.h +279 -53
  6. package/android/gradle.properties +5 -5
  7. package/android/src/main/java/com/bluebreeze/BlueBreezeModule.kt +632 -16
  8. package/android/src/main/java/com/bluebreeze/BlueBreezePackage.kt +0 -1
  9. package/ios/BlueBreezeImpl.swift +92 -84
  10. package/ios/Bluebreeze.mm +52 -25
  11. package/ios/generated/RNBlueBreezeSpec/RNBlueBreezeSpec-generated.mm +30 -18
  12. package/ios/generated/RNBlueBreezeSpec/RNBlueBreezeSpec.h +12 -7
  13. package/ios/generated/RNBlueBreezeSpecJSI-generated.cpp +19 -12
  14. package/ios/generated/RNBlueBreezeSpecJSI.h +279 -53
  15. package/lib/commonjs/NativeBlueBreeze.js +11 -0
  16. package/lib/commonjs/NativeBlueBreeze.js.map +1 -0
  17. package/lib/commonjs/implementation/bluebreeze_characteristic.js +29 -0
  18. package/lib/commonjs/implementation/bluebreeze_characteristic.js.map +1 -0
  19. package/lib/commonjs/implementation/bluebreeze_device.js +31 -0
  20. package/lib/commonjs/implementation/bluebreeze_device.js.map +1 -0
  21. package/lib/commonjs/implementation/bluebreeze_scan_result.js +20 -0
  22. package/lib/commonjs/implementation/bluebreeze_scan_result.js.map +1 -0
  23. package/lib/commonjs/implementation/bluebreeze_service.js +15 -0
  24. package/lib/commonjs/implementation/bluebreeze_service.js.map +1 -0
  25. package/lib/commonjs/implementation/emitters.js +32 -0
  26. package/lib/commonjs/implementation/emitters.js.map +1 -0
  27. package/lib/commonjs/index.js +171 -0
  28. package/lib/commonjs/index.js.map +1 -0
  29. package/lib/module/NativeBlueBreeze.js +10 -0
  30. package/lib/module/NativeBlueBreeze.js.map +1 -0
  31. package/lib/module/implementation/bluebreeze_characteristic.js +23 -0
  32. package/lib/module/implementation/bluebreeze_characteristic.js.map +1 -0
  33. package/lib/module/implementation/bluebreeze_device.js +25 -0
  34. package/lib/module/implementation/bluebreeze_device.js.map +1 -0
  35. package/lib/module/implementation/bluebreeze_scan_result.js +15 -0
  36. package/lib/module/implementation/bluebreeze_scan_result.js.map +1 -0
  37. package/lib/module/implementation/bluebreeze_service.js +10 -0
  38. package/lib/module/implementation/bluebreeze_service.js.map +1 -0
  39. package/lib/module/implementation/emitters.js +25 -0
  40. package/lib/module/implementation/emitters.js.map +1 -0
  41. package/lib/module/index.js +168 -0
  42. package/lib/module/index.js.map +1 -0
  43. package/lib/typescript/commonjs/package.json +1 -0
  44. package/lib/typescript/commonjs/src/NativeBlueBreeze.d.ts +86 -0
  45. package/lib/typescript/commonjs/src/NativeBlueBreeze.d.ts.map +1 -0
  46. package/lib/typescript/commonjs/src/implementation/bluebreeze_characteristic.d.ts +14 -0
  47. package/lib/typescript/commonjs/src/implementation/bluebreeze_characteristic.d.ts.map +1 -0
  48. package/lib/typescript/commonjs/src/implementation/bluebreeze_device.d.ts +15 -0
  49. package/lib/typescript/commonjs/src/implementation/bluebreeze_device.d.ts.map +1 -0
  50. package/lib/typescript/commonjs/src/implementation/bluebreeze_scan_result.d.ts +13 -0
  51. package/lib/typescript/commonjs/src/implementation/bluebreeze_scan_result.d.ts.map +1 -0
  52. package/lib/typescript/commonjs/src/implementation/bluebreeze_service.d.ts +8 -0
  53. package/lib/typescript/commonjs/src/implementation/bluebreeze_service.d.ts.map +1 -0
  54. package/lib/typescript/commonjs/src/implementation/emitters.d.ts +12 -0
  55. package/lib/typescript/commonjs/src/implementation/emitters.d.ts.map +1 -0
  56. package/lib/typescript/commonjs/src/index.d.ts +30 -0
  57. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  58. package/lib/typescript/module/package.json +1 -0
  59. package/lib/typescript/module/src/NativeBlueBreeze.d.ts +86 -0
  60. package/lib/typescript/module/src/NativeBlueBreeze.d.ts.map +1 -0
  61. package/lib/typescript/module/src/implementation/bluebreeze_characteristic.d.ts +14 -0
  62. package/lib/typescript/module/src/implementation/bluebreeze_characteristic.d.ts.map +1 -0
  63. package/lib/typescript/module/src/implementation/bluebreeze_device.d.ts +15 -0
  64. package/lib/typescript/module/src/implementation/bluebreeze_device.d.ts.map +1 -0
  65. package/lib/typescript/module/src/implementation/bluebreeze_scan_result.d.ts +13 -0
  66. package/lib/typescript/module/src/implementation/bluebreeze_scan_result.d.ts.map +1 -0
  67. package/lib/typescript/module/src/implementation/bluebreeze_service.d.ts +8 -0
  68. package/lib/typescript/module/src/implementation/bluebreeze_service.d.ts.map +1 -0
  69. package/lib/typescript/module/src/implementation/emitters.d.ts +12 -0
  70. package/lib/typescript/module/src/implementation/emitters.d.ts.map +1 -0
  71. package/lib/typescript/module/src/index.d.ts +30 -0
  72. package/lib/typescript/module/src/index.d.ts.map +1 -0
  73. package/package.json +25 -21
  74. package/react-native-bluebreeze.podspec +1 -1
  75. package/src/NativeBlueBreeze.ts +83 -104
  76. package/src/implementation/bluebreeze_characteristic.ts +40 -0
  77. package/src/implementation/bluebreeze_device.ts +40 -0
  78. package/src/implementation/bluebreeze_scan_result.ts +32 -0
  79. package/src/implementation/bluebreeze_service.ts +17 -0
  80. package/src/implementation/emitters.ts +28 -0
  81. package/src/index.tsx +289 -81
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.BBService = void 0;
7
+ class BBService {
8
+ constructor(id, name, characteristics) {
9
+ this.id = id;
10
+ this.name = name;
11
+ this.characteristics = characteristics;
12
+ }
13
+ }
14
+ exports.BBService = BBService;
15
+ //# sourceMappingURL=bluebreeze_service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["BBService","constructor","id","name","characteristics","exports"],"sourceRoot":"../../../src","sources":["implementation/bluebreeze_service.ts"],"mappings":";;;;;;AAEO,MAAMA,SAAS,CAAC;EACnBC,WAAWA,CACPC,EAAU,EACVC,IAAwB,EACxBC,eAAmC,EACrC;IACE,IAAI,CAACF,EAAE,GAAGA,EAAE;IACZ,IAAI,CAACC,IAAI,GAAGA,IAAI;IAChB,IAAI,CAACC,eAAe,GAAGA,eAAe;EAC1C;AAKJ;AAACC,OAAA,CAAAL,SAAA,GAAAA,SAAA","ignoreList":[]}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.StateEventEmitter = exports.EventEmitter = void 0;
7
+ var _EventEmitter2 = _interopRequireDefault(require("react-native/Libraries/vendor/emitter/EventEmitter"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
+ class EventEmitter extends _EventEmitter2.default {
10
+ constructor() {
11
+ super();
12
+ }
13
+ add(v) {
14
+ this.emit('value', v);
15
+ }
16
+ onValue = handler => {
17
+ return this.addListener('value', handler);
18
+ };
19
+ }
20
+ exports.EventEmitter = EventEmitter;
21
+ class StateEventEmitter extends EventEmitter {
22
+ constructor(initialValue = undefined) {
23
+ super();
24
+ this.value = initialValue;
25
+ }
26
+ add(v) {
27
+ this.value = v;
28
+ super.add(v);
29
+ }
30
+ }
31
+ exports.StateEventEmitter = StateEventEmitter;
32
+ //# sourceMappingURL=emitters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_EventEmitter2","_interopRequireDefault","require","e","__esModule","default","EventEmitter","_EventEmitter","constructor","add","v","emit","onValue","handler","addListener","exports","StateEventEmitter","initialValue","undefined","value"],"sourceRoot":"../../../src","sources":["implementation/emitters.ts"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA4G,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAErG,MAAMG,YAAY,SAAYC,sBAAa,CAAC;EAC/CC,WAAWA,CAAA,EAAG;IACV,KAAK,CAAC,CAAC;EACX;EAEAC,GAAGA,CAACC,CAAI,EAAE;IACN,IAAI,CAACC,IAAI,CAAC,OAAO,EAAED,CAAC,CAAC;EACzB;EAEAE,OAAO,GAAsDC,OAAO,IAAK;IACrE,OAAO,IAAI,CAACC,WAAW,CAAC,OAAO,EAAED,OAAO,CAAC;EAC7C,CAAC;AACL;AAACE,OAAA,CAAAT,YAAA,GAAAA,YAAA;AACM,MAAMU,iBAAiB,SAAYV,YAAY,CAAI;EACtDE,WAAWA,CAACS,YAA2B,GAAGC,SAAS,EAAE;IACjD,KAAK,CAAC,CAAC;IACP,IAAI,CAACC,KAAK,GAAGF,YAAY;EAC7B;EAEAR,GAAGA,CAACC,CAAI,EAAE;IACN,IAAI,CAACS,KAAK,GAAGT,CAAC;IACd,KAAK,CAACD,GAAG,CAACC,CAAC,CAAC;EAChB;AAGJ;AAACK,OAAA,CAAAC,iBAAA,GAAAA,iBAAA","ignoreList":[]}
@@ -0,0 +1,171 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _bluebreeze_characteristic = require("./implementation/bluebreeze_characteristic.js");
8
+ var _bluebreeze_device = require("./implementation/bluebreeze_device.js");
9
+ var _bluebreeze_scan_result = require("./implementation/bluebreeze_scan_result.js");
10
+ var _bluebreeze_service = require("./implementation/bluebreeze_service.js");
11
+ var _emitters = require("./implementation/emitters.js");
12
+ var _NativeBlueBreeze = _interopRequireDefault(require("./NativeBlueBreeze.js"));
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
+ // State
15
+
16
+ const state = new _emitters.StateEventEmitter(_NativeBlueBreeze.default.state());
17
+ _NativeBlueBreeze.default.stateEmitter(value => {
18
+ state.add(value);
19
+ });
20
+
21
+ // Authorization to use BLE
22
+
23
+ const authorizationStatus = new _emitters.StateEventEmitter(_NativeBlueBreeze.default.authorizationStatus());
24
+ _NativeBlueBreeze.default.authorizationStatusEmitter(value => {
25
+ authorizationStatus.add(value);
26
+ });
27
+ const authorizationRequest = _NativeBlueBreeze.default.authorizationRequest;
28
+ const authorizationOpenSettings = _NativeBlueBreeze.default.authorizationOpenSettings;
29
+
30
+ // Scanning
31
+
32
+ const scanEnabled = new _emitters.StateEventEmitter(_NativeBlueBreeze.default.scanEnabled());
33
+ _NativeBlueBreeze.default.scanEnabledEmitter(value => {
34
+ scanEnabled.add(value);
35
+ });
36
+ const scanResults = new _emitters.EventEmitter();
37
+ _NativeBlueBreeze.default.scanResultEmitter(value => {
38
+ const device = devices.value?.get(value.id);
39
+ if (device == undefined) {
40
+ return;
41
+ }
42
+ scanResults.add(convertScanResult(device, value));
43
+ });
44
+ const scanStart = _NativeBlueBreeze.default.scanStart;
45
+ const scanStop = _NativeBlueBreeze.default.scanStop;
46
+
47
+ // Device
48
+
49
+ const devices = new _emitters.StateEventEmitter(new Map(_NativeBlueBreeze.default.devices().map(d => [d.id, convertDevice(d)])));
50
+ _NativeBlueBreeze.default.devicesEmitter(value => {
51
+ devices.add(new Map(value.map(d => [d.id, devices.value?.get(d.id) ?? convertDevice(d)])));
52
+ });
53
+
54
+ // Device services
55
+
56
+ const _deviceServices = new Map();
57
+ const deviceServices = id => {
58
+ return mapGetOrSet(_deviceServices, id, () => new _emitters.StateEventEmitter(_NativeBlueBreeze.default.deviceServices(id).map(s => convertDeviceService(id, s))));
59
+ };
60
+ _NativeBlueBreeze.default.deviceServicesEmitter(value => {
61
+ deviceServices(value.id).add(value.value.map(s => convertDeviceService(value.id, s)));
62
+ });
63
+
64
+ // Device connection status
65
+
66
+ const _deviceConnectionStatus = new Map();
67
+ const deviceConnectionStatus = id => {
68
+ return mapGetOrSet(_deviceConnectionStatus, id, () => new _emitters.StateEventEmitter(_NativeBlueBreeze.default.deviceConnectionStatus(id)));
69
+ };
70
+ _NativeBlueBreeze.default.deviceConnectionStatusEmitter(value => {
71
+ deviceConnectionStatus(value.id).add(value.value);
72
+ });
73
+
74
+ // Device MTU
75
+
76
+ const _deviceMTU = new Map();
77
+ const deviceMTU = id => {
78
+ return mapGetOrSet(_deviceMTU, id, () => new _emitters.StateEventEmitter(_NativeBlueBreeze.default.deviceMTU(id)));
79
+ };
80
+ _NativeBlueBreeze.default.deviceMTUEmitter(value => {
81
+ deviceMTU(value.id).add(value.value);
82
+ });
83
+
84
+ // Device operation
85
+
86
+ const deviceConnect = _NativeBlueBreeze.default.deviceConnect;
87
+ const deviceDisconnect = _NativeBlueBreeze.default.deviceDisconnect;
88
+ const deviceDiscoverServices = _NativeBlueBreeze.default.deviceDiscoverServices;
89
+ const deviceRequestMTU = _NativeBlueBreeze.default.deviceRequestMTU;
90
+
91
+ // Device characteristic notify enabled
92
+
93
+ const _deviceCharacteristicNotifyEnabled = new Map();
94
+ const deviceCharacteristicNotifyEnabled = (id, serviceId, characteristicId) => {
95
+ const deviceMap = mapGetOrSet(_deviceCharacteristicNotifyEnabled, id, () => new Map());
96
+ const serviceMap = mapGetOrSet(deviceMap, serviceId, () => new Map());
97
+ return mapGetOrSet(serviceMap, characteristicId, () => new _emitters.StateEventEmitter(_NativeBlueBreeze.default.deviceCharacteristicNotifyEnabled(id, serviceId, characteristicId)));
98
+ };
99
+ _NativeBlueBreeze.default.deviceCharacteristicNotifyEnabledEmitter(value => {
100
+ deviceCharacteristicNotifyEnabled(value.id, value.serviceId, value.characteristicId).add(value.value);
101
+ });
102
+
103
+ // Device characteristic data
104
+
105
+ const _deviceCharacteristicData = new Map();
106
+ const deviceCharacteristicData = (id, serviceId, characteristicId) => {
107
+ const deviceMap = mapGetOrSet(_deviceCharacteristicData, id, () => new Map());
108
+ const serviceMap = mapGetOrSet(deviceMap, serviceId, () => new Map());
109
+ return mapGetOrSet(serviceMap, characteristicId, () => new _emitters.StateEventEmitter(_NativeBlueBreeze.default.deviceCharacteristicData(id, serviceId, characteristicId)));
110
+ };
111
+ _NativeBlueBreeze.default.deviceCharacteristicDataEmitter(value => {
112
+ deviceCharacteristicData(value.id, value.serviceId, value.characteristicId).add(value.value);
113
+ });
114
+
115
+ // Device characteristic operations
116
+
117
+ const deviceCharacteristicRead = _NativeBlueBreeze.default.deviceCharacteristicRead;
118
+ const deviceCharacteristicWrite = _NativeBlueBreeze.default.deviceCharacteristicWrite;
119
+ const deviceCharacteristicSubscribe = _NativeBlueBreeze.default.deviceCharacteristicSubscribe;
120
+ const deviceCharacteristicUnsubscribe = _NativeBlueBreeze.default.deviceCharacteristicUnsubscribe;
121
+
122
+ // Map helper
123
+
124
+ function mapGetOrSet(map, key, defaultValue) {
125
+ if (map.get(key) == undefined) {
126
+ map.set(key, defaultValue());
127
+ }
128
+ return map.get(key);
129
+ }
130
+
131
+ // Object decoders
132
+
133
+ const convertDevice = device => {
134
+ return new _bluebreeze_device.BBDevice(device.id, device.name);
135
+ };
136
+ const convertScanResult = (device, scanResult) => {
137
+ return new _bluebreeze_scan_result.BBScanResult(device, scanResult.name, scanResult.rssi, scanResult.connectable, scanResult.advertisedServices, scanResult.manufacturerId, scanResult.manufacturerName, scanResult.manufacturerData);
138
+ };
139
+ const convertDeviceService = (deviceId, service) => {
140
+ return new _bluebreeze_service.BBService(service.id, service.name, service.characteristics.map(c => convertDeviceCharacteristic(deviceId, service.id, c)));
141
+ };
142
+ const convertDeviceCharacteristic = (deviceId, serviceId, characteristic) => {
143
+ return new _bluebreeze_characteristic.BBCharacteristic(deviceId, serviceId, characteristic.id, characteristic.name, characteristic.properties);
144
+ };
145
+
146
+ // Export
147
+ var _default = exports.default = {
148
+ state,
149
+ authorizationStatus,
150
+ authorizationRequest,
151
+ authorizationOpenSettings,
152
+ scanEnabled,
153
+ scanResults,
154
+ scanStart,
155
+ scanStop,
156
+ devices,
157
+ deviceServices,
158
+ deviceConnectionStatus,
159
+ deviceMTU,
160
+ deviceConnect,
161
+ deviceDisconnect,
162
+ deviceDiscoverServices,
163
+ deviceRequestMTU,
164
+ deviceCharacteristicNotifyEnabled,
165
+ deviceCharacteristicData,
166
+ deviceCharacteristicRead,
167
+ deviceCharacteristicWrite,
168
+ deviceCharacteristicSubscribe,
169
+ deviceCharacteristicUnsubscribe
170
+ };
171
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_bluebreeze_characteristic","require","_bluebreeze_device","_bluebreeze_scan_result","_bluebreeze_service","_emitters","_NativeBlueBreeze","_interopRequireDefault","e","__esModule","default","state","StateEventEmitter","NativeBlueBreeze","stateEmitter","value","add","authorizationStatus","authorizationStatusEmitter","authorizationRequest","authorizationOpenSettings","scanEnabled","scanEnabledEmitter","scanResults","EventEmitter","scanResultEmitter","device","devices","get","id","undefined","convertScanResult","scanStart","scanStop","Map","map","d","convertDevice","devicesEmitter","_deviceServices","deviceServices","mapGetOrSet","s","convertDeviceService","deviceServicesEmitter","_deviceConnectionStatus","deviceConnectionStatus","deviceConnectionStatusEmitter","_deviceMTU","deviceMTU","deviceMTUEmitter","deviceConnect","deviceDisconnect","deviceDiscoverServices","deviceRequestMTU","_deviceCharacteristicNotifyEnabled","deviceCharacteristicNotifyEnabled","serviceId","characteristicId","deviceMap","serviceMap","deviceCharacteristicNotifyEnabledEmitter","_deviceCharacteristicData","deviceCharacteristicData","deviceCharacteristicDataEmitter","deviceCharacteristicRead","deviceCharacteristicWrite","deviceCharacteristicSubscribe","deviceCharacteristicUnsubscribe","key","defaultValue","set","BBDevice","name","scanResult","BBScanResult","rssi","connectable","advertisedServices","manufacturerId","manufacturerName","manufacturerData","deviceId","service","BBService","characteristics","c","convertDeviceCharacteristic","characteristic","BBCharacteristic","properties","_default","exports"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;AAAA,IAAAA,0BAAA,GAAAC,OAAA;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,KACd;EACZ,OAAO,IAAIC,6BAAS,CAChBD,OAAO,CAACtD,EAAE,EACVsD,OAAO,CAACV,IAAI,EACZU,OAAO,CAACE,eAAe,CAAClD,GAAG,CACtBmD,CAAC,IAAKC,2BAA2B,CAACL,QAAQ,EAAEC,OAAO,CAACtD,EAAE,EAAEyD,CAAC,CAC9D,CACJ,CAAC;AACL,CAAC;AAED,MAAMC,2BAA2B,GAAGA,CAChCL,QAAgB,EAChBzB,SAAiB,EACjB+B,cAAwC,KACrB;EACnB,OAAO,IAAIC,2CAAgB,CACvBP,QAAQ,EACRzB,SAAS,EACT+B,cAAc,CAAC3D,EAAE,EACjB2D,cAAc,CAACf,IAAI,EACnBe,cAAc,CAACE,UACnB,CAAC;AACL,CAAC;;AAED;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAlF,OAAA,GAGe;EACXC,KAAK;EACLM,mBAAmB;EACnBE,oBAAoB;EACpBC,yBAAyB;EACzBC,WAAW;EACXE,WAAW;EACXS,SAAS;EACTC,QAAQ;EACRN,OAAO;EACPa,cAAc;EACdM,sBAAsB;EACtBG,SAAS;EACTE,aAAa;EACbC,gBAAgB;EAChBC,sBAAsB;EACtBC,gBAAgB;EAChBE,iCAAiC;EACjCO,wBAAwB;EACxBE,wBAAwB;EACxBC,yBAAyB;EACzBC,6BAA6B;EAC7BC;AACJ,CAAC","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ import { TurboModuleRegistry } from 'react-native';
4
+
5
+ /// Events
6
+
7
+ /// Module specifications
8
+
9
+ export default TurboModuleRegistry.getEnforcing('BlueBreeze');
10
+ //# sourceMappingURL=NativeBlueBreeze.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeBlueBreeze.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;;AAGlD;;AA2DA;;AAyDA,eAAeA,mBAAmB,CAACC,YAAY,CAAO,YAAY,CAAC","ignoreList":[]}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ import BlueBreeze from "react-native-bluebreeze";
4
+ export class BBCharacteristic {
5
+ constructor(deviceId, serviceId, id, name, properties) {
6
+ this.id = id;
7
+ this.name = name;
8
+ this.properties = properties;
9
+ this.data = BlueBreeze.deviceCharacteristicData(deviceId, serviceId, id);
10
+ this.notifyEnabled = BlueBreeze.deviceCharacteristicNotifyEnabled(deviceId, serviceId, id);
11
+ this.read = () => BlueBreeze.deviceCharacteristicRead(deviceId, serviceId, id);
12
+ this.write = (data, withResponse) => BlueBreeze.deviceCharacteristicWrite(deviceId, serviceId, id, data, withResponse);
13
+ this.subscribe = () => BlueBreeze.deviceCharacteristicSubscribe(deviceId, serviceId, id);
14
+ this.unsubscribe = () => BlueBreeze.deviceCharacteristicUnsubscribe(deviceId, serviceId, id);
15
+ }
16
+
17
+ // Data
18
+
19
+ // Notifying
20
+
21
+ // Operations
22
+ }
23
+ //# sourceMappingURL=bluebreeze_characteristic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["BlueBreeze","BBCharacteristic","constructor","deviceId","serviceId","id","name","properties","data","deviceCharacteristicData","notifyEnabled","deviceCharacteristicNotifyEnabled","read","deviceCharacteristicRead","write","withResponse","deviceCharacteristicWrite","subscribe","deviceCharacteristicSubscribe","unsubscribe","deviceCharacteristicUnsubscribe"],"sourceRoot":"../../../src","sources":["implementation/bluebreeze_characteristic.ts"],"mappings":";;AAAA,OAAOA,UAAU,MAAM,yBAAyB;AAGhD,OAAO,MAAMC,gBAAgB,CAAC;EAC1BC,WAAWA,CACPC,QAAgB,EAChBC,SAAiB,EACjBC,EAAU,EACVC,IAAwB,EACxBC,UAAoB,EACtB;IACE,IAAI,CAACF,EAAE,GAAGA,EAAE;IACZ,IAAI,CAACC,IAAI,GAAGA,IAAI;IAChB,IAAI,CAACC,UAAU,GAAGA,UAAU;IAE5B,IAAI,CAACC,IAAI,GAAGR,UAAU,CAACS,wBAAwB,CAACN,QAAQ,EAAEC,SAAS,EAAEC,EAAE,CAAC;IACxE,IAAI,CAACK,aAAa,GAAGV,UAAU,CAACW,iCAAiC,CAACR,QAAQ,EAAEC,SAAS,EAAEC,EAAE,CAAC;IAE1F,IAAI,CAACO,IAAI,GAAG,MAAMZ,UAAU,CAACa,wBAAwB,CAACV,QAAQ,EAAEC,SAAS,EAAEC,EAAE,CAAC;IAC9E,IAAI,CAACS,KAAK,GAAG,CAACN,IAAc,EAAEO,YAAqB,KAAKf,UAAU,CAACgB,yBAAyB,CAACb,QAAQ,EAAEC,SAAS,EAAEC,EAAE,EAAEG,IAAI,EAAEO,YAAY,CAAC;IACzI,IAAI,CAACE,SAAS,GAAG,MAAMjB,UAAU,CAACkB,6BAA6B,CAACf,QAAQ,EAAEC,SAAS,EAAEC,EAAE,CAAC;IACxF,IAAI,CAACc,WAAW,GAAG,MAAMnB,UAAU,CAACoB,+BAA+B,CAACjB,QAAQ,EAAEC,SAAS,EAAEC,EAAE,CAAC;EAChG;;EAMA;;EAGA;;EAGA;AAKJ","ignoreList":[]}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ import BlueBreeze from "react-native-bluebreeze";
4
+ export class BBDevice {
5
+ constructor(id, name) {
6
+ this.id = id;
7
+ this.name = name;
8
+ this.services = BlueBreeze.deviceServices(id);
9
+ this.connectionStatus = BlueBreeze.deviceConnectionStatus(id);
10
+ this.mtu = BlueBreeze.deviceMTU(id);
11
+ this.connect = () => BlueBreeze.deviceConnect(id);
12
+ this.disconnect = () => BlueBreeze.deviceDisconnect(id);
13
+ this.discoverServices = () => BlueBreeze.deviceDiscoverServices(id);
14
+ this.requestMTU = mtu => BlueBreeze.deviceRequestMTU(id, mtu);
15
+ }
16
+
17
+ // Services
18
+
19
+ // Connection status
20
+
21
+ // MTU
22
+
23
+ // Operations
24
+ }
25
+ //# sourceMappingURL=bluebreeze_device.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["BlueBreeze","BBDevice","constructor","id","name","services","deviceServices","connectionStatus","deviceConnectionStatus","mtu","deviceMTU","connect","deviceConnect","disconnect","deviceDisconnect","discoverServices","deviceDiscoverServices","requestMTU","deviceRequestMTU"],"sourceRoot":"../../../src","sources":["implementation/bluebreeze_device.ts"],"mappings":";;AAAA,OAAOA,UAAU,MAAM,yBAAyB;AAIhD,OAAO,MAAMC,QAAQ,CAAC;EAClBC,WAAWA,CACPC,EAAU,EACVC,IAAa,EACf;IACE,IAAI,CAACD,EAAE,GAAGA,EAAE;IACZ,IAAI,CAACC,IAAI,GAAGA,IAAI;IAEhB,IAAI,CAACC,QAAQ,GAAGL,UAAU,CAACM,cAAc,CAACH,EAAE,CAAC;IAC7C,IAAI,CAACI,gBAAgB,GAAGP,UAAU,CAACQ,sBAAsB,CAACL,EAAE,CAAC;IAC7D,IAAI,CAACM,GAAG,GAAGT,UAAU,CAACU,SAAS,CAACP,EAAE,CAAC;IAEnC,IAAI,CAACQ,OAAO,GAAG,MAAMX,UAAU,CAACY,aAAa,CAACT,EAAE,CAAC;IACjD,IAAI,CAACU,UAAU,GAAG,MAAMb,UAAU,CAACc,gBAAgB,CAACX,EAAE,CAAC;IACvD,IAAI,CAACY,gBAAgB,GAAG,MAAMf,UAAU,CAACgB,sBAAsB,CAACb,EAAE,CAAC;IACnE,IAAI,CAACc,UAAU,GAAIR,GAAW,IAAKT,UAAU,CAACkB,gBAAgB,CAACf,EAAE,EAAEM,GAAG,CAAC;EAC3E;;EAKA;;EAGA;;EAGA;;EAGA;AAKJ","ignoreList":[]}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ export class BBScanResult {
4
+ constructor(device, name, rssi, connectable, advertisedServices, manufacturerId, manufacturerName, manufacturerData) {
5
+ this.device = device;
6
+ this.name = name;
7
+ this.rssi = rssi;
8
+ this.connectable = connectable;
9
+ this.advertisedServices = advertisedServices;
10
+ this.manufacturerId = manufacturerId;
11
+ this.manufacturerName = manufacturerName;
12
+ this.manufacturerData = manufacturerData;
13
+ }
14
+ }
15
+ //# sourceMappingURL=bluebreeze_scan_result.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["BBScanResult","constructor","device","name","rssi","connectable","advertisedServices","manufacturerId","manufacturerName","manufacturerData"],"sourceRoot":"../../../src","sources":["implementation/bluebreeze_scan_result.ts"],"mappings":";;AAEA,OAAO,MAAMA,YAAY,CAAC;EACtBC,WAAWA,CACPC,MAAgB,EAChBC,IAAwB,EACxBC,IAAY,EACZC,WAAoB,EACpBC,kBAA4B,EAC5BC,cAAuB,EACvBC,gBAAyB,EACzBC,gBAA2B,EAC7B;IACE,IAAI,CAACP,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACC,IAAI,GAAGA,IAAI;IAChB,IAAI,CAACC,IAAI,GAAGA,IAAI;IAChB,IAAI,CAACC,WAAW,GAAGA,WAAW;IAC9B,IAAI,CAACC,kBAAkB,GAAGA,kBAAkB;IAC5C,IAAI,CAACC,cAAc,GAAGA,cAAc;IACpC,IAAI,CAACC,gBAAgB,GAAGA,gBAAgB;IACxC,IAAI,CAACC,gBAAgB,GAAGA,gBAAgB;EAC5C;AAUJ","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ export class BBService {
4
+ constructor(id, name, characteristics) {
5
+ this.id = id;
6
+ this.name = name;
7
+ this.characteristics = characteristics;
8
+ }
9
+ }
10
+ //# sourceMappingURL=bluebreeze_service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["BBService","constructor","id","name","characteristics"],"sourceRoot":"../../../src","sources":["implementation/bluebreeze_service.ts"],"mappings":";;AAEA,OAAO,MAAMA,SAAS,CAAC;EACnBC,WAAWA,CACPC,EAAU,EACVC,IAAwB,EACxBC,eAAmC,EACrC;IACE,IAAI,CAACF,EAAE,GAAGA,EAAE;IACZ,IAAI,CAACC,IAAI,GAAGA,IAAI;IAChB,IAAI,CAACC,eAAe,GAAGA,eAAe;EAC1C;AAKJ","ignoreList":[]}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ import _EventEmitter from "react-native/Libraries/vendor/emitter/EventEmitter";
4
+ export class EventEmitter extends _EventEmitter {
5
+ constructor() {
6
+ super();
7
+ }
8
+ add(v) {
9
+ this.emit('value', v);
10
+ }
11
+ onValue = handler => {
12
+ return this.addListener('value', handler);
13
+ };
14
+ }
15
+ export class StateEventEmitter extends EventEmitter {
16
+ constructor(initialValue = undefined) {
17
+ super();
18
+ this.value = initialValue;
19
+ }
20
+ add(v) {
21
+ this.value = v;
22
+ super.add(v);
23
+ }
24
+ }
25
+ //# sourceMappingURL=emitters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_EventEmitter","EventEmitter","constructor","add","v","emit","onValue","handler","addListener","StateEventEmitter","initialValue","undefined","value"],"sourceRoot":"../../../src","sources":["implementation/emitters.ts"],"mappings":";;AAAA,OAAOA,aAAa,MAAoC,oDAAoD;AAE5G,OAAO,MAAMC,YAAY,SAAYD,aAAa,CAAC;EAC/CE,WAAWA,CAAA,EAAG;IACV,KAAK,CAAC,CAAC;EACX;EAEAC,GAAGA,CAACC,CAAI,EAAE;IACN,IAAI,CAACC,IAAI,CAAC,OAAO,EAAED,CAAC,CAAC;EACzB;EAEAE,OAAO,GAAsDC,OAAO,IAAK;IACrE,OAAO,IAAI,CAACC,WAAW,CAAC,OAAO,EAAED,OAAO,CAAC;EAC7C,CAAC;AACL;AACA,OAAO,MAAME,iBAAiB,SAAYR,YAAY,CAAI;EACtDC,WAAWA,CAACQ,YAA2B,GAAGC,SAAS,EAAE;IACjD,KAAK,CAAC,CAAC;IACP,IAAI,CAACC,KAAK,GAAGF,YAAY;EAC7B;EAEAP,GAAGA,CAACC,CAAI,EAAE;IACN,IAAI,CAACQ,KAAK,GAAGR,CAAC;IACd,KAAK,CAACD,GAAG,CAACC,CAAC,CAAC;EAChB;AAGJ","ignoreList":[]}
@@ -0,0 +1,168 @@
1
+ "use strict";
2
+
3
+ import { BBCharacteristic } from "./implementation/bluebreeze_characteristic.js";
4
+ import { BBDevice } from "./implementation/bluebreeze_device.js";
5
+ import { BBScanResult } from "./implementation/bluebreeze_scan_result.js";
6
+ import { BBService } from "./implementation/bluebreeze_service.js";
7
+ import { EventEmitter, StateEventEmitter } from "./implementation/emitters.js";
8
+ import NativeBlueBreeze from "./NativeBlueBreeze.js";
9
+
10
+ // State
11
+
12
+ const state = new StateEventEmitter(NativeBlueBreeze.state());
13
+ NativeBlueBreeze.stateEmitter(value => {
14
+ state.add(value);
15
+ });
16
+
17
+ // Authorization to use BLE
18
+
19
+ const authorizationStatus = new StateEventEmitter(NativeBlueBreeze.authorizationStatus());
20
+ NativeBlueBreeze.authorizationStatusEmitter(value => {
21
+ authorizationStatus.add(value);
22
+ });
23
+ const authorizationRequest = NativeBlueBreeze.authorizationRequest;
24
+ const authorizationOpenSettings = NativeBlueBreeze.authorizationOpenSettings;
25
+
26
+ // Scanning
27
+
28
+ const scanEnabled = new StateEventEmitter(NativeBlueBreeze.scanEnabled());
29
+ NativeBlueBreeze.scanEnabledEmitter(value => {
30
+ scanEnabled.add(value);
31
+ });
32
+ const scanResults = new EventEmitter();
33
+ NativeBlueBreeze.scanResultEmitter(value => {
34
+ const device = devices.value?.get(value.id);
35
+ if (device == undefined) {
36
+ return;
37
+ }
38
+ scanResults.add(convertScanResult(device, value));
39
+ });
40
+ const scanStart = NativeBlueBreeze.scanStart;
41
+ const scanStop = NativeBlueBreeze.scanStop;
42
+
43
+ // Device
44
+
45
+ const devices = new StateEventEmitter(new Map(NativeBlueBreeze.devices().map(d => [d.id, convertDevice(d)])));
46
+ NativeBlueBreeze.devicesEmitter(value => {
47
+ devices.add(new Map(value.map(d => [d.id, devices.value?.get(d.id) ?? convertDevice(d)])));
48
+ });
49
+
50
+ // Device services
51
+
52
+ const _deviceServices = new Map();
53
+ const deviceServices = id => {
54
+ return mapGetOrSet(_deviceServices, id, () => new StateEventEmitter(NativeBlueBreeze.deviceServices(id).map(s => convertDeviceService(id, s))));
55
+ };
56
+ NativeBlueBreeze.deviceServicesEmitter(value => {
57
+ deviceServices(value.id).add(value.value.map(s => convertDeviceService(value.id, s)));
58
+ });
59
+
60
+ // Device connection status
61
+
62
+ const _deviceConnectionStatus = new Map();
63
+ const deviceConnectionStatus = id => {
64
+ return mapGetOrSet(_deviceConnectionStatus, id, () => new StateEventEmitter(NativeBlueBreeze.deviceConnectionStatus(id)));
65
+ };
66
+ NativeBlueBreeze.deviceConnectionStatusEmitter(value => {
67
+ deviceConnectionStatus(value.id).add(value.value);
68
+ });
69
+
70
+ // Device MTU
71
+
72
+ const _deviceMTU = new Map();
73
+ const deviceMTU = id => {
74
+ return mapGetOrSet(_deviceMTU, id, () => new StateEventEmitter(NativeBlueBreeze.deviceMTU(id)));
75
+ };
76
+ NativeBlueBreeze.deviceMTUEmitter(value => {
77
+ deviceMTU(value.id).add(value.value);
78
+ });
79
+
80
+ // Device operation
81
+
82
+ const deviceConnect = NativeBlueBreeze.deviceConnect;
83
+ const deviceDisconnect = NativeBlueBreeze.deviceDisconnect;
84
+ const deviceDiscoverServices = NativeBlueBreeze.deviceDiscoverServices;
85
+ const deviceRequestMTU = NativeBlueBreeze.deviceRequestMTU;
86
+
87
+ // Device characteristic notify enabled
88
+
89
+ const _deviceCharacteristicNotifyEnabled = new Map();
90
+ const deviceCharacteristicNotifyEnabled = (id, serviceId, characteristicId) => {
91
+ const deviceMap = mapGetOrSet(_deviceCharacteristicNotifyEnabled, id, () => new Map());
92
+ const serviceMap = mapGetOrSet(deviceMap, serviceId, () => new Map());
93
+ return mapGetOrSet(serviceMap, characteristicId, () => new StateEventEmitter(NativeBlueBreeze.deviceCharacteristicNotifyEnabled(id, serviceId, characteristicId)));
94
+ };
95
+ NativeBlueBreeze.deviceCharacteristicNotifyEnabledEmitter(value => {
96
+ deviceCharacteristicNotifyEnabled(value.id, value.serviceId, value.characteristicId).add(value.value);
97
+ });
98
+
99
+ // Device characteristic data
100
+
101
+ const _deviceCharacteristicData = new Map();
102
+ const deviceCharacteristicData = (id, serviceId, characteristicId) => {
103
+ const deviceMap = mapGetOrSet(_deviceCharacteristicData, id, () => new Map());
104
+ const serviceMap = mapGetOrSet(deviceMap, serviceId, () => new Map());
105
+ return mapGetOrSet(serviceMap, characteristicId, () => new StateEventEmitter(NativeBlueBreeze.deviceCharacteristicData(id, serviceId, characteristicId)));
106
+ };
107
+ NativeBlueBreeze.deviceCharacteristicDataEmitter(value => {
108
+ deviceCharacteristicData(value.id, value.serviceId, value.characteristicId).add(value.value);
109
+ });
110
+
111
+ // Device characteristic operations
112
+
113
+ const deviceCharacteristicRead = NativeBlueBreeze.deviceCharacteristicRead;
114
+ const deviceCharacteristicWrite = NativeBlueBreeze.deviceCharacteristicWrite;
115
+ const deviceCharacteristicSubscribe = NativeBlueBreeze.deviceCharacteristicSubscribe;
116
+ const deviceCharacteristicUnsubscribe = NativeBlueBreeze.deviceCharacteristicUnsubscribe;
117
+
118
+ // Map helper
119
+
120
+ function mapGetOrSet(map, key, defaultValue) {
121
+ if (map.get(key) == undefined) {
122
+ map.set(key, defaultValue());
123
+ }
124
+ return map.get(key);
125
+ }
126
+
127
+ // Object decoders
128
+
129
+ const convertDevice = device => {
130
+ return new BBDevice(device.id, device.name);
131
+ };
132
+ const convertScanResult = (device, scanResult) => {
133
+ return new BBScanResult(device, scanResult.name, scanResult.rssi, scanResult.connectable, scanResult.advertisedServices, scanResult.manufacturerId, scanResult.manufacturerName, scanResult.manufacturerData);
134
+ };
135
+ const convertDeviceService = (deviceId, service) => {
136
+ return new BBService(service.id, service.name, service.characteristics.map(c => convertDeviceCharacteristic(deviceId, service.id, c)));
137
+ };
138
+ const convertDeviceCharacteristic = (deviceId, serviceId, characteristic) => {
139
+ return new BBCharacteristic(deviceId, serviceId, characteristic.id, characteristic.name, characteristic.properties);
140
+ };
141
+
142
+ // Export
143
+
144
+ export default {
145
+ state,
146
+ authorizationStatus,
147
+ authorizationRequest,
148
+ authorizationOpenSettings,
149
+ scanEnabled,
150
+ scanResults,
151
+ scanStart,
152
+ scanStop,
153
+ devices,
154
+ deviceServices,
155
+ deviceConnectionStatus,
156
+ deviceMTU,
157
+ deviceConnect,
158
+ deviceDisconnect,
159
+ deviceDiscoverServices,
160
+ deviceRequestMTU,
161
+ deviceCharacteristicNotifyEnabled,
162
+ deviceCharacteristicData,
163
+ deviceCharacteristicRead,
164
+ deviceCharacteristicWrite,
165
+ deviceCharacteristicSubscribe,
166
+ deviceCharacteristicUnsubscribe
167
+ };
168
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["BBCharacteristic","BBDevice","BBScanResult","BBService","EventEmitter","StateEventEmitter","NativeBlueBreeze","state","stateEmitter","value","add","authorizationStatus","authorizationStatusEmitter","authorizationRequest","authorizationOpenSettings","scanEnabled","scanEnabledEmitter","scanResults","scanResultEmitter","device","devices","get","id","undefined","convertScanResult","scanStart","scanStop","Map","map","d","convertDevice","devicesEmitter","_deviceServices","deviceServices","mapGetOrSet","s","convertDeviceService","deviceServicesEmitter","_deviceConnectionStatus","deviceConnectionStatus","deviceConnectionStatusEmitter","_deviceMTU","deviceMTU","deviceMTUEmitter","deviceConnect","deviceDisconnect","deviceDiscoverServices","deviceRequestMTU","_deviceCharacteristicNotifyEnabled","deviceCharacteristicNotifyEnabled","serviceId","characteristicId","deviceMap","serviceMap","deviceCharacteristicNotifyEnabledEmitter","_deviceCharacteristicData","deviceCharacteristicData","deviceCharacteristicDataEmitter","deviceCharacteristicRead","deviceCharacteristicWrite","deviceCharacteristicSubscribe","deviceCharacteristicUnsubscribe","key","defaultValue","set","name","scanResult","rssi","connectable","advertisedServices","manufacturerId","manufacturerName","manufacturerData","deviceId","service","characteristics","c","convertDeviceCharacteristic","characteristic","properties"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,+CAA4C;AAC7E,SAASC,QAAQ,QAAQ,uCAAoC;AAC7D,SAASC,YAAY,QAAQ,4CAAyC;AACtE,SAASC,SAAS,Q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