ilabs-flir 2.2.8 → 2.2.9

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.
@@ -413,7 +413,7 @@ import ThermalSDK
413
413
  discoveryTimeoutWorkItem?.cancel()
414
414
  let timeoutWork = DispatchWorkItem { [weak self] in
415
415
  guard let self = self, self.isScanning else { return }
416
- FlirLogger.log(.discovery, "⏱ Discovery timeout reached - stopping scan")
416
+ FlirLogger.log(.discovery, "DISCOVERY TIMEOUT triggered (8s) - stopping scan")
417
417
  self.discovery?.stop()
418
418
  self.isScanning = false
419
419
 
@@ -518,7 +518,7 @@ import ThermalSDK
518
518
  DispatchQueue.global(qos: .utility).asyncAfter(deadline: .now() + timeoutSeconds) { [weak self] in
519
519
  guard let self = self, !connectionCompleted else { return }
520
520
 
521
- FlirLogger.logError(.connection, "⏱ Connection timeout after \(timeoutSeconds) seconds - aborting")
521
+ FlirLogger.logError(.connection, "CONNECTION TIMEOUT triggered after \(timeoutSeconds)s - aborting")
522
522
 
523
523
  // Force cleanup
524
524
  self.camera = nil
@@ -526,6 +526,7 @@ import ThermalSDK
526
526
  self.connectedDeviceId = nil
527
527
 
528
528
  DispatchQueue.main.async {
529
+ FlirLogger.log(.connection, "⏱ Emitting connection_failed to RN due to timeout")
529
530
  self.emitStateChange("connection_failed")
530
531
  self.delegate?.onError("Connection timeout - device not responding")
531
532
  }
@@ -546,6 +547,8 @@ import ThermalSDK
546
547
  private func performConnection(identity: FLIRIdentity) {
547
548
  // Use the proven connection pattern from FLIR SDK samples:
548
549
  // FLIROneCameraSwift uses: pair(identity, code:) then connect()
550
+ let startTime = Date()
551
+ FlirLogger.log(.connection, "⏱ performConnection STARTED for: \(identity.deviceId())")
549
552
  FlirLogger.log(.connection, "performConnection starting for: \(identity.deviceId())")
550
553
 
551
554
  if camera == nil {
@@ -564,11 +567,12 @@ import ThermalSDK
564
567
 
565
568
  // Handle authentication for generic cameras (network cameras)
566
569
  if identity.cameraType() == .generic {
567
- FlirLogger.log(.connection, "Generic/network camera - starting authentication...")
570
+ FlirLogger.log(.connection, "Generic/network camera - AUTHENTICATION starting...")
568
571
  let certName = getCertificateName()
569
572
  var status = FLIRAuthenticationStatus.pending
570
573
  var attempts = 0
571
574
  let maxAttempts = 10 // 10 seconds max
575
+ let authStartTime = Date()
572
576
 
573
577
  while status == .pending && attempts < maxAttempts {
574
578
  status = cam.authenticate(identity, trustedConnectionName: certName)
@@ -580,28 +584,30 @@ import ThermalSDK
580
584
  }
581
585
 
582
586
  if status == .pending {
583
- FlirLogger.logError(.connection, "Authentication timeout after \(maxAttempts) seconds")
587
+ let authDuration = Date().timeIntervalSince(authStartTime)
588
+ FlirLogger.logError(.connection, "❌ Authentication TIMEOUT after \(authDuration)s (\(maxAttempts) attempts)")
584
589
  DispatchQueue.main.async { [weak self] in
585
590
  self?.delegate?.onError("Camera authentication timeout - device may require approval")
586
591
  }
587
592
  return
588
593
  }
589
594
 
590
- FlirLogger.log(.connection, "Authentication status: \(status.rawValue)")
595
+ let authDuration = Date().timeIntervalSince(authStartTime)
596
+ FlirLogger.log(.connection, "✅ Authentication completed in \(authDuration)s - status: \(status.rawValue)")
591
597
  }
592
598
 
593
599
  do {
594
600
  // Step 1: Pair with identity (required for FLIR One devices)
595
601
  // The code parameter is for BLE pairing, 0 for direct connection
596
- FlirLogger.log(.connection, "Step 1: Pairing with device...")
602
+ FlirLogger.log(.connection, "Step 1: PAIRING starting... [time since start: \(Date().timeIntervalSince(startTime))s]")
597
603
  try cam.pair(identity, code: 0)
598
- FlirLogger.log(.connection, "✅ Paired successfully with: \(identity.deviceId())")
604
+ FlirLogger.log(.connection, "✅ Step 1: PAIRED successfully [time: \(Date().timeIntervalSince(startTime))s]")
599
605
 
600
606
  // Step 2: Connect (no identity parameter - uses paired identity)
601
607
  // Note: This can hang on some devices - ensure we have timeout in place
602
- FlirLogger.log(.connection, "Step 2: Connecting to device...")
608
+ FlirLogger.log(.connection, "Step 2: CONNECTING starting... [time: \(Date().timeIntervalSince(startTime))s]")
603
609
  try cam.connect()
604
- FlirLogger.log(.connection, "✅ Connected successfully to: \(identity.deviceId())")
610
+ FlirLogger.log(.connection, "✅ Step 2: CONNECTED successfully [time: \(Date().timeIntervalSince(startTime))s]")
605
611
 
606
612
  // Update state
607
613
  connectedIdentity = identity
@@ -887,6 +893,12 @@ import ThermalSDK
887
893
  // MARK: - State Emission
888
894
 
889
895
  private func emitStateChange(_ state: String) {
896
+ let timestamp = Date()
897
+ let formatter = DateFormatter()
898
+ formatter.dateFormat = "HH:mm:ss.SSS"
899
+ let timeStr = formatter.string(from: timestamp)
900
+ FlirLogger.log(.connection, "⏱ [\(timeStr)] EMITTING STATE to RN: '\(state)'")
901
+
890
902
  DispatchQueue.main.async { [weak self] in
891
903
  guard let self = self else { return }
892
904
  self.delegate?.onStateChanged(
@@ -895,6 +907,7 @@ import ThermalSDK
895
907
  isStreaming: self._isStreaming,
896
908
  isEmulator: self.isEmulator
897
909
  )
910
+ FlirLogger.log(.connection, "✅ [\(timeStr)] State '\(state)' emitted to RN")
898
911
  }
899
912
  }
900
913
 
@@ -204,12 +204,15 @@ RCT_EXPORT_METHOD(setNetworkDiscoveryEnabled : (BOOL)enabled resolver : (
204
204
 
205
205
  RCT_EXPORT_METHOD(startDiscovery : (RCTPromiseResolveBlock)
206
206
  resolve rejecter : (RCTPromiseRejectBlock)reject) {
207
+ NSLog(@"[FlirModule] [%@] ⏱ RN->startDiscovery called", [NSDate date]);
207
208
  dispatch_async(dispatch_get_main_queue(), ^{
208
209
  id manager = flir_manager_shared();
209
210
  if (manager &&
210
211
  [manager respondsToSelector:sel_registerName("startDiscovery")]) {
212
+ NSLog(@"[FlirModule] [%@] ⏱ Calling FlirManager.startDiscovery", [NSDate date]);
211
213
  ((void (*)(id, SEL))objc_msgSend)(manager,
212
214
  sel_registerName("startDiscovery"));
215
+ NSLog(@"[FlirModule] [%@] ⏱ FlirManager.startDiscovery returned", [NSDate date]);
213
216
  }
214
217
  resolve(@(YES));
215
218
  });
@@ -250,13 +253,12 @@ RCT_EXPORT_METHOD(getDiscoveredDevices : (RCTPromiseResolveBlock)
250
253
 
251
254
  RCT_EXPORT_METHOD(connectToDevice : (NSString *)deviceId resolver : (
252
255
  RCTPromiseResolveBlock)resolve rejecter : (RCTPromiseRejectBlock)reject) {
256
+ NSLog(@"[FlirModule] [%@] ⏱ RN->connectToDevice called for: %@", [NSDate date], deviceId);
253
257
  dispatch_async(dispatch_get_main_queue(), ^{
254
- NSLog(@"[FlirModule] connectToDevice called for: %@", deviceId);
255
-
256
258
  id manager = flir_manager_shared();
257
259
  if (manager &&
258
260
  [manager respondsToSelector:sel_registerName("connectToDevice:")]) {
259
- NSLog(@"[FlirModule] Calling FlirManager.connectToDevice");
261
+ NSLog(@"[FlirModule] [%@] ⏱ Calling FlirManager.connectToDevice", [NSDate date]);
260
262
 
261
263
  // Store callbacks for event-driven updates (but don't block on them)
262
264
  self.connectResolve = nil; // Don't use promise for blocking
@@ -266,10 +268,12 @@ RCT_EXPORT_METHOD(connectToDevice : (NSString *)deviceId resolver : (
266
268
  ((void (*)(id, SEL, id))objc_msgSend)(
267
269
  manager, sel_registerName("connectToDevice:"), deviceId);
268
270
 
271
+ NSLog(@"[FlirModule] [%@] ⏱ FlirManager.connectToDevice returned (async started)", [NSDate date]);
272
+
269
273
  // Resolve immediately - connection status will come via events
270
274
  resolve(@(YES));
271
275
  } else {
272
- NSLog(@"[FlirModule] FlirManager not found");
276
+ NSLog(@"[FlirModule] [%@] ❌ FlirManager not found", [NSDate date]);
273
277
  reject(@"ERR_NO_MANAGER", @"FlirManager not found", nil);
274
278
  }
275
279
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ilabs-flir",
3
- "version": "2.2.8",
3
+ "version": "2.2.9",
4
4
  "description": "FLIR Thermal SDK for React Native - iOS & Android (bundled at compile time via postinstall)",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",