FABluetoothManager 0.0.1

FABluetoothManager 0.0.1

测试已测试
Lang语言 Obj-CObjective C
许可证 MIT
发布最后发布2015年9月

Fernando Arellano 负责维护。



  • 作者:
  • Fernando Arellano

一个简单的基于 iOS 的与外围设备交互的蓝牙管理器块

安装

只需使用 Cocoapods pod 'FABluetoothManager'

查看 Cocoapods

入门

1.- 获取实例

FABluetoothManager *manager = [FABluetoothManager manager];

扫描外围设备

要开始搜索外围设备,请使用以下函数

注意:我们使用 nil 作为服务值以查找所有外围设备,但这不是您在实际环境中会做的事情。请参阅 Apple Bluetooth

[manager startSearchingForPeriphetals:^(NSArray *peripherals, NSError *error) {
    NSLog(@"%@",peripherals);
} services:nil];

连接到外围设备

在进行任何类型的通信之前,我们需要连接到它。

ConnetPeripheralBlock completionBlock = ^(CBPeripheralState state, NSError* error){
        if (state == CBPeripheralStateConnected) {
        // Optional you can look for services
//            [self discoverServices:nil
//                        peripheral:peripheral
//                        completion:servicesBlock];
        } else {
            block(nil, error);
        }
    };
[manager connectToPeripheral:peripheral completion:completionBlock];

发现服务和特征

读取和写入特征值

TODOS

通知 完成README。修复错误

作者

Fernando Arellano ([email protected])