iOS support Bluetooth 4.0, many smart hardware began to communicate with the mobile phone through Bluetooth, such as Bluetooth scales, a variety of Bluetooth medical devices. Each device has a different model, and constantly iterative update, how the software supports a variety of devices, how to distinguish between multiple devices, and separate the control of different devices, I share a summary of my Bluetooth development framework.
Core Bluetooth control using iOS comes with the Corebluetooth, itself the library can be very good control of Bluetooth devices, my framework is only a further encapsulation of the library, the purpose is to solve the following problems
1 Differentiating the connection status of multiple devices
2 + devices individual Bluetooth communication processing
My Bluetooth framework connects devices, devices enable channel open, device data transmission, device connection failure and other Bluetooth engine event encapsulation, exposing the device state changes, device Data update interface, so that users only care about device status and device data, no need to care about the Bluetooth engine other events, further encapsulated the Bluetooth engine, Simplifies the processing of logic.
iOS bluetooth engine process
This process illustrates the call flow of the Bluetooth library Corebluetooth built into iOS and the encapsulation of the data and status of each device in each of my processes.
iOS Bluetooth Development Framework