ilabs-flir 2.0.4 → 2.0.6

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 (35) hide show
  1. package/Flir.podspec +139 -139
  2. package/README.md +1066 -1066
  3. package/android/Flir/build.gradle.kts +72 -72
  4. package/android/Flir/src/main/AndroidManifest.xml +45 -45
  5. package/android/Flir/src/main/java/flir/android/FlirCommands.java +136 -136
  6. package/android/Flir/src/main/java/flir/android/FlirFrameCache.kt +6 -6
  7. package/android/Flir/src/main/java/flir/android/FlirManager.kt +476 -476
  8. package/android/Flir/src/main/java/flir/android/FlirModule.kt +257 -257
  9. package/android/Flir/src/main/java/flir/android/FlirPackage.kt +18 -18
  10. package/android/Flir/src/main/java/flir/android/FlirSDKLoader.kt +74 -74
  11. package/android/Flir/src/main/java/flir/android/FlirSdkManager.java +583 -583
  12. package/android/Flir/src/main/java/flir/android/FlirStatus.kt +12 -12
  13. package/android/Flir/src/main/java/flir/android/FlirView.kt +48 -48
  14. package/android/Flir/src/main/java/flir/android/FlirViewManager.kt +13 -13
  15. package/app.plugin.js +381 -381
  16. package/expo-module.config.json +5 -5
  17. package/ios/Flir/src/Flir-Bridging-Header.h +34 -34
  18. package/ios/Flir/src/FlirEventEmitter.h +25 -25
  19. package/ios/Flir/src/FlirEventEmitter.m +63 -63
  20. package/ios/Flir/src/FlirManager.swift +599 -599
  21. package/ios/Flir/src/FlirModule.h +17 -17
  22. package/ios/Flir/src/FlirModule.m +713 -713
  23. package/ios/Flir/src/FlirPreviewView.h +13 -13
  24. package/ios/Flir/src/FlirPreviewView.m +171 -171
  25. package/ios/Flir/src/FlirState.h +68 -68
  26. package/ios/Flir/src/FlirState.m +135 -135
  27. package/ios/Flir/src/FlirViewManager.h +16 -16
  28. package/ios/Flir/src/FlirViewManager.m +27 -27
  29. package/package.json +70 -71
  30. package/react-native.config.js +14 -14
  31. package/scripts/fetch-binaries.js +103 -17
  32. package/sdk-manifest.json +50 -50
  33. package/src/index.d.ts +63 -63
  34. package/src/index.js +7 -7
  35. package/src/index.ts +6 -6
@@ -69,12 +69,55 @@ function extractZip(zipPath, dest) {
69
69
  if (!fs.existsSync(dest)) {
70
70
  throw new Error(`Destination folder ${dest} does not exist. Please create it and re-run installation.`);
71
71
  }
72
- if (process.platform === 'win32') {
73
- // Use PowerShell Expand-Archive
74
- execSync(`powershell -NoProfile -Command "Expand-Archive -Force -LiteralPath '${zipPath}' -DestinationPath '${TMP_DIR}'"`, { stdio: 'inherit' });
75
- } else {
76
- execSync(`unzip -o '${zipPath}' -d '${TMP_DIR}'`, { stdio: 'inherit' });
72
+ // Preferred: use a pure-Node extractor (adm-zip) so the script is platform-independent.
73
+ try {
74
+ const AdmZip = require('adm-zip');
75
+ const zip = new AdmZip(zipPath);
76
+ zip.extractAllTo(TMP_DIR, true);
77
+ return;
78
+ } catch (e) {
79
+ // If adm-zip isn't available, fall back to system tools.
80
+ console.log('adm-zip not available, falling back to system extraction tools');
77
81
  }
82
+ // Next preference: system `unzip` (macOS, Linux, and many developer environments). If `unzip` is not available,
83
+ // try `tar -xf` (some platforms provide bsdtar which can extract zip files), otherwise fail with a helpful message.
84
+ const cmdExists = (cmd) => {
85
+ try {
86
+ if (process.platform === 'win32') {
87
+ execSync(`where ${cmd}`, { stdio: 'ignore' });
88
+ } else {
89
+ execSync(`which ${cmd}`, { stdio: 'ignore' });
90
+ }
91
+ return true;
92
+ } catch (_err) {
93
+ return false;
94
+ }
95
+ };
96
+
97
+ if (cmdExists('unzip')) {
98
+ try {
99
+ execSync(`unzip -o "${zipPath}" -d "${TMP_DIR}"`, { stdio: 'inherit' });
100
+ return;
101
+ } catch (err) {
102
+ throw new Error(`Failed to extract zip using 'unzip'. Consider installing 'unzip' or adding 'adm-zip' package. Original error: ${err.message}`);
103
+ }
104
+ }
105
+
106
+ // 'tar' can sometimes extract zip files (via bsdtar). Try it as a last resort.
107
+ if (cmdExists('tar')) {
108
+ try {
109
+ if (process.platform === 'win32') {
110
+ execSync(`tar -xf "${zipPath}" -C "${TMP_DIR}"`, { stdio: 'inherit' });
111
+ } else {
112
+ execSync(`tar -xf '${zipPath}' -C '${TMP_DIR}'`, { stdio: 'inherit' });
113
+ }
114
+ return;
115
+ } catch (err) {
116
+ throw new Error(`Failed to extract zip using 'tar'. Consider installing 'unzip' or add 'adm-zip' package. Original error: ${err.message}`);
117
+ }
118
+ }
119
+
120
+ throw new Error(`No extractor found: please install 'unzip' or add the 'adm-zip' dependency in your project so the fetch script can extract SDK binaries.`);
78
121
  }
79
122
 
80
123
  function copyIosExtractedFiles(tmpFolder, destFolder) {
@@ -133,27 +176,67 @@ async function run() {
133
176
  return;
134
177
  }
135
178
 
136
- // Ensure target folders exist - but do NOT create them automatically.
137
- if (!fs.existsSync(DEST_ANDROID)) {
138
- throw new Error(`Android libs folder ${DEST_ANDROID} does not exist. Please create it (e.g. npm pack or ensure published package includes it).`);
139
- }
140
- if (!fs.existsSync(DEST_IOS)) {
141
- throw new Error(`iOS Frameworks folder ${DEST_IOS} does not exist. Please create it before install.`);
142
- }
179
+ // (previous 'ensure target folders exist' logic removed; handling now occurs after args parsing)
143
180
 
144
181
  ensureTmp();
145
182
 
146
183
  const argv = process.argv.slice(2);
147
- const args = argv.reduce((acc, cur) => {
148
- if (cur.startsWith('--')) acc[cur.replace(/^--/, '')] = true;
149
- else acc[cur] = true;
150
- return acc;
151
- }, {});
184
+ const args = {};
185
+ for (let i = 0; i < argv.length; i++) {
186
+ const cur = argv[i];
187
+ if (cur.startsWith('--')) {
188
+ if (cur.includes('=')) {
189
+ const parts = cur.split('=');
190
+ const key = parts.shift().replace(/^--/, '');
191
+ const value = parts.join('=');
192
+ args[key] = value;
193
+ } else {
194
+ // if following arg exists and doesn't start with '-', use it as the value
195
+ const next = argv[i+1];
196
+ if (next && !next.startsWith('-')) {
197
+ args[cur.replace(/^--/, '')] = next;
198
+ i++;
199
+ } else {
200
+ args[cur.replace(/^--/, '')] = true;
201
+ }
202
+ }
203
+ } else if (cur.startsWith('-')) {
204
+ const key = cur.replace(/^-+/, '');
205
+ const next = argv[i+1];
206
+ if (next && !next.startsWith('-')) {
207
+ args[key] = next;
208
+ i++;
209
+ } else {
210
+ args[key] = true;
211
+ }
212
+ } else {
213
+ args[cur] = true;
214
+ }
215
+ }
152
216
 
153
217
  // Skip if present per-platform
154
218
  const skipIfPresent = args['skip-if-present'] || args['skipIfPresent'] || false;
155
219
  const platformArg = args['platform'] || args['p'] || 'all';
156
220
 
221
+ // Determine whether to create missing dest directories automatically; default is true unless explicitly disabled
222
+ const noCreate = process.env.FLIR_SDK_NO_CREATE_DEST === '1' || process.env.FLIR_SDK_NO_CREATE_DEST === 'true' || args['no-create-dest'] || args['noCreateDest'];
223
+ if ((platformArg === 'all' || platformArg === 'android') && !fs.existsSync(DEST_ANDROID)) {
224
+ if (noCreate) {
225
+ throw new Error(`Android libs folder ${DEST_ANDROID} does not exist. Please create it (e.g. npm pack or ensure published package includes it).`);
226
+ } else {
227
+ console.log(`Android libs folder ${DEST_ANDROID} not found — creating it.`);
228
+ fs.mkdirSync(DEST_ANDROID, { recursive: true });
229
+ }
230
+ }
231
+ if ((platformArg === 'all' || platformArg === 'ios') && !fs.existsSync(DEST_IOS)) {
232
+ if (noCreate) {
233
+ throw new Error(`iOS Frameworks folder ${DEST_IOS} does not exist. Please create it before install.`);
234
+ } else {
235
+ console.log(`iOS Frameworks folder ${DEST_IOS} not found — creating it.`);
236
+ fs.mkdirSync(DEST_IOS, { recursive: true });
237
+ }
238
+ }
239
+
157
240
  // Short circuit checks: if skipIfPresent set and files exist, skip per platform
158
241
  if (skipIfPresent && platformArg !== 'ios' && hasAndroidAar(DEST_ANDROID)) {
159
242
  console.log('Android AAR(s) detected in libs folder; skipping Android fetch.');
@@ -193,6 +276,9 @@ async function run() {
193
276
  } catch (err) {
194
277
  console.error('Failed to fetch binaries:', err.message);
195
278
  process.exit(1);
279
+ } finally {
280
+ // Always attempt to remove temporary folder to avoid leaving cruft
281
+ try { fs.rmSync(TMP_DIR, { recursive: true, force: true }); } catch (e) {}
196
282
  }
197
283
  }
198
284
 
package/sdk-manifest.json CHANGED
@@ -1,51 +1,51 @@
1
- {
2
- "version": "2.0.0",
3
- "sdkVersion": "5.0.0",
4
- "ios": {
5
- "downloadUrl": "https://github.com/PraveenOjha/flir-sdk-binaries/releases/download/v1.0.1/ios.zip",
6
- "directDownload": {
7
- "downloadUrl": "https://github.com/PraveenOjha/flir-sdk-binaries/releases/download/v1.0.1/ios.zip",
8
- "sha256": "",
9
- "sizeBytes": 0
10
- },
11
-
12
- "sha256": "",
13
- "sizeBytes": 0,
14
- "xcframeworks": [
15
- "ThermalSDK.xcframework",
16
- "MeterLink.xcframework",
17
- "libavcodec.61.dylib.xcframework",
18
- "libavdevice.61.dylib.xcframework",
19
- "libavfilter.10.dylib.xcframework",
20
- "libavformat.61.dylib.xcframework",
21
- "libavutil.59.dylib.xcframework",
22
- "liblive666.dylib.xcframework",
23
- "libswresample.5.dylib.xcframework",
24
- "libswscale.8.dylib.xcframework"
25
- ],
26
- "minDeploymentTarget": "13.0",
27
- "supportedArchitectures": [
28
- "arm64",
29
- "arm64_x86_64-simulator"
30
- ]
31
- },
32
- "android": {
33
-
34
- "directDownload": {
35
- "downloadUrl": "https://github.com/PraveenOjha/flir-sdk-binaries/releases/download/v1.0.1/android.zip",
36
- "sha256": "",
37
- "sizeBytes": 0
38
- }
39
- },
40
- "buildFlags": {
41
- "ios": {
42
- "withSDK": {
43
- "FLIR_ENABLED": "1",
44
- "FLIR_SDK_AVAILABLE": "1"
45
- },
46
- "withoutSDK": {
47
- "FLIR_DISABLED": "1"
48
- }
49
- }
50
- }
1
+ {
2
+ "version": "2.0.0",
3
+ "sdkVersion": "5.0.0",
4
+ "ios": {
5
+ "downloadUrl": "https://github.com/PraveenOjha/flir-sdk-binaries/releases/download/v1.0.1/ios.zip",
6
+ "directDownload": {
7
+ "downloadUrl": "https://github.com/PraveenOjha/flir-sdk-binaries/releases/download/v1.0.1/ios.zip",
8
+ "sha256": "",
9
+ "sizeBytes": 0
10
+ },
11
+
12
+ "sha256": "",
13
+ "sizeBytes": 0,
14
+ "xcframeworks": [
15
+ "ThermalSDK.xcframework",
16
+ "MeterLink.xcframework",
17
+ "libavcodec.61.dylib.xcframework",
18
+ "libavdevice.61.dylib.xcframework",
19
+ "libavfilter.10.dylib.xcframework",
20
+ "libavformat.61.dylib.xcframework",
21
+ "libavutil.59.dylib.xcframework",
22
+ "liblive666.dylib.xcframework",
23
+ "libswresample.5.dylib.xcframework",
24
+ "libswscale.8.dylib.xcframework"
25
+ ],
26
+ "minDeploymentTarget": "13.0",
27
+ "supportedArchitectures": [
28
+ "arm64",
29
+ "arm64_x86_64-simulator"
30
+ ]
31
+ },
32
+ "android": {
33
+
34
+ "directDownload": {
35
+ "downloadUrl": "https://github.com/PraveenOjha/flir-sdk-binaries/releases/download/v1.0.1/android.zip",
36
+ "sha256": "",
37
+ "sizeBytes": 0
38
+ }
39
+ },
40
+ "buildFlags": {
41
+ "ios": {
42
+ "withSDK": {
43
+ "FLIR_ENABLED": "1",
44
+ "FLIR_SDK_AVAILABLE": "1"
45
+ },
46
+ "withoutSDK": {
47
+ "FLIR_DISABLED": "1"
48
+ }
49
+ }
50
+ }
51
51
  }
package/src/index.d.ts CHANGED
@@ -1,63 +1,63 @@
1
- // FlirDownload API removed: the SDK is bundled at compile time and runtime downloading is not supported.
2
-
3
- export interface SDKStatus {
4
- available: boolean;
5
- arch: string;
6
- dexPath: string;
7
- nativeLibPath: string;
8
- dexExists: boolean;
9
- nativeLibsExist: boolean;
10
- }
11
-
12
- export interface SDKInitResult {
13
- initialized: boolean;
14
- message?: string;
15
- error?: string;
16
- errorType?: string;
17
- }
18
-
19
- export interface FlirDebugInfo {
20
- sdkAvailable: boolean;
21
- arch: string;
22
- sdkClassesLoaded: boolean;
23
- discoveredDeviceCount: number;
24
- isConnected: boolean;
25
- isStreaming: boolean;
26
- connectedDevice: string;
27
- }
28
-
29
- export interface FlirDevice {
30
- id: string;
31
- name: string;
32
- communicationType: 'USB' | 'NETWORK' | 'EMULATOR';
33
- isEmulator: boolean;
34
- }
35
-
36
- export interface FlirModuleAPI {
37
- // Temperature APIs
38
- getTemperatureFromColor(color: number): Promise<number>;
39
- getLatestFramePath(): Promise<string | null>;
40
- getTemperatureAt(x: number, y: number): Promise<number>;
41
-
42
- // Status APIs
43
- isEmulator(): Promise<boolean>;
44
- isDeviceConnected(): Promise<boolean>;
45
- getConnectedDeviceInfo(): Promise<string>;
46
- isSDKDownloaded(): Promise<boolean>;
47
- getSDKStatus(): Promise<SDKStatus>;
48
-
49
- // Discovery & Connection APIs
50
- startDiscovery(): Promise<boolean>;
51
- stopDiscovery(): Promise<boolean>;
52
- startEmulator(emulatorType: string): Promise<boolean>;
53
- connectToDevice(deviceId: string): Promise<boolean>;
54
- stopFlir(): Promise<boolean>;
55
- getDiscoveredDevices(): Promise<FlirDevice[]>;
56
-
57
- // Debug APIs
58
- initializeSDK(): Promise<SDKInitResult>;
59
- getDebugInfo(): Promise<FlirDebugInfo>;
60
- }
61
-
62
- // FlirDownload removed. Use `FlirModule` APIs instead.
63
- export declare const FlirModule: FlirModuleAPI;
1
+ // FlirDownload API removed: the SDK is bundled at compile time and runtime downloading is not supported.
2
+
3
+ export interface SDKStatus {
4
+ available: boolean;
5
+ arch: string;
6
+ dexPath: string;
7
+ nativeLibPath: string;
8
+ dexExists: boolean;
9
+ nativeLibsExist: boolean;
10
+ }
11
+
12
+ export interface SDKInitResult {
13
+ initialized: boolean;
14
+ message?: string;
15
+ error?: string;
16
+ errorType?: string;
17
+ }
18
+
19
+ export interface FlirDebugInfo {
20
+ sdkAvailable: boolean;
21
+ arch: string;
22
+ sdkClassesLoaded: boolean;
23
+ discoveredDeviceCount: number;
24
+ isConnected: boolean;
25
+ isStreaming: boolean;
26
+ connectedDevice: string;
27
+ }
28
+
29
+ export interface FlirDevice {
30
+ id: string;
31
+ name: string;
32
+ communicationType: 'USB' | 'NETWORK' | 'EMULATOR';
33
+ isEmulator: boolean;
34
+ }
35
+
36
+ export interface FlirModuleAPI {
37
+ // Temperature APIs
38
+ getTemperatureFromColor(color: number): Promise<number>;
39
+ getLatestFramePath(): Promise<string | null>;
40
+ getTemperatureAt(x: number, y: number): Promise<number>;
41
+
42
+ // Status APIs
43
+ isEmulator(): Promise<boolean>;
44
+ isDeviceConnected(): Promise<boolean>;
45
+ getConnectedDeviceInfo(): Promise<string>;
46
+ isSDKDownloaded(): Promise<boolean>;
47
+ getSDKStatus(): Promise<SDKStatus>;
48
+
49
+ // Discovery & Connection APIs
50
+ startDiscovery(): Promise<boolean>;
51
+ stopDiscovery(): Promise<boolean>;
52
+ startEmulator(emulatorType: string): Promise<boolean>;
53
+ connectToDevice(deviceId: string): Promise<boolean>;
54
+ stopFlir(): Promise<boolean>;
55
+ getDiscoveredDevices(): Promise<FlirDevice[]>;
56
+
57
+ // Debug APIs
58
+ initializeSDK(): Promise<SDKInitResult>;
59
+ getDebugInfo(): Promise<FlirDebugInfo>;
60
+ }
61
+
62
+ // FlirDownload removed. Use `FlirModule` APIs instead.
63
+ export declare const FlirModule: FlirModuleAPI;
package/src/index.js CHANGED
@@ -1,7 +1,7 @@
1
- // FlirDownload removed; use `FlirModule` for runtime access to SDK features.
2
-
3
- // Re-export existing FlirModule functionality
4
- // Note: FlirModule should be imported from the native module
5
- import { NativeModules } from 'react-native';
6
- export const FlirModule = NativeModules.FlirModule;
7
-
1
+ // FlirDownload removed; use `FlirModule` for runtime access to SDK features.
2
+
3
+ // Re-export existing FlirModule functionality
4
+ // Note: FlirModule should be imported from the native module
5
+ import { NativeModules } from 'react-native';
6
+ export const FlirModule = NativeModules.FlirModule;
7
+
package/src/index.ts CHANGED
@@ -1,6 +1,6 @@
1
- // FlirDownload removed: SDK is now bundled at compile time; runtime downloads are no longer supported.
2
-
3
- // Re-export existing FlirModule functionality
4
- // Note: FlirModule should be imported from the native module
5
- import { NativeModules } from 'react-native';
6
- export const FlirModule = NativeModules.FlirModule;
1
+ // FlirDownload removed: SDK is now bundled at compile time; runtime downloads are no longer supported.
2
+
3
+ // Re-export existing FlirModule functionality
4
+ // Note: FlirModule should be imported from the native module
5
+ import { NativeModules } from 'react-native';
6
+ export const FlirModule = NativeModules.FlirModule;