ilabs-flir 1.0.3 → 1.0.5

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 (33) hide show
  1. package/android/Flir/build.gradle.kts +14 -27
  2. package/android/Flir/libs/androidsdk-release.aar +0 -0
  3. package/android/Flir/libs/thermalsdk-release.aar +0 -0
  4. package/android/Flir/src/main/java/flir/android/FlirCommands.java +40 -15
  5. package/android/Flir/src/main/java/flir/android/FlirDownloadManager.kt +26 -46
  6. package/android/Flir/src/main/java/flir/android/FlirManager.kt +265 -42
  7. package/android/Flir/src/main/java/flir/android/FlirModule.kt +32 -0
  8. package/android/Flir/src/main/java/flir/android/FlirSDKLoader.kt +84 -195
  9. package/android/Flir/src/main/java/flir/android/FlirSdkManager.java +667 -797
  10. package/package.json +1 -1
  11. package/sdk-manifest.json +14 -7
  12. package/src/index.d.ts +21 -1
  13. package/android/Flir/libs/flir-stubs.jar +0 -0
  14. package/android/Flir/src/main/java/com/flir/thermalsdk/ErrorCodeException.java +0 -14
  15. package/android/Flir/src/main/java/com/flir/thermalsdk/image/ImageBuffer.java +0 -11
  16. package/android/Flir/src/main/java/com/flir/thermalsdk/image/JavaImageBuffer.java +0 -35
  17. package/android/Flir/src/main/java/com/flir/thermalsdk/image/Palette.java +0 -15
  18. package/android/Flir/src/main/java/com/flir/thermalsdk/image/PaletteManager.java +0 -16
  19. package/android/Flir/src/main/java/com/flir/thermalsdk/image/Point.java +0 -11
  20. package/android/Flir/src/main/java/com/flir/thermalsdk/image/ThermalImage.java +0 -23
  21. package/android/Flir/src/main/java/com/flir/thermalsdk/image/ThermalValue.java +0 -9
  22. package/android/Flir/src/main/java/com/flir/thermalsdk/live/CameraType.java +0 -8
  23. package/android/Flir/src/main/java/com/flir/thermalsdk/live/CommunicationInterface.java +0 -16
  24. package/android/Flir/src/main/java/com/flir/thermalsdk/live/Identity.java +0 -23
  25. package/android/Flir/src/main/java/com/flir/thermalsdk/live/IpSettings.java +0 -9
  26. package/android/Flir/src/main/java/com/flir/thermalsdk/live/connectivity/ConnectionStatusListener.java +0 -7
  27. package/android/Flir/src/main/java/com/flir/thermalsdk/live/remote/OnReceived.java +0 -5
  28. package/android/Flir/src/main/java/com/flir/thermalsdk/live/remote/OnRemoteError.java +0 -7
  29. package/android/Flir/src/main/java/flir/android/CameraHandler.java +0 -224
  30. package/android/Flir/src/main/java/flir/android/FlirConnectionManager.java +0 -354
  31. package/android/Flir/src/main/java/flir/android/FlirController.kt +0 -11
  32. package/android/Flir/src/main/java/flir/android/FlirDiscoveryManager.java +0 -236
  33. package/android/Flir/src/main/java/flir/android/FrameDataHolder.java +0 -14
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ilabs-flir",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "FLIR Thermal SDK for React Native - On-Demand Download",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
package/sdk-manifest.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.0",
2
+ "version": "1.0.1",
3
3
  "sdkVersion": "4.16.0",
4
4
  "ios": {
5
5
  "downloadUrl": "https://github.com/PraveenOjha/flir-sdk-binaries/releases/download/v1.0.0/ios-sdk.zip",
@@ -19,12 +19,19 @@
19
19
  ]
20
20
  },
21
21
  "android": {
22
- "playFeatureModule": "flir_sdk",
23
- "directDownload": {
24
- "downloadUrl": "https://github.com/PraveenOjha/flir-sdk-binaries/releases/download/v1.0.0/android-sdk.zip",
25
- "sha256": "d4901615e39e396126bde0dbccd4a234e64cda1d6f9464a30e317e1c5cb9c5e9",
26
- "sizeBytes": 103912094,
27
- "files": ["thermalsdk-release.aar", "androidsdk-release.aar"]
22
+ "packages": {
23
+ "arm64-v8a": {
24
+ "downloadUrl": "https://github.com/PraveenOjha/flir-sdk-binaries/releases/download/v1.0.1/flir-sdk-arm64-v8a.zip",
25
+ "sizeBytes": 36328411
26
+ },
27
+ "armeabi-v7a": {
28
+ "downloadUrl": "https://github.com/PraveenOjha/flir-sdk-binaries/releases/download/v1.0.1/flir-sdk-armeabi-v7a.zip",
29
+ "sizeBytes": 33248516
30
+ },
31
+ "x86_64": {
32
+ "downloadUrl": "https://github.com/PraveenOjha/flir-sdk-binaries/releases/download/v1.0.1/flir-sdk-x86_64.zip",
33
+ "sizeBytes": 38421590
34
+ }
28
35
  }
29
36
  }
30
37
  }
package/src/index.d.ts CHANGED
@@ -13,5 +13,25 @@ export interface FlirDownloadAPI {
13
13
  delete(): Promise<boolean>;
14
14
  }
15
15
 
16
+ export interface SDKStatus {
17
+ available: boolean;
18
+ arch: string;
19
+ dexPath: string;
20
+ nativeLibPath: string;
21
+ dexExists: boolean;
22
+ nativeLibsExist: boolean;
23
+ }
24
+
25
+ export interface FlirModuleAPI {
26
+ getTemperatureFromColor(color: number): Promise<number>;
27
+ getLatestFramePath(): Promise<string | null>;
28
+ getTemperatureAt(x: number, y: number): Promise<number>;
29
+ isEmulator(): Promise<boolean>;
30
+ isDeviceConnected(): Promise<boolean>;
31
+ getConnectedDeviceInfo(): Promise<string>;
32
+ isSDKDownloaded(): Promise<boolean>;
33
+ getSDKStatus(): Promise<SDKStatus>;
34
+ }
35
+
16
36
  export declare const FlirDownload: FlirDownloadAPI;
17
- export declare const FlirModule: any;
37
+ export declare const FlirModule: FlirModuleAPI;
Binary file
@@ -1,14 +0,0 @@
1
- package com.flir.thermalsdk;
2
-
3
- public class ErrorCodeException extends Exception {
4
- private final ErrorCode errorCode;
5
-
6
- public ErrorCodeException(ErrorCode errorCode) {
7
- super(errorCode.toString());
8
- this.errorCode = errorCode;
9
- }
10
-
11
- public ErrorCode getErrorCode() {
12
- return errorCode;
13
- }
14
- }
@@ -1,11 +0,0 @@
1
- package com.flir.thermalsdk.image;
2
-
3
- public interface ImageBuffer {
4
- int getWidth();
5
-
6
- int getHeight();
7
-
8
- int getStride();
9
-
10
- byte[] getPixelBuffer();
11
- }
@@ -1,35 +0,0 @@
1
- package com.flir.thermalsdk.image;
2
-
3
- public class JavaImageBuffer implements ImageBuffer {
4
- public final byte[] pixelBuffer;
5
- public final int height;
6
- public final int width;
7
- public final int stride;
8
-
9
- public JavaImageBuffer(byte[] pixelBuffer, int width, int height, int stride) {
10
- this.pixelBuffer = pixelBuffer;
11
- this.width = width;
12
- this.height = height;
13
- this.stride = stride;
14
- }
15
-
16
- @Override
17
- public int getWidth() {
18
- return width;
19
- }
20
-
21
- @Override
22
- public int getHeight() {
23
- return height;
24
- }
25
-
26
- @Override
27
- public int getStride() {
28
- return stride;
29
- }
30
-
31
- @Override
32
- public byte[] getPixelBuffer() {
33
- return pixelBuffer;
34
- }
35
- }
@@ -1,15 +0,0 @@
1
- package com.flir.thermalsdk.image;
2
-
3
- public class Palette {
4
- public final String name;
5
- public final boolean inverted;
6
-
7
- public Palette(String name, boolean inverted) {
8
- this.name = name;
9
- this.inverted = inverted;
10
- }
11
-
12
- public Palette getInverted() {
13
- return new Palette(name, !inverted);
14
- }
15
- }
@@ -1,16 +0,0 @@
1
- package com.flir.thermalsdk.image;
2
-
3
- import java.util.ArrayList;
4
- import java.util.List;
5
-
6
- public class PaletteManager {
7
- public static List<Palette> getDefaultPalettes() {
8
- List<Palette> palettes = new ArrayList<>();
9
- palettes.add(new Palette("iron", false));
10
- palettes.add(new Palette("rainbow", false));
11
- palettes.add(new Palette("arctic", false));
12
- palettes.add(new Palette("lava", false));
13
- palettes.add(new Palette("grayscale", false));
14
- return palettes;
15
- }
16
- }
@@ -1,11 +0,0 @@
1
- package com.flir.thermalsdk.image;
2
-
3
- public class Point {
4
- public final int x;
5
- public final int y;
6
-
7
- public Point(int x, int y) {
8
- this.x = x;
9
- this.y = y;
10
- }
11
- }
@@ -1,23 +0,0 @@
1
- package com.flir.thermalsdk.image;
2
-
3
- public class ThermalImage {
4
- public void setPalette(Palette palette) {
5
- // Stub implementation
6
- }
7
-
8
- public Palette getPalette() {
9
- return null;
10
- }
11
-
12
- public int getWidth() {
13
- return 0;
14
- }
15
-
16
- public int getHeight() {
17
- return 0;
18
- }
19
-
20
- public ThermalValue getValueAt(Point point) {
21
- return new ThermalValue(0.0);
22
- }
23
- }
@@ -1,9 +0,0 @@
1
- package com.flir.thermalsdk.image;
2
-
3
- public class ThermalValue {
4
- public final double value;
5
-
6
- public ThermalValue(double value) {
7
- this.value = value;
8
- }
9
- }
@@ -1,8 +0,0 @@
1
- package com.flir.thermalsdk.live;
2
-
3
- public enum CameraType {
4
- FLIR_ONE,
5
- FLIR_ONE_PRO,
6
- FLIR_ONE_EDGE,
7
- GENERIC
8
- }
@@ -1,16 +0,0 @@
1
- package com.flir.thermalsdk.live;
2
-
3
- public enum CommunicationInterface {
4
- USB,
5
- NETWORK,
6
- FIREWIRE,
7
- EMULATOR,
8
- BLUETOOTH,
9
- EBUS,
10
- USBHSI,
11
- LIGHTNING,
12
- INTEGRATED,
13
- FLIR_ONE_WIRELESS,
14
- ACE,
15
- CUSTOM
16
- }
@@ -1,23 +0,0 @@
1
- package com.flir.thermalsdk.live;
2
-
3
- public class Identity {
4
- public final CommunicationInterface communicationInterface;
5
- public final CameraType cameraType;
6
- public final IpSettings ipSettings;
7
- public final String deviceId;
8
-
9
- public Identity() {
10
- this.communicationInterface = null;
11
- this.cameraType = null;
12
- this.ipSettings = null;
13
- this.deviceId = null;
14
- }
15
-
16
- public Identity(CommunicationInterface communicationInterface, CameraType cameraType, String deviceId,
17
- IpSettings ipSettings) {
18
- this.communicationInterface = communicationInterface;
19
- this.cameraType = cameraType;
20
- this.deviceId = deviceId;
21
- this.ipSettings = ipSettings;
22
- }
23
- }
@@ -1,9 +0,0 @@
1
- package com.flir.thermalsdk.live;
2
-
3
- public class IpSettings {
4
- public final String ipAddress;
5
-
6
- public IpSettings(String ipAddress) {
7
- this.ipAddress = ipAddress;
8
- }
9
- }
@@ -1,7 +0,0 @@
1
- package com.flir.thermalsdk.live.connectivity;
2
-
3
- import com.flir.thermalsdk.ErrorCode;
4
-
5
- public interface ConnectionStatusListener {
6
- void onDisconnected(ErrorCode errorCode);
7
- }
@@ -1,5 +0,0 @@
1
- package com.flir.thermalsdk.live.remote;
2
-
3
- public interface OnReceived<T> {
4
- void onReceived(T data);
5
- }
@@ -1,7 +0,0 @@
1
- package com.flir.thermalsdk.live.remote;
2
-
3
- import com.flir.thermalsdk.ErrorCode;
4
-
5
- public interface OnRemoteError {
6
- void onRemoteError(ErrorCode error);
7
- }
@@ -1,224 +0,0 @@
1
- package flir.android;
2
-
3
- import android.graphics.Bitmap;
4
- import android.util.Log;
5
-
6
- import com.flir.thermalsdk.androidsdk.image.BitmapAndroid;
7
- import com.flir.thermalsdk.image.ThermalImage;
8
- import com.flir.thermalsdk.live.Camera;
9
- import com.flir.thermalsdk.live.CommunicationInterface;
10
- import com.flir.thermalsdk.live.ConnectParameters;
11
- import com.flir.thermalsdk.live.Identity;
12
- import com.flir.thermalsdk.live.connectivity.ConnectionStatusListener;
13
- import com.flir.thermalsdk.live.discovery.DiscoveryEventListener;
14
- import com.flir.thermalsdk.live.discovery.DiscoveryFactory;
15
- import com.flir.thermalsdk.live.streaming.Stream;
16
- import com.flir.thermalsdk.live.streaming.ThermalStreamer;
17
-
18
- import java.io.IOException;
19
- import java.util.LinkedList;
20
- import java.util.Objects;
21
-
22
- public class CameraHandler {
23
-
24
- private static final String TAG = "CameraHandler";
25
-
26
- private StreamDataListener streamDataListener;
27
-
28
- public interface StreamDataListener {
29
- void images(FrameDataHolder dataHolder);
30
-
31
- void images(Bitmap msxBitmap, Bitmap dcBitmap);
32
- }
33
-
34
- LinkedList<Identity> foundCameraIdentities = new LinkedList<>();
35
-
36
- private Camera camera;
37
-
38
- private Stream connectedStream;
39
- private ThermalStreamer streamer;
40
- // Cache the latest ThermalImage delivered by the streamer
41
- private ThermalImage latestThermalImage;
42
-
43
- public CameraHandler() {
44
- Log.d(TAG, "CameraHandler constr");
45
- }
46
-
47
- public void startDiscovery(DiscoveryEventListener cameraDiscoveryListener, DiscoveryStatus discoveryStatus) {
48
- DiscoveryFactory.getInstance().scan(cameraDiscoveryListener, CommunicationInterface.EMULATOR,
49
- CommunicationInterface.USB);
50
- discoveryStatus.started();
51
- }
52
-
53
- public void stopDiscovery(DiscoveryStatus discoveryStatus) {
54
- DiscoveryFactory.getInstance().stop(CommunicationInterface.EMULATOR, CommunicationInterface.USB);
55
- discoveryStatus.stopped();
56
- }
57
-
58
- public synchronized void connect(Identity identity, ConnectionStatusListener connectionStatusListener)
59
- throws IOException {
60
- Log.d(TAG, "connect identity: " + identity);
61
- camera = new Camera();
62
- camera.connect(identity, connectionStatusListener, new ConnectParameters());
63
- }
64
-
65
- public synchronized void disconnect() {
66
- Log.d(TAG, "disconnect");
67
- if (camera == null) {
68
- return;
69
- }
70
- if (connectedStream == null) {
71
- return;
72
- }
73
-
74
- if (connectedStream.isStreaming()) {
75
- connectedStream.stop();
76
- }
77
- camera.disconnect();
78
- camera = null;
79
- }
80
-
81
- public synchronized void startStream(StreamDataListener listener) {
82
- this.streamDataListener = listener;
83
- if (camera == null || !camera.isConnected()) {
84
- Log.e(TAG, "startStream, failed, camera was null or not connected");
85
- return;
86
- }
87
- connectedStream = camera.getStreams().get(0);
88
- if (connectedStream.isThermal()) {
89
- streamer = new ThermalStreamer(connectedStream);
90
- } else {
91
- Log.e(TAG, "startStream, failed, no thermal stream available for the camera");
92
- return;
93
- }
94
- connectedStream.start(
95
- unused -> {
96
- streamer.update();
97
- final Bitmap[] dcBitmap = new Bitmap[1];
98
- streamer.withThermalImage(thermalImage -> {
99
- try {
100
- // Cache the latest ThermalImage for sampling
101
- latestThermalImage = thermalImage;
102
- // TODO: Re-enable fusion when SDK is available at runtime
103
- // if (thermalImage.getFusion() != null && thermalImage.getFusion().getPhoto()
104
- // != null) {
105
- // dcBitmap[0] = BitmapAndroid.createBitmap(thermalImage.getFusion().getPhoto())
106
- // .getBitMap();
107
- // }
108
- // The streamer.getImage() returns the ImageBuffer expected by BitmapAndroid
109
- // final Bitmap thermalPixels =
110
- // BitmapAndroid.createBitmap(streamer.getImage()).getBitMap();
111
- // if (streamDataListener != null) streamDataListener.images(thermalPixels,
112
- // dcBitmap[0]);
113
- } catch (Exception e) {
114
- Log.e(TAG, "thermal bitmap creation error", e);
115
- }
116
- });
117
- },
118
- error -> Log.e(TAG, "Streaming error: " + error));
119
- }
120
-
121
- public synchronized Double getTemperatureAt(int x, int y) {
122
- try {
123
- if (streamer == null)
124
- return null;
125
- ThermalImage img = latestThermalImage;
126
- if (img == null)
127
- return null;
128
-
129
- java.lang.reflect.Method[] methods = img.getClass().getMethods();
130
- for (java.lang.reflect.Method m : methods) {
131
- String name = m.getName().toLowerCase();
132
- Class<?>[] params = m.getParameterTypes();
133
-
134
- if ((name.contains("get") || name.contains("value") || name.contains("temperature"))
135
- && params.length == 2
136
- && (params[0] == int.class || params[0] == Integer.class || params[0] == double.class
137
- || params[0] == float.class)
138
- && (params[1] == int.class || params[1] == Integer.class || params[1] == double.class
139
- || params[1] == float.class)) {
140
- try {
141
- Object res = null;
142
- if (params[0] == int.class && params[1] == int.class) {
143
- res = m.invoke(img, x, y);
144
- } else if (params[0] == double.class && params[1] == double.class) {
145
- res = m.invoke(img, (double) x, (double) y);
146
- } else if (params[0] == float.class && params[1] == float.class) {
147
- res = m.invoke(img, (float) x, (float) y);
148
- } else {
149
- res = m.invoke(img, Integer.valueOf(x), Integer.valueOf(y));
150
- }
151
- if (res instanceof Number) {
152
- return ((Number) res).doubleValue();
153
- }
154
- } catch (Exception e) {
155
- }
156
- }
157
- }
158
- } catch (Exception e) {
159
- Log.e(TAG, "getTemperatureAt error", e);
160
- }
161
- return null;
162
- }
163
-
164
- public void add(Identity identity) {
165
- foundCameraIdentities.add(identity);
166
- }
167
-
168
- public Identity getCppEmulator() {
169
- for (Identity foundCameraIdentity : foundCameraIdentities) {
170
- if (foundCameraIdentity.deviceId.contains("C++ Emulator")) {
171
- return foundCameraIdentity;
172
- }
173
- }
174
- return null;
175
- }
176
-
177
- public Identity getFlirOneEmulator() {
178
- for (Identity foundCameraIdentity : foundCameraIdentities) {
179
- if (foundCameraIdentity.deviceId.contains("EMULATED FLIR ONE")) {
180
- return foundCameraIdentity;
181
- }
182
- }
183
- return null;
184
- }
185
-
186
- public Identity getFlirOne() {
187
- for (Identity foundCameraIdentity : foundCameraIdentities) {
188
- if (foundCameraIdentity.communicationInterface == CommunicationInterface.USB)
189
- return foundCameraIdentity;
190
- }
191
- return null;
192
- }
193
-
194
- public String getDeviceInfo() {
195
- if (camera == null)
196
- return "N/A";
197
- try {
198
- if (camera.getRemoteControl() == null)
199
- return "N/A";
200
- return camera.getRemoteControl().cameraInformation().getSync().displayName;
201
- } catch (Exception e) {
202
- return "N/A";
203
- }
204
- }
205
-
206
- public void setPalette(String name) {
207
- if (latestThermalImage != null) {
208
- java.util.List<com.flir.thermalsdk.image.Palette> palettes = com.flir.thermalsdk.image.PaletteManager
209
- .getDefaultPalettes();
210
- for (com.flir.thermalsdk.image.Palette p : palettes) {
211
- if (p.name.equalsIgnoreCase(name)) {
212
- latestThermalImage.setPalette(p);
213
- break;
214
- }
215
- }
216
- }
217
- }
218
-
219
- public interface DiscoveryStatus {
220
- void started();
221
-
222
- void stopped();
223
- }
224
- }