To run the example project, clone the repo, and run pod install
from the Example directory first.
MedCheckPod is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'MedCheckPod'
import MedCheckPod
let bluetoothManager = BPMDataManager.sharedInstance
override func viewDidLoad() { super.viewDidLoad() . . bluetoothManager.delegate = self bluetoothManager.didUpdateManager() }
extension ViewController: BPMDataManagerDelegate{ func medcheckBLEDetected(_ peripheral: CBPeripheral, advertisementData: [String : Any], RSSI: NSNumber) { print(bluetoothManager.arrBLEList) } }
BPMDataManager.sharedInstance.connectPeripheral(peripheral: connectedPeripheral!)
BPMDataManager.sharedInstance.didDisconnectPeripheral(connectedPeripheral!)
BPMDataManager.sharedInstance.clearBPMDataCommand()
BPMDataManager.sharedInstance.timeSyncOfBPM()
BPMDataManager.sharedInstance.timeSyncOfBPM()
extension ViewController: BPMDataManagerDelegate{ func medcheckBLEDetected(_ peripheral: CBPeripheral, advertisementData: [String : Any], RSSI: NSNumber) { if bpmDataManager.bluetoothManager.connected { bpmDataManager.connectPeripheral(peripheral: bpmDataManager.connectedPeripheral!) } } func didMedCheckConnected(_ connectedPeripheral: CBPeripheral) { print("didMedCheckConnected \(connectedPeripheral)") } func connectedUserData(_ connectedUser: [String : Any]) { print("connectedUserData \(connectedUser)") } func willTakeNewReading(_ BLEName: CBPeripheral) { print("willStartDataReading \(BLEName)") } func didSyncTime() { print("didSyncTime") } func didTakeNewReading(_ readingData: [String : Any]) { print("didTakeNewReading \(jsonStringConvert(readingData))") } func showAlertMessage(_ title : String, message : String) { let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.alert) alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.cancel, handler: nil)) present(alert, animated: true, completion: nil) } func fetchAllDataFromMedCheck(_ readingData: [Any]) { print("fetchAllDataFromMedCheck \(jsonStringConvert(readingData))") } func didClearedData() { print("didClearedData") } func willStartDataReading() { print("willStartDataReading") } func didEndDataReading() { print("didEndDataReading") } func jsonStringConvert(_ obj : Any) -> String { do { let jsonData = try JSONSerialization.data(withJSONObject: obj, options: JSONSerialization.WritingOptions.prettyPrinted) return String(data: jsonData, encoding: String.Encoding.utf8)! as String } catch { return "" } } }
smartfuturesg, [email protected]
MedCheckPod is available under the MIT license. See the LICENSE file for more info.