Original link:
Http://liuyanwei.jumppo.com/2015/07/17/ios-BLE-1.html |
iOS bluetooth development (i) Bluetooth related basics:
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.
The relationship between peripherals, services, features:
Bluetooth Hub Mode Flow:
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
- Preparation (Standby)
- Broadcast (advertising)
- Monitor scan (scanning
- Initiating a connection (initiating)
- Connected (Connected)
Bluetooth and version usage restrictions
- Bluetooth 2.0 = = = Jailbreak device
- Bluetooth 4.0 = = = IOS6 above
- MFI Certified equipment (make for ipod/ipad/iphone) = = = Unlimited
Noun Explanation:
- Gaat:generic Attribute Profile, the GATT configuration file is a generic specification for sending and receiving data blocks called "Properties" on a ble link. All BLE applications are currently based on GATT. The Bluetooth sig provides configuration files for many low-power devices. A configuration file is a specification of how a device works in a particular application. Note that a device can implement multiple configuration files. For example, a device might include a heart rate monitor and a battery test.
- Characteristic a characteristic includes a single variable and 0-n descriptor,characteristic used to describe a characteristic variable can be considered a type, similar to a class.
- Descriptor descriptor is used to describe the properties of a characteristic variable. For example, a descriptor can specify a readable description, or an acceptable range of characteristic variables, or a specific unit of measurement for a characteristic variable. The service service is a collection of characteristic. For example, you might have a service called "Heart rate Monitor", which includes many characteristics, such as "heart rate measurement". You can find a list of currently supported GATT-based profiles and services in bluetooth.org.
How to use? Please refer to the link:
Https://github.com/coolnameismy/BabyBluetooth |
iOS bluetooth development (i) Bluetooth related basics