ilabs-flir 1.0.0 → 1.0.1

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.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ilabs-flir",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
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",
@@ -58,4 +58,4 @@
58
58
  "@types/react": "*",
59
59
  "@types/react-native": "*"
60
60
  }
61
- }
61
+ }
@@ -0,0 +1,174 @@
1
+ import os
2
+ import subprocess
3
+
4
+ def create_file(path, content):
5
+ os.makedirs(os.path.dirname(path), exist_ok=True)
6
+ with open(path, 'w') as f:
7
+ f.write(content)
8
+
9
+ # Define stub classes
10
+ stubs = {
11
+ "com/flir/thermalsdk/androidsdk/image/BitmapAndroid.java": """
12
+ package com.flir.thermalsdk.androidsdk.image;
13
+ import android.graphics.Bitmap;
14
+ import com.flir.thermalsdk.image.JavaImageBuffer;
15
+ public class BitmapAndroid {
16
+ public static BitmapAndroid createBitmap(JavaImageBuffer buffer) { return null; }
17
+ public Bitmap getBitMap() { return null; }
18
+ }
19
+ """,
20
+ "com/flir/thermalsdk/image/JavaImageBuffer.java": """
21
+ package com.flir.thermalsdk.image;
22
+ public interface JavaImageBuffer {}
23
+ """,
24
+ "com/flir/thermalsdk/image/ThermalImage.java": """
25
+ package com.flir.thermalsdk.image;
26
+ public class ThermalImage {
27
+ public Fusion getFusion() { return null; }
28
+ }
29
+ """,
30
+ "com/flir/thermalsdk/image/Fusion.java": """
31
+ package com.flir.thermalsdk.image;
32
+ public class Fusion {
33
+ public JavaImageBuffer getPhoto() { return null; }
34
+ }
35
+ """,
36
+ "com/flir/thermalsdk/live/Camera.java": """
37
+ package com.flir.thermalsdk.live;
38
+ import java.util.List;
39
+ import com.flir.thermalsdk.live.connectivity.ConnectionStatusListener;
40
+ import com.flir.thermalsdk.live.streaming.Stream;
41
+ public class Camera {
42
+ public void connect(Identity id, ConnectionStatusListener listener, ConnectParameters params) {}
43
+ public void disconnect() {}
44
+ public boolean isConnected() { return false; }
45
+ public List<Stream> getStreams() { return null; }
46
+ public RemoteControl getRemoteControl() { return null; }
47
+ }
48
+ """,
49
+ "com/flir/thermalsdk/live/RemoteControl.java": """
50
+ package com.flir.thermalsdk.live;
51
+ public class RemoteControl {
52
+ public CameraInformation cameraInformation() { return null; }
53
+ }
54
+ """,
55
+ "com/flir/thermalsdk/live/CameraInformation.java": """
56
+ package com.flir.thermalsdk.live;
57
+ public class CameraInformation {
58
+ public CameraInformationSync getSync() { return null; }
59
+ }
60
+ """,
61
+ "com/flir/thermalsdk/live/CameraInformationSync.java": """
62
+ package com.flir.thermalsdk.live;
63
+ public class CameraInformationSync {
64
+ public String displayName;
65
+ }
66
+ """,
67
+ "com/flir/thermalsdk/live/CommunicationInterface.java": """
68
+ package com.flir.thermalsdk.live;
69
+ public enum CommunicationInterface {
70
+ USB, EMULATOR
71
+ }
72
+ """,
73
+ "com/flir/thermalsdk/live/ConnectParameters.java": """
74
+ package com.flir.thermalsdk.live;
75
+ public class ConnectParameters {}
76
+ """,
77
+ "com/flir/thermalsdk/live/Identity.java": """
78
+ package com.flir.thermalsdk.live;
79
+ public class Identity {
80
+ public String deviceId;
81
+ public CommunicationInterface communicationInterface;
82
+ }
83
+ """,
84
+ "com/flir/thermalsdk/ErrorCode.java": """
85
+ package com.flir.thermalsdk;
86
+ public class ErrorCode {}
87
+ """,
88
+ "com/flir/thermalsdk/live/discovery/DiscoveredCamera.java": """
89
+ package com.flir.thermalsdk.live.discovery;
90
+ import com.flir.thermalsdk.live.Identity;
91
+ public class DiscoveredCamera {
92
+ public Identity identity;
93
+ }
94
+ """,
95
+ "com/flir/thermalsdk/live/connectivity/ConnectionStatusListener.java": """
96
+ package com.flir.thermalsdk.live.connectivity;
97
+ import com.flir.thermalsdk.ErrorCode;
98
+ public interface ConnectionStatusListener {
99
+ void onDisconnected(ErrorCode errorCode);
100
+ }
101
+ """,
102
+ "com/flir/thermalsdk/live/discovery/DiscoveryEventListener.java": """
103
+ package com.flir.thermalsdk.live.discovery;
104
+ import com.flir.thermalsdk.live.CommunicationInterface;
105
+ import com.flir.thermalsdk.ErrorCode;
106
+ public interface DiscoveryEventListener {
107
+ void onCameraFound(DiscoveredCamera camera);
108
+ void onDiscoveryError(CommunicationInterface communicationInterface, ErrorCode errorCode);
109
+ }
110
+ """,
111
+ "com/flir/thermalsdk/live/discovery/DiscoveryFactory.java": """
112
+ package com.flir.thermalsdk.live.discovery;
113
+ import com.flir.thermalsdk.live.CommunicationInterface;
114
+ public class DiscoveryFactory {
115
+ public static DiscoveryFactory getInstance() { return new DiscoveryFactory(); }
116
+ public void scan(DiscoveryEventListener listener, CommunicationInterface... ifaces) {}
117
+ public void stop(CommunicationInterface... ifaces) {}
118
+ }
119
+ """,
120
+ "com/flir/thermalsdk/live/streaming/Stream.java": """
121
+ package com.flir.thermalsdk.live.streaming;
122
+ import com.flir.thermalsdk.image.JavaImageBuffer;
123
+ public interface Stream {
124
+ boolean isStreaming();
125
+ void stop();
126
+ boolean isThermal();
127
+ void start(OnImageReceivedListener listener, OnErrorListener errorListener);
128
+ interface OnImageReceivedListener { void onImageReceived(Void v); }
129
+ interface OnErrorListener { void onError(Object error); }
130
+ }
131
+ """,
132
+ "com/flir/thermalsdk/live/streaming/ThermalStreamer.java": """
133
+ package com.flir.thermalsdk.live.streaming;
134
+ import com.flir.thermalsdk.image.ThermalImage;
135
+ import com.flir.thermalsdk.image.JavaImageBuffer;
136
+ public class ThermalStreamer {
137
+ public ThermalStreamer(Stream stream) {}
138
+ public void update() {}
139
+ public void withThermalImage(OnThermalImageReceivedListener listener) {}
140
+ public JavaImageBuffer getImage() { return null; }
141
+ public interface OnThermalImageReceivedListener { void onThermalImageReceived(ThermalImage image); }
142
+ }
143
+ """
144
+ }
145
+
146
+ # Create source files
147
+ base_dir = "stubs_src"
148
+ for path, content in stubs.items():
149
+ create_file(os.path.join(base_dir, path), content)
150
+
151
+ # Mock android.graphics.Bitmap
152
+ create_file(os.path.join(base_dir, "android/graphics/Bitmap.java"), "package android.graphics; public class Bitmap {}")
153
+
154
+ # Compile
155
+ sources_file = "sources.txt"
156
+ with open(sources_file, 'w') as f:
157
+ for root, dirs, files in os.walk(base_dir):
158
+ for file in files:
159
+ if file.endswith(".java"):
160
+ f.write(os.path.join(root, file) + "\n")
161
+
162
+ subprocess.run(["javac", "@" + sources_file], check=True)
163
+
164
+ # Jar
165
+ subprocess.run(["jar", "cf", "flir-stubs.jar", "-C", base_dir, "."], check=True)
166
+
167
+ # Move to libs
168
+ os.rename("flir-stubs.jar", "android/Flir/libs/flir-stubs.jar")
169
+
170
+ # Cleanup
171
+ import shutil
172
+ shutil.rmtree(base_dir)
173
+ os.remove(sources_file)
174
+ print("Done!")