CocoaPods trunk is moving to be read-only. Read more on the blog, there are 14 months to go.
| TestsTested | ✗ |
| LangLanguage | Obj-CObjective C |
| License | MIT |
| ReleasedLast Release | Sep 2017 |
Maintained by zhuozhuo.
ZHBLE using Block callback methods, aimed at making the system CoreBluetooth library function is called simple.
simple and convenient to use Bluetooth。
| Class name | Function and usage |
|---|---|
| ZHBLECentral | Equipment as the relevant attributes and operations on the Central side, for example: initialize Central, scanned, connect, retrieve equipment. |
| ZHBLEPeripheral | Peripheral-side operations such as: discovery service and features, listening, reading and writing, and so on. |
| ZHBLEPeripheralManager | Device as a Peripheral-side operations such as initialization of CBPeripheralManager, radio, adding services and send data. |
| ZHBLEStoredPeripherals | Equipment local cache operations |
| ZHBLEManager | Fast access to recently connected devices |
| ZHBLEBlocks | All Block definitio |
#import "ZHBLE.h"
self.central = [ZHBLECentral sharedZHBLECentral];
//Scan
[self.central scanPeripheralWithServices:uuids options:@{CBCentralManagerScanOptionAllowDuplicatesKey: @(YES)} onUpdated:^(ZHBLEPeripheral *peripheral,NSDictionary *data){
if (peripheral) {
//Do Something
}}];
//Connection
[self.central connectPeripheral:peripheral options:nil onFinished:^(ZHBLEPeripheral *peripheral, NSError *error){
}];#import "ZHBLE.h"
self.peripheralManager = [ZHBLEPeripheralManager sharedZHBLEPeripheralManager];
//Advertise
CBUUID *temUUID = [CBUUID UUIDWithString:@"902DD287-69BE-4ADD-AACF-AA3C24D83B66"];
NSArray *temUUIDArray = [NSArray arrayWithObjects:temUUID, nil];
NSDictionary *temServiceDic = @{CBAdvertisementDataServiceUUIDsKey:temUUIDArray};
[self.peripheralManager startAdvertising:temServiceDic onStarted:^(NSError *error){
}];
//Add Service
[self.peripheralManager addService:_transferService onFinish:^(CBService *service,NSError *error){
}];
This code is distributed under the terms and conditions of the MIT license.