Get info about your Xiaomi Mijia 365 Scooter via BLE (Bluetooth Low Energy) using Swift and Core Bluetooth Framework.
- macOS 10.10+
- Xcode or Xcode Command Tools
- BLE compatible device (Bluetooth 5.0)
Drag and drop M365Info.swift class into your project. Initialize like let m365 = M365Info().
Start scanning for devices. Use M365DevicesDelegate
delegate methods:
didDiscoverDevice(peripheral: CBPeripheral)
didConnect(peripheral: CBPeripheral)
Connect to given device and get all data. After connection is being made Use M365DevicesDelegate
delegate methods:
didDiscoverDevice(peripheral: CBPeripheral)
didConnect(peripheral: CBPeripheral)
Disconnect from currently connected device. Use M365DevicesDelegate
delegate methods:
didDiscoverDevice(peripheral: CBPeripheral)
didConnect(peripheral: CBPeripheral)
List of key and value pairs with scooter data obtained after connection. You can simply do let sn = values["Serial Number"]
Array Keys |
---|
Firmware Version |
Serial Number |
Battery Level |
Body Temperature |
Total Mileage |
Voltage |
Current Speed |