munim-bluetooth 0.3.27 → 0.4.1

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 (116) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/LICENSE +201 -21
  3. package/README.md +480 -75
  4. package/android/gradle.properties +2 -2
  5. package/android/src/main/AndroidManifest.xml +3 -1
  6. package/android/src/main/cpp/cpp-adapter.cpp +4 -1
  7. package/android/src/main/java/com/munimbluetooth/HybridMunimBluetooth.kt +2006 -209
  8. package/android/src/main/java/com/munimbluetooth/MunimBluetoothBackgroundService.kt +561 -53
  9. package/app.plugin.js +155 -0
  10. package/ios/HybridMunimBluetooth.swift +2123 -298
  11. package/ios/MunimBluetoothEventEmitter.swift +68 -8
  12. package/lib/commonjs/index.js +272 -11
  13. package/lib/commonjs/index.js.map +1 -1
  14. package/lib/module/index.js +243 -11
  15. package/lib/module/index.js.map +1 -1
  16. package/lib/typescript/src/index.d.ts +310 -7
  17. package/lib/typescript/src/index.d.ts.map +1 -1
  18. package/lib/typescript/src/specs/munim-bluetooth.nitro.d.ts +219 -5
  19. package/lib/typescript/src/specs/munim-bluetooth.nitro.d.ts.map +1 -1
  20. package/nitro.json +9 -3
  21. package/nitrogen/generated/android/c++/JAdvertisingDataTypes.hpp +96 -96
  22. package/nitrogen/generated/android/c++/JAdvertisingOptions.hpp +8 -8
  23. package/nitrogen/generated/android/c++/JBackgroundSessionOptions.hpp +8 -8
  24. package/nitrogen/generated/android/c++/JBluetoothCapabilities.hpp +105 -0
  25. package/nitrogen/generated/android/c++/JBluetoothPhy.hpp +61 -0
  26. package/nitrogen/generated/android/c++/JBluetoothPhyOption.hpp +61 -0
  27. package/nitrogen/generated/android/c++/JBondState.hpp +64 -0
  28. package/nitrogen/generated/android/c++/JDescriptorValue.hpp +69 -0
  29. package/nitrogen/generated/android/c++/JExtendedAdvertisingOptions.hpp +131 -0
  30. package/nitrogen/generated/android/c++/JGATTCharacteristic.hpp +35 -11
  31. package/nitrogen/generated/android/c++/JGATTDescriptor.hpp +85 -0
  32. package/nitrogen/generated/android/c++/JGATTService.hpp +33 -9
  33. package/nitrogen/generated/android/c++/JHybridMunimBluetoothSpec.cpp +422 -12
  34. package/nitrogen/generated/android/c++/JHybridMunimBluetoothSpec.hpp +29 -0
  35. package/nitrogen/generated/android/c++/JL2CAPChannel.hpp +66 -0
  36. package/nitrogen/generated/android/c++/JMultipeerDiscoveryInfoEntry.hpp +61 -0
  37. package/nitrogen/generated/android/c++/JMultipeerEncryptionPreference.hpp +61 -0
  38. package/nitrogen/generated/android/c++/JMultipeerPeer.hpp +93 -0
  39. package/nitrogen/generated/android/c++/JMultipeerPeerState.hpp +61 -0
  40. package/nitrogen/generated/android/c++/JMultipeerSessionOptions.hpp +105 -0
  41. package/nitrogen/generated/android/c++/JPhyStatus.hpp +62 -0
  42. package/nitrogen/generated/android/c++/JScanOptions.hpp +8 -8
  43. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/AdvertisingDataTypes.kt +47 -0
  44. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/AdvertisingOptions.kt +19 -0
  45. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/BackgroundSessionOptions.kt +27 -0
  46. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/BluetoothCapabilities.kt +111 -0
  47. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/BluetoothPhy.kt +24 -0
  48. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/BluetoothPhyOption.kt +24 -0
  49. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/BondState.kt +25 -0
  50. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/CharacteristicValue.kt +17 -0
  51. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/DescriptorValue.kt +66 -0
  52. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/ExtendedAdvertisingOptions.kt +111 -0
  53. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/GATTCharacteristic.kt +25 -3
  54. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/GATTDescriptor.kt +61 -0
  55. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/GATTService.kt +23 -3
  56. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/HybridMunimBluetoothSpec.kt +138 -22
  57. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/L2CAPChannel.kt +61 -0
  58. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/MultipeerDiscoveryInfoEntry.kt +56 -0
  59. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/MultipeerEncryptionPreference.kt +24 -0
  60. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/MultipeerPeer.kt +66 -0
  61. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/MultipeerPeerState.kt +24 -0
  62. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/MultipeerSessionOptions.kt +81 -0
  63. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/PhyStatus.kt +56 -0
  64. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/ScanOptions.kt +17 -0
  65. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/ServiceDataEntry.kt +15 -0
  66. package/nitrogen/generated/ios/MunimBluetooth+autolinking.rb +2 -0
  67. package/nitrogen/generated/ios/MunimBluetooth-Swift-Cxx-Bridge.cpp +61 -5
  68. package/nitrogen/generated/ios/MunimBluetooth-Swift-Cxx-Bridge.hpp +494 -49
  69. package/nitrogen/generated/ios/MunimBluetooth-Swift-Cxx-Umbrella.hpp +42 -0
  70. package/nitrogen/generated/ios/c++/HybridMunimBluetoothSpecSwift.hpp +254 -0
  71. package/nitrogen/generated/ios/swift/BluetoothCapabilities.swift +89 -0
  72. package/nitrogen/generated/ios/swift/BluetoothPhy.swift +44 -0
  73. package/nitrogen/generated/ios/swift/BluetoothPhyOption.swift +44 -0
  74. package/nitrogen/generated/ios/swift/BondState.swift +48 -0
  75. package/nitrogen/generated/ios/swift/DescriptorValue.swift +44 -0
  76. package/nitrogen/generated/ios/swift/ExtendedAdvertisingOptions.swift +243 -0
  77. package/nitrogen/generated/ios/swift/Func_void_BluetoothCapabilities.swift +46 -0
  78. package/nitrogen/generated/ios/swift/Func_void_BondState.swift +46 -0
  79. package/nitrogen/generated/ios/swift/Func_void_DescriptorValue.swift +46 -0
  80. package/nitrogen/generated/ios/swift/Func_void_L2CAPChannel.swift +46 -0
  81. package/nitrogen/generated/ios/swift/Func_void_PhyStatus.swift +46 -0
  82. package/nitrogen/generated/ios/swift/Func_void_std__string.swift +46 -0
  83. package/nitrogen/generated/ios/swift/Func_void_std__vector_MultipeerPeer_.swift +46 -0
  84. package/nitrogen/generated/ios/swift/GATTCharacteristic.swift +25 -1
  85. package/nitrogen/generated/ios/swift/GATTDescriptor.swift +71 -0
  86. package/nitrogen/generated/ios/swift/GATTService.swift +25 -1
  87. package/nitrogen/generated/ios/swift/HybridMunimBluetoothSpec.swift +29 -0
  88. package/nitrogen/generated/ios/swift/HybridMunimBluetoothSpec_cxx.swift +556 -23
  89. package/nitrogen/generated/ios/swift/L2CAPChannel.swift +52 -0
  90. package/nitrogen/generated/ios/swift/MultipeerDiscoveryInfoEntry.swift +34 -0
  91. package/nitrogen/generated/ios/swift/MultipeerEncryptionPreference.swift +44 -0
  92. package/nitrogen/generated/ios/swift/MultipeerPeer.swift +63 -0
  93. package/nitrogen/generated/ios/swift/MultipeerPeerState.swift +44 -0
  94. package/nitrogen/generated/ios/swift/MultipeerSessionOptions.swift +136 -0
  95. package/nitrogen/generated/ios/swift/PhyStatus.swift +34 -0
  96. package/nitrogen/generated/shared/c++/BluetoothCapabilities.hpp +131 -0
  97. package/nitrogen/generated/shared/c++/BluetoothPhy.hpp +80 -0
  98. package/nitrogen/generated/shared/c++/BluetoothPhyOption.hpp +80 -0
  99. package/nitrogen/generated/shared/c++/BondState.hpp +84 -0
  100. package/nitrogen/generated/shared/c++/DescriptorValue.hpp +95 -0
  101. package/nitrogen/generated/shared/c++/ExtendedAdvertisingOptions.hpp +138 -0
  102. package/nitrogen/generated/shared/c++/GATTCharacteristic.hpp +9 -3
  103. package/nitrogen/generated/shared/c++/GATTDescriptor.hpp +93 -0
  104. package/nitrogen/generated/shared/c++/GATTService.hpp +7 -2
  105. package/nitrogen/generated/shared/c++/HybridMunimBluetoothSpec.cpp +29 -0
  106. package/nitrogen/generated/shared/c++/HybridMunimBluetoothSpec.hpp +61 -2
  107. package/nitrogen/generated/shared/c++/L2CAPChannel.hpp +92 -0
  108. package/nitrogen/generated/shared/c++/MultipeerDiscoveryInfoEntry.hpp +87 -0
  109. package/nitrogen/generated/shared/c++/MultipeerEncryptionPreference.hpp +80 -0
  110. package/nitrogen/generated/shared/c++/MultipeerPeer.hpp +102 -0
  111. package/nitrogen/generated/shared/c++/MultipeerPeerState.hpp +80 -0
  112. package/nitrogen/generated/shared/c++/MultipeerSessionOptions.hpp +114 -0
  113. package/nitrogen/generated/shared/c++/PhyStatus.hpp +88 -0
  114. package/package.json +23 -12
  115. package/src/index.ts +416 -31
  116. package/src/specs/munim-bluetooth.nitro.ts +298 -14
@@ -6,12 +6,14 @@ export interface ServiceDataEntry {
6
6
  data: string
7
7
  }
8
8
 
9
- // BLE Advertising Data Types - Only Platform-Supported Types
9
+ // BLE advertising data types. Android can advertise all supported fields when
10
+ // payload size and hardware allow it; iOS advertising is limited by
11
+ // CoreBluetooth to local name and service UUIDs.
10
12
  export interface AdvertisingDataTypes {
11
- // 0x01 - Flags (partial support)
13
+ // 0x01 - Flags
12
14
  flags?: number
13
15
 
14
- // 0x02-0x07 - Service UUIDs (fully supported)
16
+ // 0x02-0x07 - Service UUIDs
15
17
  incompleteServiceUUIDs16?: string[]
16
18
  completeServiceUUIDs16?: string[]
17
19
  incompleteServiceUUIDs32?: string[]
@@ -19,18 +21,18 @@ export interface AdvertisingDataTypes {
19
21
  incompleteServiceUUIDs128?: string[]
20
22
  completeServiceUUIDs128?: string[]
21
23
 
22
- // 0x08-0x09 - Local Name (fully supported)
24
+ // 0x08-0x09 - Local Name
23
25
  shortenedLocalName?: string
24
26
  completeLocalName?: string
25
27
 
26
- // 0x0A - Tx Power Level (fully supported)
28
+ // 0x0A - Tx Power Level
27
29
  txPowerLevel?: number
28
30
 
29
- // 0x14-0x15 - Service Solicitation (fully supported)
31
+ // 0x14-0x15 - Service Solicitation
30
32
  serviceSolicitationUUIDs16?: string[]
31
33
  serviceSolicitationUUIDs128?: string[]
32
34
 
33
- // 0x16, 0x20, 0x21 - Service Data (fully supported)
35
+ // 0x16, 0x20, 0x21 - Service Data
34
36
  serviceData16?: ServiceDataEntry[]
35
37
  serviceData32?: ServiceDataEntry[]
36
38
  serviceData128?: ServiceDataEntry[]
@@ -38,10 +40,10 @@ export interface AdvertisingDataTypes {
38
40
  // 0x19 - Appearance (partial support)
39
41
  appearance?: number
40
42
 
41
- // 0x1F - Service Solicitation (32-bit) (fully supported)
43
+ // 0x1F - Service Solicitation (32-bit)
42
44
  serviceSolicitationUUIDs32?: string[]
43
45
 
44
- // 0xFF - Manufacturer Specific Data (fully supported)
46
+ // 0xFF - Manufacturer Specific Data
45
47
  manufacturerData?: string
46
48
  }
47
49
 
@@ -49,9 +51,13 @@ export interface AdvertisingDataTypes {
49
51
  export interface BLEDevice {
50
52
  id: string
51
53
  name?: string
54
+ localName?: string
52
55
  rssi?: number
53
56
  advertisingData?: AdvertisingDataTypes
54
57
  serviceUUIDs?: string[]
58
+ serviceData?: ServiceDataEntry[]
59
+ manufacturerData?: string
60
+ txPowerLevel?: number
55
61
  isConnectable?: boolean
56
62
  }
57
63
 
@@ -65,17 +71,25 @@ export interface ScanOptions {
65
71
  scanMode?: ScanMode
66
72
  }
67
73
 
74
+ export interface GATTDescriptor {
75
+ uuid: string
76
+ value?: string
77
+ permissions?: string[]
78
+ }
79
+
68
80
  // GATT Characteristic
69
81
  export interface GATTCharacteristic {
70
82
  uuid: string
71
83
  properties: string[]
72
84
  value?: string
85
+ descriptors?: GATTDescriptor[]
73
86
  }
74
87
 
75
88
  // GATT Service
76
89
  export interface GATTService {
77
90
  uuid: string
78
91
  characteristics: GATTCharacteristic[]
92
+ includedServices?: string[]
79
93
  }
80
94
 
81
95
  // Characteristic value
@@ -85,9 +99,43 @@ export interface CharacteristicValue {
85
99
  characteristicUUID: string
86
100
  }
87
101
 
102
+ export interface DescriptorValue {
103
+ value: string
104
+ serviceUUID: string
105
+ characteristicUUID: string
106
+ descriptorUUID: string
107
+ }
108
+
88
109
  // Write type for characteristic writes
89
110
  export type WriteType = 'write' | 'writeWithoutResponse'
90
111
 
112
+ export type BluetoothPhy = 'le1m' | 'le2m' | 'leCoded'
113
+
114
+ export type BluetoothPhyOption = 'none' | 's2' | 's8'
115
+
116
+ export interface PhyStatus {
117
+ txPhy: BluetoothPhy
118
+ rxPhy: BluetoothPhy
119
+ }
120
+
121
+ export type BondState = 'none' | 'bonding' | 'bonded' | 'unsupported'
122
+
123
+ export interface BluetoothCapabilities {
124
+ platform: string
125
+ supportsBleCentral: boolean
126
+ supportsBlePeripheral: boolean
127
+ supportsDescriptors: boolean
128
+ supportsIncludedServices: boolean
129
+ supportsMtu: boolean
130
+ supportsPhy: boolean
131
+ supportsBonding: boolean
132
+ supportsExtendedAdvertising: boolean
133
+ supportsL2cap: boolean
134
+ supportsClassicBluetooth: boolean
135
+ supportsBackgroundBle: boolean
136
+ supportsMultipeerConnectivity: boolean
137
+ }
138
+
91
139
  // Advertising options for startAdvertising
92
140
  export interface AdvertisingOptions {
93
141
  serviceUUIDs: string[]
@@ -96,6 +144,22 @@ export interface AdvertisingOptions {
96
144
  advertisingData?: AdvertisingDataTypes
97
145
  }
98
146
 
147
+ export interface ExtendedAdvertisingOptions {
148
+ serviceUUIDs?: string[]
149
+ localName?: string
150
+ manufacturerData?: string
151
+ advertisingData?: AdvertisingDataTypes
152
+ connectable?: boolean
153
+ scannable?: boolean
154
+ legacyMode?: boolean
155
+ anonymous?: boolean
156
+ includeTxPower?: boolean
157
+ interval?: number
158
+ txPowerLevel?: number
159
+ primaryPhy?: BluetoothPhy
160
+ secondaryPhy?: BluetoothPhy
161
+ }
162
+
99
163
  export interface BackgroundSessionOptions {
100
164
  serviceUUIDs: string[]
101
165
  localName?: string
@@ -107,14 +171,51 @@ export interface BackgroundSessionOptions {
107
171
  androidNotificationText?: string
108
172
  }
109
173
 
174
+ export type MultipeerEncryptionPreference = 'none' | 'optional' | 'required'
175
+
176
+ export type MultipeerPeerState = 'notConnected' | 'connecting' | 'connected'
177
+
178
+ export interface MultipeerDiscoveryInfoEntry {
179
+ key: string
180
+ value: string
181
+ }
182
+
183
+ export interface MultipeerSessionOptions {
184
+ /**
185
+ * Bonjour service type, 1-15 chars: lowercase letters, numbers, hyphen.
186
+ * Example: "anonmesh" or "munim-chat".
187
+ */
188
+ serviceType: string
189
+ displayName?: string
190
+ discoveryInfo?: MultipeerDiscoveryInfoEntry[]
191
+ autoInvite?: boolean
192
+ autoAcceptInvitations?: boolean
193
+ inviteTimeout?: number
194
+ encryptionPreference?: MultipeerEncryptionPreference
195
+ }
196
+
197
+ export interface MultipeerPeer {
198
+ id: string
199
+ displayName: string
200
+ state: MultipeerPeerState
201
+ discoveryInfo?: MultipeerDiscoveryInfoEntry[]
202
+ }
203
+
204
+ export interface L2CAPChannel {
205
+ id: string
206
+ psm: number
207
+ deviceId?: string
208
+ }
209
+
110
210
  export interface MunimBluetooth
111
211
  extends HybridObject<{ ios: 'swift'; android: 'kotlin' }> {
112
212
  // ========== Peripheral Features ==========
113
213
 
114
214
  /**
115
- * Start advertising as a Bluetooth peripheral with supported advertising data.
215
+ * Start advertising as a Bluetooth peripheral with platform-aware advertising data.
116
216
  *
117
- * @param options - An object with serviceUUIDs (string[]) and supported advertising data types.
217
+ * @param options - An object with serviceUUIDs (string[]) and advertising data types.
218
+ * iOS only advertises local name and service UUIDs.
118
219
  * This must be a plain JS object (no Maps/Sets/functions).
119
220
  */
120
221
  startAdvertising(options: AdvertisingOptions): void
@@ -146,6 +247,22 @@ export interface MunimBluetooth
146
247
  */
147
248
  setServices(services: GATTService[]): void
148
249
 
250
+ /**
251
+ * Update a local peripheral characteristic value and optionally notify/indicate
252
+ * subscribed centrals.
253
+ *
254
+ * @param serviceUUID - The UUID of the local GATT service.
255
+ * @param characteristicUUID - The UUID of the local characteristic.
256
+ * @param value - Hex-encoded value.
257
+ * @param notify - When true, push the value to subscribed centrals.
258
+ */
259
+ updateCharacteristicValue(
260
+ serviceUUID: string,
261
+ characteristicUUID: string,
262
+ value: string,
263
+ notify?: boolean
264
+ ): Promise<void>
265
+
149
266
  // ========== Central/Manager Features ==========
150
267
 
151
268
  /**
@@ -162,6 +279,11 @@ export interface MunimBluetooth
162
279
  */
163
280
  requestBluetoothPermission(): Promise<boolean>
164
281
 
282
+ /**
283
+ * Return the Bluetooth features this platform can support through public APIs.
284
+ */
285
+ getCapabilities(): Promise<BluetoothCapabilities>
286
+
165
287
  /**
166
288
  * Start scanning for BLE devices.
167
289
  *
@@ -211,6 +333,16 @@ export interface MunimBluetooth
211
333
  characteristicUUID: string
212
334
  ): Promise<CharacteristicValue>
213
335
 
336
+ /**
337
+ * Read a descriptor value from a connected BLE device.
338
+ */
339
+ readDescriptor(
340
+ deviceId: string,
341
+ serviceUUID: string,
342
+ characteristicUUID: string,
343
+ descriptorUUID: string
344
+ ): Promise<DescriptorValue>
345
+
214
346
  /**
215
347
  * Write a value to a characteristic on a connected device.
216
348
  *
@@ -229,6 +361,17 @@ export interface MunimBluetooth
229
361
  writeType?: WriteType
230
362
  ): Promise<void>
231
363
 
364
+ /**
365
+ * Write a descriptor value on a connected BLE device.
366
+ */
367
+ writeDescriptor(
368
+ deviceId: string,
369
+ serviceUUID: string,
370
+ characteristicUUID: string,
371
+ descriptorUUID: string,
372
+ value: string
373
+ ): Promise<void>
374
+
232
375
  /**
233
376
  * Subscribe to notifications/indications from a characteristic.
234
377
  *
@@ -270,12 +413,120 @@ export interface MunimBluetooth
270
413
  */
271
414
  readRSSI(deviceId: string): Promise<number>
272
415
 
416
+ /**
417
+ * Request a BLE ATT MTU. Android supports this directly; iOS negotiates MTU internally.
418
+ */
419
+ requestMTU(deviceId: string, mtu: number): Promise<number>
420
+
421
+ /**
422
+ * Set preferred BLE PHY where supported.
423
+ */
424
+ setPreferredPhy(
425
+ deviceId: string,
426
+ txPhy: BluetoothPhy,
427
+ rxPhy: BluetoothPhy,
428
+ phyOption?: BluetoothPhyOption
429
+ ): Promise<void>
430
+
431
+ /**
432
+ * Read current BLE PHY where supported.
433
+ */
434
+ readPhy(deviceId: string): Promise<PhyStatus>
435
+
436
+ /**
437
+ * Return the current bond/pairing state for a device.
438
+ */
439
+ getBondState(deviceId: string): Promise<BondState>
440
+
441
+ /**
442
+ * Start platform pairing/bonding for a device.
443
+ */
444
+ createBond(deviceId: string): Promise<BondState>
445
+
446
+ /**
447
+ * Remove an Android bond. Unsupported on iOS public APIs.
448
+ */
449
+ removeBond(deviceId: string): Promise<BondState>
450
+
451
+ /**
452
+ * Start BLE extended advertising where supported.
453
+ */
454
+ startExtendedAdvertising(options: ExtendedAdvertisingOptions): Promise<string>
455
+
456
+ /**
457
+ * Stop a BLE extended advertising set.
458
+ */
459
+ stopExtendedAdvertising(advertisingId: string): void
460
+
461
+ /**
462
+ * Publish a local L2CAP channel where supported.
463
+ */
464
+ publishL2CAPChannel(encryptionRequired?: boolean): Promise<L2CAPChannel>
465
+
466
+ /**
467
+ * Stop a local L2CAP channel.
468
+ */
469
+ unpublishL2CAPChannel(psm: number): void
470
+
471
+ /**
472
+ * Open an outbound L2CAP channel to a BLE device.
473
+ */
474
+ openL2CAPChannel(deviceId: string, psm: number): Promise<L2CAPChannel>
475
+
476
+ /**
477
+ * Close an L2CAP channel.
478
+ */
479
+ closeL2CAPChannel(channelId: string): void
480
+
481
+ /**
482
+ * Send hex data over an open L2CAP channel.
483
+ */
484
+ sendL2CAPData(channelId: string, value: string): Promise<void>
485
+
486
+ /**
487
+ * Start Classic Bluetooth discovery. Android only.
488
+ */
489
+ startClassicScan(): void
490
+
491
+ /**
492
+ * Stop Classic Bluetooth discovery. Android only.
493
+ */
494
+ stopClassicScan(): void
495
+
496
+ /**
497
+ * Connect to a Classic Bluetooth RFCOMM service. Android only.
498
+ */
499
+ connectClassic(deviceId: string, serviceUUID?: string): Promise<void>
500
+
501
+ /**
502
+ * Listen for incoming Classic Bluetooth RFCOMM connections. Android only.
503
+ */
504
+ startClassicServer(serviceUUID?: string, serviceName?: string): Promise<void>
505
+
506
+ /**
507
+ * Stop a Classic Bluetooth RFCOMM listener. Android only.
508
+ */
509
+ stopClassicServer(serviceUUID?: string): void
510
+
511
+ /**
512
+ * Disconnect a Classic Bluetooth device. Android only.
513
+ */
514
+ disconnectClassic(deviceId: string): void
515
+
516
+ /**
517
+ * Write hex data to a Classic Bluetooth RFCOMM connection. Android only.
518
+ */
519
+ writeClassic(deviceId: string, value: string): Promise<void>
520
+
273
521
  /**
274
522
  * Start a best-effort background BLE session.
275
523
  *
276
- * Android uses a foreground service so BLE can continue after the app leaves the foreground.
277
- * iOS keeps the central/peripheral managers running and relies on the host app's Bluetooth
278
- * background modes for best-effort background operation.
524
+ * Android uses a foreground service so BLE can continue after the app leaves
525
+ * the foreground, and restores scan/advertising/configured GATT services
526
+ * after normal service process recreation. iOS relies on Bluetooth background
527
+ * modes and CoreBluetooth state restoration, with terminated-state relaunch
528
+ * still limited by Apple's current relaunch rules. User force-quit/force-stop
529
+ * is controlled by the OS and cannot be bypassed.
279
530
  */
280
531
  startBackgroundSession(options: BackgroundSessionOptions): void
281
532
 
@@ -284,6 +535,39 @@ export interface MunimBluetooth
284
535
  */
285
536
  stopBackgroundSession(): void
286
537
 
538
+ /**
539
+ * Start Apple Multipeer Connectivity discovery/session transport.
540
+ *
541
+ * iOS/iPadOS/macOS/tvOS only. Android cannot join Apple's Multipeer
542
+ * Connectivity sessions and rejects the related promises.
543
+ */
544
+ startMultipeerSession(options: MultipeerSessionOptions): void
545
+
546
+ /**
547
+ * Stop the active Apple Multipeer Connectivity session.
548
+ */
549
+ stopMultipeerSession(): void
550
+
551
+ /**
552
+ * Invite a discovered Multipeer peer by runtime peer id.
553
+ */
554
+ inviteMultipeerPeer(peerId: string): void
555
+
556
+ /**
557
+ * Return discovered/connected Multipeer peers for this runtime session.
558
+ */
559
+ getMultipeerPeers(): Promise<MultipeerPeer[]>
560
+
561
+ /**
562
+ * Send hex data to connected Multipeer peers. Omit peerIds to broadcast to
563
+ * all connected peers.
564
+ */
565
+ sendMultipeerMessage(
566
+ value: string,
567
+ peerIds?: string[],
568
+ reliable?: boolean
569
+ ): Promise<void>
570
+
287
571
  // ========== Event Management ==========
288
572
 
289
573
  /**