ilabs-flir 1.0.2 → 1.0.3
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.
- package/Flir.podspec +31 -31
- package/README.md +1271 -1271
- package/android/Flir/build.gradle.kts +85 -80
- package/android/Flir/src/main/AndroidManifest.xml +31 -31
- package/android/Flir/src/main/java/com/flir/thermalsdk/ErrorCodeException.java +14 -0
- package/android/Flir/src/main/java/com/flir/thermalsdk/image/ImageBuffer.java +11 -0
- package/android/Flir/src/main/java/com/flir/thermalsdk/image/JavaImageBuffer.java +35 -0
- package/android/Flir/src/main/java/com/flir/thermalsdk/image/Palette.java +15 -0
- package/android/Flir/src/main/java/com/flir/thermalsdk/image/PaletteManager.java +16 -0
- package/android/Flir/src/main/java/com/flir/thermalsdk/image/Point.java +11 -0
- package/android/Flir/src/main/java/com/flir/thermalsdk/image/ThermalImage.java +23 -0
- package/android/Flir/src/main/java/com/flir/thermalsdk/image/ThermalValue.java +9 -0
- package/android/Flir/src/main/java/com/flir/thermalsdk/live/CameraType.java +8 -0
- package/android/Flir/src/main/java/com/flir/thermalsdk/live/CommunicationInterface.java +16 -0
- package/android/Flir/src/main/java/com/flir/thermalsdk/live/Identity.java +23 -0
- package/android/Flir/src/main/java/com/flir/thermalsdk/live/IpSettings.java +9 -0
- package/android/Flir/src/main/java/com/flir/thermalsdk/live/connectivity/ConnectionStatusListener.java +7 -0
- package/android/Flir/src/main/java/com/flir/thermalsdk/live/remote/OnReceived.java +5 -0
- package/android/Flir/src/main/java/com/flir/thermalsdk/live/remote/OnRemoteError.java +7 -0
- package/android/Flir/src/main/java/flir/android/CameraHandler.java +224 -194
- package/android/Flir/src/main/java/flir/android/FlirCommands.java +111 -0
- package/android/Flir/src/main/java/flir/android/FlirConnectionManager.java +354 -0
- package/android/Flir/src/main/java/flir/android/FlirController.kt +11 -11
- package/android/Flir/src/main/java/flir/android/FlirDiscoveryManager.java +236 -0
- package/android/Flir/src/main/java/flir/android/FlirDownloadManager.kt +75 -75
- package/android/Flir/src/main/java/flir/android/FlirDownloadPackage.kt +16 -16
- package/android/Flir/src/main/java/flir/android/FlirFrameCache.kt +6 -6
- package/android/Flir/src/main/java/flir/android/FlirManager.kt +254 -248
- package/android/Flir/src/main/java/flir/android/FlirModule.kt +74 -74
- package/android/Flir/src/main/java/flir/android/FlirPackage.kt +19 -19
- package/android/Flir/src/main/java/flir/android/FlirSDKLoader.kt +195 -195
- package/android/Flir/src/main/java/flir/android/FlirSdkManager.java +890 -0
- package/android/Flir/src/main/java/flir/android/FlirStatus.kt +12 -12
- package/android/Flir/src/main/java/flir/android/FlirView.kt +48 -48
- package/android/Flir/src/main/java/flir/android/FlirViewManager.kt +13 -13
- package/android/Flir/src/main/java/flir/android/FrameDataHolder.java +14 -14
- package/app.plugin.js +264 -264
- package/expo-module.config.json +5 -5
- package/ios/Flir/Framework/ThermalSDK/FLIRBattery.h +76 -76
- package/ios/Flir/Framework/ThermalSDK/FLIRCalibration.h +108 -108
- package/ios/Flir/Framework/ThermalSDK/FLIRCamera.h +156 -156
- package/ios/Flir/Framework/ThermalSDK/FLIRCameraDeviceInfo.h +53 -53
- package/ios/Flir/Framework/ThermalSDK/FLIRCameraEvent.h +132 -132
- package/ios/Flir/Framework/ThermalSDK/FLIRCameraImport.h +204 -204
- package/ios/Flir/Framework/ThermalSDK/FLIRColorDistributionSettings.h +204 -204
- package/ios/Flir/Framework/ThermalSDK/FLIRColorizer.h +82 -82
- package/ios/Flir/Framework/ThermalSDK/FLIRDiscoveredCamera.h +44 -44
- package/ios/Flir/Framework/ThermalSDK/FLIRDiscovery.h +132 -132
- package/ios/Flir/Framework/ThermalSDK/FLIRDisplaySettings.h +29 -29
- package/ios/Flir/Framework/ThermalSDK/FLIRFocus.h +70 -70
- package/ios/Flir/Framework/ThermalSDK/FLIRFusion.h +192 -192
- package/ios/Flir/Framework/ThermalSDK/FLIRFusionController.h +136 -136
- package/ios/Flir/Framework/ThermalSDK/FLIRFusionTransformation.h +35 -35
- package/ios/Flir/Framework/ThermalSDK/FLIRIdentity.h +264 -264
- package/ios/Flir/Framework/ThermalSDK/FLIRImageBase.h +196 -196
- package/ios/Flir/Framework/ThermalSDK/FLIRImageColorizer.h +26 -26
- package/ios/Flir/Framework/ThermalSDK/FLIRImageStatistics.h +61 -61
- package/ios/Flir/Framework/ThermalSDK/FLIRIsotherms.h +208 -208
- package/ios/Flir/Framework/ThermalSDK/FLIRMeasurementArea.h +38 -38
- package/ios/Flir/Framework/ThermalSDK/FLIRMeasurementCollection.h +147 -147
- package/ios/Flir/Framework/ThermalSDK/FLIRMeasurementDelta.h +62 -62
- package/ios/Flir/Framework/ThermalSDK/FLIRMeasurementDimensions.h +33 -33
- package/ios/Flir/Framework/ThermalSDK/FLIRMeasurementEllipse.h +49 -49
- package/ios/Flir/Framework/ThermalSDK/FLIRMeasurementLine.h +66 -66
- package/ios/Flir/Framework/ThermalSDK/FLIRMeasurementMarker.h +69 -69
- package/ios/Flir/Framework/ThermalSDK/FLIRMeasurementParameters.h +41 -41
- package/ios/Flir/Framework/ThermalSDK/FLIRMeasurementRectangle.h +36 -36
- package/ios/Flir/Framework/ThermalSDK/FLIRMeasurementReference.h +27 -27
- package/ios/Flir/Framework/ThermalSDK/FLIRMeasurementShape.h +46 -46
- package/ios/Flir/Framework/ThermalSDK/FLIRMeasurementSpot.h +33 -33
- package/ios/Flir/Framework/ThermalSDK/FLIRMeasurementsController.h +160 -160
- package/ios/Flir/Framework/ThermalSDK/FLIRMeterLinkSensorPoll.h +247 -247
- package/ios/Flir/Framework/ThermalSDK/FLIROverlayController.h +27 -27
- package/ios/Flir/Framework/ThermalSDK/FLIRPalette.h +60 -60
- package/ios/Flir/Framework/ThermalSDK/FLIRPaletteController.h +36 -36
- package/ios/Flir/Framework/ThermalSDK/FLIRPaletteManager.h +97 -97
- package/ios/Flir/Framework/ThermalSDK/FLIRQuantification.h +55 -55
- package/ios/Flir/Framework/ThermalSDK/FLIRRemoteControl.h +393 -393
- package/ios/Flir/Framework/ThermalSDK/FLIRRenderer.h +35 -35
- package/ios/Flir/Framework/ThermalSDK/FLIRRendererImpl.h +17 -17
- package/ios/Flir/Framework/ThermalSDK/FLIRScale.h +99 -99
- package/ios/Flir/Framework/ThermalSDK/FLIRScaleController.h +44 -44
- package/ios/Flir/Framework/ThermalSDK/FLIRStream.h +109 -109
- package/ios/Flir/Framework/ThermalSDK/FLIRStreamer.h +124 -124
- package/ios/Flir/Framework/ThermalSDK/FLIRSystem.h +40 -40
- package/ios/Flir/Framework/ThermalSDK/FLIRTemperatureRange.h +43 -43
- package/ios/Flir/Framework/ThermalSDK/FLIRThermalDelta.h +77 -77
- package/ios/Flir/Framework/ThermalSDK/FLIRThermalImage.h +331 -331
- package/ios/Flir/Framework/ThermalSDK/FLIRThermalImageFile.h +56 -56
- package/ios/Flir/Framework/ThermalSDK/FLIRThermalParameters.h +31 -31
- package/ios/Flir/Framework/ThermalSDK/FLIRThermalValue.h +92 -92
- package/ios/Flir/Framework/ThermalSDK/FLIRWirelessCameraDetails.h +88 -88
- package/ios/Flir/Framework/ThermalSDK/ThermalSDK.h +73 -73
- package/ios/Flir/SDKLoader/FlirSDKLoader.m +13 -13
- package/ios/Flir/SDKLoader/FlirSDKLoader.swift +175 -175
- package/ios/Flir/src/FlirEventEmitter.h +12 -12
- package/ios/Flir/src/FlirEventEmitter.m +33 -33
- package/ios/Flir/src/FlirModule.h +10 -10
- package/ios/Flir/src/FlirModule.m +381 -381
- package/ios/Flir/src/FlirPreviewView.h +13 -13
- package/ios/Flir/src/FlirPreviewView.m +24 -24
- package/ios/Flir/src/FlirState.h +20 -20
- package/ios/Flir/src/FlirState.m +79 -79
- package/ios/Flir/src/FlirViewManager.h +9 -9
- package/ios/Flir/src/FlirViewManager.m +16 -16
- package/package.json +60 -60
- package/react-native.config.js +14 -14
- package/scripts/copy_ios_libs.sh +32 -32
- package/scripts/create_stubs.py +174 -174
- package/scripts/download-sdk.js +62 -62
- package/scripts/prepare-binaries.sh +171 -171
- package/sdk-manifest.json +30 -30
- package/src/FlirDownload.ts +78 -78
- package/src/index.d.ts +17 -17
- package/src/index.js +7 -7
- package/src/index.ts +7 -7
|
@@ -1,194 +1,224 @@
|
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
private
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
if (
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
//
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
return null;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
public Identity
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
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
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
package flir.android;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.Nullable;
|
|
4
|
+
import com.facebook.react.bridge.ReadableArray;
|
|
5
|
+
import com.facebook.react.bridge.WritableMap;
|
|
6
|
+
// import com.otaliastudios.cameraview.CameraView; // Removed dependency
|
|
7
|
+
// import ilabs.libs.io.data.Var; // Removed dependency
|
|
8
|
+
|
|
9
|
+
public final class FlirCommands {
|
|
10
|
+
|
|
11
|
+
private FlirCommands() {
|
|
12
|
+
// No instances
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Command 59: selectFlirDevice - Select FLIR device by ID
|
|
17
|
+
* Args: [deviceId: string]
|
|
18
|
+
*/
|
|
19
|
+
public static void handleSelectFlirDevice(Object root, WritableMap resp, @Nullable ReadableArray args) {
|
|
20
|
+
try {
|
|
21
|
+
if (args == null || args.size() < 1) {
|
|
22
|
+
resp.putString("status", "error");
|
|
23
|
+
resp.putString("message", "deviceId required");
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
String deviceId = args.getString(0);
|
|
28
|
+
android.util.Log.i("CameraCommand", "[FLIR] Selecting device: " + deviceId);
|
|
29
|
+
|
|
30
|
+
// Get device from discovery manager
|
|
31
|
+
FlirDiscoveryManager discoveryMgr = FlirDiscoveryManager.getInstance();
|
|
32
|
+
|
|
33
|
+
com.flir.thermalsdk.live.Identity identity = discoveryMgr.getDeviceById(deviceId);
|
|
34
|
+
|
|
35
|
+
if (identity == null) {
|
|
36
|
+
resp.putString("status", "error");
|
|
37
|
+
resp.putString("message", "Device not found: " + deviceId);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Select and connect to device
|
|
42
|
+
FlirConnectionManager.getInstance().selectDevice(identity);
|
|
43
|
+
|
|
44
|
+
resp.putString("status", "ok");
|
|
45
|
+
resp.putString("message", "Device selected");
|
|
46
|
+
resp.putString("deviceId", deviceId);
|
|
47
|
+
} catch (Exception e) {
|
|
48
|
+
android.util.Log.w("CameraCommand", "[FLIR] Device selection failed", e);
|
|
49
|
+
resp.putString("status", "error");
|
|
50
|
+
resp.putString("message", e.getMessage());
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Command 60: setFlirEmulatorType - Set FLIR emulator type
|
|
56
|
+
* Args: [type: "FLIR_ONE" | "FLIR_ONE_EDGE"]
|
|
57
|
+
*/
|
|
58
|
+
public static void handleSetFlirEmulatorType(Object root, WritableMap resp, @Nullable ReadableArray args) {
|
|
59
|
+
try {
|
|
60
|
+
if (args == null || args.size() < 1) {
|
|
61
|
+
resp.putString("status", "error");
|
|
62
|
+
resp.putString("message", "emulator type required");
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
String type = args.getString(0);
|
|
67
|
+
|
|
68
|
+
if (!"FLIR_ONE".equals(type) && !"FLIR_ONE_EDGE".equals(type)) {
|
|
69
|
+
resp.putString("status", "error");
|
|
70
|
+
resp.putString("message", "Invalid type. Use FLIR_ONE or FLIR_ONE_EDGE");
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Set type in discovery manager
|
|
75
|
+
FlirDiscoveryManager.getInstance().setEmulatorType(type);
|
|
76
|
+
|
|
77
|
+
android.util.Log.i("CameraCommand", "[FLIR] Emulator type set to: " + type);
|
|
78
|
+
|
|
79
|
+
resp.putString("status", "ok");
|
|
80
|
+
resp.putString("message", "Emulator type set");
|
|
81
|
+
resp.putString("emulatorType", type);
|
|
82
|
+
} catch (Exception e) {
|
|
83
|
+
android.util.Log.w("CameraCommand", "[FLIR] Set emulator type failed", e);
|
|
84
|
+
resp.putString("status", "error");
|
|
85
|
+
resp.putString("message", e.getMessage());
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Command 61: setFlirPalette - Set FLIR thermal palette
|
|
91
|
+
* Args: [acol: number] - palette index
|
|
92
|
+
*/
|
|
93
|
+
public static void handleSetFlirPalette(Object root, WritableMap resp, @Nullable ReadableArray args) {
|
|
94
|
+
try {
|
|
95
|
+
int acol = args != null && args.size() > 0 ? (int) args.getDouble(0) : 1;
|
|
96
|
+
|
|
97
|
+
android.util.Log.i("CameraCommand", "[FLIR] Setting palette acol=" + acol);
|
|
98
|
+
|
|
99
|
+
// Set palette via FlirConnectionManager
|
|
100
|
+
FlirConnectionManager.getInstance().setPalette(acol);
|
|
101
|
+
|
|
102
|
+
resp.putString("status", "ok");
|
|
103
|
+
resp.putString("message", "Palette set");
|
|
104
|
+
resp.putInt("acol", acol);
|
|
105
|
+
} catch (Exception e) {
|
|
106
|
+
android.util.Log.w("CameraCommand", "[FLIR] Set palette failed", e);
|
|
107
|
+
resp.putString("status", "error");
|
|
108
|
+
resp.putString("message", e.getMessage());
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|