@tempivo/sensor-beacon 0.2.0 → 0.3.0
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 +233 -0
- package/android/src/main/java/expo/modules/tempivosensorbeacon/TempivoSensorBeaconModule.kt +122 -0
- package/android-aar/build.gradle +4 -0
- package/{android → android-aar}/library/src/main/java/com/tempivo/sensor/beacon/TempivoSensorSession.kt +13 -0
- 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 +2 -0
- package/dist/index.js +1 -0
- package/dist/native-bridge.d.ts +14 -0
- package/dist/native-bridge.js +51 -0
- package/dist/native-helpers.d.ts +5 -0
- package/dist/native-helpers.js +33 -0
- package/dist/native-module.d.ts +14 -0
- package/dist/native-module.js +104 -0
- package/dist/native-types.d.ts +41 -0
- package/dist/native-types.js +1 -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 +159 -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 +159 -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/TempivoSensorBeacon.podspec +35 -0
- package/ios/TempivoSensorBeaconModule.swift +208 -0
- package/package.json +48 -7
- /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/PartnerBleRules.kt +0 -0
- /package/{android → android-aar}/library/src/main/java/com/tempivo/sensor/beacon/SensorBleRuntime.kt +0 -0
- /package/{android → android-aar}/library/src/main/java/com/tempivo/sensor/beacon/TempivoSensorBeaconDecoder.kt +0 -0
- /package/{android → android-aar}/library/src/main/java/com/tempivo/sensor/beacon/TempivoSensorBeaconScanner.kt +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/TempivoSensorError.kt +0 -0
- /package/{android → android-aar}/library/src/main/java/com/tempivo/sensor/beacon/TempivoSensorProfile.kt +0 -0
- /package/{android → android-aar}/library/src/main/java/com/tempivo/sensor/beacon/TempivoSensorQr.kt +0 -0
- /package/{android → android-aar}/settings.gradle +0 -0
|
@@ -0,0 +1,159 @@
|
|
|
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 __attribute__((swift_name("connectPayloadJson(serial:bluetoothMac:pin:legacy:)")));
|
|
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
|
+
- (NSString *)triggerTransmissionPayloadJson __attribute__((swift_name("triggerTransmissionPayloadJson()")));
|
|
155
|
+
@end
|
|
156
|
+
|
|
157
|
+
#pragma pop_macro("_Nullable_result")
|
|
158
|
+
#pragma clang diagnostic pop
|
|
159
|
+
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,159 @@
|
|
|
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 __attribute__((swift_name("connectPayloadJson(serial:bluetoothMac:pin:legacy:)")));
|
|
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
|
+
- (NSString *)triggerTransmissionPayloadJson __attribute__((swift_name("triggerTransmissionPayloadJson()")));
|
|
155
|
+
@end
|
|
156
|
+
|
|
157
|
+
#pragma pop_macro("_Nullable_result")
|
|
158
|
+
#pragma clang diagnostic pop
|
|
159
|
+
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
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = 'TempivoSensorBeacon'
|
|
7
|
+
s.version = package['version']
|
|
8
|
+
s.summary = package['description']
|
|
9
|
+
s.description = package['description']
|
|
10
|
+
s.license = package['license']
|
|
11
|
+
s.author = package['author'] || 'Tempivo'
|
|
12
|
+
s.homepage = package['homepage']
|
|
13
|
+
s.platforms = { :ios => '15.1' }
|
|
14
|
+
s.swift_version = '5.9'
|
|
15
|
+
s.source = { git: 'https://github.com/tempivo/tempivo-app.git' }
|
|
16
|
+
s.static_framework = true
|
|
17
|
+
s.dependency 'ExpoModulesCore'
|
|
18
|
+
s.frameworks = 'CoreBluetooth'
|
|
19
|
+
|
|
20
|
+
s.pod_target_xcconfig = {
|
|
21
|
+
'DEFINES_MODULE' => 'YES',
|
|
22
|
+
'SWIFT_COMPILATION_MODE' => 'wholemodule',
|
|
23
|
+
'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'x86_64'
|
|
24
|
+
}
|
|
25
|
+
s.user_target_xcconfig = {
|
|
26
|
+
'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'x86_64'
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
s.source_files = 'TempivoSensorBeaconModule.swift', 'Sources/TempivoSensorBeacon/**/*.swift'
|
|
30
|
+
|
|
31
|
+
bridge = File.join(__dir__, 'Frameworks/TempivoSensorBridge.xcframework')
|
|
32
|
+
if File.directory?(bridge)
|
|
33
|
+
s.vendored_frameworks = 'Frameworks/TempivoSensorBridge.xcframework'
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import CoreBluetooth
|
|
2
|
+
import ExpoModulesCore
|
|
3
|
+
|
|
4
|
+
public class TempivoSensorBeaconModule: Module, TempivoSensorBeaconScannerDelegate {
|
|
5
|
+
private var scanner: TempivoSensorBeaconScanner?
|
|
6
|
+
private let session = TempivoSensorSession()
|
|
7
|
+
|
|
8
|
+
public func definition() -> ModuleDefinition {
|
|
9
|
+
Name("TempivoSensorBeacon")
|
|
10
|
+
Events("onDeviceFound")
|
|
11
|
+
|
|
12
|
+
AsyncFunction("requestPermissions") { () -> [String: Any] in
|
|
13
|
+
_ = self.requireScanner()
|
|
14
|
+
return self.permissionPayload()
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
AsyncFunction("startScan") {
|
|
18
|
+
self.requireScanner().startScanning()
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
Function("stopScan") {
|
|
22
|
+
self.scanner?.stopScanning()
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
Function("isScanning") { () -> Bool in
|
|
26
|
+
self.scanner?.scanning ?? false
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
AsyncFunction("connect") { (qrJson: String) -> [String: Any] in
|
|
30
|
+
do {
|
|
31
|
+
let qr = try TempivoSensorQrParser.parse(qrJson)
|
|
32
|
+
try self.session.connect(qr: qr)
|
|
33
|
+
return self.qrPayload(qr)
|
|
34
|
+
} catch {
|
|
35
|
+
throw self.mapError(error)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
AsyncFunction("disconnect") {
|
|
40
|
+
self.session.disconnect()
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
AsyncFunction("getConfigurationJson") { () -> String in
|
|
44
|
+
do {
|
|
45
|
+
return try self.session.getConfigurationJson()
|
|
46
|
+
} catch {
|
|
47
|
+
throw self.mapError(error)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
AsyncFunction("setConfigurationJson") { (json: String) in
|
|
52
|
+
do {
|
|
53
|
+
try self.session.setConfigurationJson(json)
|
|
54
|
+
} catch {
|
|
55
|
+
throw self.mapError(error)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
AsyncFunction("triggerTransmission") { () -> [String: Any] in
|
|
60
|
+
do {
|
|
61
|
+
let result = try self.session.triggerTransmission()
|
|
62
|
+
return ["ok": result.ok, "supported": result.supported]
|
|
63
|
+
} catch {
|
|
64
|
+
throw self.mapError(error)
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
AsyncFunction("getCalibration") { () -> [String: Any] in
|
|
69
|
+
do {
|
|
70
|
+
let cal = try self.session.getCalibration()
|
|
71
|
+
var payload: [String: Any] = [:]
|
|
72
|
+
if let date = cal.laboratoryCalibrationDate {
|
|
73
|
+
payload["laboratoryCalibrationDate"] = date
|
|
74
|
+
}
|
|
75
|
+
if let ts = cal.laboratoryCalibrationTimestamp {
|
|
76
|
+
payload["laboratoryCalibrationTimestamp"] = Int(ts)
|
|
77
|
+
}
|
|
78
|
+
return payload
|
|
79
|
+
} catch {
|
|
80
|
+
throw self.mapError(error)
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
OnDestroy {
|
|
85
|
+
self.scanner?.stopScanning()
|
|
86
|
+
self.session.disconnect()
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
public func sensorBeaconScanner(
|
|
91
|
+
_ scanner: TempivoSensorBeaconScanner,
|
|
92
|
+
didDiscover discovery: SensorBeaconDiscovery
|
|
93
|
+
) {
|
|
94
|
+
sendEvent("onDeviceFound", devicePayload(discovery))
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
private func requireScanner() -> TempivoSensorBeaconScanner {
|
|
98
|
+
if let scanner {
|
|
99
|
+
return scanner
|
|
100
|
+
}
|
|
101
|
+
let created = TempivoSensorBeaconScanner()
|
|
102
|
+
created.delegate = self
|
|
103
|
+
scanner = created
|
|
104
|
+
return created
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
private func permissionPayload() -> [String: Any] {
|
|
108
|
+
if #available(iOS 13.1, *) {
|
|
109
|
+
let status = CBManager.authorization
|
|
110
|
+
let granted = status == .allowedAlways
|
|
111
|
+
let statusName: String
|
|
112
|
+
switch status {
|
|
113
|
+
case .allowedAlways: statusName = "granted"
|
|
114
|
+
case .notDetermined: statusName = "undetermined"
|
|
115
|
+
default: statusName = "denied"
|
|
116
|
+
}
|
|
117
|
+
return [
|
|
118
|
+
"granted": granted,
|
|
119
|
+
"status": statusName,
|
|
120
|
+
"canAskAgain": status == .notDetermined,
|
|
121
|
+
"expires": "never",
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
return [
|
|
125
|
+
"granted": true,
|
|
126
|
+
"status": "granted",
|
|
127
|
+
"canAskAgain": true,
|
|
128
|
+
"expires": "never",
|
|
129
|
+
]
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
private func qrPayload(_ qr: TempivoSensorQr) -> [String: Any] {
|
|
133
|
+
var payload: [String: Any] = [
|
|
134
|
+
"serial": qr.serial,
|
|
135
|
+
"pin": qr.pin,
|
|
136
|
+
"sessionType": qr.sessionType.rawValue,
|
|
137
|
+
"bluetoothMac": qr.bluetoothMac,
|
|
138
|
+
]
|
|
139
|
+
if let model = qr.model {
|
|
140
|
+
payload["model"] = model
|
|
141
|
+
}
|
|
142
|
+
return payload
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
private func devicePayload(_ discovery: SensorBeaconDiscovery) -> [String: Any] {
|
|
146
|
+
var payload: [String: Any] = [
|
|
147
|
+
"deviceId": discovery.deviceId,
|
|
148
|
+
"rssi": discovery.rssi,
|
|
149
|
+
]
|
|
150
|
+
if let serial = discovery.serialNumber {
|
|
151
|
+
payload["serialNumber"] = serial
|
|
152
|
+
}
|
|
153
|
+
if let mac = discovery.bluetoothMacAddress {
|
|
154
|
+
payload["bluetoothMacAddress"] = mac
|
|
155
|
+
}
|
|
156
|
+
if let reading = discovery.reading {
|
|
157
|
+
payload["summary"] = reading.summary
|
|
158
|
+
payload["telemetry"] = telemetryPayload(reading)
|
|
159
|
+
}
|
|
160
|
+
return payload
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
private func telemetryPayload(_ reading: SensorBeaconReading) -> [String: Any] {
|
|
164
|
+
var payload: [String: Any] = [
|
|
165
|
+
"readingsCount": reading.readingsCount,
|
|
166
|
+
"summary": reading.summary,
|
|
167
|
+
"readings": reading.readings.map { slot in
|
|
168
|
+
[
|
|
169
|
+
"typeHex": slot.typeHex,
|
|
170
|
+
"raw24": slot.raw24,
|
|
171
|
+
"text": slot.text,
|
|
172
|
+
] as [String: Any]
|
|
173
|
+
},
|
|
174
|
+
]
|
|
175
|
+
if let firmware = reading.firmware { payload["firmware"] = firmware }
|
|
176
|
+
if let batteryOk = reading.batteryOk { payload["batteryOk"] = batteryOk }
|
|
177
|
+
if let encryptionEnabled = reading.encryptionEnabled { payload["encryptionEnabled"] = encryptionEnabled }
|
|
178
|
+
if let cellularStatus = reading.cellularStatus { payload["cellularStatus"] = cellularStatus }
|
|
179
|
+
if let measurementCounter = reading.measurementCounter { payload["measurementCounter"] = measurementCounter }
|
|
180
|
+
if let readingTimestampUnix = reading.readingTimestampUnix { payload["readingTimestampUnix"] = readingTimestampUnix }
|
|
181
|
+
if let readingTimestampIso = reading.readingTimestampIso { payload["readingTimestampIso"] = readingTimestampIso }
|
|
182
|
+
if let measurementIntervalSeconds = reading.measurementIntervalSeconds {
|
|
183
|
+
payload["measurementIntervalSeconds"] = measurementIntervalSeconds
|
|
184
|
+
}
|
|
185
|
+
return payload
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
private func mapError(_ error: Error) -> SensorBeaconException {
|
|
189
|
+
if let sensor = error as? TempivoSensorError {
|
|
190
|
+
return SensorBeaconException(code: sensor.code.rawValue, reason: sensor.message)
|
|
191
|
+
}
|
|
192
|
+
return SensorBeaconException(code: "unknown", reason: error.localizedDescription)
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
internal final class SensorBeaconException: Exception {
|
|
197
|
+
private let customCode: String
|
|
198
|
+
private let customReason: String
|
|
199
|
+
|
|
200
|
+
init(code: String, reason: String) {
|
|
201
|
+
self.customCode = code
|
|
202
|
+
self.customReason = reason
|
|
203
|
+
super.init()
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
override var code: String { customCode }
|
|
207
|
+
override var reason: String { customReason }
|
|
208
|
+
}
|