Latest 1.0.7
Homepage https://github.com/LNAndroid/BPTrackerPod
License MIT
Platforms ios 8.0
Authors

CI Status
Version
License
Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

BPTrackerPod is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'BPTrackerPod'

Source files

Alternatively you can directly add the BPTrackerPod folder to your project.

  1. Download the latest code version or add the repository as a git submodule to your git-tracked project.
  2. Open your project in Xcode, then drag and drop BPTrackerPod folder onto your project (use the "Product Navigator view"). Make sure to select Copy items when asked if you extracted the code archive outside of your project.

Usage

Pod Import

import BPTrackerPod

Get Shared Instance of BPMDataManager

let bluetoothManager = BPMDataManager.sharedInstance

Set delegate from ViewDidLoad()

override func viewDidLoad() {
    super.viewDidLoad()
    .
    .
    bluetoothManager.delegate = self
    bluetoothManager.didUpdateManager()
}

Get BPMDataManager delegate method for scanned MedCheck devices

extension ViewController: BPMDataManagerDelegate{
    func medcheckBLEDetected(_ peripheral: CBPeripheral, advertisementData: [String : Any], RSSI: NSNumber) {
        print(bluetoothManager.arrBLEList)
    }
}

Connect to MedCheck BLE device

    BPMDataManager.sharedInstance.connectPeripheral(peripheral: connectedPeripheral!)

Disconnect to MedCheck BLE device

    BPMDataManager.sharedInstance.didDisconnectPeripheral(connectedPeripheral!)

Clear Blood Pressure data from MedCheck BLE device

    BPMDataManager.sharedInstance.clearBPMDataCommand()

Synch current time with Blood Pressure data from MedCheck BLE device

    BPMDataManager.sharedInstance.timeSyncOfBPM()

Synch current time with Blood Pressure data from MedCheck BLE device

    BPMDataManager.sharedInstance.timeSyncOfBPM()

BPMDataManagerDelegate methods combined with CoreBluetoothManagerDelegate methods.

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 ""
        }
    }
}

Author

LNAndroid, [email protected]

License

BPTrackerPod is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "BPTrackerPod",
    "version": "1.0.7",
    "summary": "This Pod will allow users to connect with MedCheck BLE Devices and read data from BLE.",
    "description": "This Pod will allow users to connect with MedCheck BLE Devices and read data from BLE. This SDK will return data.",
    "homepage": "https://github.com/LNAndroid/BPTrackerPod",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "LNAndroid": "[email protected]"
    },
    "source": {
        "git": "https://github.com/LNAndroid/BPTrackerPod.git",
        "tag": "1.0.7"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "BPTrackerPod/Classes/**/*",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This