ilabs-flir 1.0.3 → 1.0.4
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/android/Flir/libs/flir-stubs.jar +0 -0
- package/android/Flir/src/main/java/com/flir/thermalsdk/ErrorCode.java +13 -0
- package/android/Flir/src/main/java/com/flir/thermalsdk/ThermalSdkAndroid.java +16 -0
- package/android/Flir/src/main/java/com/flir/thermalsdk/androidsdk/image/BitmapAndroid.java +20 -0
- package/android/Flir/src/main/java/com/flir/thermalsdk/live/Camera.java +26 -0
- package/android/Flir/src/main/java/com/flir/thermalsdk/live/ConnectParameters.java +16 -0
- package/android/Flir/src/main/java/com/flir/thermalsdk/live/RemoteControl.java +16 -0
- package/android/Flir/src/main/java/com/flir/thermalsdk/live/discovery/DiscoveryEventListener.java +14 -0
- package/android/Flir/src/main/java/com/flir/thermalsdk/live/discovery/DiscoveryFactory.java +33 -0
- package/android/Flir/src/main/java/com/flir/thermalsdk/live/streaming/Stream.java +8 -0
- package/android/Flir/src/main/java/com/flir/thermalsdk/live/streaming/ThermalStreamer.java +28 -0
- package/android/Flir/src/main/java/com/flir/thermalsdk/live/streaming/VisualStreamer.java +18 -0
- package/android/Flir/src/main/java/flir/android/FlirCommands.java +40 -15
- package/android/Flir/src/main/java/flir/android/FlirDownloadManager.kt +6 -5
- package/android/Flir/src/main/java/flir/android/FlirManager.kt +265 -42
- package/android/Flir/src/main/java/flir/android/FlirSDKLoader.kt +242 -194
- package/android/Flir/src/main/java/flir/android/FlirSdkManager.java +1376 -755
- package/package.json +1 -1
- package/sdk-manifest.json +14 -7
- package/android/Flir/src/main/java/flir/android/CameraHandler.java +0 -224
- package/android/Flir/src/main/java/flir/android/FlirConnectionManager.java +0 -354
- package/android/Flir/src/main/java/flir/android/FlirController.kt +0 -11
- package/android/Flir/src/main/java/flir/android/FlirDiscoveryManager.java +0 -236
- package/android/Flir/src/main/java/flir/android/FrameDataHolder.java +0 -14
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
package flir.android;
|
|
2
|
-
|
|
3
|
-
import android.util.Log;
|
|
4
|
-
import com.flir.thermalsdk.ErrorCode;
|
|
5
|
-
import com.flir.thermalsdk.live.CommunicationInterface;
|
|
6
|
-
import com.flir.thermalsdk.live.Identity;
|
|
7
|
-
import com.flir.thermalsdk.live.discovery.DiscoveredCamera;
|
|
8
|
-
import com.flir.thermalsdk.live.discovery.DiscoveryEventListener;
|
|
9
|
-
import com.flir.thermalsdk.live.discovery.DiscoveryFactory;
|
|
10
|
-
import java.util.ArrayList;
|
|
11
|
-
import java.util.List;
|
|
12
|
-
import java.util.concurrent.Executors;
|
|
13
|
-
import java.util.concurrent.ScheduledExecutorService;
|
|
14
|
-
import java.util.concurrent.TimeUnit;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* FLIR Discovery Manager
|
|
18
|
-
* Handles device discovery with 5 second timeout
|
|
19
|
-
* Supports FLIR ONE and FLIR ONE Edge emulators
|
|
20
|
-
* Emits discovered devices to React Native
|
|
21
|
-
*/
|
|
22
|
-
public class FlirDiscoveryManager {
|
|
23
|
-
private static final String TAG = "FlirDiscoveryManager";
|
|
24
|
-
private static FlirDiscoveryManager instance;
|
|
25
|
-
|
|
26
|
-
private final List<Identity> discoveredDevices = new ArrayList<>();
|
|
27
|
-
private final ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor();
|
|
28
|
-
private boolean isDiscovering = false;
|
|
29
|
-
private DiscoveryEventListener currentListener;
|
|
30
|
-
|
|
31
|
-
// Configuration variables (set by app)
|
|
32
|
-
private String flirEmulatorType = "FLIR_ONE_EDGE";
|
|
33
|
-
private boolean isEmu = false;
|
|
34
|
-
|
|
35
|
-
// Event callback interface
|
|
36
|
-
public interface DiscoveryEventCallback {
|
|
37
|
-
void onDevicesDiscovered(List<Identity> devices);
|
|
38
|
-
|
|
39
|
-
void onDiscoveryError(String error);
|
|
40
|
-
|
|
41
|
-
// Added missing methods to match usage
|
|
42
|
-
void onCameraFound(String deviceId, String cameraType, String connectionType);
|
|
43
|
-
|
|
44
|
-
void onDiscoveryError(String connectionType, String error);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
private DiscoveryEventCallback eventCallback;
|
|
48
|
-
|
|
49
|
-
private FlirDiscoveryManager() {
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
public static synchronized FlirDiscoveryManager getInstance() {
|
|
53
|
-
if (instance == null) {
|
|
54
|
-
instance = new FlirDiscoveryManager();
|
|
55
|
-
}
|
|
56
|
-
return instance;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
public void setEmulatorType(String type) {
|
|
60
|
-
this.flirEmulatorType = type;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
public void setIsEmu(boolean isEmu) {
|
|
64
|
-
this.isEmu = isEmu;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
public void setEventCallback(DiscoveryEventCallback callback) {
|
|
68
|
-
this.eventCallback = callback;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Start discovery with 5 second timeout
|
|
73
|
-
* Searches for NETWORK devices and EMULATOR (based on flirEmulatorType)
|
|
74
|
-
* Disconnects any currently connected device first
|
|
75
|
-
*/
|
|
76
|
-
public void startDiscovery() {
|
|
77
|
-
if (isDiscovering) {
|
|
78
|
-
Log.d(TAG, "[FLIR] Discovery already in progress");
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// Disconnect current device before starting new discovery
|
|
83
|
-
Log.i(TAG, "[FLIR] 🔌 Disconnecting current device before discovery...");
|
|
84
|
-
FlirConnectionManager.getInstance().disconnect();
|
|
85
|
-
|
|
86
|
-
Log.i(TAG, "[FLIR] 🔍 Starting discovery (timeout based on isEmu)...");
|
|
87
|
-
isDiscovering = true;
|
|
88
|
-
discoveredDevices.clear();
|
|
89
|
-
|
|
90
|
-
// Determine emulator interface based on type
|
|
91
|
-
CommunicationInterface emulatorInterface = getEmulatorInterface();
|
|
92
|
-
Log.d(TAG, "[FLIR] Emulator type: " + flirEmulatorType + " -> " + emulatorInterface);
|
|
93
|
-
|
|
94
|
-
// Create discovery listener
|
|
95
|
-
currentListener = new DiscoveryEventListener() {
|
|
96
|
-
@Override
|
|
97
|
-
public void onCameraFound(DiscoveredCamera discoveredCamera) {
|
|
98
|
-
Identity identity = discoveredCamera.identity; // Field access
|
|
99
|
-
|
|
100
|
-
// Avoid duplicates
|
|
101
|
-
boolean alreadyAdded = false;
|
|
102
|
-
for (Identity existing : discoveredDevices) {
|
|
103
|
-
if (existing.deviceId.equals(identity.deviceId)) {
|
|
104
|
-
alreadyAdded = true;
|
|
105
|
-
break;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (!alreadyAdded) {
|
|
110
|
-
discoveredDevices.add(identity);
|
|
111
|
-
String type = "UNKNOWN";
|
|
112
|
-
if (identity.communicationInterface != null) {
|
|
113
|
-
type = identity.communicationInterface.name();
|
|
114
|
-
}
|
|
115
|
-
Log.i(TAG, "[FLIR] 📡 Device found: " + identity.deviceId + " (" + type + ")");
|
|
116
|
-
|
|
117
|
-
if (eventCallback != null) {
|
|
118
|
-
// Use cameraType field directly (public final field)
|
|
119
|
-
String cameraTypeStr = (identity.cameraType != null) ? identity.cameraType.toString()
|
|
120
|
-
: "UNKNOWN";
|
|
121
|
-
eventCallback.onCameraFound(identity.deviceId, cameraTypeStr, type);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
@Override
|
|
127
|
-
public void onDiscoveryError(CommunicationInterface iface, ErrorCode err) {
|
|
128
|
-
Log.w(TAG, "[FLIR] Discovery error on " + iface + ": " + err);
|
|
129
|
-
if (eventCallback != null) {
|
|
130
|
-
eventCallback.onDiscoveryError(iface.name(), err.toString());
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
// Start scan
|
|
136
|
-
try {
|
|
137
|
-
DiscoveryFactory.getInstance().scan(
|
|
138
|
-
currentListener,
|
|
139
|
-
CommunicationInterface.NETWORK,
|
|
140
|
-
emulatorInterface);
|
|
141
|
-
|
|
142
|
-
// Timeout: 0 seconds if isEmu=true (go straight to emulator), else 5 seconds
|
|
143
|
-
long timeoutSeconds = isEmu ? 0 : 5;
|
|
144
|
-
Log.d(TAG, "[FLIR] Discovery timeout: " + timeoutSeconds + "s (isEmu=" + isEmu + ")");
|
|
145
|
-
|
|
146
|
-
// Schedule timeout
|
|
147
|
-
scheduler.schedule(() -> {
|
|
148
|
-
stopDiscovery();
|
|
149
|
-
onDiscoveryComplete();
|
|
150
|
-
}, timeoutSeconds, TimeUnit.SECONDS);
|
|
151
|
-
|
|
152
|
-
} catch (Exception e) {
|
|
153
|
-
Log.e(TAG, "[FLIR] Failed to start discovery", e);
|
|
154
|
-
isDiscovering = false;
|
|
155
|
-
if (eventCallback != null) {
|
|
156
|
-
eventCallback.onDiscoveryError("Failed to start discovery: " + e.getMessage());
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Stop discovery
|
|
163
|
-
*/
|
|
164
|
-
public void stopDiscovery() {
|
|
165
|
-
if (!isDiscovering) {
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
Log.d(TAG, "[FLIR] Stopping discovery...");
|
|
170
|
-
try {
|
|
171
|
-
DiscoveryFactory.getInstance().stop();
|
|
172
|
-
} catch (Exception e) {
|
|
173
|
-
Log.w(TAG, "[FLIR] Error stopping discovery", e);
|
|
174
|
-
}
|
|
175
|
-
isDiscovering = false;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Called when discovery completes (timeout or manual stop)
|
|
180
|
-
*/
|
|
181
|
-
private void onDiscoveryComplete() {
|
|
182
|
-
Log.i(TAG, "[FLIR] ✅ Discovery complete - found " + discoveredDevices.size() + " device(s)");
|
|
183
|
-
|
|
184
|
-
// Notify callback
|
|
185
|
-
if (eventCallback != null) {
|
|
186
|
-
eventCallback.onDevicesDiscovered(new ArrayList<>(discoveredDevices));
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
// Auto-select first device
|
|
190
|
-
if (!discoveredDevices.isEmpty()) {
|
|
191
|
-
Identity firstDevice = discoveredDevices.get(0);
|
|
192
|
-
Log.i(TAG, "[FLIR] Auto-selecting first device: " + firstDevice.deviceId);
|
|
193
|
-
FlirConnectionManager.getInstance().selectDevice(firstDevice);
|
|
194
|
-
} else {
|
|
195
|
-
Log.w(TAG, "[FLIR] No devices found after timeout");
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Get emulator communication interface based on flirEmulatorType
|
|
201
|
-
*/
|
|
202
|
-
private CommunicationInterface getEmulatorInterface() {
|
|
203
|
-
if ("FLIR_ONE".equals(flirEmulatorType)) {
|
|
204
|
-
return CommunicationInterface.EMULATOR;
|
|
205
|
-
} else {
|
|
206
|
-
// Default to FLIR_ONE_EDGE
|
|
207
|
-
return CommunicationInterface.EMULATOR;
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* Get discovered device by ID
|
|
213
|
-
*/
|
|
214
|
-
public Identity getDeviceById(String deviceId) {
|
|
215
|
-
for (Identity identity : discoveredDevices) {
|
|
216
|
-
if (identity.deviceId.equals(deviceId)) {
|
|
217
|
-
return identity;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
return null;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* Get list of all discovered devices
|
|
225
|
-
*/
|
|
226
|
-
public List<Identity> getDiscoveredDevices() {
|
|
227
|
-
return new ArrayList<>(discoveredDevices);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* Check if discovery is in progress
|
|
232
|
-
*/
|
|
233
|
-
public boolean isDiscovering() {
|
|
234
|
-
return isDiscovering;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
package flir.android;
|
|
2
|
-
|
|
3
|
-
import android.graphics.Bitmap;
|
|
4
|
-
|
|
5
|
-
public class FrameDataHolder {
|
|
6
|
-
|
|
7
|
-
public final Bitmap msxBitmap;
|
|
8
|
-
public final Bitmap dcBitmap;
|
|
9
|
-
|
|
10
|
-
public FrameDataHolder(Bitmap msxBitmap, Bitmap dcBitmap) {
|
|
11
|
-
this.msxBitmap = msxBitmap;
|
|
12
|
-
this.dcBitmap = dcBitmap;
|
|
13
|
-
}
|
|
14
|
-
}
|