@tempivo/sensor-beacon 0.2.0 → 0.3.2
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/README.md +142 -114
- package/android/build.gradle +38 -2
- package/android/src/main/AndroidManifest.xml +10 -0
- package/android/src/main/java/expo/modules/tempivosensorbeacon/SensorBeaconNative.java +241 -0
- package/android/src/main/java/expo/modules/tempivosensorbeacon/TempivoSensorBeaconModule.kt +124 -0
- package/android-aar/build.gradle +4 -0
- package/{android → android-aar}/library/src/main/java/com/tempivo/sensor/beacon/PartnerBleRules.kt +6 -3
- package/{android → android-aar}/library/src/main/java/com/tempivo/sensor/beacon/SensorBleRuntime.kt +81 -38
- package/{android → android-aar}/library/src/main/java/com/tempivo/sensor/beacon/TempivoSensorBeaconDecoder.kt +14 -0
- package/{android → android-aar}/library/src/main/java/com/tempivo/sensor/beacon/TempivoSensorBeaconScanner.kt +40 -11
- package/android-aar/library/src/main/java/com/tempivo/sensor/beacon/TempivoSensorError.kt +35 -0
- package/{android → android-aar}/library/src/main/java/com/tempivo/sensor/beacon/TempivoSensorQr.kt +9 -0
- package/{android → android-aar}/library/src/main/java/com/tempivo/sensor/beacon/TempivoSensorSession.kt +40 -7
- package/app.plugin.cjs +142 -0
- package/dist/expo-modules-core.web-stub.d.ts +5 -0
- package/dist/expo-modules-core.web-stub.js +9 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -1
- package/dist/native-bridge.d.ts +14 -0
- package/dist/native-bridge.js +51 -0
- package/dist/native-helpers.d.ts +6 -0
- package/dist/native-helpers.js +48 -0
- package/dist/native-module.d.ts +14 -0
- package/dist/native-module.js +105 -0
- package/dist/native-types.d.ts +41 -0
- package/dist/native-types.js +1 -0
- package/dist/qr.d.ts +4 -0
- package/dist/qr.js +17 -0
- package/dist/react-native.d.ts +1 -0
- package/dist/react-native.js +1 -0
- package/dist/tempivo-sensor-beacon.aar +0 -0
- package/expo-module.config.json +12 -0
- package/ios/Frameworks/TempivoSensorBridge.xcframework/Info.plist +43 -0
- package/ios/Frameworks/TempivoSensorBridge.xcframework/ios-arm64/TempivoSensorBridge.framework/Headers/TempivoSensorBridge.h +161 -0
- package/ios/Frameworks/TempivoSensorBridge.xcframework/ios-arm64/TempivoSensorBridge.framework/Info.plist +35 -0
- package/ios/Frameworks/TempivoSensorBridge.xcframework/ios-arm64/TempivoSensorBridge.framework/Modules/module.modulemap +8 -0
- package/ios/Frameworks/TempivoSensorBridge.xcframework/ios-arm64/TempivoSensorBridge.framework/TempivoSensorBridge +0 -0
- package/ios/Frameworks/TempivoSensorBridge.xcframework/ios-arm64-simulator/TempivoSensorBridge.framework/Headers/TempivoSensorBridge.h +161 -0
- package/ios/Frameworks/TempivoSensorBridge.xcframework/ios-arm64-simulator/TempivoSensorBridge.framework/Info.plist +31 -0
- package/ios/Frameworks/TempivoSensorBridge.xcframework/ios-arm64-simulator/TempivoSensorBridge.framework/Modules/module.modulemap +8 -0
- package/ios/Frameworks/TempivoSensorBridge.xcframework/ios-arm64-simulator/TempivoSensorBridge.framework/TempivoSensorBridge +0 -0
- package/ios/Sources/TempivoSensorBeacon/TempivoSensorBeaconScanner.swift +80 -4
- package/ios/Sources/TempivoSensorBeacon/TempivoSensorBeaconTypes.swift +15 -0
- package/ios/Sources/TempivoSensorBeacon/TempivoSensorError.swift +15 -1
- package/ios/Sources/TempivoSensorBeacon/TempivoSensorQr.swift +17 -0
- package/ios/Sources/TempivoSensorBeacon/TempivoSensorSession.swift +36 -8
- package/ios/TempivoSensorBeacon.podspec +35 -0
- package/ios/TempivoSensorBeaconModule.swift +217 -0
- package/package.json +48 -7
- package/android/library/src/main/java/com/tempivo/sensor/beacon/TempivoSensorError.kt +0 -18
- /package/{android → android-aar}/gradle/wrapper/gradle-wrapper.jar +0 -0
- /package/{android → android-aar}/gradle/wrapper/gradle-wrapper.properties +0 -0
- /package/{android → android-aar}/gradle.properties +0 -0
- /package/{android → android-aar}/gradlew +0 -0
- /package/{android → android-aar}/library/build.gradle +0 -0
- /package/{android → android-aar}/library/consumer-rules.pro +0 -0
- /package/{android → android-aar}/library/src/main/AndroidManifest.xml +0 -0
- /package/{android → android-aar}/library/src/main/java/com/tempivo/sensor/beacon/TempivoSensorBeaconTypes.kt +0 -0
- /package/{android → android-aar}/library/src/main/java/com/tempivo/sensor/beacon/TempivoSensorCalibration.kt +0 -0
- /package/{android → android-aar}/library/src/main/java/com/tempivo/sensor/beacon/TempivoSensorProfile.kt +0 -0
- /package/{android → android-aar}/settings.gradle +0 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
#import <Foundation/NSArray.h>
|
|
2
|
+
#import <Foundation/NSDictionary.h>
|
|
3
|
+
#import <Foundation/NSError.h>
|
|
4
|
+
#import <Foundation/NSObject.h>
|
|
5
|
+
#import <Foundation/NSSet.h>
|
|
6
|
+
#import <Foundation/NSString.h>
|
|
7
|
+
#import <Foundation/NSValue.h>
|
|
8
|
+
|
|
9
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
10
|
+
#pragma clang diagnostic push
|
|
11
|
+
#pragma clang diagnostic ignored "-Wunknown-warning-option"
|
|
12
|
+
#pragma clang diagnostic ignored "-Wincompatible-property-type"
|
|
13
|
+
#pragma clang diagnostic ignored "-Wnullability"
|
|
14
|
+
|
|
15
|
+
#pragma push_macro("_Nullable_result")
|
|
16
|
+
#if !__has_feature(nullability_nullable_result)
|
|
17
|
+
#undef _Nullable_result
|
|
18
|
+
#define _Nullable_result _Nullable
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
__attribute__((swift_name("KotlinBase")))
|
|
22
|
+
@interface TSBBase : NSObject
|
|
23
|
+
- (instancetype)init __attribute__((unavailable));
|
|
24
|
+
+ (instancetype)new __attribute__((unavailable));
|
|
25
|
+
+ (void)initialize __attribute__((objc_requires_super));
|
|
26
|
+
@end
|
|
27
|
+
|
|
28
|
+
@interface TSBBase (TSBBaseCopying) <NSCopying>
|
|
29
|
+
@end
|
|
30
|
+
|
|
31
|
+
__attribute__((swift_name("KotlinMutableSet")))
|
|
32
|
+
@interface TSBMutableSet<ObjectType> : NSMutableSet<ObjectType>
|
|
33
|
+
@end
|
|
34
|
+
|
|
35
|
+
__attribute__((swift_name("KotlinMutableDictionary")))
|
|
36
|
+
@interface TSBMutableDictionary<KeyType, ObjectType> : NSMutableDictionary<KeyType, ObjectType>
|
|
37
|
+
@end
|
|
38
|
+
|
|
39
|
+
@interface NSError (NSErrorTSBKotlinException)
|
|
40
|
+
@property (readonly) id _Nullable kotlinException;
|
|
41
|
+
@end
|
|
42
|
+
|
|
43
|
+
__attribute__((swift_name("KotlinNumber")))
|
|
44
|
+
@interface TSBNumber : NSNumber
|
|
45
|
+
- (instancetype)initWithChar:(char)value __attribute__((unavailable));
|
|
46
|
+
- (instancetype)initWithUnsignedChar:(unsigned char)value __attribute__((unavailable));
|
|
47
|
+
- (instancetype)initWithShort:(short)value __attribute__((unavailable));
|
|
48
|
+
- (instancetype)initWithUnsignedShort:(unsigned short)value __attribute__((unavailable));
|
|
49
|
+
- (instancetype)initWithInt:(int)value __attribute__((unavailable));
|
|
50
|
+
- (instancetype)initWithUnsignedInt:(unsigned int)value __attribute__((unavailable));
|
|
51
|
+
- (instancetype)initWithLong:(long)value __attribute__((unavailable));
|
|
52
|
+
- (instancetype)initWithUnsignedLong:(unsigned long)value __attribute__((unavailable));
|
|
53
|
+
- (instancetype)initWithLongLong:(long long)value __attribute__((unavailable));
|
|
54
|
+
- (instancetype)initWithUnsignedLongLong:(unsigned long long)value __attribute__((unavailable));
|
|
55
|
+
- (instancetype)initWithFloat:(float)value __attribute__((unavailable));
|
|
56
|
+
- (instancetype)initWithDouble:(double)value __attribute__((unavailable));
|
|
57
|
+
- (instancetype)initWithBool:(BOOL)value __attribute__((unavailable));
|
|
58
|
+
- (instancetype)initWithInteger:(NSInteger)value __attribute__((unavailable));
|
|
59
|
+
- (instancetype)initWithUnsignedInteger:(NSUInteger)value __attribute__((unavailable));
|
|
60
|
+
+ (instancetype)numberWithChar:(char)value __attribute__((unavailable));
|
|
61
|
+
+ (instancetype)numberWithUnsignedChar:(unsigned char)value __attribute__((unavailable));
|
|
62
|
+
+ (instancetype)numberWithShort:(short)value __attribute__((unavailable));
|
|
63
|
+
+ (instancetype)numberWithUnsignedShort:(unsigned short)value __attribute__((unavailable));
|
|
64
|
+
+ (instancetype)numberWithInt:(int)value __attribute__((unavailable));
|
|
65
|
+
+ (instancetype)numberWithUnsignedInt:(unsigned int)value __attribute__((unavailable));
|
|
66
|
+
+ (instancetype)numberWithLong:(long)value __attribute__((unavailable));
|
|
67
|
+
+ (instancetype)numberWithUnsignedLong:(unsigned long)value __attribute__((unavailable));
|
|
68
|
+
+ (instancetype)numberWithLongLong:(long long)value __attribute__((unavailable));
|
|
69
|
+
+ (instancetype)numberWithUnsignedLongLong:(unsigned long long)value __attribute__((unavailable));
|
|
70
|
+
+ (instancetype)numberWithFloat:(float)value __attribute__((unavailable));
|
|
71
|
+
+ (instancetype)numberWithDouble:(double)value __attribute__((unavailable));
|
|
72
|
+
+ (instancetype)numberWithBool:(BOOL)value __attribute__((unavailable));
|
|
73
|
+
+ (instancetype)numberWithInteger:(NSInteger)value __attribute__((unavailable));
|
|
74
|
+
+ (instancetype)numberWithUnsignedInteger:(NSUInteger)value __attribute__((unavailable));
|
|
75
|
+
@end
|
|
76
|
+
|
|
77
|
+
__attribute__((swift_name("KotlinByte")))
|
|
78
|
+
@interface TSBByte : TSBNumber
|
|
79
|
+
- (instancetype)initWithChar:(char)value;
|
|
80
|
+
+ (instancetype)numberWithChar:(char)value;
|
|
81
|
+
@end
|
|
82
|
+
|
|
83
|
+
__attribute__((swift_name("KotlinUByte")))
|
|
84
|
+
@interface TSBUByte : TSBNumber
|
|
85
|
+
- (instancetype)initWithUnsignedChar:(unsigned char)value;
|
|
86
|
+
+ (instancetype)numberWithUnsignedChar:(unsigned char)value;
|
|
87
|
+
@end
|
|
88
|
+
|
|
89
|
+
__attribute__((swift_name("KotlinShort")))
|
|
90
|
+
@interface TSBShort : TSBNumber
|
|
91
|
+
- (instancetype)initWithShort:(short)value;
|
|
92
|
+
+ (instancetype)numberWithShort:(short)value;
|
|
93
|
+
@end
|
|
94
|
+
|
|
95
|
+
__attribute__((swift_name("KotlinUShort")))
|
|
96
|
+
@interface TSBUShort : TSBNumber
|
|
97
|
+
- (instancetype)initWithUnsignedShort:(unsigned short)value;
|
|
98
|
+
+ (instancetype)numberWithUnsignedShort:(unsigned short)value;
|
|
99
|
+
@end
|
|
100
|
+
|
|
101
|
+
__attribute__((swift_name("KotlinInt")))
|
|
102
|
+
@interface TSBInt : TSBNumber
|
|
103
|
+
- (instancetype)initWithInt:(int)value;
|
|
104
|
+
+ (instancetype)numberWithInt:(int)value;
|
|
105
|
+
@end
|
|
106
|
+
|
|
107
|
+
__attribute__((swift_name("KotlinUInt")))
|
|
108
|
+
@interface TSBUInt : TSBNumber
|
|
109
|
+
- (instancetype)initWithUnsignedInt:(unsigned int)value;
|
|
110
|
+
+ (instancetype)numberWithUnsignedInt:(unsigned int)value;
|
|
111
|
+
@end
|
|
112
|
+
|
|
113
|
+
__attribute__((swift_name("KotlinLong")))
|
|
114
|
+
@interface TSBLong : TSBNumber
|
|
115
|
+
- (instancetype)initWithLongLong:(long long)value;
|
|
116
|
+
+ (instancetype)numberWithLongLong:(long long)value;
|
|
117
|
+
@end
|
|
118
|
+
|
|
119
|
+
__attribute__((swift_name("KotlinULong")))
|
|
120
|
+
@interface TSBULong : TSBNumber
|
|
121
|
+
- (instancetype)initWithUnsignedLongLong:(unsigned long long)value;
|
|
122
|
+
+ (instancetype)numberWithUnsignedLongLong:(unsigned long long)value;
|
|
123
|
+
@end
|
|
124
|
+
|
|
125
|
+
__attribute__((swift_name("KotlinFloat")))
|
|
126
|
+
@interface TSBFloat : TSBNumber
|
|
127
|
+
- (instancetype)initWithFloat:(float)value;
|
|
128
|
+
+ (instancetype)numberWithFloat:(float)value;
|
|
129
|
+
@end
|
|
130
|
+
|
|
131
|
+
__attribute__((swift_name("KotlinDouble")))
|
|
132
|
+
@interface TSBDouble : TSBNumber
|
|
133
|
+
- (instancetype)initWithDouble:(double)value;
|
|
134
|
+
+ (instancetype)numberWithDouble:(double)value;
|
|
135
|
+
@end
|
|
136
|
+
|
|
137
|
+
__attribute__((swift_name("KotlinBoolean")))
|
|
138
|
+
@interface TSBBoolean : TSBNumber
|
|
139
|
+
- (instancetype)initWithBool:(BOOL)value;
|
|
140
|
+
+ (instancetype)numberWithBool:(BOOL)value;
|
|
141
|
+
@end
|
|
142
|
+
|
|
143
|
+
__attribute__((objc_subclassing_restricted))
|
|
144
|
+
__attribute__((swift_name("TempivoSensorBridge")))
|
|
145
|
+
@interface TSBTempivoSensorBridge : TSBBase
|
|
146
|
+
- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer));
|
|
147
|
+
+ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead")));
|
|
148
|
+
- (NSString *)connectPayloadJsonSerial:(NSString *)serial bluetoothMac:(NSString *)bluetoothMac pin:(int32_t)pin legacy:(BOOL)legacy deviceId:(NSString *)deviceId encryptionKey:(NSString *)encryptionKey __attribute__((swift_name("connectPayloadJson(serial:bluetoothMac:pin:legacy:deviceId:encryptionKey:)")));
|
|
149
|
+
- (void)disconnect __attribute__((swift_name("disconnect()")));
|
|
150
|
+
- (NSString *)getCalibrationPayloadJson __attribute__((swift_name("getCalibrationPayloadJson()")));
|
|
151
|
+
- (NSString *)getConfigurationPayloadJson __attribute__((swift_name("getConfigurationPayloadJson()")));
|
|
152
|
+
- (void)initialize __attribute__((swift_name("initialize()")));
|
|
153
|
+
- (NSString *)setConfigurationPayloadJsonJson:(NSString *)json __attribute__((swift_name("setConfigurationPayloadJson(json:)")));
|
|
154
|
+
- (void)startDeviceScanOnDeviceJson:(void (^)(NSString *))onDeviceJson __attribute__((swift_name("startDeviceScan(onDeviceJson:)")));
|
|
155
|
+
- (void)stopDeviceScan __attribute__((swift_name("stopDeviceScan()")));
|
|
156
|
+
- (NSString *)triggerTransmissionPayloadJson __attribute__((swift_name("triggerTransmissionPayloadJson()")));
|
|
157
|
+
@end
|
|
158
|
+
|
|
159
|
+
#pragma pop_macro("_Nullable_result")
|
|
160
|
+
#pragma clang diagnostic pop
|
|
161
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>CFBundleExecutable</key>
|
|
6
|
+
<string>TempivoSensorBridge</string>
|
|
7
|
+
<key>CFBundleIdentifier</key>
|
|
8
|
+
<string>com.tempivo.sensor.bridge.TempivoSensorBridge</string>
|
|
9
|
+
<key>CFBundleInfoDictionaryVersion</key>
|
|
10
|
+
<string>6.0</string>
|
|
11
|
+
<key>CFBundleName</key>
|
|
12
|
+
<string>TempivoSensorBridge</string>
|
|
13
|
+
<key>CFBundlePackageType</key>
|
|
14
|
+
<string>FMWK</string>
|
|
15
|
+
<key>CFBundleShortVersionString</key>
|
|
16
|
+
<string>1.0</string>
|
|
17
|
+
<key>CFBundleSupportedPlatforms</key>
|
|
18
|
+
<array>
|
|
19
|
+
<string>iPhoneOS</string>
|
|
20
|
+
</array>
|
|
21
|
+
<key>CFBundleVersion</key>
|
|
22
|
+
<string>1</string>
|
|
23
|
+
<key>MinimumOSVersion</key>
|
|
24
|
+
<string>14.0</string>
|
|
25
|
+
<key>UIDeviceFamily</key>
|
|
26
|
+
<array>
|
|
27
|
+
<integer>1</integer>
|
|
28
|
+
<integer>2</integer>
|
|
29
|
+
</array>
|
|
30
|
+
<key>UIRequiredDeviceCapabilities</key>
|
|
31
|
+
<array>
|
|
32
|
+
<string>arm64</string>
|
|
33
|
+
</array>
|
|
34
|
+
</dict>
|
|
35
|
+
</plist>
|
|
Binary file
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
#import <Foundation/NSArray.h>
|
|
2
|
+
#import <Foundation/NSDictionary.h>
|
|
3
|
+
#import <Foundation/NSError.h>
|
|
4
|
+
#import <Foundation/NSObject.h>
|
|
5
|
+
#import <Foundation/NSSet.h>
|
|
6
|
+
#import <Foundation/NSString.h>
|
|
7
|
+
#import <Foundation/NSValue.h>
|
|
8
|
+
|
|
9
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
10
|
+
#pragma clang diagnostic push
|
|
11
|
+
#pragma clang diagnostic ignored "-Wunknown-warning-option"
|
|
12
|
+
#pragma clang diagnostic ignored "-Wincompatible-property-type"
|
|
13
|
+
#pragma clang diagnostic ignored "-Wnullability"
|
|
14
|
+
|
|
15
|
+
#pragma push_macro("_Nullable_result")
|
|
16
|
+
#if !__has_feature(nullability_nullable_result)
|
|
17
|
+
#undef _Nullable_result
|
|
18
|
+
#define _Nullable_result _Nullable
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
__attribute__((swift_name("KotlinBase")))
|
|
22
|
+
@interface TSBBase : NSObject
|
|
23
|
+
- (instancetype)init __attribute__((unavailable));
|
|
24
|
+
+ (instancetype)new __attribute__((unavailable));
|
|
25
|
+
+ (void)initialize __attribute__((objc_requires_super));
|
|
26
|
+
@end
|
|
27
|
+
|
|
28
|
+
@interface TSBBase (TSBBaseCopying) <NSCopying>
|
|
29
|
+
@end
|
|
30
|
+
|
|
31
|
+
__attribute__((swift_name("KotlinMutableSet")))
|
|
32
|
+
@interface TSBMutableSet<ObjectType> : NSMutableSet<ObjectType>
|
|
33
|
+
@end
|
|
34
|
+
|
|
35
|
+
__attribute__((swift_name("KotlinMutableDictionary")))
|
|
36
|
+
@interface TSBMutableDictionary<KeyType, ObjectType> : NSMutableDictionary<KeyType, ObjectType>
|
|
37
|
+
@end
|
|
38
|
+
|
|
39
|
+
@interface NSError (NSErrorTSBKotlinException)
|
|
40
|
+
@property (readonly) id _Nullable kotlinException;
|
|
41
|
+
@end
|
|
42
|
+
|
|
43
|
+
__attribute__((swift_name("KotlinNumber")))
|
|
44
|
+
@interface TSBNumber : NSNumber
|
|
45
|
+
- (instancetype)initWithChar:(char)value __attribute__((unavailable));
|
|
46
|
+
- (instancetype)initWithUnsignedChar:(unsigned char)value __attribute__((unavailable));
|
|
47
|
+
- (instancetype)initWithShort:(short)value __attribute__((unavailable));
|
|
48
|
+
- (instancetype)initWithUnsignedShort:(unsigned short)value __attribute__((unavailable));
|
|
49
|
+
- (instancetype)initWithInt:(int)value __attribute__((unavailable));
|
|
50
|
+
- (instancetype)initWithUnsignedInt:(unsigned int)value __attribute__((unavailable));
|
|
51
|
+
- (instancetype)initWithLong:(long)value __attribute__((unavailable));
|
|
52
|
+
- (instancetype)initWithUnsignedLong:(unsigned long)value __attribute__((unavailable));
|
|
53
|
+
- (instancetype)initWithLongLong:(long long)value __attribute__((unavailable));
|
|
54
|
+
- (instancetype)initWithUnsignedLongLong:(unsigned long long)value __attribute__((unavailable));
|
|
55
|
+
- (instancetype)initWithFloat:(float)value __attribute__((unavailable));
|
|
56
|
+
- (instancetype)initWithDouble:(double)value __attribute__((unavailable));
|
|
57
|
+
- (instancetype)initWithBool:(BOOL)value __attribute__((unavailable));
|
|
58
|
+
- (instancetype)initWithInteger:(NSInteger)value __attribute__((unavailable));
|
|
59
|
+
- (instancetype)initWithUnsignedInteger:(NSUInteger)value __attribute__((unavailable));
|
|
60
|
+
+ (instancetype)numberWithChar:(char)value __attribute__((unavailable));
|
|
61
|
+
+ (instancetype)numberWithUnsignedChar:(unsigned char)value __attribute__((unavailable));
|
|
62
|
+
+ (instancetype)numberWithShort:(short)value __attribute__((unavailable));
|
|
63
|
+
+ (instancetype)numberWithUnsignedShort:(unsigned short)value __attribute__((unavailable));
|
|
64
|
+
+ (instancetype)numberWithInt:(int)value __attribute__((unavailable));
|
|
65
|
+
+ (instancetype)numberWithUnsignedInt:(unsigned int)value __attribute__((unavailable));
|
|
66
|
+
+ (instancetype)numberWithLong:(long)value __attribute__((unavailable));
|
|
67
|
+
+ (instancetype)numberWithUnsignedLong:(unsigned long)value __attribute__((unavailable));
|
|
68
|
+
+ (instancetype)numberWithLongLong:(long long)value __attribute__((unavailable));
|
|
69
|
+
+ (instancetype)numberWithUnsignedLongLong:(unsigned long long)value __attribute__((unavailable));
|
|
70
|
+
+ (instancetype)numberWithFloat:(float)value __attribute__((unavailable));
|
|
71
|
+
+ (instancetype)numberWithDouble:(double)value __attribute__((unavailable));
|
|
72
|
+
+ (instancetype)numberWithBool:(BOOL)value __attribute__((unavailable));
|
|
73
|
+
+ (instancetype)numberWithInteger:(NSInteger)value __attribute__((unavailable));
|
|
74
|
+
+ (instancetype)numberWithUnsignedInteger:(NSUInteger)value __attribute__((unavailable));
|
|
75
|
+
@end
|
|
76
|
+
|
|
77
|
+
__attribute__((swift_name("KotlinByte")))
|
|
78
|
+
@interface TSBByte : TSBNumber
|
|
79
|
+
- (instancetype)initWithChar:(char)value;
|
|
80
|
+
+ (instancetype)numberWithChar:(char)value;
|
|
81
|
+
@end
|
|
82
|
+
|
|
83
|
+
__attribute__((swift_name("KotlinUByte")))
|
|
84
|
+
@interface TSBUByte : TSBNumber
|
|
85
|
+
- (instancetype)initWithUnsignedChar:(unsigned char)value;
|
|
86
|
+
+ (instancetype)numberWithUnsignedChar:(unsigned char)value;
|
|
87
|
+
@end
|
|
88
|
+
|
|
89
|
+
__attribute__((swift_name("KotlinShort")))
|
|
90
|
+
@interface TSBShort : TSBNumber
|
|
91
|
+
- (instancetype)initWithShort:(short)value;
|
|
92
|
+
+ (instancetype)numberWithShort:(short)value;
|
|
93
|
+
@end
|
|
94
|
+
|
|
95
|
+
__attribute__((swift_name("KotlinUShort")))
|
|
96
|
+
@interface TSBUShort : TSBNumber
|
|
97
|
+
- (instancetype)initWithUnsignedShort:(unsigned short)value;
|
|
98
|
+
+ (instancetype)numberWithUnsignedShort:(unsigned short)value;
|
|
99
|
+
@end
|
|
100
|
+
|
|
101
|
+
__attribute__((swift_name("KotlinInt")))
|
|
102
|
+
@interface TSBInt : TSBNumber
|
|
103
|
+
- (instancetype)initWithInt:(int)value;
|
|
104
|
+
+ (instancetype)numberWithInt:(int)value;
|
|
105
|
+
@end
|
|
106
|
+
|
|
107
|
+
__attribute__((swift_name("KotlinUInt")))
|
|
108
|
+
@interface TSBUInt : TSBNumber
|
|
109
|
+
- (instancetype)initWithUnsignedInt:(unsigned int)value;
|
|
110
|
+
+ (instancetype)numberWithUnsignedInt:(unsigned int)value;
|
|
111
|
+
@end
|
|
112
|
+
|
|
113
|
+
__attribute__((swift_name("KotlinLong")))
|
|
114
|
+
@interface TSBLong : TSBNumber
|
|
115
|
+
- (instancetype)initWithLongLong:(long long)value;
|
|
116
|
+
+ (instancetype)numberWithLongLong:(long long)value;
|
|
117
|
+
@end
|
|
118
|
+
|
|
119
|
+
__attribute__((swift_name("KotlinULong")))
|
|
120
|
+
@interface TSBULong : TSBNumber
|
|
121
|
+
- (instancetype)initWithUnsignedLongLong:(unsigned long long)value;
|
|
122
|
+
+ (instancetype)numberWithUnsignedLongLong:(unsigned long long)value;
|
|
123
|
+
@end
|
|
124
|
+
|
|
125
|
+
__attribute__((swift_name("KotlinFloat")))
|
|
126
|
+
@interface TSBFloat : TSBNumber
|
|
127
|
+
- (instancetype)initWithFloat:(float)value;
|
|
128
|
+
+ (instancetype)numberWithFloat:(float)value;
|
|
129
|
+
@end
|
|
130
|
+
|
|
131
|
+
__attribute__((swift_name("KotlinDouble")))
|
|
132
|
+
@interface TSBDouble : TSBNumber
|
|
133
|
+
- (instancetype)initWithDouble:(double)value;
|
|
134
|
+
+ (instancetype)numberWithDouble:(double)value;
|
|
135
|
+
@end
|
|
136
|
+
|
|
137
|
+
__attribute__((swift_name("KotlinBoolean")))
|
|
138
|
+
@interface TSBBoolean : TSBNumber
|
|
139
|
+
- (instancetype)initWithBool:(BOOL)value;
|
|
140
|
+
+ (instancetype)numberWithBool:(BOOL)value;
|
|
141
|
+
@end
|
|
142
|
+
|
|
143
|
+
__attribute__((objc_subclassing_restricted))
|
|
144
|
+
__attribute__((swift_name("TempivoSensorBridge")))
|
|
145
|
+
@interface TSBTempivoSensorBridge : TSBBase
|
|
146
|
+
- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer));
|
|
147
|
+
+ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead")));
|
|
148
|
+
- (NSString *)connectPayloadJsonSerial:(NSString *)serial bluetoothMac:(NSString *)bluetoothMac pin:(int32_t)pin legacy:(BOOL)legacy deviceId:(NSString *)deviceId encryptionKey:(NSString *)encryptionKey __attribute__((swift_name("connectPayloadJson(serial:bluetoothMac:pin:legacy:deviceId:encryptionKey:)")));
|
|
149
|
+
- (void)disconnect __attribute__((swift_name("disconnect()")));
|
|
150
|
+
- (NSString *)getCalibrationPayloadJson __attribute__((swift_name("getCalibrationPayloadJson()")));
|
|
151
|
+
- (NSString *)getConfigurationPayloadJson __attribute__((swift_name("getConfigurationPayloadJson()")));
|
|
152
|
+
- (void)initialize __attribute__((swift_name("initialize()")));
|
|
153
|
+
- (NSString *)setConfigurationPayloadJsonJson:(NSString *)json __attribute__((swift_name("setConfigurationPayloadJson(json:)")));
|
|
154
|
+
- (void)startDeviceScanOnDeviceJson:(void (^)(NSString *))onDeviceJson __attribute__((swift_name("startDeviceScan(onDeviceJson:)")));
|
|
155
|
+
- (void)stopDeviceScan __attribute__((swift_name("stopDeviceScan()")));
|
|
156
|
+
- (NSString *)triggerTransmissionPayloadJson __attribute__((swift_name("triggerTransmissionPayloadJson()")));
|
|
157
|
+
@end
|
|
158
|
+
|
|
159
|
+
#pragma pop_macro("_Nullable_result")
|
|
160
|
+
#pragma clang diagnostic pop
|
|
161
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>CFBundleExecutable</key>
|
|
6
|
+
<string>TempivoSensorBridge</string>
|
|
7
|
+
<key>CFBundleIdentifier</key>
|
|
8
|
+
<string>com.tempivo.sensor.bridge.TempivoSensorBridge</string>
|
|
9
|
+
<key>CFBundleInfoDictionaryVersion</key>
|
|
10
|
+
<string>6.0</string>
|
|
11
|
+
<key>CFBundleName</key>
|
|
12
|
+
<string>TempivoSensorBridge</string>
|
|
13
|
+
<key>CFBundlePackageType</key>
|
|
14
|
+
<string>FMWK</string>
|
|
15
|
+
<key>CFBundleShortVersionString</key>
|
|
16
|
+
<string>1.0</string>
|
|
17
|
+
<key>CFBundleSupportedPlatforms</key>
|
|
18
|
+
<array>
|
|
19
|
+
<string>iPhoneSimulator</string>
|
|
20
|
+
</array>
|
|
21
|
+
<key>CFBundleVersion</key>
|
|
22
|
+
<string>1</string>
|
|
23
|
+
<key>MinimumOSVersion</key>
|
|
24
|
+
<string>14.0</string>
|
|
25
|
+
<key>UIDeviceFamily</key>
|
|
26
|
+
<array>
|
|
27
|
+
<integer>1</integer>
|
|
28
|
+
<integer>2</integer>
|
|
29
|
+
</array>
|
|
30
|
+
</dict>
|
|
31
|
+
</plist>
|
|
Binary file
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import CoreBluetooth
|
|
2
2
|
import Foundation
|
|
3
3
|
|
|
4
|
+
#if canImport(TempivoSensorBridge)
|
|
5
|
+
import TempivoSensorBridge
|
|
6
|
+
#endif
|
|
7
|
+
|
|
4
8
|
public protocol TempivoSensorBeaconScannerDelegate: AnyObject {
|
|
5
9
|
func sensorBeaconScanner(_ scanner: TempivoSensorBeaconScanner, didDiscover discovery: SensorBeaconDiscovery)
|
|
6
10
|
func sensorBeaconScanner(_ scanner: TempivoSensorBeaconScanner, didUpdateState state: CBManagerState)
|
|
@@ -10,15 +14,21 @@ public extension TempivoSensorBeaconScannerDelegate {
|
|
|
10
14
|
func sensorBeaconScanner(_ scanner: TempivoSensorBeaconScanner, didUpdateState state: CBManagerState) {}
|
|
11
15
|
}
|
|
12
16
|
|
|
13
|
-
/// Active BLE scan
|
|
17
|
+
/// Active BLE scan. iPhone uses the same hardware runtime scan as Tempivo.
|
|
18
|
+
/// Manufacturer-only CoreBluetooth misses HC7 / FW 7+ on iPhone.
|
|
14
19
|
public final class TempivoSensorBeaconScanner: NSObject {
|
|
15
20
|
|
|
16
21
|
public weak var delegate: TempivoSensorBeaconScannerDelegate?
|
|
17
22
|
|
|
18
23
|
private var central: CBCentralManager!
|
|
19
24
|
private var frameCache = SensorBeaconFrameCache()
|
|
25
|
+
private var lastSeen: [String: TempivoSensorSeenDevice] = [:]
|
|
20
26
|
private var isScanning = false
|
|
21
27
|
private var pendingStart = false
|
|
28
|
+
#if canImport(TempivoSensorBridge)
|
|
29
|
+
private let runtime = TempivoSensorBridge()
|
|
30
|
+
private var useRuntimeScan: Bool { !ProcessInfo.processInfo.isiOSAppOnMac }
|
|
31
|
+
#endif
|
|
22
32
|
|
|
23
33
|
public override init() {
|
|
24
34
|
super.init()
|
|
@@ -36,10 +46,25 @@ public final class TempivoSensorBeaconScanner: NSObject {
|
|
|
36
46
|
/// Clears cached `0x03` / `0x04` frames. Does not stop an active scan.
|
|
37
47
|
public func clearCache() {
|
|
38
48
|
frameCache.clear()
|
|
49
|
+
lastSeen.removeAll()
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public func lookup(serial: String) -> TempivoSensorSeenDevice? {
|
|
53
|
+
lastSeen[TempivoSensorBeaconDecoder.macKey(serial)]
|
|
39
54
|
}
|
|
40
55
|
|
|
41
|
-
/// Starts an active scan
|
|
56
|
+
/// Starts an active scan. iPhone: hardware runtime. Mac: manufacturer advertisements.
|
|
42
57
|
public func startScanning() {
|
|
58
|
+
#if canImport(TempivoSensorBridge)
|
|
59
|
+
if useRuntimeScan {
|
|
60
|
+
runtime.initialize()
|
|
61
|
+
isScanning = true
|
|
62
|
+
runtime.startDeviceScan { [weak self] json in
|
|
63
|
+
self?.handleRuntimeScanJson(json)
|
|
64
|
+
}
|
|
65
|
+
return
|
|
66
|
+
}
|
|
67
|
+
#endif
|
|
43
68
|
pendingStart = true
|
|
44
69
|
if central.state == .poweredOn {
|
|
45
70
|
beginScanningIfNeeded()
|
|
@@ -49,8 +74,12 @@ public final class TempivoSensorBeaconScanner: NSObject {
|
|
|
49
74
|
/// Stops scanning and clears pending start.
|
|
50
75
|
public func stopScanning() {
|
|
51
76
|
pendingStart = false
|
|
52
|
-
|
|
53
|
-
|
|
77
|
+
#if canImport(TempivoSensorBridge)
|
|
78
|
+
runtime.stopDeviceScan()
|
|
79
|
+
#endif
|
|
80
|
+
if isScanning {
|
|
81
|
+
central.stopScan()
|
|
82
|
+
}
|
|
54
83
|
isScanning = false
|
|
55
84
|
}
|
|
56
85
|
|
|
@@ -133,8 +162,55 @@ public final class TempivoSensorBeaconScanner: NSObject {
|
|
|
133
162
|
bluetoothMacAddress: bluetoothMacAddress,
|
|
134
163
|
reading: reading
|
|
135
164
|
)
|
|
165
|
+
if let serial = (serialNumber ?? reading?.serialNumber).map({ TempivoSensorBeaconDecoder.macKey($0) }),
|
|
166
|
+
!serial.isEmpty {
|
|
167
|
+
let seen = TempivoSensorSeenDevice(
|
|
168
|
+
deviceId: deviceId,
|
|
169
|
+
bluetoothMac: bluetoothMacAddress ?? reading?.bluetoothMacAddress,
|
|
170
|
+
serial: serial,
|
|
171
|
+
firmware: reading?.firmware
|
|
172
|
+
)
|
|
173
|
+
lastSeen[serial] = seen
|
|
174
|
+
}
|
|
136
175
|
delegate?.sensorBeaconScanner(self, didDiscover: discovery)
|
|
137
176
|
}
|
|
177
|
+
|
|
178
|
+
private func handleRuntimeScanJson(_ raw: String) {
|
|
179
|
+
guard let data = raw.data(using: .utf8),
|
|
180
|
+
let obj = try? JSONSerialization.jsonObject(with: data) as? [String: Any]
|
|
181
|
+
else { return }
|
|
182
|
+
let deviceId = (obj["deviceId"] as? String)?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
|
|
183
|
+
let serial = (obj["serialNumber"] as? String).map { TempivoSensorBeaconDecoder.macKey($0) } ?? ""
|
|
184
|
+
guard !deviceId.isEmpty, !serial.isEmpty else { return }
|
|
185
|
+
let mac = obj["bluetoothMacAddress"] as? String
|
|
186
|
+
let rssi = (obj["rssi"] as? NSNumber)?.intValue ?? (obj["rssi"] as? Int) ?? 0
|
|
187
|
+
let firmware = obj["firmware"] as? String
|
|
188
|
+
let reading = SensorBeaconReading(
|
|
189
|
+
serialNumber: serial,
|
|
190
|
+
bluetoothMacAddress: mac,
|
|
191
|
+
firmware: firmware
|
|
192
|
+
)
|
|
193
|
+
rememberSeen(deviceId: deviceId, bluetoothMac: mac, serial: serial, firmware: firmware)
|
|
194
|
+
delegate?.sensorBeaconScanner(
|
|
195
|
+
self,
|
|
196
|
+
didDiscover: SensorBeaconDiscovery(
|
|
197
|
+
deviceId: deviceId,
|
|
198
|
+
rssi: rssi,
|
|
199
|
+
serialNumber: serial,
|
|
200
|
+
bluetoothMacAddress: mac,
|
|
201
|
+
reading: reading
|
|
202
|
+
)
|
|
203
|
+
)
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
private func rememberSeen(deviceId: String, bluetoothMac: String?, serial: String, firmware: String?) {
|
|
207
|
+
lastSeen[serial] = TempivoSensorSeenDevice(
|
|
208
|
+
deviceId: deviceId,
|
|
209
|
+
bluetoothMac: bluetoothMac,
|
|
210
|
+
serial: serial,
|
|
211
|
+
firmware: firmware
|
|
212
|
+
)
|
|
213
|
+
}
|
|
138
214
|
}
|
|
139
215
|
|
|
140
216
|
extension TempivoSensorBeaconScanner: CBCentralManagerDelegate {
|
|
@@ -101,3 +101,18 @@ public struct SensorBeaconDiscovery: Sendable, Equatable {
|
|
|
101
101
|
self.reading = reading
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
+
|
|
105
|
+
/// Last advertisement used to resolve GATT connect (scan device id + firmware).
|
|
106
|
+
public struct TempivoSensorSeenDevice: Sendable, Equatable {
|
|
107
|
+
public let deviceId: String
|
|
108
|
+
public let bluetoothMac: String?
|
|
109
|
+
public let serial: String
|
|
110
|
+
public let firmware: String?
|
|
111
|
+
|
|
112
|
+
public init(deviceId: String, bluetoothMac: String?, serial: String, firmware: String?) {
|
|
113
|
+
self.deviceId = deviceId
|
|
114
|
+
self.bluetoothMac = bluetoothMac
|
|
115
|
+
self.serial = serial
|
|
116
|
+
self.firmware = firmware
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -17,7 +17,21 @@ public struct TempivoSensorError: Error, LocalizedError, Sendable {
|
|
|
17
17
|
|
|
18
18
|
public init(_ code: TempivoSensorErrorCode, _ message: String) {
|
|
19
19
|
self.code = code
|
|
20
|
-
self.message = message
|
|
20
|
+
self.message = Self.sanitizeClientMessage(message)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public static func sanitizeClientMessage(_ raw: String) -> String {
|
|
24
|
+
var text = raw
|
|
25
|
+
let full = NSRange(location: 0, length: text.utf16.count)
|
|
26
|
+
if let regex = try? NSRegularExpression(pattern: #"(?i)pl\.[A-Za-z][A-Za-z0-9_.$]*"#) {
|
|
27
|
+
text = regex.stringByReplacingMatches(in: text, range: full, withTemplate: "")
|
|
28
|
+
}
|
|
29
|
+
let full2 = NSRange(location: 0, length: text.utf16.count)
|
|
30
|
+
if let regex = try? NSRegularExpression(pattern: #"(?i)\befento[A-Za-z0-9_$]*"#) {
|
|
31
|
+
text = regex.stringByReplacingMatches(in: text, range: full2, withTemplate: "")
|
|
32
|
+
}
|
|
33
|
+
text = text.replacingOccurrences(of: #"\s+"#, with: " ", options: .regularExpression)
|
|
34
|
+
return text.trimmingCharacters(in: CharacterSet(charactersIn: " :-.\n\t/"))
|
|
21
35
|
}
|
|
22
36
|
|
|
23
37
|
public var errorDescription: String? { message }
|
|
@@ -30,6 +30,23 @@ public enum TempivoSensorQrParser {
|
|
|
30
30
|
public static let defaultModel = "HC7"
|
|
31
31
|
|
|
32
32
|
public static func sessionType(fromModel model: String?) -> TempivoSensorSessionType {
|
|
33
|
+
sessionType(fromModel: model, firmware: nil)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public static func sessionType(fromModel model: String?, firmware: String?) -> TempivoSensorSessionType {
|
|
37
|
+
if let firmware {
|
|
38
|
+
let t = firmware.trimmingCharacters(in: .whitespacesAndNewlines)
|
|
39
|
+
if t.range(of: "^FW\\s*5", options: [.regularExpression, .caseInsensitive]) != nil {
|
|
40
|
+
return .legacy
|
|
41
|
+
}
|
|
42
|
+
if let match = t.range(of: "^(\\d+)\\.\\d+", options: .regularExpression) {
|
|
43
|
+
let majorStr = String(t[match]).split(separator: ".").first.flatMap { Int($0) }
|
|
44
|
+
if let major = majorStr {
|
|
45
|
+
if major >= 7 { return .modern }
|
|
46
|
+
if major >= 1 { return .legacy }
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
33
50
|
guard let model, !model.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty else {
|
|
34
51
|
return .modern
|
|
35
52
|
}
|