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
- @objc(POSdidUpdatePeripheralList:RSSIList:)
380
- public func poSdidUpdatePeripheralList(_ peripherals: [Any]!, rssiList: [Any]!) {
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
- @objc(POSdidConnectPeripheral:)
389
- public func poSdidConnectPeripheral(_ peripheral: CBPeripheral!) {
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
- @objc(POSdidFailToConnectPeripheral:error:)
397
- public func poSdidFailToConnectPeripheral(_ peripheral: CBPeripheral!, error: Error!) {
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
- @objc(POSdidDisconnectPeripheral:isAutoDisconnect:)
406
- public func poSdidDisconnectPeripheral(_ peripheral: CBPeripheral!, isAutoDisconnect: Bool) {
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
- @objc(POSdidWriteValueForCharacteristic:error:)
411
- public func poSdidWriteValueForCharacteristic(_ character: CBCharacteristic!, error: Error!) {
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, didReadData data: Data, tag: Int) {
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seven365-zyprinter",
3
- "version": "0.0.10",
3
+ "version": "0.1.0",
4
4
  "description": "Capacitor plugin for Zywell/Zyprint thermal printer integration with Bluetooth and WiFi support",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",