Reprinted from: http://www.cocoachina.com/ios/20150915/13454.html
Original Liu Yanji
Bluetooth common names and abbreviations
-
MFI ======= make for ipad, iphone, itouch devices for Apple devices
-
ble = buletouch Low energy, Bluetooth 4.0 devices because of the power consumption, so also called ble
-
Peripheral,central = = Peripheral and center, initiating connected central, connected device for Perilheral
-
Service and characteristic = = = Services and features each device provides services and features, similar to the API on the server side, but the organization is different. Each peripheral will have a lot of services, each service contains a lot of fields, the permissions of these fields are generally divided into reading read, write, notify Notiy several, that is, we connect the device after the specific need to operate content.
-
Description each characteristic can correspond to one or more Description users to describe characteristic information or properties
-
MFI = = = Development using Externalaccessory framework
-
4.0 BLE = = = Development using Corebluetooth framework
Basic knowledge of Bluetooth
The core of the Corebluetooth framework is actually two things, peripheral and central, which can be understood as peripherals and centers. Corresponding they have a set of related APIs and classes
-
These two sets of APIs correspond to different business scenarios, the left is called the central mode, which is the center of your app, connected to other peripheral scenes, and the right side is called peripheral mode, using the phone as a peripheral other central device operation scenario.
-
Services and characteristics, attributes of the feature (service and characteristic):
Each device will have some services, each service will have some characteristics, characteristics are specific key value pairs, the location of the data provided. Each feature attribute is divided into such several ways: Read, write, and notify.
| 12345678910111213 |
//objcetive c特征的定义枚举typedefNS_OPTIONS(NSUInteger, CBCharacteristicProperties) { CBCharacteristicPropertyBroadcast = 0x01, CBCharacteristicPropertyRead = 0x02, CBCharacteristicPropertyWriteWithoutResponse = 0x04, CBCharacteristicPropertyWrite = 0x08, CBCharacteristicPropertyNotify = 0x10, CBCharacteristicPropertyIndicate = 0x20, CBCharacteristicPropertyAuthenticatedSignedWrites = 0x40, CBCharacteristicPropertyExtendedProperties = 0x80, CBCharacteristicPropertyNotifyEncryptionRequired NS_ENUM_AVAILABLE(NA, 6_0) = 0x100, CBCharacteristicPropertyIndicateEncryptionRequired NS_ENUM_AVAILABLE(NA, 6_0) = 0x200}; |
The relationship between peripherals, services, features
Bluetooth Hub Mode Process
1. Establishing a central role
2. Scanning Peripherals (Discover)
3. Connecting Peripherals (Connect)
4. Scanning for services and features in peripherals (Discover)
-4.1 access to peripherals services
-4.2 Get the characteristics of the peripheral, get the value of characteristics, get the value of characteristics descriptor and descriptor
5. Data interaction with peripherals (explore and interact)
6. Notice of subscription to characteristic
7. Disconnect (disconnect)
Bluetooth Peripheral Mode Flow
1. Start a peripheral Management object
2. Local Peripheral settings services, features, descriptions, permissions, etc.
3. Peripheral sending Ads
4. Set up a delegate method to process subscriptions, unsubscribe, read characteristic, write characteristic
Bluetooth Device status
1. Standby status (Standby): The device does not transmit and send data, and is not connected to any set
2. Broadcast Status (Advertiser): Periodic broadcast status
3. Scan status (Scanner): Actively looking for the device being broadcast
4. Initiate link state (initiator): Initiate a connection to the scanning device proactively.
5. Master: Connect to other devices as the primary device.
6. From Device (Slave): Connect to other devices as slave devices.
Five working status of Bluetooth devices
Bluetooth and version usage restrictions
-
Bluetooth 2.0 = = = Jailbreak device
-
Bluetooth 4.0 = = = IOS 6 +
-
MFI Certified equipment (make for ipod/ipad/iphone) = = = Unlimited
iOS bluetooth development (i) Bluetooth related basics (RPM)