Latest 1.0.0
Homepage https://github.com/StephenCMZ/LSBLEManager
License MIT
Platforms ios 8.0, requires ARC
Authors

一个简易的蓝牙管理器

使用步骤:
  • pod ‘LSBLEManager’, ‘~> 1.0.0’
  • 导入LSBluetoothManager.h
  • 设置代理并获取蓝牙管理器
    @interface ConnectDeviceViewController ()<LSBluetoothManagerDelegate>
    LSBluetoothManager *bleManager = [LSBluetoothManager shareBLEManager]; 
    bleManager.delegate = self;
  • 查找蓝牙

    // 查找蓝牙设备
    [bleManager scanDevice];
    
    // 查找到设备回调
    - (void)updateDevices:(NSArray *)devices{
        // devices 为 CBPeripheral 集合
    } 
  • 连接蓝牙

    //连接蓝牙
    [_bleManager connectDeviceWithCBPeripheral:peripheral
                                andServiceUUID:SERVICEUUID
                   andOutputCharacteristicUUID:OUTPUTUUID
                    andInputCharacteristicUUID:INPUTUUID];
    
     // 连接状态回调
    - (void)updateStatue:(BLESTATUE)statue{}
  • 收发数据
    //收到数据回调
    - (void)revicedMessage:(NSData *)msg{}
    //发送数据
    NSData data = [NSData dataWithBytes:@"89" length:1];
    [bleManager sendMsg:data];

Latest podspec

{
    "name": "LSBLEManager",
    "version": "1.0.0",
    "summary": "easy away to use bluetooth.",
    "description": "you can easy away to use bluetooth.",
    "homepage": "https://github.com/StephenCMZ/LSBLEManager",
    "license": "MIT",
    "authors": {
        "Stephen": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/StephenCMZ/LSBLEManager.git",
        "tag": "1.0.0"
    },
    "source_files": [
        "LSBLEManager",
        "*.{h,m}"
    ],
    "exclude_files": "LSBLEManager/Exclude",
    "requires_arc": true
}

Pin It on Pinterest

Share This