react-native-mytatva-rn-sdk 1.2.69 → 1.2.71
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/android/src/main/java/com/mytatvarnsdk/CgmTrackyLibModule.kt +62 -0
- package/ios/Database/KLTDatabaseHandler.m +46 -1
- package/ios/MyReactNativeBridge.m +77 -0
- package/lib/commonjs/CGMConnect.js +25 -1
- package/lib/commonjs/CGMConnect.js.map +1 -1
- package/lib/commonjs/index.js +8 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/CGMConnect.js +24 -1
- package/lib/module/CGMConnect.js.map +1 -1
- package/lib/module/index.js +4 -3
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/CGMConnect.d.ts +14 -1
- package/package.json +1 -1
- package/src/CGMConnect.ts +24 -0
- package/src/index.js +5 -3
|
@@ -4,6 +4,7 @@ import android.app.Application
|
|
|
4
4
|
import android.bluetooth.BluetoothAdapter
|
|
5
5
|
import android.content.Intent
|
|
6
6
|
import android.content.Context
|
|
7
|
+
import android.os.Environment
|
|
7
8
|
import android.os.Handler
|
|
8
9
|
import android.os.Looper
|
|
9
10
|
import android.util.Log
|
|
@@ -837,6 +838,67 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
837
838
|
}
|
|
838
839
|
}
|
|
839
840
|
|
|
841
|
+
/**
|
|
842
|
+
* Get all CGM log file paths
|
|
843
|
+
* Returns array of absolute file paths to CGM log files (CSV format)
|
|
844
|
+
*/
|
|
845
|
+
@ReactMethod
|
|
846
|
+
fun getCgmLogFiles(promise: Promise) {
|
|
847
|
+
try {
|
|
848
|
+
val context = reactApplicationContext
|
|
849
|
+
val logFiles = mutableListOf<String>()
|
|
850
|
+
|
|
851
|
+
// Get the primary log folder path
|
|
852
|
+
val externalFilesDir = context.getExternalFilesDir(android.os.Environment.DIRECTORY_DOCUMENTS)
|
|
853
|
+
val primaryFolder = externalFilesDir?.absolutePath
|
|
854
|
+
|
|
855
|
+
// Get the fallback log folder path
|
|
856
|
+
val fallbackFolder = android.os.Environment.getExternalStorageDirectory().absolutePath +
|
|
857
|
+
File.separatorChar + "PocData" + File.separatorChar + "logger"
|
|
858
|
+
|
|
859
|
+
// Check primary folder
|
|
860
|
+
if (primaryFolder != null) {
|
|
861
|
+
val primaryDir = File(primaryFolder)
|
|
862
|
+
if (primaryDir.exists() && primaryDir.isDirectory) {
|
|
863
|
+
val files = primaryDir.listFiles { file ->
|
|
864
|
+
file.isFile && file.name.endsWith(".csv")
|
|
865
|
+
}
|
|
866
|
+
files?.forEach { file ->
|
|
867
|
+
logFiles.add(file.absolutePath)
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
// Check fallback folder
|
|
873
|
+
val fallbackDir = File(fallbackFolder)
|
|
874
|
+
if (fallbackDir.exists() && fallbackDir.isDirectory) {
|
|
875
|
+
val files = fallbackDir.listFiles { file ->
|
|
876
|
+
file.isFile && file.name.endsWith(".csv")
|
|
877
|
+
}
|
|
878
|
+
files?.forEach { file ->
|
|
879
|
+
// Only add if not already in list
|
|
880
|
+
if (!logFiles.contains(file.absolutePath)) {
|
|
881
|
+
logFiles.add(file.absolutePath)
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
Log.d("getCgmLogFiles", "Found ${logFiles.size} log files")
|
|
887
|
+
|
|
888
|
+
// Convert list to WritableArray
|
|
889
|
+
val resultArray = Arguments.createArray()
|
|
890
|
+
logFiles.forEach { path ->
|
|
891
|
+
resultArray.pushString(path)
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
promise.resolve(resultArray)
|
|
895
|
+
|
|
896
|
+
} catch (e: Exception) {
|
|
897
|
+
Log.e("getCgmLogFiles", "Error getting log files: ${e.message}")
|
|
898
|
+
promise.reject("ERROR_GET_LOG_FILES", e.message, e)
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
|
|
840
902
|
// Updated batch processing method with better sync control
|
|
841
903
|
private suspend fun processBatchDataSynchronously(
|
|
842
904
|
dataList: List<PocGlucose>,
|
|
@@ -159,6 +159,29 @@
|
|
|
159
159
|
|
|
160
160
|
KLTLog(@"ERROR_CODE_ALGORITHM_DATA:dataId=%@, operatingCurrent=%@, blankCurrent=%@, temperature=%@, algo_k=%@, algo_r=%@, day=%@, hour=%@, minute=%@, localName=%@, newBgValue=%@, algorithm=%@", @(d.glucoseId), @(d.Iw), @(d.Ib), @(d.T), @(d.K0), @(d.R), @(d.day), @(d.hour), @(d.minute), d.name, @(d.newBgValue), @(d.algorithm));
|
|
161
161
|
currentGlucose = [AlgorithmTools algorithmLatestGlucose:d];
|
|
162
|
+
NSString *logString = [NSString stringWithFormat:@"glucoseId=%@, Iw=%@, Ib=%@, T=%@,dayCount=%@, hour=%@, minute=%@, milles=%@, GluMG=%@,BGCount=%@, BGICount=%@, errorCode=%@ trend=%@ calibrationStatus=%@, countdownDays=%@, countdownHours=%@, countdownMinutes=%@ ",
|
|
163
|
+
@(d.glucoseId),
|
|
164
|
+
@(d.Iw),
|
|
165
|
+
@(d.Ib),
|
|
166
|
+
@(d.T),
|
|
167
|
+
@(d.day),
|
|
168
|
+
@(d.hour),
|
|
169
|
+
@(d.minute),
|
|
170
|
+
@(d.timeMillis),
|
|
171
|
+
@(currentGlucose.GluMG),
|
|
172
|
+
@(currentGlucose.BGCount),
|
|
173
|
+
@(currentGlucose.BGICount),
|
|
174
|
+
@(currentGlucose.errorCode),
|
|
175
|
+
@(currentGlucose.trend),
|
|
176
|
+
@(currentGlucose.BGMG),
|
|
177
|
+
@(currentGlucose.countdownDays),
|
|
178
|
+
@(currentGlucose.countdownHours),
|
|
179
|
+
@(currentGlucose.countdownHours)
|
|
180
|
+
|
|
181
|
+
];
|
|
182
|
+
KLTRunLog *runLog = [KLTAppDelegate getCurrentKLTRunLog];
|
|
183
|
+
[runLog useCurrentCSV:localName];
|
|
184
|
+
KLTRunWarn(logString);
|
|
162
185
|
}
|
|
163
186
|
|
|
164
187
|
glucose.errorCode = @(currentGlucose.errorCode);
|
|
@@ -192,7 +215,29 @@
|
|
|
192
215
|
|
|
193
216
|
// [Notification_Center postNotificationName:@"ErrorStatusFromTransmitter" object: glucose];
|
|
194
217
|
[Notification_Center postNotificationName:@"CheckErrorStatusFromLastBatchData" object: glucose];
|
|
195
|
-
|
|
218
|
+
NSString *logString = [NSString stringWithFormat:@"glucoseId=%@, Iw=%@, Ib=%@, T=%@,dayCount=%@, hour=%@, minute=%@, milles=%@, GluMG=%@,BGCount=%@, BGICount=%@, errorCode=%@ trend=%@ calibrationStatus=%@, countdownDays=%@, countdownHours=%@, countdownMinutes=%@ ",
|
|
219
|
+
@(d.glucoseId),
|
|
220
|
+
@(d.Iw),
|
|
221
|
+
@(d.Ib),
|
|
222
|
+
@(d.T),
|
|
223
|
+
@(d.day),
|
|
224
|
+
@(d.hour),
|
|
225
|
+
@(d.minute),
|
|
226
|
+
@(d.timeMillis),
|
|
227
|
+
@(currentGlucose.GluMG),
|
|
228
|
+
@(currentGlucose.BGCount),
|
|
229
|
+
@(currentGlucose.BGICount),
|
|
230
|
+
@(currentGlucose.errorCode),
|
|
231
|
+
@(currentGlucose.trend),
|
|
232
|
+
@(currentGlucose.BGMG),
|
|
233
|
+
@(currentGlucose.countdownDays),
|
|
234
|
+
@(currentGlucose.countdownHours),
|
|
235
|
+
@(currentGlucose.countdownHours)
|
|
236
|
+
|
|
237
|
+
];
|
|
238
|
+
KLTRunLog *runLog = [KLTAppDelegate getCurrentKLTRunLog];
|
|
239
|
+
[runLog useCurrentCSV:localName];
|
|
240
|
+
KLTRunWarn(logString);
|
|
196
241
|
[self.appDelegate saveContext];
|
|
197
242
|
return glucose;
|
|
198
243
|
}
|
|
@@ -204,6 +204,8 @@
|
|
|
204
204
|
#import <React/RCTEventEmitter.h>
|
|
205
205
|
#import "react_native_mytatva_rn_sdk-Swift.h"
|
|
206
206
|
#import "KLTDatabaseHandler.h"
|
|
207
|
+
#import "KLTRunLog.h"
|
|
208
|
+
#import "KLTAppDelegate.h"
|
|
207
209
|
|
|
208
210
|
@implementation MyEventEmitterManager
|
|
209
211
|
|
|
@@ -604,4 +606,79 @@ RCT_EXPORT_METHOD(observeTransmitterUnbindStatus:(NSString *)token
|
|
|
604
606
|
}];
|
|
605
607
|
}
|
|
606
608
|
|
|
609
|
+
/**
|
|
610
|
+
* Get all CGM log file paths
|
|
611
|
+
* Returns array of absolute file paths to CGM log files (CSV format)
|
|
612
|
+
*/
|
|
613
|
+
RCT_REMAP_METHOD(getCgmLogFiles,
|
|
614
|
+
getCgmLogFilesWithResolver:(RCTPromiseResolveBlock)resolve
|
|
615
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
616
|
+
{
|
|
617
|
+
@try {
|
|
618
|
+
NSMutableArray *logFilePaths = [NSMutableArray array];
|
|
619
|
+
|
|
620
|
+
// Use the same base path strategy as getTrackLibDbPath
|
|
621
|
+
NSArray<NSURL *> *urls = [[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask];
|
|
622
|
+
NSURL *documentsURL = [urls lastObject];
|
|
623
|
+
if (documentsURL.path.length == 0) {
|
|
624
|
+
NSError *error = [NSError errorWithDomain:@"CgmTrackyLib" code:1002 userInfo:@{NSLocalizedDescriptionKey: @"Could not access Documents directory"}];
|
|
625
|
+
reject(@"ERROR_DOCUMENTS_DIR", @"Failed to get documents directory", error);
|
|
626
|
+
return;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
NSLog(@"CGM Documents path: %@", documentsURL.path);
|
|
630
|
+
|
|
631
|
+
// Ensure runLog directory exists (SDK may not create it before first write)
|
|
632
|
+
NSURL *logFolderURL = [documentsURL URLByAppendingPathComponent:@"runLog" isDirectory:YES];
|
|
633
|
+
NSFileManager *fm = [NSFileManager defaultManager];
|
|
634
|
+
BOOL isDir = NO;
|
|
635
|
+
if (![fm fileExistsAtPath:logFolderURL.path isDirectory:&isDir]) {
|
|
636
|
+
NSError *mkErr = nil;
|
|
637
|
+
[fm createDirectoryAtURL:logFolderURL withIntermediateDirectories:YES attributes:nil error:&mkErr];
|
|
638
|
+
if (mkErr) {
|
|
639
|
+
NSLog(@"CGM could not create runLog dir: %@", mkErr.localizedDescription);
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
NSLog(@"CGM runLog path: %@", logFolderURL.path);
|
|
644
|
+
|
|
645
|
+
// Use exactly what the SDK uses first: current runlog absolute path
|
|
646
|
+
KLTRunLog *current = [KLTAppDelegate getCurrentKLTRunLog];
|
|
647
|
+
NSString *currentPath = current.path; // absolute path the SDK writes to
|
|
648
|
+
NSLog(@"CGM current runlog path: %@", currentPath);
|
|
649
|
+
if (currentPath.length > 0) {
|
|
650
|
+
BOOL isDir3 = NO;
|
|
651
|
+
if ([fm fileExistsAtPath:currentPath isDirectory:&isDir3] && !isDir3) {
|
|
652
|
+
[logFilePaths addObject:currentPath];
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
// If current file isn’t there yet, list the runLog dir contents
|
|
657
|
+
if (logFilePaths.count == 0) {
|
|
658
|
+
NSError *dirErr = nil;
|
|
659
|
+
NSArray<NSString *> *runLogList = [fm contentsOfDirectoryAtPath:logFolderURL.path error:&dirErr];
|
|
660
|
+
if (dirErr) {
|
|
661
|
+
NSLog(@"CGM failed reading runLog dir: %@", dirErr.localizedDescription);
|
|
662
|
+
} else {
|
|
663
|
+
for (NSString *name in runLogList) {
|
|
664
|
+
NSString *fullPath = [logFolderURL.path stringByAppendingPathComponent:name];
|
|
665
|
+
BOOL isDirLocal = NO;
|
|
666
|
+
if ([fm fileExistsAtPath:fullPath isDirectory:&isDirLocal] && !isDirLocal) {
|
|
667
|
+
[logFilePaths addObject:fullPath];
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
NSLog(@"CGM runLog resolved %lu file(s)", (unsigned long)logFilePaths.count);
|
|
674
|
+
resolve(logFilePaths);
|
|
675
|
+
|
|
676
|
+
} @catch (NSException *exception) {
|
|
677
|
+
NSError *error = [NSError errorWithDomain:@"CgmTrackyLib"
|
|
678
|
+
code:1003
|
|
679
|
+
userInfo:@{NSLocalizedDescriptionKey: exception.reason ?: @"Unknown error"}];
|
|
680
|
+
reject(@"ERROR_GET_LOG_FILES", exception.reason, error);
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
|
|
607
684
|
@end
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.helpCGM = exports.getSqliteDBPath = void 0;
|
|
6
|
+
exports.helpCGM = exports.getSqliteDBPath = exports.getCgmLogFilePaths = void 0;
|
|
7
7
|
exports.initializeCGMEventListener = initializeCGMEventListener;
|
|
8
8
|
exports.reconnectCGM = exports.observeTransmitterUnbindStatusHandler = exports.observeResetLogoutHandler = exports.observeAllGlucoseDataHandler = void 0;
|
|
9
9
|
exports.removeCGMEventListener = removeCGMEventListener;
|
|
@@ -130,5 +130,29 @@ exports.getSqliteDBPath = getSqliteDBPath;
|
|
|
130
130
|
const stopCGM = async () => {
|
|
131
131
|
// Implementation
|
|
132
132
|
};
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Get all CGM log file paths
|
|
136
|
+
* Returns array of absolute file paths to CGM log files (CSV format)
|
|
137
|
+
* Use react-native-fs or similar in your main app to read these files
|
|
138
|
+
*
|
|
139
|
+
* @returns Promise<string[]> - Array of absolute file paths
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* const logPaths = await getCgmLogFilePaths();
|
|
143
|
+
* // Android: ['/storage/emulated/0/Android/data/.../Documents/12345_POCTech.csv']
|
|
144
|
+
* // iOS: ['/var/mobile/Containers/Data/Application/.../Documents/runLog/1_SensorID.csv']
|
|
145
|
+
*/
|
|
133
146
|
exports.stopCGM = stopCGM;
|
|
147
|
+
const getCgmLogFilePaths = async () => {
|
|
148
|
+
try {
|
|
149
|
+
const result = await cgmLib.getCgmLogFiles();
|
|
150
|
+
console.log(`CGM Log Files: ${result.length} files found`);
|
|
151
|
+
return result;
|
|
152
|
+
} catch (error) {
|
|
153
|
+
console.error('Error getting CGM log file paths:', error);
|
|
154
|
+
throw error;
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
exports.getCgmLogFilePaths = getCgmLogFilePaths;
|
|
134
158
|
//# sourceMappingURL=CGMConnect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","eventSubscription","LINKING_ERROR","Platform","select","ios","default","cgmLib","NativeModules","CgmTrackyLib","Proxy","get","Error","initializeCGMEventListener","callback","iosEventEmitter","NativeEventEmitter","remove","OS","DeviceEventEmitter","addListener","eventData","status","removeCGMEventListener","startCGM","token","envType","console","log","result","startCgmTracky","error","exports","reconnectCGM","reconnectCgmTracky","observeAllGlucoseDataHandler","isCleanData","observeAllGlucoseData","deviceStatus","observeDeviceStatus","helpCGM","openHelpSupport","observeTransmitterUnbindStatusHandler","apiResponse","patientId","observeTransmitterUnbindStatus","observeResetLogoutHandler","resetCgmState","getSqliteDBPath","getTrackLibDbPath","stopCGM"],"sources":["CGMConnect.ts"],"sourcesContent":["import {\n DeviceEventEmitter,\n EmitterSubscription,\n NativeEventEmitter,\n NativeModules,\n Platform,\n} from 'react-native';\n\nlet eventSubscription: EmitterSubscription | null = null;\n\nconst LINKING_ERROR =\n `The package 'react-native-mytatva-rn-sdk' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo Go\\n';\n\nconst cgmLib = NativeModules.CgmTrackyLib\n ? NativeModules.CgmTrackyLib\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nfunction initializeCGMEventListener(callback: (eventData: any) => void) {\n const iosEventEmitter = new NativeEventEmitter(cgmLib);\n if (eventSubscription) {\n eventSubscription.remove();\n }\n\n if (Platform.OS === 'android') {\n eventSubscription = DeviceEventEmitter.addListener(\n 'cgmDeviceEvent',\n (eventData: any) => {\n const { status } = eventData;\n if (status === 'WARM_PERIOD_STARTED') {\n callback(eventData);\n } else {\n callback(eventData);\n }\n }\n );\n } else if (Platform.OS === 'ios' && iosEventEmitter) {\n eventSubscription = iosEventEmitter.addListener(\n 'cgmDeviceEvent',\n (eventData: any) => {\n const { status } = eventData;\n if (status === 'WARM_PERIOD_STARTED') {\n callback(eventData);\n } else {\n callback(eventData);\n }\n }\n );\n }\n}\n\nfunction removeCGMEventListener() {\n if (eventSubscription) {\n eventSubscription.remove();\n eventSubscription = null;\n }\n}\n\nconst startCGM = async (token: string, envType: string) => {\n console.log('startCGM===');\n try {\n const result = await cgmLib.startCgmTracky(token, envType);\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst reconnectCGM = async (token: string, envType: string) => {\n console.log('reconnectCGM====');\n try {\n const result = await cgmLib.reconnectCgmTracky(token, envType);\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst observeAllGlucoseDataHandler = async (\n token: string,\n isCleanData: boolean,\n envType: string\n) => {\n console.log('observeAllGlucoseDataHandler====');\n try {\n if (Platform.OS === 'android') {\n const result = await cgmLib.observeAllGlucoseData(\n token,\n isCleanData,\n envType\n );\n const deviceStatus = await cgmLib.observeDeviceStatus(token, envType);\n console.log(result);\n console.log(deviceStatus);\n } else if (Platform.OS === 'ios') {\n const result = await cgmLib.observeAllGlucoseData(\n token,\n isCleanData,\n envType\n );\n console.log(result);\n }\n } catch (error) {\n console.log('error====', error);\n console.error(error);\n }\n};\n\nconst helpCGM = async (token: string, envType: string) => {\n console.log('helpCGM====');\n try {\n const result = await cgmLib.openHelpSupport();\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst observeTransmitterUnbindStatusHandler = async (\n token: string,\n apiResponse: string,\n patientId: string,\n envType: string\n) => {\n console.log('observeTransmitterUnbindStatusHandler====');\n try {\n const result = await cgmLib.observeTransmitterUnbindStatus(\n token,\n apiResponse,\n patientId,\n envType\n );\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst observeResetLogoutHandler = async () => {\n console.log('observeResetLogoutHandler====');\n try {\n const result = await cgmLib.resetCgmState();\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst getSqliteDBPath = async (): Promise<string> => {\n const result = await cgmLib.getTrackLibDbPath();\n return result;\n};\n\nconst stopCGM = async () => {\n // Implementation\n};\n\nexport {\n startCGM,\n stopCGM,\n initializeCGMEventListener,\n removeCGMEventListener,\n observeAllGlucoseDataHandler,\n reconnectCGM,\n helpCGM,\n observeTransmitterUnbindStatusHandler,\n observeResetLogoutHandler,\n getSqliteDBPath,\n};\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAQA,IAAIC,iBAA6C,GAAG,IAAI;AAExD,MAAMC,aAAa,GACjB,sFAAsF,GACtFC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,MAAM,GAAGC,0BAAa,CAACC,YAAY,GACrCD,0BAAa,CAACC,YAAY,GAC1B,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACV,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEL,SAASW,0BAA0BA,CAACC,QAAkC,EAAE;EACtE,MAAMC,eAAe,GAAG,IAAIC,+BAAkB,CAACT,MAAM,CAAC;EACtD,IAAIN,iBAAiB,EAAE;IACrBA,iBAAiB,CAACgB,MAAM,CAAC,CAAC;EAC5B;EAEA,IAAId,qBAAQ,CAACe,EAAE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C0C,iBAAiB,CAAC,CAAC;EAC/C,OAAOpB,MAAM;AACf,CAAC;AAACG,OAAA,CAAAgB,eAAA,GAAAA,eAAA;AAEF,MAAME,OAAO,GAAG,MAAAA,CAAA,KAAY;EAC1B;AAAA,CACD;AAAClB,OAAA,CAAAkB,OAAA,GAAAA,OAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_reactNative","require","eventSubscription","LINKING_ERROR","Platform","select","ios","default","cgmLib","NativeModules","CgmTrackyLib","Proxy","get","Error","initializeCGMEventListener","callback","iosEventEmitter","NativeEventEmitter","remove","OS","DeviceEventEmitter","addListener","eventData","status","removeCGMEventListener","startCGM","token","envType","console","log","result","startCgmTracky","error","exports","reconnectCGM","reconnectCgmTracky","observeAllGlucoseDataHandler","isCleanData","observeAllGlucoseData","deviceStatus","observeDeviceStatus","helpCGM","openHelpSupport","observeTransmitterUnbindStatusHandler","apiResponse","patientId","observeTransmitterUnbindStatus","observeResetLogoutHandler","resetCgmState","getSqliteDBPath","getTrackLibDbPath","stopCGM","getCgmLogFilePaths","getCgmLogFiles","length"],"sources":["CGMConnect.ts"],"sourcesContent":["import {\n DeviceEventEmitter,\n EmitterSubscription,\n NativeEventEmitter,\n NativeModules,\n Platform,\n} from 'react-native';\n\nlet eventSubscription: EmitterSubscription | null = null;\n\nconst LINKING_ERROR =\n `The package 'react-native-mytatva-rn-sdk' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo Go\\n';\n\nconst cgmLib = NativeModules.CgmTrackyLib\n ? NativeModules.CgmTrackyLib\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nfunction initializeCGMEventListener(callback: (eventData: any) => void) {\n const iosEventEmitter = new NativeEventEmitter(cgmLib);\n if (eventSubscription) {\n eventSubscription.remove();\n }\n\n if (Platform.OS === 'android') {\n eventSubscription = DeviceEventEmitter.addListener(\n 'cgmDeviceEvent',\n (eventData: any) => {\n const { status } = eventData;\n if (status === 'WARM_PERIOD_STARTED') {\n callback(eventData);\n } else {\n callback(eventData);\n }\n }\n );\n } else if (Platform.OS === 'ios' && iosEventEmitter) {\n eventSubscription = iosEventEmitter.addListener(\n 'cgmDeviceEvent',\n (eventData: any) => {\n const { status } = eventData;\n if (status === 'WARM_PERIOD_STARTED') {\n callback(eventData);\n } else {\n callback(eventData);\n }\n }\n );\n }\n}\n\nfunction removeCGMEventListener() {\n if (eventSubscription) {\n eventSubscription.remove();\n eventSubscription = null;\n }\n}\n\nconst startCGM = async (token: string, envType: string) => {\n console.log('startCGM===');\n try {\n const result = await cgmLib.startCgmTracky(token, envType);\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst reconnectCGM = async (token: string, envType: string) => {\n console.log('reconnectCGM====');\n try {\n const result = await cgmLib.reconnectCgmTracky(token, envType);\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst observeAllGlucoseDataHandler = async (\n token: string,\n isCleanData: boolean,\n envType: string\n) => {\n console.log('observeAllGlucoseDataHandler====');\n try {\n if (Platform.OS === 'android') {\n const result = await cgmLib.observeAllGlucoseData(\n token,\n isCleanData,\n envType\n );\n const deviceStatus = await cgmLib.observeDeviceStatus(token, envType);\n console.log(result);\n console.log(deviceStatus);\n } else if (Platform.OS === 'ios') {\n const result = await cgmLib.observeAllGlucoseData(\n token,\n isCleanData,\n envType\n );\n console.log(result);\n }\n } catch (error) {\n console.log('error====', error);\n console.error(error);\n }\n};\n\nconst helpCGM = async (token: string, envType: string) => {\n console.log('helpCGM====');\n try {\n const result = await cgmLib.openHelpSupport();\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst observeTransmitterUnbindStatusHandler = async (\n token: string,\n apiResponse: string,\n patientId: string,\n envType: string\n) => {\n console.log('observeTransmitterUnbindStatusHandler====');\n try {\n const result = await cgmLib.observeTransmitterUnbindStatus(\n token,\n apiResponse,\n patientId,\n envType\n );\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst observeResetLogoutHandler = async () => {\n console.log('observeResetLogoutHandler====');\n try {\n const result = await cgmLib.resetCgmState();\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst getSqliteDBPath = async (): Promise<string> => {\n const result = await cgmLib.getTrackLibDbPath();\n return result;\n};\n\nconst stopCGM = async () => {\n // Implementation\n};\n\n/**\n * Get all CGM log file paths\n * Returns array of absolute file paths to CGM log files (CSV format)\n * Use react-native-fs or similar in your main app to read these files\n *\n * @returns Promise<string[]> - Array of absolute file paths\n *\n * @example\n * const logPaths = await getCgmLogFilePaths();\n * // Android: ['/storage/emulated/0/Android/data/.../Documents/12345_POCTech.csv']\n * // iOS: ['/var/mobile/Containers/Data/Application/.../Documents/runLog/1_SensorID.csv']\n */\nconst getCgmLogFilePaths = async (): Promise<string[]> => {\n try {\n const result = await cgmLib.getCgmLogFiles();\n console.log(`CGM Log Files: ${result.length} files found`);\n return result;\n } catch (error) {\n console.error('Error getting CGM log file paths:', error);\n throw error;\n }\n};\n\nexport {\n startCGM,\n stopCGM,\n initializeCGMEventListener,\n removeCGMEventListener,\n observeAllGlucoseDataHandler,\n reconnectCGM,\n helpCGM,\n observeTransmitterUnbindStatusHandler,\n observeResetLogoutHandler,\n getSqliteDBPath,\n getCgmLogFilePaths,\n};\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAQA,IAAIC,iBAA6C,GAAG,IAAI;AAExD,MAAMC,aAAa,GACjB,sFAAsF,GACtFC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,MAAM,GAAGC,0BAAa,CAACC,YAAY,GACrCD,0BAAa,CAACC,YAAY,GAC1B,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC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,aAAa,CAAC,CAAC;IAC3CpB,OAAO,CAACC,GAAG,CAACC,MAAM,CAAC;EACrB,CAAC,CAAC,OAAOE,KAAK,EAAE;IACdJ,OAAO,CAACI,KAAK,CAACA,KAAK,CAAC;EACtB;AACF,CAAC;AAACC,OAAA,CAAAc,yBAAA,GAAAA,yBAAA;AAEF,MAAME,eAAe,GAAG,MAAAA,CAAA,KAA6B;EACnD,MAAMnB,MAAM,GAAG,MAAMtB,MAAM,CAAC0C,iBAAiB,CAAC,CAAC;EAC/C,OAAOpB,MAAM;AACf,CAAC;AAACG,OAAA,CAAAgB,eAAA,GAAAA,eAAA;AAEF,MAAME,OAAO,GAAG,MAAAA,CAAA,KAAY;EAC1B;AAAA,CACD;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXAlB,OAAA,CAAAkB,OAAA,GAAAA,OAAA;AAYA,MAAMC,kBAAkB,GAAG,MAAAA,CAAA,KAA+B;EACxD,IAAI;IACF,MAAMtB,MAAM,GAAG,MAAMtB,MAAM,CAAC6C,cAAc,CAAC,CAAC;IAC5CzB,OAAO,CAACC,GAAG,CAAC,kBAAkBC,MAAM,CAACwB,MAAM,cAAc,CAAC;IAC1D,OAAOxB,MAAM;EACf,CAAC,CAAC,OAAOE,KAAK,EAAE;IACdJ,OAAO,CAACI,KAAK,CAAC,mCAAmC,EAAEA,KAAK,CAAC;IACzD,MAAMA,KAAK;EACb;AACF,CAAC;AAACC,OAAA,CAAAmB,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -4,6 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.MyTatvaRnSdkView = void 0;
|
|
7
|
+
Object.defineProperty(exports, "getCgmLogFilePaths", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _CGMConnect.getCgmLogFilePaths;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
7
13
|
Object.defineProperty(exports, "getSqliteDBPath", {
|
|
8
14
|
enumerable: true,
|
|
9
15
|
get: function () {
|
|
@@ -83,6 +89,7 @@ var _default = exports.default = {
|
|
|
83
89
|
helpCGM: _CGMConnect.helpCGM,
|
|
84
90
|
observeTransmitterUnbindStatusHandler: _CGMConnect.observeTransmitterUnbindStatusHandler,
|
|
85
91
|
observeResetLogoutHandler: _CGMConnect.observeResetLogoutHandler,
|
|
86
|
-
getSqliteDBPath: _CGMConnect.getSqliteDBPath
|
|
92
|
+
getSqliteDBPath: _CGMConnect.getSqliteDBPath,
|
|
93
|
+
getCgmLogFilePaths: _CGMConnect.getCgmLogFilePaths
|
|
87
94
|
};
|
|
88
95
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_MyTatvaRnSdkView","_interopRequireDefault","require","_MyTatvaRnSdkView2","_reactNative","_CGMConnect","e","__esModule","default","MyTatvaRnSdkView","exports","Platform","select","ios","MyTatvaRnSdkViewIOS","android","MyTatvaRnSdkViewAndroid","_default","startCGM","initializeCGMEventListener","removeCGMEventListener","observeAllGlucoseDataHandler","reconnectCGM","helpCGM","observeTransmitterUnbindStatusHandler","observeResetLogoutHandler","getSqliteDBPath"],"sources":["index.js"],"sourcesContent":["import MyTatvaRnSdkViewAndroid from './MyTatvaRnSdkView.android';\nimport MyTatvaRnSdkViewIOS from './MyTatvaRnSdkView.ios';\nimport { Platform } from 'react-native';\nimport { startCGM, initializeCGMEventListener, removeCGMEventListener, observeAllGlucoseDataHandler, reconnectCGM, helpCGM, observeTransmitterUnbindStatusHandler, observeResetLogoutHandler, getSqliteDBPath } from './CGMConnect';\n// ... other imports\n\n// Export the platform-specific component\nexport const MyTatvaRnSdkView = Platform.select({\n ios: MyTatvaRnSdkViewIOS,\n android: MyTatvaRnSdkViewAndroid,\n});\n\n// Export individual functions\nexport {\n startCGM,\n initializeCGMEventListener,\n removeCGMEventListener,\n observeAllGlucoseDataHandler,\n reconnectCGM,\n helpCGM,\n observeTransmitterUnbindStatusHandler,\n observeResetLogoutHandler,\n getSqliteDBPath\n // ... other functions\n};\n\n// Export a default object with everything\nexport default {\n MyTatvaRnSdkView,\n startCGM,\n initializeCGMEventListener,\n removeCGMEventListener,\n observeAllGlucoseDataHandler,\n reconnectCGM,\n helpCGM,\n observeTransmitterUnbindStatusHandler,\n observeResetLogoutHandler,\n getSqliteDBPath
|
|
1
|
+
{"version":3,"names":["_MyTatvaRnSdkView","_interopRequireDefault","require","_MyTatvaRnSdkView2","_reactNative","_CGMConnect","e","__esModule","default","MyTatvaRnSdkView","exports","Platform","select","ios","MyTatvaRnSdkViewIOS","android","MyTatvaRnSdkViewAndroid","_default","startCGM","initializeCGMEventListener","removeCGMEventListener","observeAllGlucoseDataHandler","reconnectCGM","helpCGM","observeTransmitterUnbindStatusHandler","observeResetLogoutHandler","getSqliteDBPath","getCgmLogFilePaths"],"sources":["index.js"],"sourcesContent":["import MyTatvaRnSdkViewAndroid from './MyTatvaRnSdkView.android';\nimport MyTatvaRnSdkViewIOS from './MyTatvaRnSdkView.ios';\nimport { Platform } from 'react-native';\nimport { startCGM, initializeCGMEventListener, removeCGMEventListener, observeAllGlucoseDataHandler, reconnectCGM, helpCGM, observeTransmitterUnbindStatusHandler, observeResetLogoutHandler, getSqliteDBPath, getCgmLogFilePaths } from './CGMConnect';\n// ... other imports\n\n// Export the platform-specific component\nexport const MyTatvaRnSdkView = Platform.select({\n ios: MyTatvaRnSdkViewIOS,\n android: MyTatvaRnSdkViewAndroid,\n});\n\n// Export individual functions\nexport {\n startCGM,\n initializeCGMEventListener,\n removeCGMEventListener,\n observeAllGlucoseDataHandler,\n reconnectCGM,\n helpCGM,\n observeTransmitterUnbindStatusHandler,\n observeResetLogoutHandler,\n getSqliteDBPath,\n getCgmLogFilePaths\n // ... other functions\n};\n\n// Export a default object with everything\nexport default {\n MyTatvaRnSdkView,\n startCGM,\n initializeCGMEventListener,\n removeCGMEventListener,\n observeAllGlucoseDataHandler,\n reconnectCGM,\n helpCGM,\n observeTransmitterUnbindStatusHandler,\n observeResetLogoutHandler,\n getSqliteDBPath,\n getCgmLogFilePaths,\n};"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAAwP,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AACxP;;AAEA;AACO,MAAMG,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAGE,qBAAQ,CAACC,MAAM,CAAC;EAC9CC,GAAG,EAAEC,0BAAmB;EACxBC,OAAO,EAAEC;AACX,CAAC,CAAC;;AAEF;AAeA;AAAA,IAAAC,QAAA,GAAAP,OAAA,CAAAF,OAAA,GACe;EACbC,gBAAgB;EAChBS,QAAQ,EAARA,oBAAQ;EACRC,0BAA0B,EAA1BA,sCAA0B;EAC1BC,sBAAsB,EAAtBA,kCAAsB;EACtBC,4BAA4B,EAA5BA,wCAA4B;EAC5BC,YAAY,EAAZA,wBAAY;EACZC,OAAO,EAAPA,mBAAO;EACPC,qCAAqC,EAArCA,iDAAqC;EACrCC,yBAAyB,EAAzBA,qCAAyB;EACzBC,eAAe,EAAfA,2BAAe;EACfC,kBAAkB,EAAlBA;AACF,CAAC","ignoreList":[]}
|
package/lib/module/CGMConnect.js
CHANGED
|
@@ -113,5 +113,28 @@ const getSqliteDBPath = async () => {
|
|
|
113
113
|
const stopCGM = async () => {
|
|
114
114
|
// Implementation
|
|
115
115
|
};
|
|
116
|
-
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Get all CGM log file paths
|
|
119
|
+
* Returns array of absolute file paths to CGM log files (CSV format)
|
|
120
|
+
* Use react-native-fs or similar in your main app to read these files
|
|
121
|
+
*
|
|
122
|
+
* @returns Promise<string[]> - Array of absolute file paths
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* const logPaths = await getCgmLogFilePaths();
|
|
126
|
+
* // Android: ['/storage/emulated/0/Android/data/.../Documents/12345_POCTech.csv']
|
|
127
|
+
* // iOS: ['/var/mobile/Containers/Data/Application/.../Documents/runLog/1_SensorID.csv']
|
|
128
|
+
*/
|
|
129
|
+
const getCgmLogFilePaths = async () => {
|
|
130
|
+
try {
|
|
131
|
+
const result = await cgmLib.getCgmLogFiles();
|
|
132
|
+
console.log(`CGM Log Files: ${result.length} files found`);
|
|
133
|
+
return result;
|
|
134
|
+
} catch (error) {
|
|
135
|
+
console.error('Error getting CGM log file paths:', error);
|
|
136
|
+
throw error;
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
export { startCGM, stopCGM, initializeCGMEventListener, removeCGMEventListener, observeAllGlucoseDataHandler, reconnectCGM, helpCGM, observeTransmitterUnbindStatusHandler, observeResetLogoutHandler, getSqliteDBPath, getCgmLogFilePaths };
|
|
117
140
|
//# sourceMappingURL=CGMConnect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DeviceEventEmitter","NativeEventEmitter","NativeModules","Platform","eventSubscription","LINKING_ERROR","select","ios","default","cgmLib","CgmTrackyLib","Proxy","get","Error","initializeCGMEventListener","callback","iosEventEmitter","remove","OS","addListener","eventData","status","removeCGMEventListener","startCGM","token","envType","console","log","result","startCgmTracky","error","reconnectCGM","reconnectCgmTracky","observeAllGlucoseDataHandler","isCleanData","observeAllGlucoseData","deviceStatus","observeDeviceStatus","helpCGM","openHelpSupport","observeTransmitterUnbindStatusHandler","apiResponse","patientId","observeTransmitterUnbindStatus","observeResetLogoutHandler","resetCgmState","getSqliteDBPath","getTrackLibDbPath","stopCGM"],"sources":["CGMConnect.ts"],"sourcesContent":["import {\n DeviceEventEmitter,\n EmitterSubscription,\n NativeEventEmitter,\n NativeModules,\n Platform,\n} from 'react-native';\n\nlet eventSubscription: EmitterSubscription | null = null;\n\nconst LINKING_ERROR =\n `The package 'react-native-mytatva-rn-sdk' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo Go\\n';\n\nconst cgmLib = NativeModules.CgmTrackyLib\n ? NativeModules.CgmTrackyLib\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nfunction initializeCGMEventListener(callback: (eventData: any) => void) {\n const iosEventEmitter = new NativeEventEmitter(cgmLib);\n if (eventSubscription) {\n eventSubscription.remove();\n }\n\n if (Platform.OS === 'android') {\n eventSubscription = DeviceEventEmitter.addListener(\n 'cgmDeviceEvent',\n (eventData: any) => {\n const { status } = eventData;\n if (status === 'WARM_PERIOD_STARTED') {\n callback(eventData);\n } else {\n callback(eventData);\n }\n }\n );\n } else if (Platform.OS === 'ios' && iosEventEmitter) {\n eventSubscription = iosEventEmitter.addListener(\n 'cgmDeviceEvent',\n (eventData: any) => {\n const { status } = eventData;\n if (status === 'WARM_PERIOD_STARTED') {\n callback(eventData);\n } else {\n callback(eventData);\n }\n }\n );\n }\n}\n\nfunction removeCGMEventListener() {\n if (eventSubscription) {\n eventSubscription.remove();\n eventSubscription = null;\n }\n}\n\nconst startCGM = async (token: string, envType: string) => {\n console.log('startCGM===');\n try {\n const result = await cgmLib.startCgmTracky(token, envType);\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst reconnectCGM = async (token: string, envType: string) => {\n console.log('reconnectCGM====');\n try {\n const result = await cgmLib.reconnectCgmTracky(token, envType);\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst observeAllGlucoseDataHandler = async (\n token: string,\n isCleanData: boolean,\n envType: string\n) => {\n console.log('observeAllGlucoseDataHandler====');\n try {\n if (Platform.OS === 'android') {\n const result = await cgmLib.observeAllGlucoseData(\n token,\n isCleanData,\n envType\n );\n const deviceStatus = await cgmLib.observeDeviceStatus(token, envType);\n console.log(result);\n console.log(deviceStatus);\n } else if (Platform.OS === 'ios') {\n const result = await cgmLib.observeAllGlucoseData(\n token,\n isCleanData,\n envType\n );\n console.log(result);\n }\n } catch (error) {\n console.log('error====', error);\n console.error(error);\n }\n};\n\nconst helpCGM = async (token: string, envType: string) => {\n console.log('helpCGM====');\n try {\n const result = await cgmLib.openHelpSupport();\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst observeTransmitterUnbindStatusHandler = async (\n token: string,\n apiResponse: string,\n patientId: string,\n envType: string\n) => {\n console.log('observeTransmitterUnbindStatusHandler====');\n try {\n const result = await cgmLib.observeTransmitterUnbindStatus(\n token,\n apiResponse,\n patientId,\n envType\n );\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst observeResetLogoutHandler = async () => {\n console.log('observeResetLogoutHandler====');\n try {\n const result = await cgmLib.resetCgmState();\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst getSqliteDBPath = async (): Promise<string> => {\n const result = await cgmLib.getTrackLibDbPath();\n return result;\n};\n\nconst stopCGM = async () => {\n // Implementation\n};\n\nexport {\n startCGM,\n stopCGM,\n initializeCGMEventListener,\n removeCGMEventListener,\n observeAllGlucoseDataHandler,\n reconnectCGM,\n helpCGM,\n observeTransmitterUnbindStatusHandler,\n observeResetLogoutHandler,\n getSqliteDBPath,\n};\n"],"mappings":"AAAA,SACEA,kBAAkB,EAElBC,kBAAkB,EAClBC,aAAa,EACbC,QAAQ,QACH,cAAc;AAErB,IAAIC,iBAA6C,GAAG,IAAI;AAExD,MAAMC,aAAa,GACjB,sFAAsF,GACtFF,QAAQ,CAACG,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAA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,OAAO,CAACC,GAAG,CAACC,MAAM,CAAC;EACrB,CAAC,CAAC,OAAOE,KAAK,EAAE;IACdJ,OAAO,CAACI,KAAK,CAACA,KAAK,CAAC;EACtB;AACF,CAAC;AAED,MAAMgB,eAAe,GAAG,MAAAA,CAAA,KAA6B;EACnD,MAAMlB,MAAM,GAAG,MAAMnB,MAAM,CAACsC,iBAAiB,CAAC,CAAC;EAC/C,OAAOnB,MAAM;AACf,CAAC;AAED,MAAMoB,OAAO,GAAG,MAAAA,CAAA,KAAY;EAC1B;AAAA,CACD;AAED,SACEzB,QAAQ,EACRyB,OAAO,EACPlC,0BAA0B,EAC1BQ,sBAAsB,EACtBW,4BAA4B,EAC5BF,YAAY,EACZO,OAAO,EACPE,qCAAqC,EACrCI,yBAAyB,EACzBE,eAAe","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["DeviceEventEmitter","NativeEventEmitter","NativeModules","Platform","eventSubscription","LINKING_ERROR","select","ios","default","cgmLib","CgmTrackyLib","Proxy","get","Error","initializeCGMEventListener","callback","iosEventEmitter","remove","OS","addListener","eventData","status","removeCGMEventListener","startCGM","token","envType","console","log","result","startCgmTracky","error","reconnectCGM","reconnectCgmTracky","observeAllGlucoseDataHandler","isCleanData","observeAllGlucoseData","deviceStatus","observeDeviceStatus","helpCGM","openHelpSupport","observeTransmitterUnbindStatusHandler","apiResponse","patientId","observeTransmitterUnbindStatus","observeResetLogoutHandler","resetCgmState","getSqliteDBPath","getTrackLibDbPath","stopCGM","getCgmLogFilePaths","getCgmLogFiles","length"],"sources":["CGMConnect.ts"],"sourcesContent":["import {\n DeviceEventEmitter,\n EmitterSubscription,\n NativeEventEmitter,\n NativeModules,\n Platform,\n} from 'react-native';\n\nlet eventSubscription: EmitterSubscription | null = null;\n\nconst LINKING_ERROR =\n `The package 'react-native-mytatva-rn-sdk' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo Go\\n';\n\nconst cgmLib = NativeModules.CgmTrackyLib\n ? NativeModules.CgmTrackyLib\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nfunction initializeCGMEventListener(callback: (eventData: any) => void) {\n const iosEventEmitter = new NativeEventEmitter(cgmLib);\n if (eventSubscription) {\n eventSubscription.remove();\n }\n\n if (Platform.OS === 'android') {\n eventSubscription = DeviceEventEmitter.addListener(\n 'cgmDeviceEvent',\n (eventData: any) => {\n const { status } = eventData;\n if (status === 'WARM_PERIOD_STARTED') {\n callback(eventData);\n } else {\n callback(eventData);\n }\n }\n );\n } else if (Platform.OS === 'ios' && iosEventEmitter) {\n eventSubscription = iosEventEmitter.addListener(\n 'cgmDeviceEvent',\n (eventData: any) => {\n const { status } = eventData;\n if (status === 'WARM_PERIOD_STARTED') {\n callback(eventData);\n } else {\n callback(eventData);\n }\n }\n );\n }\n}\n\nfunction removeCGMEventListener() {\n if (eventSubscription) {\n eventSubscription.remove();\n eventSubscription = null;\n }\n}\n\nconst startCGM = async (token: string, envType: string) => {\n console.log('startCGM===');\n try {\n const result = await cgmLib.startCgmTracky(token, envType);\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst reconnectCGM = async (token: string, envType: string) => {\n console.log('reconnectCGM====');\n try {\n const result = await cgmLib.reconnectCgmTracky(token, envType);\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst observeAllGlucoseDataHandler = async (\n token: string,\n isCleanData: boolean,\n envType: string\n) => {\n console.log('observeAllGlucoseDataHandler====');\n try {\n if (Platform.OS === 'android') {\n const result = await cgmLib.observeAllGlucoseData(\n token,\n isCleanData,\n envType\n );\n const deviceStatus = await cgmLib.observeDeviceStatus(token, envType);\n console.log(result);\n console.log(deviceStatus);\n } else if (Platform.OS === 'ios') {\n const result = await cgmLib.observeAllGlucoseData(\n token,\n isCleanData,\n envType\n );\n console.log(result);\n }\n } catch (error) {\n console.log('error====', error);\n console.error(error);\n }\n};\n\nconst helpCGM = async (token: string, envType: string) => {\n console.log('helpCGM====');\n try {\n const result = await cgmLib.openHelpSupport();\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst observeTransmitterUnbindStatusHandler = async (\n token: string,\n apiResponse: string,\n patientId: string,\n envType: string\n) => {\n console.log('observeTransmitterUnbindStatusHandler====');\n try {\n const result = await cgmLib.observeTransmitterUnbindStatus(\n token,\n apiResponse,\n patientId,\n envType\n );\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst observeResetLogoutHandler = async () => {\n console.log('observeResetLogoutHandler====');\n try {\n const result = await cgmLib.resetCgmState();\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst getSqliteDBPath = async (): Promise<string> => {\n const result = await cgmLib.getTrackLibDbPath();\n return result;\n};\n\nconst stopCGM = async () => {\n // Implementation\n};\n\n/**\n * Get all CGM log file paths\n * Returns array of absolute file paths to CGM log files (CSV format)\n * Use react-native-fs or similar in your main app to read these files\n *\n * @returns Promise<string[]> - Array of absolute file paths\n *\n * @example\n * const logPaths = await getCgmLogFilePaths();\n * // Android: ['/storage/emulated/0/Android/data/.../Documents/12345_POCTech.csv']\n * // iOS: ['/var/mobile/Containers/Data/Application/.../Documents/runLog/1_SensorID.csv']\n */\nconst getCgmLogFilePaths = async (): Promise<string[]> => {\n try {\n const result = await cgmLib.getCgmLogFiles();\n console.log(`CGM Log Files: ${result.length} files found`);\n return result;\n } catch (error) {\n console.error('Error getting CGM log file paths:', error);\n throw error;\n }\n};\n\nexport {\n startCGM,\n stopCGM,\n initializeCGMEventListener,\n removeCGMEventListener,\n observeAllGlucoseDataHandler,\n reconnectCGM,\n helpCGM,\n observeTransmitterUnbindStatusHandler,\n observeResetLogoutHandler,\n getSqliteDBPath,\n getCgmLogFilePaths,\n};\n"],"mappings":"AAAA,SACEA,kBAAkB,EAElBC,kBAAkB,EAClBC,aAAa,EACbC,QAAQ,QACH,cAAc;AA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Y;EAC5ClB,OAAO,CAACC,GAAG,CAAC,+BAA+B,CAAC;EAC5C,IAAI;IACF,MAAMC,MAAM,GAAG,MAAMnB,MAAM,CAACoC,aAAa,CAAC,CAAC;IAC3CnB,OAAO,CAACC,GAAG,CAACC,MAAM,CAAC;EACrB,CAAC,CAAC,OAAOE,KAAK,EAAE;IACdJ,OAAO,CAACI,KAAK,CAACA,KAAK,CAAC;EACtB;AACF,CAAC;AAED,MAAMgB,eAAe,GAAG,MAAAA,CAAA,KAA6B;EACnD,MAAMlB,MAAM,GAAG,MAAMnB,MAAM,CAACsC,iBAAiB,CAAC,CAAC;EAC/C,OAAOnB,MAAM;AACf,CAAC;AAED,MAAMoB,OAAO,GAAG,MAAAA,CAAA,KAAY;EAC1B;AAAA,CACD;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,kBAAkB,GAAG,MAAAA,CAAA,KAA+B;EACxD,IAAI;IACF,MAAMrB,MAAM,GAAG,MAAMnB,MAAM,CAACyC,cAAc,CAAC,CAAC;IAC5CxB,OAAO,CAACC,GAAG,CAAC,kBAAkBC,MAAM,CAACuB,MAAM,cAAc,CAAC;IAC1D,OAAOvB,MAAM;EACf,CAAC,CAAC,OAAOE,KAAK,EAAE;IACdJ,OAAO,CAACI,KAAK,CAAC,mCAAmC,EAAEA,KAAK,CAAC;IACzD,MAAMA,KAAK;EACb;AACF,CAAC;AAED,SACEP,QAAQ,EACRyB,OAAO,EACPlC,0BAA0B,EAC1BQ,sBAAsB,EACtBW,4BAA4B,EAC5BF,YAAY,EACZO,OAAO,EACPE,qCAAqC,EACrCI,yBAAyB,EACzBE,eAAe,EACfG,kBAAkB","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import MyTatvaRnSdkViewAndroid from './MyTatvaRnSdkView.android';
|
|
2
2
|
import MyTatvaRnSdkViewIOS from './MyTatvaRnSdkView.ios';
|
|
3
3
|
import { Platform } from 'react-native';
|
|
4
|
-
import { startCGM, initializeCGMEventListener, removeCGMEventListener, observeAllGlucoseDataHandler, reconnectCGM, helpCGM, observeTransmitterUnbindStatusHandler, observeResetLogoutHandler, getSqliteDBPath } from './CGMConnect';
|
|
4
|
+
import { startCGM, initializeCGMEventListener, removeCGMEventListener, observeAllGlucoseDataHandler, reconnectCGM, helpCGM, observeTransmitterUnbindStatusHandler, observeResetLogoutHandler, getSqliteDBPath, getCgmLogFilePaths } from './CGMConnect';
|
|
5
5
|
// ... other imports
|
|
6
6
|
|
|
7
7
|
// Export the platform-specific component
|
|
@@ -11,7 +11,7 @@ export const MyTatvaRnSdkView = Platform.select({
|
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
// Export individual functions
|
|
14
|
-
export { startCGM, initializeCGMEventListener, removeCGMEventListener, observeAllGlucoseDataHandler, reconnectCGM, helpCGM, observeTransmitterUnbindStatusHandler, observeResetLogoutHandler, getSqliteDBPath
|
|
14
|
+
export { startCGM, initializeCGMEventListener, removeCGMEventListener, observeAllGlucoseDataHandler, reconnectCGM, helpCGM, observeTransmitterUnbindStatusHandler, observeResetLogoutHandler, getSqliteDBPath, getCgmLogFilePaths
|
|
15
15
|
// ... other functions
|
|
16
16
|
};
|
|
17
17
|
|
|
@@ -26,6 +26,7 @@ export default {
|
|
|
26
26
|
helpCGM,
|
|
27
27
|
observeTransmitterUnbindStatusHandler,
|
|
28
28
|
observeResetLogoutHandler,
|
|
29
|
-
getSqliteDBPath
|
|
29
|
+
getSqliteDBPath,
|
|
30
|
+
getCgmLogFilePaths
|
|
30
31
|
};
|
|
31
32
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["MyTatvaRnSdkViewAndroid","MyTatvaRnSdkViewIOS","Platform","startCGM","initializeCGMEventListener","removeCGMEventListener","observeAllGlucoseDataHandler","reconnectCGM","helpCGM","observeTransmitterUnbindStatusHandler","observeResetLogoutHandler","getSqliteDBPath","MyTatvaRnSdkView","select","ios","android"],"sources":["index.js"],"sourcesContent":["import MyTatvaRnSdkViewAndroid from './MyTatvaRnSdkView.android';\nimport MyTatvaRnSdkViewIOS from './MyTatvaRnSdkView.ios';\nimport { Platform } from 'react-native';\nimport { startCGM, initializeCGMEventListener, removeCGMEventListener, observeAllGlucoseDataHandler, reconnectCGM, helpCGM, observeTransmitterUnbindStatusHandler, observeResetLogoutHandler, getSqliteDBPath } from './CGMConnect';\n// ... other imports\n\n// Export the platform-specific component\nexport const MyTatvaRnSdkView = Platform.select({\n ios: MyTatvaRnSdkViewIOS,\n android: MyTatvaRnSdkViewAndroid,\n});\n\n// Export individual functions\nexport {\n startCGM,\n initializeCGMEventListener,\n removeCGMEventListener,\n observeAllGlucoseDataHandler,\n reconnectCGM,\n helpCGM,\n observeTransmitterUnbindStatusHandler,\n observeResetLogoutHandler,\n getSqliteDBPath\n // ... other functions\n};\n\n// Export a default object with everything\nexport default {\n MyTatvaRnSdkView,\n startCGM,\n initializeCGMEventListener,\n removeCGMEventListener,\n observeAllGlucoseDataHandler,\n reconnectCGM,\n helpCGM,\n observeTransmitterUnbindStatusHandler,\n observeResetLogoutHandler,\n getSqliteDBPath
|
|
1
|
+
{"version":3,"names":["MyTatvaRnSdkViewAndroid","MyTatvaRnSdkViewIOS","Platform","startCGM","initializeCGMEventListener","removeCGMEventListener","observeAllGlucoseDataHandler","reconnectCGM","helpCGM","observeTransmitterUnbindStatusHandler","observeResetLogoutHandler","getSqliteDBPath","getCgmLogFilePaths","MyTatvaRnSdkView","select","ios","android"],"sources":["index.js"],"sourcesContent":["import MyTatvaRnSdkViewAndroid from './MyTatvaRnSdkView.android';\nimport MyTatvaRnSdkViewIOS from './MyTatvaRnSdkView.ios';\nimport { Platform } from 'react-native';\nimport { startCGM, initializeCGMEventListener, removeCGMEventListener, observeAllGlucoseDataHandler, reconnectCGM, helpCGM, observeTransmitterUnbindStatusHandler, observeResetLogoutHandler, getSqliteDBPath, getCgmLogFilePaths } from './CGMConnect';\n// ... other imports\n\n// Export the platform-specific component\nexport const MyTatvaRnSdkView = Platform.select({\n ios: MyTatvaRnSdkViewIOS,\n android: MyTatvaRnSdkViewAndroid,\n});\n\n// Export individual functions\nexport {\n startCGM,\n initializeCGMEventListener,\n removeCGMEventListener,\n observeAllGlucoseDataHandler,\n reconnectCGM,\n helpCGM,\n observeTransmitterUnbindStatusHandler,\n observeResetLogoutHandler,\n getSqliteDBPath,\n getCgmLogFilePaths\n // ... other functions\n};\n\n// Export a default object with everything\nexport default {\n MyTatvaRnSdkView,\n startCGM,\n initializeCGMEventListener,\n removeCGMEventListener,\n observeAllGlucoseDataHandler,\n reconnectCGM,\n helpCGM,\n observeTransmitterUnbindStatusHandler,\n observeResetLogoutHandler,\n getSqliteDBPath,\n getCgmLogFilePaths,\n};"],"mappings":"AAAA,OAAOA,uBAAuB,MAAM,4BAA4B;AAChE,OAAOC,mBAAmB,MAAM,wBAAwB;AACxD,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,QAAQ,EAAEC,0BAA0B,EAAEC,sBAAsB,EAAEC,4BAA4B,EAAEC,YAAY,EAAEC,OAAO,EAAEC,qCAAqC,EAAEC,yBAAyB,EAAEC,eAAe,EAAEC,kBAAkB,QAAQ,cAAc;AACvP;;AAEA;AACA,OAAO,MAAMC,gBAAgB,GAAGX,QAAQ,CAACY,MAAM,CAAC;EAC9CC,GAAG,EAAEd,mBAAmB;EACxBe,OAAO,EAAEhB;AACX,CAAC,CAAC;;AAEF;AACA,SACEG,QAAQ,EACRC,0BAA0B,EAC1BC,sBAAsB,EACtBC,4BAA4B,EAC5BC,YAAY,EACZC,OAAO,EACPC,qCAAqC,EACrCC,yBAAyB,EACzBC,eAAe,EACfC;AACA;AAAA;;AAGF;AACA,eAAe;EACbC,gBAAgB;EAChBV,QAAQ;EACRC,0BAA0B;EAC1BC,sBAAsB;EACtBC,4BAA4B;EAC5BC,YAAY;EACZC,OAAO;EACPC,qCAAqC;EACrCC,yBAAyB;EACzBC,eAAe;EACfC;AACF,CAAC","ignoreList":[]}
|
|
@@ -8,4 +8,17 @@ declare const observeTransmitterUnbindStatusHandler: (token: string, apiResponse
|
|
|
8
8
|
declare const observeResetLogoutHandler: () => Promise<void>;
|
|
9
9
|
declare const getSqliteDBPath: () => Promise<string>;
|
|
10
10
|
declare const stopCGM: () => Promise<void>;
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Get all CGM log file paths
|
|
13
|
+
* Returns array of absolute file paths to CGM log files (CSV format)
|
|
14
|
+
* Use react-native-fs or similar in your main app to read these files
|
|
15
|
+
*
|
|
16
|
+
* @returns Promise<string[]> - Array of absolute file paths
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* const logPaths = await getCgmLogFilePaths();
|
|
20
|
+
* // Android: ['/storage/emulated/0/Android/data/.../Documents/12345_POCTech.csv']
|
|
21
|
+
* // iOS: ['/var/mobile/Containers/Data/Application/.../Documents/runLog/1_SensorID.csv']
|
|
22
|
+
*/
|
|
23
|
+
declare const getCgmLogFilePaths: () => Promise<string[]>;
|
|
24
|
+
export { startCGM, stopCGM, initializeCGMEventListener, removeCGMEventListener, observeAllGlucoseDataHandler, reconnectCGM, helpCGM, observeTransmitterUnbindStatusHandler, observeResetLogoutHandler, getSqliteDBPath, getCgmLogFilePaths, };
|
package/package.json
CHANGED
package/src/CGMConnect.ts
CHANGED
|
@@ -164,6 +164,29 @@ const stopCGM = async () => {
|
|
|
164
164
|
// Implementation
|
|
165
165
|
};
|
|
166
166
|
|
|
167
|
+
/**
|
|
168
|
+
* Get all CGM log file paths
|
|
169
|
+
* Returns array of absolute file paths to CGM log files (CSV format)
|
|
170
|
+
* Use react-native-fs or similar in your main app to read these files
|
|
171
|
+
*
|
|
172
|
+
* @returns Promise<string[]> - Array of absolute file paths
|
|
173
|
+
*
|
|
174
|
+
* @example
|
|
175
|
+
* const logPaths = await getCgmLogFilePaths();
|
|
176
|
+
* // Android: ['/storage/emulated/0/Android/data/.../Documents/12345_POCTech.csv']
|
|
177
|
+
* // iOS: ['/var/mobile/Containers/Data/Application/.../Documents/runLog/1_SensorID.csv']
|
|
178
|
+
*/
|
|
179
|
+
const getCgmLogFilePaths = async (): Promise<string[]> => {
|
|
180
|
+
try {
|
|
181
|
+
const result = await cgmLib.getCgmLogFiles();
|
|
182
|
+
console.log(`CGM Log Files: ${result.length} files found`);
|
|
183
|
+
return result;
|
|
184
|
+
} catch (error) {
|
|
185
|
+
console.error('Error getting CGM log file paths:', error);
|
|
186
|
+
throw error;
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
|
|
167
190
|
export {
|
|
168
191
|
startCGM,
|
|
169
192
|
stopCGM,
|
|
@@ -175,4 +198,5 @@ export {
|
|
|
175
198
|
observeTransmitterUnbindStatusHandler,
|
|
176
199
|
observeResetLogoutHandler,
|
|
177
200
|
getSqliteDBPath,
|
|
201
|
+
getCgmLogFilePaths,
|
|
178
202
|
};
|
package/src/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import MyTatvaRnSdkViewAndroid from './MyTatvaRnSdkView.android';
|
|
2
2
|
import MyTatvaRnSdkViewIOS from './MyTatvaRnSdkView.ios';
|
|
3
3
|
import { Platform } from 'react-native';
|
|
4
|
-
import { startCGM, initializeCGMEventListener, removeCGMEventListener, observeAllGlucoseDataHandler, reconnectCGM, helpCGM, observeTransmitterUnbindStatusHandler, observeResetLogoutHandler, getSqliteDBPath } from './CGMConnect';
|
|
4
|
+
import { startCGM, initializeCGMEventListener, removeCGMEventListener, observeAllGlucoseDataHandler, reconnectCGM, helpCGM, observeTransmitterUnbindStatusHandler, observeResetLogoutHandler, getSqliteDBPath, getCgmLogFilePaths } from './CGMConnect';
|
|
5
5
|
// ... other imports
|
|
6
6
|
|
|
7
7
|
// Export the platform-specific component
|
|
@@ -20,7 +20,8 @@ export {
|
|
|
20
20
|
helpCGM,
|
|
21
21
|
observeTransmitterUnbindStatusHandler,
|
|
22
22
|
observeResetLogoutHandler,
|
|
23
|
-
getSqliteDBPath
|
|
23
|
+
getSqliteDBPath,
|
|
24
|
+
getCgmLogFilePaths
|
|
24
25
|
// ... other functions
|
|
25
26
|
};
|
|
26
27
|
|
|
@@ -35,5 +36,6 @@ export default {
|
|
|
35
36
|
helpCGM,
|
|
36
37
|
observeTransmitterUnbindStatusHandler,
|
|
37
38
|
observeResetLogoutHandler,
|
|
38
|
-
getSqliteDBPath
|
|
39
|
+
getSqliteDBPath,
|
|
40
|
+
getCgmLogFilePaths,
|
|
39
41
|
};
|