iOS App bluetooth remote controller acting as central iOS App bluetooth remote controller acting as central.
The BlueBot project consists of two parts. The first part is the laptop application that simulate an electronic robot that communicate via bluetooth with its remote. The second part is an iOS application that behave as a bluetooth controller.
The iOS communicate with the simualtor OSX app to turn on/off the robot and to receive alerts notifications when the robot has low battery or get stuck.
The steps that are required to turn the mobile app into a bluetooth central:
- Implement CBCentralManagerDelegate methods [centralManagerDidUpdateState, didDiscover, didConnect, didDisconnectPeripheral]
- Implement CBPeripheralDelegate methods [didDiscoverServices, didDiscoverCharacteristicsFor, didUpdateValueFor, didWriteValueFor]
- Create a instance of CBCentralManager , CBPeripheral classes
- Scan for peripherals using CBCentralManager instance
- Connect to the robot peripheral From the list of scanned peripherals (Laptop)
- Discover the peripheral services and its characteristics
- Register as a listener for notifiable characteristics.
- Start reading and writing values using CBPeripheral instance [readValue, writeValue]
- Detect alerts and read responses using didUpdateValueFor method
- Detect the response of write request using didWriteValueFor method
