Latest 0.1.0
Homepage https://github.com/sudotamm/RYBle
License MIT
Platforms ios 9.0, requires ARC
Frameworks Foundation
Authors

基于CoreBluetooth库封装的BleCentral服务类,使用block的方式简化了蓝牙启动、扫描、配对及数据更新的回调流程。

Integrate in your project

pod 'RYBle'

How to use

  1. Initial ble central manager
      RYBleManager.sharedManager.bleInit(completion: nil) { state in
            print( state.description)
            // Deal with ble error status
        }
  1. Scan ble devices
            RYBleManager.sharedManager.scan(services: services, discoverBlock: { discoverys in
                // Callback when device discovered
            }, completionBlock: {
                // Callback when scan process stoped
            }, errorBlock: { state in
                // Callback when error occurred in scan service and character progress
            })
  1. Connect with ble device and received updated value from characters.
        RYBleManager.sharedManager.connect(peripheral: peripheral, connected: {
                // Callback when device connect succeed
        }, updateValue: { character in
                // Callback when character value updated
        }) { bleError in
                // Callback when error occurred in connect and update character process
        }

Example

Clone or download this repository and then open *.xcworkspace file when pod dependencies installed.

Latest podspec

{
    "name": "RYBle",
    "version": "0.1.0",
    "summary": "Simplified ble central manager base on CoreBluetooth.",
    "description": "Replace start, scan, connect and update value delegate callback with block to simplify central manager use.",
    "homepage": "https://github.com/sudotamm/RYBle",
    "license": "MIT",
    "authors": {
        "sudotamm": "[email protected]"
    },
    "source": {
        "git": "https://github.com/sudotamm/RYBle.git",
        "tag": "0.1.0"
    },
    "platforms": {
        "ios": "9.0"
    },
    "requires_arc": true,
    "source_files": "RYBle/*.{swift}",
    "frameworks": "Foundation",
    "pushed_with_swift_version": "3.1"
}

Pin It on Pinterest

Share This