@tryvital/vital-devices-react-native 0.2.5
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/LICENSE +1 -0
- package/README.md +14 -0
- package/android/build.gradle +150 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/com/vitaldevicesreactnative/VitalDevicesEvent.kt +24 -0
- package/android/src/main/java/com/vitaldevicesreactnative/VitalDevicesReactNativeModule.kt +272 -0
- package/android/src/main/java/com/vitaldevicesreactnative/VitalDevicesReactNativePackage.kt +16 -0
- package/ios/VitalDevicesReactNative-Bridging-Header.h +2 -0
- package/ios/VitalDevicesReactNative.m +14 -0
- package/ios/VitalDevicesReactNative.swift +8 -0
- package/ios/VitalDevicesReactNative.xcodeproj/project.pbxproj +283 -0
- package/lib/index.d.ts +25 -0
- package/lib/index.js +112 -0
- package/lib/model/brand.d.ts +7 -0
- package/lib/model/brand.js +8 -0
- package/lib/model/device_model.d.ts +11 -0
- package/lib/model/device_model.js +5 -0
- package/lib/model/scanned_device.d.ts +6 -0
- package/lib/model/scanned_device.js +1 -0
- package/package.json +145 -0
- package/src/index.ts +144 -0
- package/src/model/brand.js +8 -0
- package/src/model/brand.ts +7 -0
- package/src/model/device_model.js +5 -0
- package/src/model/device_model.ts +13 -0
- package/src/model/scanned_device.js +1 -0
- package/src/model/scanned_device.ts +7 -0
- package/vital-devices-react-native.podspec +35 -0
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
// !$*UTF8*$!
|
|
2
|
+
{
|
|
3
|
+
archiveVersion = 1;
|
|
4
|
+
classes = {
|
|
5
|
+
};
|
|
6
|
+
objectVersion = 46;
|
|
7
|
+
objects = {
|
|
8
|
+
|
|
9
|
+
/* Begin PBXBuildFile section */
|
|
10
|
+
5E555C0D2413F4C50049A1A2 /* VitalDevicesReactNative.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* VitalDevicesReactNative.m */; };
|
|
11
|
+
F4FF95D7245B92E800C19C63 /* VitalDevicesReactNative.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FF95D6245B92E800C19C63 /* VitalDevicesReactNative.swift */; };
|
|
12
|
+
/* End PBXBuildFile section */
|
|
13
|
+
|
|
14
|
+
/* Begin PBXCopyFilesBuildPhase section */
|
|
15
|
+
58B511D91A9E6C8500147676 /* CopyFiles */ = {
|
|
16
|
+
isa = PBXCopyFilesBuildPhase;
|
|
17
|
+
buildActionMask = 2147483647;
|
|
18
|
+
dstPath = "include/$(PRODUCT_NAME)";
|
|
19
|
+
dstSubfolderSpec = 16;
|
|
20
|
+
files = (
|
|
21
|
+
);
|
|
22
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
23
|
+
};
|
|
24
|
+
/* End PBXCopyFilesBuildPhase section */
|
|
25
|
+
|
|
26
|
+
/* Begin PBXFileReference section */
|
|
27
|
+
134814201AA4EA6300B7C361 /* libVitalDevicesReactNative.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libVitalDevicesReactNative.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
28
|
+
B3E7B5891CC2AC0600A0062D /* VitalDevicesReactNative.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VitalDevicesReactNative.m; sourceTree = "<group>"; };
|
|
29
|
+
F4FF95D5245B92E700C19C63 /* VitalDevicesReactNative-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "VitalDevicesReactNative-Bridging-Header.h"; sourceTree = "<group>"; };
|
|
30
|
+
F4FF95D6245B92E800C19C63 /* VitalDevicesReactNative.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VitalDevicesReactNative.swift; sourceTree = "<group>"; };
|
|
31
|
+
/* End PBXFileReference section */
|
|
32
|
+
|
|
33
|
+
/* Begin PBXFrameworksBuildPhase section */
|
|
34
|
+
58B511D81A9E6C8500147676 /* Frameworks */ = {
|
|
35
|
+
isa = PBXFrameworksBuildPhase;
|
|
36
|
+
buildActionMask = 2147483647;
|
|
37
|
+
files = (
|
|
38
|
+
);
|
|
39
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
40
|
+
};
|
|
41
|
+
/* End PBXFrameworksBuildPhase section */
|
|
42
|
+
|
|
43
|
+
/* Begin PBXGroup section */
|
|
44
|
+
134814211AA4EA7D00B7C361 /* Products */ = {
|
|
45
|
+
isa = PBXGroup;
|
|
46
|
+
children = (
|
|
47
|
+
134814201AA4EA6300B7C361 /* libVitalDevicesReactNative.a */,
|
|
48
|
+
);
|
|
49
|
+
name = Products;
|
|
50
|
+
sourceTree = "<group>";
|
|
51
|
+
};
|
|
52
|
+
58B511D21A9E6C8500147676 = {
|
|
53
|
+
isa = PBXGroup;
|
|
54
|
+
children = (
|
|
55
|
+
F4FF95D6245B92E800C19C63 /* VitalDevicesReactNative.swift */,
|
|
56
|
+
B3E7B5891CC2AC0600A0062D /* VitalDevicesReactNative.m */,
|
|
57
|
+
F4FF95D5245B92E700C19C63 /* VitalDevicesReactNative-Bridging-Header.h */,
|
|
58
|
+
134814211AA4EA7D00B7C361 /* Products */,
|
|
59
|
+
);
|
|
60
|
+
sourceTree = "<group>";
|
|
61
|
+
};
|
|
62
|
+
/* End PBXGroup section */
|
|
63
|
+
|
|
64
|
+
/* Begin PBXNativeTarget section */
|
|
65
|
+
58B511DA1A9E6C8500147676 /* VitalDevicesReactNative */ = {
|
|
66
|
+
isa = PBXNativeTarget;
|
|
67
|
+
buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "VitalDevicesReactNative" */;
|
|
68
|
+
buildPhases = (
|
|
69
|
+
58B511D71A9E6C8500147676 /* Sources */,
|
|
70
|
+
58B511D81A9E6C8500147676 /* Frameworks */,
|
|
71
|
+
58B511D91A9E6C8500147676 /* CopyFiles */,
|
|
72
|
+
);
|
|
73
|
+
buildRules = (
|
|
74
|
+
);
|
|
75
|
+
dependencies = (
|
|
76
|
+
);
|
|
77
|
+
name = VitalDevicesReactNative;
|
|
78
|
+
productName = RCTDataManager;
|
|
79
|
+
productReference = 134814201AA4EA6300B7C361 /* libVitalDevicesReactNative.a */;
|
|
80
|
+
productType = "com.apple.product-type.library.static";
|
|
81
|
+
};
|
|
82
|
+
/* End PBXNativeTarget section */
|
|
83
|
+
|
|
84
|
+
/* Begin PBXProject section */
|
|
85
|
+
58B511D31A9E6C8500147676 /* Project object */ = {
|
|
86
|
+
isa = PBXProject;
|
|
87
|
+
attributes = {
|
|
88
|
+
LastUpgradeCheck = 0920;
|
|
89
|
+
ORGANIZATIONNAME = Facebook;
|
|
90
|
+
TargetAttributes = {
|
|
91
|
+
58B511DA1A9E6C8500147676 = {
|
|
92
|
+
CreatedOnToolsVersion = 6.1.1;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "VitalDevicesReactNative" */;
|
|
97
|
+
compatibilityVersion = "Xcode 3.2";
|
|
98
|
+
developmentRegion = English;
|
|
99
|
+
hasScannedForEncodings = 0;
|
|
100
|
+
knownRegions = (
|
|
101
|
+
English,
|
|
102
|
+
en,
|
|
103
|
+
);
|
|
104
|
+
mainGroup = 58B511D21A9E6C8500147676;
|
|
105
|
+
productRefGroup = 58B511D21A9E6C8500147676;
|
|
106
|
+
projectDirPath = "";
|
|
107
|
+
projectRoot = "";
|
|
108
|
+
targets = (
|
|
109
|
+
58B511DA1A9E6C8500147676 /* VitalDevicesReactNative */,
|
|
110
|
+
);
|
|
111
|
+
};
|
|
112
|
+
/* End PBXProject section */
|
|
113
|
+
|
|
114
|
+
/* Begin PBXSourcesBuildPhase section */
|
|
115
|
+
58B511D71A9E6C8500147676 /* Sources */ = {
|
|
116
|
+
isa = PBXSourcesBuildPhase;
|
|
117
|
+
buildActionMask = 2147483647;
|
|
118
|
+
files = (
|
|
119
|
+
F4FF95D7245B92E800C19C63 /* VitalDevicesReactNative.swift in Sources */,
|
|
120
|
+
B3E7B58A1CC2AC0600A0062D /* VitalDevicesReactNative.m in Sources */,
|
|
121
|
+
);
|
|
122
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
123
|
+
};
|
|
124
|
+
/* End PBXSourcesBuildPhase section */
|
|
125
|
+
|
|
126
|
+
/* Begin XCBuildConfiguration section */
|
|
127
|
+
58B511ED1A9E6C8500147676 /* Debug */ = {
|
|
128
|
+
isa = XCBuildConfiguration;
|
|
129
|
+
buildSettings = {
|
|
130
|
+
ALWAYS_SEARCH_USER_PATHS = NO;
|
|
131
|
+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
|
132
|
+
CLANG_CXX_LIBRARY = "libc++";
|
|
133
|
+
CLANG_ENABLE_MODULES = YES;
|
|
134
|
+
CLANG_ENABLE_OBJC_ARC = YES;
|
|
135
|
+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
|
136
|
+
CLANG_WARN_BOOL_CONVERSION = YES;
|
|
137
|
+
CLANG_WARN_COMMA = YES;
|
|
138
|
+
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
|
139
|
+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
|
140
|
+
CLANG_WARN_EMPTY_BODY = YES;
|
|
141
|
+
CLANG_WARN_ENUM_CONVERSION = YES;
|
|
142
|
+
CLANG_WARN_INFINITE_RECURSION = YES;
|
|
143
|
+
CLANG_WARN_INT_CONVERSION = YES;
|
|
144
|
+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
|
145
|
+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
|
146
|
+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
|
147
|
+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
|
148
|
+
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
|
149
|
+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
|
150
|
+
CLANG_WARN_UNREACHABLE_CODE = YES;
|
|
151
|
+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
|
152
|
+
COPY_PHASE_STRIP = NO;
|
|
153
|
+
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
154
|
+
ENABLE_TESTABILITY = YES;
|
|
155
|
+
"EXCLUDED_ARCHS[sdk=*]" = arm64;
|
|
156
|
+
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
157
|
+
GCC_DYNAMIC_NO_PIC = NO;
|
|
158
|
+
GCC_NO_COMMON_BLOCKS = YES;
|
|
159
|
+
GCC_OPTIMIZATION_LEVEL = 0;
|
|
160
|
+
GCC_PREPROCESSOR_DEFINITIONS = (
|
|
161
|
+
"DEBUG=1",
|
|
162
|
+
"$(inherited)",
|
|
163
|
+
);
|
|
164
|
+
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
|
165
|
+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
166
|
+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
|
167
|
+
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
|
168
|
+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
|
169
|
+
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
170
|
+
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
171
|
+
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
|
172
|
+
MTL_ENABLE_DEBUG_INFO = YES;
|
|
173
|
+
ONLY_ACTIVE_ARCH = YES;
|
|
174
|
+
SDKROOT = iphoneos;
|
|
175
|
+
};
|
|
176
|
+
name = Debug;
|
|
177
|
+
};
|
|
178
|
+
58B511EE1A9E6C8500147676 /* Release */ = {
|
|
179
|
+
isa = XCBuildConfiguration;
|
|
180
|
+
buildSettings = {
|
|
181
|
+
ALWAYS_SEARCH_USER_PATHS = NO;
|
|
182
|
+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
|
183
|
+
CLANG_CXX_LIBRARY = "libc++";
|
|
184
|
+
CLANG_ENABLE_MODULES = YES;
|
|
185
|
+
CLANG_ENABLE_OBJC_ARC = YES;
|
|
186
|
+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
|
187
|
+
CLANG_WARN_BOOL_CONVERSION = YES;
|
|
188
|
+
CLANG_WARN_COMMA = YES;
|
|
189
|
+
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
|
190
|
+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
|
191
|
+
CLANG_WARN_EMPTY_BODY = YES;
|
|
192
|
+
CLANG_WARN_ENUM_CONVERSION = YES;
|
|
193
|
+
CLANG_WARN_INFINITE_RECURSION = YES;
|
|
194
|
+
CLANG_WARN_INT_CONVERSION = YES;
|
|
195
|
+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
|
196
|
+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
|
197
|
+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
|
198
|
+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
|
199
|
+
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
|
200
|
+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
|
201
|
+
CLANG_WARN_UNREACHABLE_CODE = YES;
|
|
202
|
+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
|
203
|
+
COPY_PHASE_STRIP = YES;
|
|
204
|
+
ENABLE_NS_ASSERTIONS = NO;
|
|
205
|
+
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
206
|
+
"EXCLUDED_ARCHS[sdk=*]" = arm64;
|
|
207
|
+
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
208
|
+
GCC_NO_COMMON_BLOCKS = YES;
|
|
209
|
+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
210
|
+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
|
211
|
+
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
|
212
|
+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
|
213
|
+
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
214
|
+
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
215
|
+
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
|
216
|
+
MTL_ENABLE_DEBUG_INFO = NO;
|
|
217
|
+
SDKROOT = iphoneos;
|
|
218
|
+
VALIDATE_PRODUCT = YES;
|
|
219
|
+
};
|
|
220
|
+
name = Release;
|
|
221
|
+
};
|
|
222
|
+
58B511F01A9E6C8500147676 /* Debug */ = {
|
|
223
|
+
isa = XCBuildConfiguration;
|
|
224
|
+
buildSettings = {
|
|
225
|
+
HEADER_SEARCH_PATHS = (
|
|
226
|
+
"$(inherited)",
|
|
227
|
+
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
|
228
|
+
"$(SRCROOT)/../../../React/**",
|
|
229
|
+
"$(SRCROOT)/../../react-native/React/**",
|
|
230
|
+
);
|
|
231
|
+
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
|
232
|
+
OTHER_LDFLAGS = "-ObjC";
|
|
233
|
+
PRODUCT_NAME = VitalDevicesReactNative;
|
|
234
|
+
SKIP_INSTALL = YES;
|
|
235
|
+
SWIFT_OBJC_BRIDGING_HEADER = "VitalDevicesReactNative-Bridging-Header.h";
|
|
236
|
+
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
|
237
|
+
SWIFT_VERSION = 5.0;
|
|
238
|
+
};
|
|
239
|
+
name = Debug;
|
|
240
|
+
};
|
|
241
|
+
58B511F11A9E6C8500147676 /* Release */ = {
|
|
242
|
+
isa = XCBuildConfiguration;
|
|
243
|
+
buildSettings = {
|
|
244
|
+
HEADER_SEARCH_PATHS = (
|
|
245
|
+
"$(inherited)",
|
|
246
|
+
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
|
247
|
+
"$(SRCROOT)/../../../React/**",
|
|
248
|
+
"$(SRCROOT)/../../react-native/React/**",
|
|
249
|
+
);
|
|
250
|
+
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
|
251
|
+
OTHER_LDFLAGS = "-ObjC";
|
|
252
|
+
PRODUCT_NAME = VitalDevicesReactNative;
|
|
253
|
+
SKIP_INSTALL = YES;
|
|
254
|
+
SWIFT_OBJC_BRIDGING_HEADER = "VitalDevicesReactNative-Bridging-Header.h";
|
|
255
|
+
SWIFT_VERSION = 5.0;
|
|
256
|
+
};
|
|
257
|
+
name = Release;
|
|
258
|
+
};
|
|
259
|
+
/* End XCBuildConfiguration section */
|
|
260
|
+
|
|
261
|
+
/* Begin XCConfigurationList section */
|
|
262
|
+
58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "VitalDevicesReactNative" */ = {
|
|
263
|
+
isa = XCConfigurationList;
|
|
264
|
+
buildConfigurations = (
|
|
265
|
+
58B511ED1A9E6C8500147676 /* Debug */,
|
|
266
|
+
58B511EE1A9E6C8500147676 /* Release */,
|
|
267
|
+
);
|
|
268
|
+
defaultConfigurationIsVisible = 0;
|
|
269
|
+
defaultConfigurationName = Release;
|
|
270
|
+
};
|
|
271
|
+
58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "VitalDevicesReactNative" */ = {
|
|
272
|
+
isa = XCConfigurationList;
|
|
273
|
+
buildConfigurations = (
|
|
274
|
+
58B511F01A9E6C8500147676 /* Debug */,
|
|
275
|
+
58B511F11A9E6C8500147676 /* Release */,
|
|
276
|
+
);
|
|
277
|
+
defaultConfigurationIsVisible = 0;
|
|
278
|
+
defaultConfigurationName = Release;
|
|
279
|
+
};
|
|
280
|
+
/* End XCConfigurationList section */
|
|
281
|
+
};
|
|
282
|
+
rootObject = 58B511D31A9E6C8500147676 /* Project object */;
|
|
283
|
+
}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { DeviceModel } from './model/device_model';
|
|
2
|
+
import { Brand } from './model/brand';
|
|
3
|
+
import { DeviceKind } from './model/device_model';
|
|
4
|
+
export declare const VitalDevicesNativeModule: any;
|
|
5
|
+
export declare const VitalDevicesEvents: {
|
|
6
|
+
scanEvent: any;
|
|
7
|
+
pairEvent: any;
|
|
8
|
+
glucoseMeterReadEvent: any;
|
|
9
|
+
bloodPressureReadEvent: any;
|
|
10
|
+
};
|
|
11
|
+
export declare class VitalDevicesManager {
|
|
12
|
+
scanForDevice(deviceModel: DeviceModel): Promise<any>;
|
|
13
|
+
stopScan(): Promise<any>;
|
|
14
|
+
pairDevice(scannedDeviceId: string): Promise<any>;
|
|
15
|
+
readBloodPressure(scannedDeviceId: string): Promise<any>;
|
|
16
|
+
readGlucoseMeter(scannedDeviceId: string): Promise<any>;
|
|
17
|
+
private checkPermission;
|
|
18
|
+
static brands: Brand[];
|
|
19
|
+
static supportedDevices: {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
brand: Brand;
|
|
23
|
+
kind: DeviceKind;
|
|
24
|
+
}[];
|
|
25
|
+
}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { NativeModules, Platform } from 'react-native';
|
|
2
|
+
import { checkMultiple, PERMISSIONS } from 'react-native-permissions';
|
|
3
|
+
import { Brand } from './model/brand';
|
|
4
|
+
import { DeviceKind } from './model/device_model';
|
|
5
|
+
const LINKING_ERROR = `The package 'vital-core-react-native' doesn't seem to be linked. Make sure: \n\n` +
|
|
6
|
+
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
7
|
+
'- You rebuilt the app after installing the package\n' +
|
|
8
|
+
'- You are not using Expo Go\n';
|
|
9
|
+
const VitalDevicesReactNative = NativeModules.VitalDevicesReactNative
|
|
10
|
+
? NativeModules.VitalDevicesReactNative
|
|
11
|
+
: new Proxy({}, {
|
|
12
|
+
get() {
|
|
13
|
+
throw new Error(LINKING_ERROR);
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
export const VitalDevicesNativeModule = VitalDevicesReactNative;
|
|
17
|
+
export const VitalDevicesEvents = {
|
|
18
|
+
scanEvent: VitalDevicesNativeModule.ScanEvent,
|
|
19
|
+
pairEvent: VitalDevicesNativeModule.PairEvent,
|
|
20
|
+
glucoseMeterReadEvent: VitalDevicesNativeModule.GlucoseMeterReadEvent,
|
|
21
|
+
bloodPressureReadEvent: VitalDevicesNativeModule.BloodPressureReadEvent,
|
|
22
|
+
};
|
|
23
|
+
export class VitalDevicesManager {
|
|
24
|
+
async scanForDevice(deviceModel) {
|
|
25
|
+
await this.checkPermission();
|
|
26
|
+
return NativeModules.VitalDevicesReactNative.startScanForDevice(deviceModel.id, deviceModel.name, deviceModel.brand, deviceModel.kind);
|
|
27
|
+
}
|
|
28
|
+
async stopScan() {
|
|
29
|
+
return NativeModules.VitalDevicesReactNative.stopScanForDevice();
|
|
30
|
+
}
|
|
31
|
+
async pairDevice(scannedDeviceId) {
|
|
32
|
+
await this.checkPermission();
|
|
33
|
+
return NativeModules.VitalDevicesReactNative.pair(scannedDeviceId);
|
|
34
|
+
}
|
|
35
|
+
async readBloodPressure(scannedDeviceId) {
|
|
36
|
+
await this.checkPermission();
|
|
37
|
+
return NativeModules.VitalDevicesReactNative.startReadingBloodPressure(scannedDeviceId);
|
|
38
|
+
}
|
|
39
|
+
async readGlucoseMeter(scannedDeviceId) {
|
|
40
|
+
await this.checkPermission();
|
|
41
|
+
return NativeModules.VitalDevicesReactNative.startReadingGlucoseMeter(scannedDeviceId);
|
|
42
|
+
}
|
|
43
|
+
async checkPermission() {
|
|
44
|
+
const result = await checkMultiple([
|
|
45
|
+
PERMISSIONS.ANDROID.BLUETOOTH_SCAN,
|
|
46
|
+
PERMISSIONS.ANDROID.BLUETOOTH_CONNECT,
|
|
47
|
+
]);
|
|
48
|
+
if (result[PERMISSIONS.ANDROID.BLUETOOTH_SCAN] !== 'granted') {
|
|
49
|
+
throw new Error('Bluetooth scan permission is not granted');
|
|
50
|
+
}
|
|
51
|
+
if (result[PERMISSIONS.ANDROID.BLUETOOTH_CONNECT] !== 'granted') {
|
|
52
|
+
throw new Error('Bluetooth connect permission is not granted');
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
static brands = [
|
|
56
|
+
Brand.Omron,
|
|
57
|
+
Brand.AccuChek,
|
|
58
|
+
Brand.Contour,
|
|
59
|
+
Brand.Beurer,
|
|
60
|
+
Brand.Libre,
|
|
61
|
+
];
|
|
62
|
+
static supportedDevices = [
|
|
63
|
+
{
|
|
64
|
+
id: 'omron_m4',
|
|
65
|
+
name: 'Omron Intelli IT M4',
|
|
66
|
+
brand: Brand.Omron,
|
|
67
|
+
kind: DeviceKind.BloodPressure,
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
id: 'omron_m7',
|
|
71
|
+
name: 'Omron Intelli IT M7',
|
|
72
|
+
brand: Brand.Omron,
|
|
73
|
+
kind: DeviceKind.BloodPressure,
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
id: 'accuchek_guide',
|
|
77
|
+
name: 'Accu-Chek Guide',
|
|
78
|
+
brand: Brand.AccuChek,
|
|
79
|
+
kind: DeviceKind.GlucoseMeter,
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
id: 'accuchek_guide_me',
|
|
83
|
+
name: 'Accu-Chek Guide Me',
|
|
84
|
+
brand: Brand.AccuChek,
|
|
85
|
+
kind: DeviceKind.GlucoseMeter,
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
id: 'accuchek_guide_active',
|
|
89
|
+
name: 'Accu-Chek Active',
|
|
90
|
+
brand: Brand.AccuChek,
|
|
91
|
+
kind: DeviceKind.GlucoseMeter,
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
id: 'contour_next_one',
|
|
95
|
+
name: 'Contour Next One',
|
|
96
|
+
brand: Brand.Contour,
|
|
97
|
+
kind: DeviceKind.GlucoseMeter,
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
id: 'beurer',
|
|
101
|
+
name: 'Beurer Devices',
|
|
102
|
+
brand: Brand.Beurer,
|
|
103
|
+
kind: DeviceKind.BloodPressure,
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
id: 'libre1',
|
|
107
|
+
name: 'Freestyle Libre 1',
|
|
108
|
+
brand: Brand.Libre,
|
|
109
|
+
kind: DeviceKind.GlucoseMeter,
|
|
110
|
+
},
|
|
111
|
+
];
|
|
112
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tryvital/vital-devices-react-native",
|
|
3
|
+
"version": "0.2.5",
|
|
4
|
+
"description": "Client to access Vital's Endpoints",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"types": "lib/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"src",
|
|
9
|
+
"lib",
|
|
10
|
+
"android",
|
|
11
|
+
"ios",
|
|
12
|
+
"cpp",
|
|
13
|
+
"*.podspec",
|
|
14
|
+
"!lib/typescript/example",
|
|
15
|
+
"!ios/build",
|
|
16
|
+
"!android/build",
|
|
17
|
+
"!android/gradle",
|
|
18
|
+
"!android/gradlew",
|
|
19
|
+
"!android/gradlew.bat",
|
|
20
|
+
"!android/local.properties",
|
|
21
|
+
"!**/__tests__",
|
|
22
|
+
"!**/__fixtures__",
|
|
23
|
+
"!**/__mocks__",
|
|
24
|
+
"!**/.*"
|
|
25
|
+
],
|
|
26
|
+
"scripts": {
|
|
27
|
+
"np": "np --no-publish",
|
|
28
|
+
"postversion": "react-native-version",
|
|
29
|
+
"test": "jest",
|
|
30
|
+
"typescript": "tsc --declaration",
|
|
31
|
+
"postinstall": "npm run typescript",
|
|
32
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
33
|
+
"release": "release-it",
|
|
34
|
+
"example": "yarn --cwd example",
|
|
35
|
+
"bootstrap": "yarn example && yarn install && yarn example pods",
|
|
36
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build"
|
|
37
|
+
},
|
|
38
|
+
"keywords": [
|
|
39
|
+
"react-native",
|
|
40
|
+
"ios",
|
|
41
|
+
"android"
|
|
42
|
+
],
|
|
43
|
+
"repository": "https://github.com/tryVital/vital-devices-react-native",
|
|
44
|
+
"author": "Vital",
|
|
45
|
+
"bugs": {
|
|
46
|
+
"url": "https://github.com/tryVital/vital-devices-react-native/issues"
|
|
47
|
+
},
|
|
48
|
+
"homepage": "https://github.com/tryVital/vital-devices-react-native#readme",
|
|
49
|
+
"publishConfig": {
|
|
50
|
+
"registry": "https://registry.npmjs.org/"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"react-native-permissions": "^3.6.1"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@arkweid/lefthook": "^0.7.7",
|
|
57
|
+
"@commitlint/config-conventional": "^17.0.2",
|
|
58
|
+
"@react-native-community/eslint-config": "^3.0.2",
|
|
59
|
+
"@release-it/conventional-changelog": "^5.0.0",
|
|
60
|
+
"@types/jest": "^28.1.2",
|
|
61
|
+
"@types/react": "~17.0.21",
|
|
62
|
+
"@types/react-native": "0.70.0",
|
|
63
|
+
"commitlint": "^17.0.2",
|
|
64
|
+
"del-cli": "^5.0.0",
|
|
65
|
+
"eslint": "^8.4.1",
|
|
66
|
+
"eslint-config-prettier": "^8.5.0",
|
|
67
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
68
|
+
"jest": "^28.1.1",
|
|
69
|
+
"np": "^7.6.2",
|
|
70
|
+
"pod-install": "^0.1.0",
|
|
71
|
+
"prettier": "^2.0.5",
|
|
72
|
+
"react": "18.1.0",
|
|
73
|
+
"react-native": "0.70.6",
|
|
74
|
+
"react-native-builder-bob": "^0.20.1",
|
|
75
|
+
"react-native-version": "^4.0.0",
|
|
76
|
+
"release-it": "^15.0.0",
|
|
77
|
+
"typescript": "^4.5.2"
|
|
78
|
+
},
|
|
79
|
+
"resolutions": {
|
|
80
|
+
"@types/react": "17.0.21"
|
|
81
|
+
},
|
|
82
|
+
"engines": {
|
|
83
|
+
"node": ">= 16.0.0"
|
|
84
|
+
},
|
|
85
|
+
"packageManager": "^yarn@1.22.15",
|
|
86
|
+
"jest": {
|
|
87
|
+
"preset": "react-native",
|
|
88
|
+
"modulePathIgnorePatterns": [
|
|
89
|
+
"<rootDir>/example/node_modules",
|
|
90
|
+
"<rootDir>/lib/"
|
|
91
|
+
]
|
|
92
|
+
},
|
|
93
|
+
"commitlint": {
|
|
94
|
+
"extends": [
|
|
95
|
+
"@commitlint/config-conventional"
|
|
96
|
+
]
|
|
97
|
+
},
|
|
98
|
+
"release-it": {
|
|
99
|
+
"git": {
|
|
100
|
+
"commitMessage": "chore: release ${version}",
|
|
101
|
+
"tagName": "v${version}"
|
|
102
|
+
},
|
|
103
|
+
"npm": {
|
|
104
|
+
"publish": true
|
|
105
|
+
},
|
|
106
|
+
"github": {
|
|
107
|
+
"release": true
|
|
108
|
+
},
|
|
109
|
+
"plugins": {
|
|
110
|
+
"@release-it/conventional-changelog": {
|
|
111
|
+
"preset": "angular"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"eslintConfig": {
|
|
116
|
+
"root": true,
|
|
117
|
+
"extends": [
|
|
118
|
+
"@react-native-community",
|
|
119
|
+
"prettier"
|
|
120
|
+
],
|
|
121
|
+
"rules": {
|
|
122
|
+
"prettier/prettier": [
|
|
123
|
+
"error",
|
|
124
|
+
{
|
|
125
|
+
"quoteProps": "consistent",
|
|
126
|
+
"singleQuote": true,
|
|
127
|
+
"tabWidth": 2,
|
|
128
|
+
"trailingComma": "es5",
|
|
129
|
+
"useTabs": false
|
|
130
|
+
}
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
"eslintIgnore": [
|
|
135
|
+
"node_modules/",
|
|
136
|
+
"lib/"
|
|
137
|
+
],
|
|
138
|
+
"prettier": {
|
|
139
|
+
"quoteProps": "consistent",
|
|
140
|
+
"singleQuote": true,
|
|
141
|
+
"tabWidth": 2,
|
|
142
|
+
"trailingComma": "es5",
|
|
143
|
+
"useTabs": false
|
|
144
|
+
}
|
|
145
|
+
}
|