seven365-zyprinter 0.0.10 → 0.1.0
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.
|
@@ -373,11 +373,11 @@ import Network
|
|
|
373
373
|
}
|
|
374
374
|
|
|
375
375
|
// MARK: - POSBLEManagerDelegate
|
|
376
|
-
|
|
377
376
|
extension ZywellSDK: POSBLEManagerDelegate {
|
|
378
377
|
|
|
379
|
-
|
|
380
|
-
|
|
378
|
+
// Method 1: Already had
|
|
379
|
+
|
|
380
|
+
@objc public func poSdidUpdatePeripheralList(_ peripherals: [Any]?, rssiList: [Any]?) {
|
|
381
381
|
guard let peripherals = peripherals as? [CBPeripheral],
|
|
382
382
|
let rssis = rssiList as? [NSNumber] else { return }
|
|
383
383
|
|
|
@@ -385,16 +385,18 @@ extension ZywellSDK: POSBLEManagerDelegate {
|
|
|
385
385
|
self.peripheralRSSIs = rssis
|
|
386
386
|
}
|
|
387
387
|
|
|
388
|
-
|
|
389
|
-
|
|
388
|
+
|
|
389
|
+
// Method 2: Already had
|
|
390
|
+
@objc public func poSdidConnect(_ peripheral: CBPeripheral?) {
|
|
391
|
+
guard let peripheral = peripheral else { return }
|
|
390
392
|
DispatchQueue.main.async { [weak self] in
|
|
391
393
|
self?.connectionCompletion?(true, nil)
|
|
392
394
|
self?.connectionCompletion = nil
|
|
393
395
|
}
|
|
394
396
|
}
|
|
395
397
|
|
|
396
|
-
|
|
397
|
-
public func
|
|
398
|
+
// Method 3: Already had
|
|
399
|
+
@objc public func poSdidFail(toConnect peripheral: CBPeripheral?, error: Error?) {
|
|
398
400
|
let errorMsg = error?.localizedDescription ?? "Connection failed"
|
|
399
401
|
DispatchQueue.main.async { [weak self] in
|
|
400
402
|
self?.connectionCompletion?(false, errorMsg)
|
|
@@ -402,13 +404,16 @@ extension ZywellSDK: POSBLEManagerDelegate {
|
|
|
402
404
|
}
|
|
403
405
|
}
|
|
404
406
|
|
|
405
|
-
|
|
406
|
-
public func poSdidDisconnectPeripheral(_ peripheral: CBPeripheral
|
|
407
|
+
// Method 4: Already had
|
|
408
|
+
@objc public func poSdidDisconnectPeripheral(_ peripheral: CBPeripheral?, isAutoDisconnect: Bool) {
|
|
407
409
|
// Handle disconnection
|
|
410
|
+
if let peripheral = peripheral {
|
|
411
|
+
print("Disconnected from: \(peripheral.name ?? "Unknown")")
|
|
412
|
+
}
|
|
408
413
|
}
|
|
409
414
|
|
|
410
|
-
|
|
411
|
-
public func
|
|
415
|
+
// Method 5: Fixed based on error
|
|
416
|
+
@objc public func poSdidWriteValue(for character: CBCharacteristic?, error: Error?) {
|
|
412
417
|
DispatchQueue.main.async { [weak self] in
|
|
413
418
|
if let error = error {
|
|
414
419
|
self?.printCompletion?(false, error.localizedDescription)
|
|
@@ -418,6 +423,35 @@ extension ZywellSDK: POSBLEManagerDelegate {
|
|
|
418
423
|
self?.printCompletion = nil
|
|
419
424
|
}
|
|
420
425
|
}
|
|
426
|
+
|
|
427
|
+
// ADD THESE COMMONLY REQUIRED METHODS:
|
|
428
|
+
|
|
429
|
+
// Method 6: Bluetooth state updates - VERY COMMONLY REQUIRED
|
|
430
|
+
@objc public func poScentralManagerDidUpdateState(_ central: Any?) {
|
|
431
|
+
if let central = central as? CBCentralManager {
|
|
432
|
+
print("Bluetooth state: \(central.state.rawValue)")
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
// Method 7: Did discover services
|
|
437
|
+
@objc public func poSdidDiscoverServices(_ peripheral: CBPeripheral!) {
|
|
438
|
+
// Handle service discovery
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
// Method 8: Did discover characteristics
|
|
442
|
+
@objc public func poSdidDiscoverCharacteristics(for service: CBService!, error: Error!) {
|
|
443
|
+
// Handle characteristic discovery
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
// Method 9: Did update value for characteristic
|
|
447
|
+
@objc public func poSdidUpdateValue(for characteristic: CBCharacteristic!, error: Error!) {
|
|
448
|
+
// Handle updated values
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
// Method 10: Did update notification state
|
|
452
|
+
@objc public func poSdidUpdateNotificationState(for characteristic: CBCharacteristic!, error: Error!) {
|
|
453
|
+
// Handle notification state changes
|
|
454
|
+
}
|
|
421
455
|
}
|
|
422
456
|
|
|
423
457
|
// MARK: - POSWIFIManagerDelegate
|
|
@@ -446,7 +480,7 @@ extension ZywellSDK: POSWIFIManagerDelegate {
|
|
|
446
480
|
}
|
|
447
481
|
|
|
448
482
|
@objc(POSWIFIManager:didReadData:tag:)
|
|
449
|
-
public func poswifiManager(_ manager: POSWIFIManager,
|
|
483
|
+
public func poswifiManager(_ manager: POSWIFIManager, didRead data: Data, tag: Int) {
|
|
450
484
|
// Handle data reading if needed
|
|
451
485
|
}
|
|
452
486
|
|
package/package.json
CHANGED