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.
- package/Flir.podspec +139 -139
- package/README.md +1066 -1066
- package/android/Flir/build.gradle.kts +72 -72
- package/android/Flir/src/main/AndroidManifest.xml +45 -45
- package/android/Flir/src/main/java/flir/android/FlirCommands.java +136 -136
- package/android/Flir/src/main/java/flir/android/FlirFrameCache.kt +6 -6
- package/android/Flir/src/main/java/flir/android/FlirManager.kt +476 -476
- package/android/Flir/src/main/java/flir/android/FlirModule.kt +257 -257
- package/android/Flir/src/main/java/flir/android/FlirPackage.kt +18 -18
- package/android/Flir/src/main/java/flir/android/FlirSDKLoader.kt +74 -74
- package/android/Flir/src/main/java/flir/android/FlirSdkManager.java +583 -583
- 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/app.plugin.js +381 -381
- package/expo-module.config.json +5 -5
- package/ios/Flir/src/Flir-Bridging-Header.h +34 -34
- package/ios/Flir/src/FlirEventEmitter.h +25 -25
- package/ios/Flir/src/FlirEventEmitter.m +63 -63
- package/ios/Flir/src/FlirManager.swift +599 -599
- package/ios/Flir/src/FlirModule.h +17 -17
- package/ios/Flir/src/FlirModule.m +713 -713
- package/ios/Flir/src/FlirPreviewView.h +13 -13
- package/ios/Flir/src/FlirPreviewView.m +171 -171
- package/ios/Flir/src/FlirState.h +68 -68
- package/ios/Flir/src/FlirState.m +135 -135
- package/ios/Flir/src/FlirViewManager.h +16 -16
- package/ios/Flir/src/FlirViewManager.m +27 -27
- package/package.json +70 -71
- package/react-native.config.js +14 -14
- package/scripts/fetch-binaries.js +103 -17
- package/sdk-manifest.json +50 -50
- package/src/index.d.ts +63 -63
- package/src/index.js +7 -7
- package/src/index.ts +6 -6
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
#import <UIKit/UIKit.h>
|
|
2
|
-
|
|
3
|
-
NS_ASSUME_NONNULL_BEGIN
|
|
4
|
-
|
|
5
|
-
@interface FlirPreviewView : UIView
|
|
6
|
-
|
|
7
|
-
@property (nonatomic, assign) double lastTemperature;
|
|
8
|
-
|
|
9
|
-
- (void)updateWithFrameImage:(UIImage *)image temperature:(double)temperature;
|
|
10
|
-
|
|
11
|
-
@end
|
|
12
|
-
|
|
13
|
-
NS_ASSUME_NONNULL_END
|
|
1
|
+
#import <UIKit/UIKit.h>
|
|
2
|
+
|
|
3
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
4
|
+
|
|
5
|
+
@interface FlirPreviewView : UIView
|
|
6
|
+
|
|
7
|
+
@property (nonatomic, assign) double lastTemperature;
|
|
8
|
+
|
|
9
|
+
- (void)updateWithFrameImage:(UIImage *)image temperature:(double)temperature;
|
|
10
|
+
|
|
11
|
+
@end
|
|
12
|
+
|
|
13
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -1,171 +1,171 @@
|
|
|
1
|
-
//
|
|
2
|
-
// FlirPreviewView.m
|
|
3
|
-
// Flir
|
|
4
|
-
//
|
|
5
|
-
// Native preview view for displaying FLIR thermal camera frames
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
#import "FlirPreviewView.h"
|
|
9
|
-
#import "FlirState.h"
|
|
10
|
-
|
|
11
|
-
@interface FlirPreviewView ()
|
|
12
|
-
@property(nonatomic, strong) UIImageView *imageView;
|
|
13
|
-
@property(nonatomic, strong) UILabel *temperatureLabel;
|
|
14
|
-
@property(nonatomic, strong) CADisplayLink *displayLink;
|
|
15
|
-
@property(nonatomic, assign) BOOL isActive;
|
|
16
|
-
@end
|
|
17
|
-
|
|
18
|
-
@implementation FlirPreviewView
|
|
19
|
-
|
|
20
|
-
- (instancetype)initWithFrame:(CGRect)frame {
|
|
21
|
-
if (self = [super initWithFrame:frame]) {
|
|
22
|
-
[self setupView];
|
|
23
|
-
}
|
|
24
|
-
return self;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
- (void)setupView {
|
|
28
|
-
self.backgroundColor = [UIColor blackColor];
|
|
29
|
-
self.clipsToBounds = YES;
|
|
30
|
-
_lastTemperature = NAN;
|
|
31
|
-
_isActive = NO;
|
|
32
|
-
|
|
33
|
-
// Image view for thermal frames
|
|
34
|
-
_imageView = [[UIImageView alloc] initWithFrame:self.bounds];
|
|
35
|
-
_imageView.contentMode = UIViewContentModeScaleAspectFit;
|
|
36
|
-
_imageView.autoresizingMask =
|
|
37
|
-
UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
|
38
|
-
_imageView.backgroundColor = [UIColor blackColor];
|
|
39
|
-
[self addSubview:_imageView];
|
|
40
|
-
|
|
41
|
-
// Temperature label overlay (optional)
|
|
42
|
-
_temperatureLabel = [[UILabel alloc] init];
|
|
43
|
-
_temperatureLabel.textColor = [UIColor whiteColor];
|
|
44
|
-
_temperatureLabel.font = [UIFont boldSystemFontOfSize:14];
|
|
45
|
-
_temperatureLabel.backgroundColor =
|
|
46
|
-
[[UIColor blackColor] colorWithAlphaComponent:0.5];
|
|
47
|
-
_temperatureLabel.textAlignment = NSTextAlignmentCenter;
|
|
48
|
-
_temperatureLabel.layer.cornerRadius = 4;
|
|
49
|
-
_temperatureLabel.clipsToBounds = YES;
|
|
50
|
-
_temperatureLabel.hidden = YES; // Hidden by default
|
|
51
|
-
[self addSubview:_temperatureLabel];
|
|
52
|
-
|
|
53
|
-
// Register for frame updates from FlirState
|
|
54
|
-
__weak FlirPreviewView *weakSelf = self;
|
|
55
|
-
[FlirState shared].onTextureUpdate = ^(UIImage *image, int textureUnit) {
|
|
56
|
-
[weakSelf updateWithImage:image];
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
- (void)layoutSubviews {
|
|
61
|
-
[super layoutSubviews];
|
|
62
|
-
|
|
63
|
-
_imageView.frame = self.bounds;
|
|
64
|
-
|
|
65
|
-
// Position temperature label in top-right corner
|
|
66
|
-
CGFloat labelWidth = 100;
|
|
67
|
-
CGFloat labelHeight = 30;
|
|
68
|
-
CGFloat padding = 10;
|
|
69
|
-
_temperatureLabel.frame =
|
|
70
|
-
CGRectMake(self.bounds.size.width - labelWidth - padding, padding,
|
|
71
|
-
labelWidth, labelHeight);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
- (void)updateWithImage:(UIImage *)image {
|
|
75
|
-
if (!image)
|
|
76
|
-
return;
|
|
77
|
-
|
|
78
|
-
dispatch_async(dispatch_get_main_queue(), ^{
|
|
79
|
-
self.imageView.image = image;
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
- (void)updateWithFrameImage:(UIImage *)image temperature:(double)temperature {
|
|
84
|
-
dispatch_async(dispatch_get_main_queue(), ^{
|
|
85
|
-
self.imageView.image = image;
|
|
86
|
-
self.lastTemperature = temperature;
|
|
87
|
-
[FlirState shared].lastTemperature = temperature;
|
|
88
|
-
|
|
89
|
-
if (!isnan(temperature)) {
|
|
90
|
-
self.temperatureLabel.text =
|
|
91
|
-
[NSString stringWithFormat:@"%.1f°C", temperature];
|
|
92
|
-
self.temperatureLabel.hidden = NO;
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
- (void)showFallbackFrame {
|
|
98
|
-
// Generate a fallback gradient when no FLIR data is available
|
|
99
|
-
UIGraphicsBeginImageContextWithOptions(CGSizeMake(320, 240), YES, 1.0);
|
|
100
|
-
CGContextRef context = UIGraphicsGetCurrentContext();
|
|
101
|
-
|
|
102
|
-
if (context) {
|
|
103
|
-
// Create thermal-looking gradient
|
|
104
|
-
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
|
|
105
|
-
NSArray *colors = @[
|
|
106
|
-
(id)[UIColor colorWithRed:0 green:0 blue:0.5 alpha:1].CGColor,
|
|
107
|
-
(id)[UIColor colorWithRed:0 green:0.5 blue:0.5 alpha:1].CGColor,
|
|
108
|
-
(id)[UIColor colorWithRed:0 green:0.8 blue:0 alpha:1].CGColor,
|
|
109
|
-
(id)[UIColor colorWithRed:1 green:1 blue:0 alpha:1].CGColor,
|
|
110
|
-
(id)[UIColor colorWithRed:1 green:0.5 blue:0 alpha:1].CGColor,
|
|
111
|
-
(id)[UIColor colorWithRed:1 green:0 blue:0 alpha:1].CGColor,
|
|
112
|
-
];
|
|
113
|
-
CGFloat locations[] = {0.0, 0.2, 0.4, 0.6, 0.8, 1.0};
|
|
114
|
-
CGGradientRef gradient = CGGradientCreateWithColors(
|
|
115
|
-
colorSpace, (__bridge CFArrayRef)colors, locations);
|
|
116
|
-
|
|
117
|
-
CGContextDrawLinearGradient(context, gradient, CGPointMake(0, 240),
|
|
118
|
-
CGPointMake(320, 0), 0);
|
|
119
|
-
|
|
120
|
-
CGGradientRelease(gradient);
|
|
121
|
-
CGColorSpaceRelease(colorSpace);
|
|
122
|
-
|
|
123
|
-
// Add "FALLBACK" text
|
|
124
|
-
NSDictionary *attrs = @{
|
|
125
|
-
NSFontAttributeName : [UIFont boldSystemFontOfSize:20],
|
|
126
|
-
NSForegroundColorAttributeName : [UIColor whiteColor]
|
|
127
|
-
};
|
|
128
|
-
NSString *text = @"FLIR FALLBACK";
|
|
129
|
-
CGSize textSize = [text sizeWithAttributes:attrs];
|
|
130
|
-
CGRect textRect =
|
|
131
|
-
CGRectMake((320 - textSize.width) / 2, (240 - textSize.height) / 2,
|
|
132
|
-
textSize.width, textSize.height);
|
|
133
|
-
[text drawInRect:textRect withAttributes:attrs];
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
UIImage *fallbackImage = UIGraphicsGetImageFromCurrentImageContext();
|
|
137
|
-
UIGraphicsEndImageContext();
|
|
138
|
-
|
|
139
|
-
dispatch_async(dispatch_get_main_queue(), ^{
|
|
140
|
-
self.imageView.image = fallbackImage;
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
#pragma mark - Lifecycle
|
|
145
|
-
|
|
146
|
-
- (void)willMoveToWindow:(UIWindow *)newWindow {
|
|
147
|
-
[super willMoveToWindow:newWindow];
|
|
148
|
-
|
|
149
|
-
if (newWindow) {
|
|
150
|
-
// View is being added to window - start updates
|
|
151
|
-
_isActive = YES;
|
|
152
|
-
|
|
153
|
-
// Check if we have a frame, otherwise show fallback
|
|
154
|
-
UIImage *currentFrame = [FlirState shared].latestImage;
|
|
155
|
-
if (currentFrame) {
|
|
156
|
-
[self updateWithImage:currentFrame];
|
|
157
|
-
} else {
|
|
158
|
-
[self showFallbackFrame];
|
|
159
|
-
}
|
|
160
|
-
} else {
|
|
161
|
-
// View is being removed from window - stop updates
|
|
162
|
-
_isActive = NO;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
- (void)dealloc {
|
|
167
|
-
// Clean up
|
|
168
|
-
[FlirState shared].onTextureUpdate = nil;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
@end
|
|
1
|
+
//
|
|
2
|
+
// FlirPreviewView.m
|
|
3
|
+
// Flir
|
|
4
|
+
//
|
|
5
|
+
// Native preview view for displaying FLIR thermal camera frames
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import "FlirPreviewView.h"
|
|
9
|
+
#import "FlirState.h"
|
|
10
|
+
|
|
11
|
+
@interface FlirPreviewView ()
|
|
12
|
+
@property(nonatomic, strong) UIImageView *imageView;
|
|
13
|
+
@property(nonatomic, strong) UILabel *temperatureLabel;
|
|
14
|
+
@property(nonatomic, strong) CADisplayLink *displayLink;
|
|
15
|
+
@property(nonatomic, assign) BOOL isActive;
|
|
16
|
+
@end
|
|
17
|
+
|
|
18
|
+
@implementation FlirPreviewView
|
|
19
|
+
|
|
20
|
+
- (instancetype)initWithFrame:(CGRect)frame {
|
|
21
|
+
if (self = [super initWithFrame:frame]) {
|
|
22
|
+
[self setupView];
|
|
23
|
+
}
|
|
24
|
+
return self;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
- (void)setupView {
|
|
28
|
+
self.backgroundColor = [UIColor blackColor];
|
|
29
|
+
self.clipsToBounds = YES;
|
|
30
|
+
_lastTemperature = NAN;
|
|
31
|
+
_isActive = NO;
|
|
32
|
+
|
|
33
|
+
// Image view for thermal frames
|
|
34
|
+
_imageView = [[UIImageView alloc] initWithFrame:self.bounds];
|
|
35
|
+
_imageView.contentMode = UIViewContentModeScaleAspectFit;
|
|
36
|
+
_imageView.autoresizingMask =
|
|
37
|
+
UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
|
38
|
+
_imageView.backgroundColor = [UIColor blackColor];
|
|
39
|
+
[self addSubview:_imageView];
|
|
40
|
+
|
|
41
|
+
// Temperature label overlay (optional)
|
|
42
|
+
_temperatureLabel = [[UILabel alloc] init];
|
|
43
|
+
_temperatureLabel.textColor = [UIColor whiteColor];
|
|
44
|
+
_temperatureLabel.font = [UIFont boldSystemFontOfSize:14];
|
|
45
|
+
_temperatureLabel.backgroundColor =
|
|
46
|
+
[[UIColor blackColor] colorWithAlphaComponent:0.5];
|
|
47
|
+
_temperatureLabel.textAlignment = NSTextAlignmentCenter;
|
|
48
|
+
_temperatureLabel.layer.cornerRadius = 4;
|
|
49
|
+
_temperatureLabel.clipsToBounds = YES;
|
|
50
|
+
_temperatureLabel.hidden = YES; // Hidden by default
|
|
51
|
+
[self addSubview:_temperatureLabel];
|
|
52
|
+
|
|
53
|
+
// Register for frame updates from FlirState
|
|
54
|
+
__weak FlirPreviewView *weakSelf = self;
|
|
55
|
+
[FlirState shared].onTextureUpdate = ^(UIImage *image, int textureUnit) {
|
|
56
|
+
[weakSelf updateWithImage:image];
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
- (void)layoutSubviews {
|
|
61
|
+
[super layoutSubviews];
|
|
62
|
+
|
|
63
|
+
_imageView.frame = self.bounds;
|
|
64
|
+
|
|
65
|
+
// Position temperature label in top-right corner
|
|
66
|
+
CGFloat labelWidth = 100;
|
|
67
|
+
CGFloat labelHeight = 30;
|
|
68
|
+
CGFloat padding = 10;
|
|
69
|
+
_temperatureLabel.frame =
|
|
70
|
+
CGRectMake(self.bounds.size.width - labelWidth - padding, padding,
|
|
71
|
+
labelWidth, labelHeight);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
- (void)updateWithImage:(UIImage *)image {
|
|
75
|
+
if (!image)
|
|
76
|
+
return;
|
|
77
|
+
|
|
78
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
79
|
+
self.imageView.image = image;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
- (void)updateWithFrameImage:(UIImage *)image temperature:(double)temperature {
|
|
84
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
85
|
+
self.imageView.image = image;
|
|
86
|
+
self.lastTemperature = temperature;
|
|
87
|
+
[FlirState shared].lastTemperature = temperature;
|
|
88
|
+
|
|
89
|
+
if (!isnan(temperature)) {
|
|
90
|
+
self.temperatureLabel.text =
|
|
91
|
+
[NSString stringWithFormat:@"%.1f°C", temperature];
|
|
92
|
+
self.temperatureLabel.hidden = NO;
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
- (void)showFallbackFrame {
|
|
98
|
+
// Generate a fallback gradient when no FLIR data is available
|
|
99
|
+
UIGraphicsBeginImageContextWithOptions(CGSizeMake(320, 240), YES, 1.0);
|
|
100
|
+
CGContextRef context = UIGraphicsGetCurrentContext();
|
|
101
|
+
|
|
102
|
+
if (context) {
|
|
103
|
+
// Create thermal-looking gradient
|
|
104
|
+
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
|
|
105
|
+
NSArray *colors = @[
|
|
106
|
+
(id)[UIColor colorWithRed:0 green:0 blue:0.5 alpha:1].CGColor,
|
|
107
|
+
(id)[UIColor colorWithRed:0 green:0.5 blue:0.5 alpha:1].CGColor,
|
|
108
|
+
(id)[UIColor colorWithRed:0 green:0.8 blue:0 alpha:1].CGColor,
|
|
109
|
+
(id)[UIColor colorWithRed:1 green:1 blue:0 alpha:1].CGColor,
|
|
110
|
+
(id)[UIColor colorWithRed:1 green:0.5 blue:0 alpha:1].CGColor,
|
|
111
|
+
(id)[UIColor colorWithRed:1 green:0 blue:0 alpha:1].CGColor,
|
|
112
|
+
];
|
|
113
|
+
CGFloat locations[] = {0.0, 0.2, 0.4, 0.6, 0.8, 1.0};
|
|
114
|
+
CGGradientRef gradient = CGGradientCreateWithColors(
|
|
115
|
+
colorSpace, (__bridge CFArrayRef)colors, locations);
|
|
116
|
+
|
|
117
|
+
CGContextDrawLinearGradient(context, gradient, CGPointMake(0, 240),
|
|
118
|
+
CGPointMake(320, 0), 0);
|
|
119
|
+
|
|
120
|
+
CGGradientRelease(gradient);
|
|
121
|
+
CGColorSpaceRelease(colorSpace);
|
|
122
|
+
|
|
123
|
+
// Add "FALLBACK" text
|
|
124
|
+
NSDictionary *attrs = @{
|
|
125
|
+
NSFontAttributeName : [UIFont boldSystemFontOfSize:20],
|
|
126
|
+
NSForegroundColorAttributeName : [UIColor whiteColor]
|
|
127
|
+
};
|
|
128
|
+
NSString *text = @"FLIR FALLBACK";
|
|
129
|
+
CGSize textSize = [text sizeWithAttributes:attrs];
|
|
130
|
+
CGRect textRect =
|
|
131
|
+
CGRectMake((320 - textSize.width) / 2, (240 - textSize.height) / 2,
|
|
132
|
+
textSize.width, textSize.height);
|
|
133
|
+
[text drawInRect:textRect withAttributes:attrs];
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
UIImage *fallbackImage = UIGraphicsGetImageFromCurrentImageContext();
|
|
137
|
+
UIGraphicsEndImageContext();
|
|
138
|
+
|
|
139
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
140
|
+
self.imageView.image = fallbackImage;
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
#pragma mark - Lifecycle
|
|
145
|
+
|
|
146
|
+
- (void)willMoveToWindow:(UIWindow *)newWindow {
|
|
147
|
+
[super willMoveToWindow:newWindow];
|
|
148
|
+
|
|
149
|
+
if (newWindow) {
|
|
150
|
+
// View is being added to window - start updates
|
|
151
|
+
_isActive = YES;
|
|
152
|
+
|
|
153
|
+
// Check if we have a frame, otherwise show fallback
|
|
154
|
+
UIImage *currentFrame = [FlirState shared].latestImage;
|
|
155
|
+
if (currentFrame) {
|
|
156
|
+
[self updateWithImage:currentFrame];
|
|
157
|
+
} else {
|
|
158
|
+
[self showFallbackFrame];
|
|
159
|
+
}
|
|
160
|
+
} else {
|
|
161
|
+
// View is being removed from window - stop updates
|
|
162
|
+
_isActive = NO;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
- (void)dealloc {
|
|
167
|
+
// Clean up
|
|
168
|
+
[FlirState shared].onTextureUpdate = nil;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
@end
|
package/ios/Flir/src/FlirState.h
CHANGED
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
//
|
|
2
|
-
// FlirState.h
|
|
3
|
-
// Flir
|
|
4
|
-
//
|
|
5
|
-
// Shared state singleton for FLIR frame and temperature data
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
#import <Foundation/Foundation.h>
|
|
9
|
-
#import <UIKit/UIKit.h>
|
|
10
|
-
|
|
11
|
-
NS_ASSUME_NONNULL_BEGIN
|
|
12
|
-
|
|
13
|
-
/// Callback for temperature updates
|
|
14
|
-
typedef void (^FlirTemperatureCallback)(double temperature, int x, int y);
|
|
15
|
-
|
|
16
|
-
/// Callback for texture/image updates
|
|
17
|
-
typedef void (^FlirTextureCallback)(UIImage *_Nonnull image, int textureUnit);
|
|
18
|
-
|
|
19
|
-
@interface FlirState : NSObject
|
|
20
|
-
|
|
21
|
-
/// Singleton instance
|
|
22
|
-
+ (instancetype)shared;
|
|
23
|
-
|
|
24
|
-
/// Last sampled temperature value
|
|
25
|
-
@property(nonatomic, assign) double lastTemperature;
|
|
26
|
-
|
|
27
|
-
/// Latest thermal image
|
|
28
|
-
@property(nonatomic, strong, nullable) UIImage *latestImage;
|
|
29
|
-
|
|
30
|
-
/// Frame dimensions
|
|
31
|
-
@property(nonatomic, assign, readonly) int imageWidth;
|
|
32
|
-
@property(nonatomic, assign, readonly) int imageHeight;
|
|
33
|
-
|
|
34
|
-
/// Callback invoked when temperature is sampled
|
|
35
|
-
@property(nonatomic, copy, nullable)
|
|
36
|
-
FlirTemperatureCallback onTemperatureUpdate;
|
|
37
|
-
|
|
38
|
-
/// Callback invoked when a new frame is available for Metal texture
|
|
39
|
-
@property(nonatomic, copy, nullable) FlirTextureCallback onTextureUpdate;
|
|
40
|
-
|
|
41
|
-
/// Get temperature at pixel coordinates
|
|
42
|
-
/// @param x X coordinate
|
|
43
|
-
/// @param y Y coordinate
|
|
44
|
-
/// @return Temperature in Celsius, or NAN if not available
|
|
45
|
-
- (double)getTemperatureAt:(int)x y:(int)y;
|
|
46
|
-
|
|
47
|
-
/// Query temperature at point using stored temperature data array
|
|
48
|
-
/// @param x X coordinate
|
|
49
|
-
/// @param y Y coordinate
|
|
50
|
-
/// @return Temperature in Celsius, or NAN if not available
|
|
51
|
-
- (double)queryTemperatureAtPoint:(int)x y:(int)y;
|
|
52
|
-
|
|
53
|
-
/// Update frame with new image
|
|
54
|
-
/// @param image The thermal image
|
|
55
|
-
- (void)updateFrame:(UIImage *_Nonnull)image;
|
|
56
|
-
|
|
57
|
-
/// Update frame with new image and temperature data array
|
|
58
|
-
/// @param image The thermal image
|
|
59
|
-
/// @param tempData Flattened array of temperature values (row-major order)
|
|
60
|
-
- (void)updateFrame:(UIImage *_Nonnull)image
|
|
61
|
-
withTemperatureData:(NSArray<NSNumber *> *_Nullable)tempData;
|
|
62
|
-
|
|
63
|
-
/// Clear all stored data
|
|
64
|
-
- (void)reset;
|
|
65
|
-
|
|
66
|
-
@end
|
|
67
|
-
|
|
68
|
-
NS_ASSUME_NONNULL_END
|
|
1
|
+
//
|
|
2
|
+
// FlirState.h
|
|
3
|
+
// Flir
|
|
4
|
+
//
|
|
5
|
+
// Shared state singleton for FLIR frame and temperature data
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
#import <UIKit/UIKit.h>
|
|
10
|
+
|
|
11
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
12
|
+
|
|
13
|
+
/// Callback for temperature updates
|
|
14
|
+
typedef void (^FlirTemperatureCallback)(double temperature, int x, int y);
|
|
15
|
+
|
|
16
|
+
/// Callback for texture/image updates
|
|
17
|
+
typedef void (^FlirTextureCallback)(UIImage *_Nonnull image, int textureUnit);
|
|
18
|
+
|
|
19
|
+
@interface FlirState : NSObject
|
|
20
|
+
|
|
21
|
+
/// Singleton instance
|
|
22
|
+
+ (instancetype)shared;
|
|
23
|
+
|
|
24
|
+
/// Last sampled temperature value
|
|
25
|
+
@property(nonatomic, assign) double lastTemperature;
|
|
26
|
+
|
|
27
|
+
/// Latest thermal image
|
|
28
|
+
@property(nonatomic, strong, nullable) UIImage *latestImage;
|
|
29
|
+
|
|
30
|
+
/// Frame dimensions
|
|
31
|
+
@property(nonatomic, assign, readonly) int imageWidth;
|
|
32
|
+
@property(nonatomic, assign, readonly) int imageHeight;
|
|
33
|
+
|
|
34
|
+
/// Callback invoked when temperature is sampled
|
|
35
|
+
@property(nonatomic, copy, nullable)
|
|
36
|
+
FlirTemperatureCallback onTemperatureUpdate;
|
|
37
|
+
|
|
38
|
+
/// Callback invoked when a new frame is available for Metal texture
|
|
39
|
+
@property(nonatomic, copy, nullable) FlirTextureCallback onTextureUpdate;
|
|
40
|
+
|
|
41
|
+
/// Get temperature at pixel coordinates
|
|
42
|
+
/// @param x X coordinate
|
|
43
|
+
/// @param y Y coordinate
|
|
44
|
+
/// @return Temperature in Celsius, or NAN if not available
|
|
45
|
+
- (double)getTemperatureAt:(int)x y:(int)y;
|
|
46
|
+
|
|
47
|
+
/// Query temperature at point using stored temperature data array
|
|
48
|
+
/// @param x X coordinate
|
|
49
|
+
/// @param y Y coordinate
|
|
50
|
+
/// @return Temperature in Celsius, or NAN if not available
|
|
51
|
+
- (double)queryTemperatureAtPoint:(int)x y:(int)y;
|
|
52
|
+
|
|
53
|
+
/// Update frame with new image
|
|
54
|
+
/// @param image The thermal image
|
|
55
|
+
- (void)updateFrame:(UIImage *_Nonnull)image;
|
|
56
|
+
|
|
57
|
+
/// Update frame with new image and temperature data array
|
|
58
|
+
/// @param image The thermal image
|
|
59
|
+
/// @param tempData Flattened array of temperature values (row-major order)
|
|
60
|
+
- (void)updateFrame:(UIImage *_Nonnull)image
|
|
61
|
+
withTemperatureData:(NSArray<NSNumber *> *_Nullable)tempData;
|
|
62
|
+
|
|
63
|
+
/// Clear all stored data
|
|
64
|
+
- (void)reset;
|
|
65
|
+
|
|
66
|
+
@end
|
|
67
|
+
|
|
68
|
+
NS_ASSUME_NONNULL_END
|