if characteristic.uuid.uuidString == readCharacteristicUUID {
let info = IBWatchInfo(data)
IBBluetooth.shared.currentConnected.battery = info.battery
- IBBluetooth.shared.currentConnected.macAddress = info.macAddress
+ IBBluetooth.shared.currentConnected.macAddress = info.macAddress.uppercased()
IBBluetooth.shared.currentConnected.productID = info.productID
IBBluetooth.shared.currentConnected.customerID = info.customerID
sendDeviceInfo()
}
centralManager.scanForPeripherals(withServices: nil, options: option.values)
- if let connectedPeripheral = centralManager.retrieveConnectedPeripherals(withServices: [CBUUID(string: serviceUUID)]).first{
- currentConnected = IBPeripheral()
- currentConnected.peripheral = connectedPeripheral
- IBManager.discoverHandler?(currentConnected)
+// if let connectedPeripheral = centralManager.retrieveConnectedPeripherals(withServices: [CBUUID(string: serviceUUID)]).first{
+// currentConnected = IBPeripheral()
+// currentConnected.peripheral = connectedPeripheral
+// IBManager.discoverHandler?(currentConnected)
+// }
+
+ let devices = centralManager.retrieveConnectedPeripherals(withServices: [CBUUID(string: serviceUUID)])
+ for item in devices {
+ var p = IBPeripheral()
+ p .peripheral = item
+ IBManager.discoverHandler?(p )
+
}
}
device.productID = manufacturer.productID
device.customerID = manufacturer.productID
device.advertisementData = advertisementData
- device.macAddress = manufacturer.macAddress
+ device.macAddress = manufacturer.macAddress.uppercased()
device.softwareVersion = manufacturer.softwareVersion
IBManager.discoverHandler?(device)
// Logger.log("发现设备", device.name, device.macAddress)
guard code == "JH" else { return nil }
isBind = data[2].int
- macAddress = data[3...8].reversedJoined(":")
+ macAddress = data[3...8].reversedJoined(":").uppercased()
customerID = data[9].int
productID = data[10].int
softwareVersion = data[11..<14].joined(format: "%d", ".")
battery = data[0].int
dialID = data[1...2].int
firmwareVersion = data[3...5].joined(format: "%d", ".")
- macAddress = data[6...11].joined(":")
+ macAddress = data[6...11].joined(":").uppercased()
messagePush = data[12].int
media = data[13].int
customerID = data[14].int