- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想显示来自 iHealth 设备(如 iHealth 应用程序)的实时测量数据。所以我实现了 iHealth-SDK。我可以获得已经存储的用户 prfile 数据。
{
HeightUnit: 0,
WeightUnit: 0,
dateofbirth: xxxxx,
gender: "Male",
height: 180.34,
logo: "https%3a%2f%2fcloud.ihealthlabs.com%2fimages%2fdefault%2fAvatar.png",
nickname: "Senthil kumar",
userid: "yyyyyyy",
weight: 29.483539113316585
}
我实现了 corebuletooth
扣除iHealth
var optionsdic : NSDictionary = NSDictionary(objectsAndKeys: false, CBCentralManagerScanOptionAllowDuplicatesKey)
centralManager!.scanForPeripheralsWithServices(nil, options: optionsdic as [NSObject : AnyObject])
上面的代码调用了它的委托(delegate)方法
let devID = "12345678-1234-1234-1234-123456789123"
func centralManager(central: CBCentralManager!, didDiscoverPeripheral peripheral: CBPeripheral!, advertisementData: [NSObject : AnyObject]!, RSSI: NSNumber!) {
if peripheral.identifier.UUIDString == devID
{
self.centralManager?.stopScan()
self.myperipheral = peripheral
self.myperipheral?.delegate = self
self.centralManager?.connectPeripheral(peripheral, options: nil)
}
}
func centralManager(central: CBCentralManager!, didConnectPeripheral peripheral: CBPeripheral!) {
if peripheral.identifier.UUIDString == devID
{
if peripheral.state == CBPeripheralState.Connected
{
var uid : CBUUID = CBUUID(string: "FF70")
self.myperipheral = peripheral
self.myperipheral?.delegate = self
self.myperipheral?.discoverServices([CBUUID(string: peripheral.identifier.UUIDString)])
}
}
}
func centralManager(central: CBCentralManager!, didDisconnectPeripheral peripheral: CBPeripheral!, error: NSError!) {
println("Disconnected!== \(error)")
}
func peripheral(peripheral: CBPeripheral!, didDiscoverServices error: NSError!) {
if let servicePeripherals = peripheral.services as? [CBService]
{
for servicePeripheral in servicePeripherals
{
peripheral.discoverCharacteristics([servicePeripheral.UUID], forService: servicePeripheral)
}
}
}
func peripheral(peripheral: CBPeripheral!, didDiscoverCharacteristicsForService service: CBService!, error: NSError!) {
if let charactericsArr = service.characteristics as? [CBCharacteristic]
{
for charactericsx in charactericsArr
{
peripheral.setNotifyValue(true, forCharacteristic: charactericsx)
if charactericsx.UUID.UUIDString == devID{
var parameter = NSInteger(1)
let data = NSData(bytes: ¶meter, length: 1)
peripheral.writeValue(data, forCharacteristic: charactericsx, type: CBCharacteristicWriteType.WithResponse)
}
if charactericsx.UUID.UUIDString == "FF70" || charactericsx.UUID.UUIDString == "FF71"{
var parameter = NSInteger(1)
let data = NSData(bytes: ¶meter, length: 1)
peripheral.writeValue(data, forCharacteristic: charactericsx, type: CBCharacteristicWriteType.WithResponse)
}
peripheral.readValueForCharacteristic(charactericsx)
}
}
}
func readValueForCharacteristic(Charactersic: CBCharacteristic!){
println("character == \(Charactersic)")
}
func peripheral(peripheral: CBPeripheral!, didUpdateNotificationStateForCharacteristic characteristic: CBCharacteristic!, error: NSError!) {
if ((error) != nil) {
println("Error discovering service: \(error.localizedDescription)")
return;
}
println("description: \(characteristic.description), descriptors: \(characteristic.descriptors), properties: \(characteristic.properties), service :\(characteristic.service), value:\(characteristic.value)")
if (characteristic.isNotifying) {
peripheral.readValueForCharacteristic(characteristic)
}
}
我在 didDiscoverServices 方法中得到空数组 (servicePeripherals)。我想直接在 ios 应用程序和 iHealth 设备之间进行通信。 iHealth 设备读取的所有数据都显示在我的应用程序中。我坚持连接并使用核心蓝牙从 iHealth 设备读取实时数据。请给我建议。
最佳答案
我的办公 table 上刚放了一个无线脉搏血氧仪,我需要链接到 Raspberry Pi 或 Android(或任何东西,真的)在我看来,iHealth API 是云中的存储库。我不认为与 ble 设备的通信在他们的 API 中公开。
如果您像我一样仍在尝试从这些设备获取数据,也许可以通过观察 iPhone 和 ble 设备之间的数据交换来实现,但我不确定。
如果你知道了,请告诉我!!约翰·布罗汉
关于ios - 从 iHealth 设备(ios - Swift)实时阅读?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32564551/
我想编写应用程序 IOS 并使用 IHealth BP7 设备 BLE。 在CBCentralManager的代表中我没有收到 BP7 设备。 有人知道是否可以使用来自 BP7 设备的数据编写 BLE
我想显示来自 iHealth 设备(如 iHealth 应用程序)的实时测量数据。所以我实现了 iHealth-SDK。我可以获得已经存储的用户 prfile 数据。 { HeightUnit: 0,
我是一名优秀的程序员,十分优秀!