Latest 0.1.0
Homepage https://github.com/MacPu/MPBluetoothKit
License MIT
Platforms ios 7.0
Authors

This is a block-based framework for building Bluetooth iOS apps using the CoreBluetooth Framework.Its a very powerful and useful,and very easy to use it . originally developed for BI-CI

Version

v0.1

Why you should use this framework

  • ObjectiveC Block-based API for Bluetooth LE communication.
  • It provide a easiest way to use CoreBluetooth framework.
  • This project is activity.
  • It provide some very useful tools

How to use it

manual

download repository and add MPBluetoothKit/MPBluetoothKit to your project

import "MPBluetoothKit.h"

cocoapods

pod 'MPBluetoothKit','~> 0.1.0'

then

import "MPBluetoothKit.h"

Scan for peripheral

MPCentralManager *centralManager = [[MPCentralManager alloc] initWithQueue:queue options:options];
[centralManager scanForPeripheralsWithServices:nil options:nil withBlock:^(MPCentralManager *centralManager,MPPeripheral *peripheral,NSDictionary *advertisementData,NSNumber *RSSI){

  }];

Connecting to a Peripheral

[centralManager connectPeripheral:peripheral options:nil withSuccessBlock:^(MPCentralManager *centralManager, MPPeripheral *peripheral) {

  }withDisConnectBlock:^(MPCentralManager *centralManager, MPPeripheral *peripheral, NSError *error) {

    }];

Read a Characteristic

there is two way to read a Characteristic

[peripheral readValueForCharacteristic:(nullable MPCharacteristic *)characteristic withBlock:^(MPPeripheral *peripheral,MPCharacteristic *characteristic,NSError *error){

  }];
[characteristic readValueWithBlock:^(MPPeripheral *peripheral,MPCharacteristic *characteristic,NSError *error){

  }];

Write to a Characteristic

there is two way to write to a characteristic


[peripheral writeValue:(nullable NSData *)data
 forCharacteristic:(nullable MPCharacteristic *)characteristic
              type:(CBCharacteristicWriteType)type
         withBlock:^(MPPeripheral *peripheral,MPCharacteristic *characteristic,NSError *error){
         }];
[characteristic writeValue:(nullable NSData *)data
              type:(CBCharacteristicWriteType)type
         withBlock:^(MPPeripheral *peripheral,MPCharacteristic *characteristic,NSError *error){
         }];

more detail on MPBluetoothKit

Required

  • CoreBluetooth.framework
  • iOS 7.0 or later

TODO

v0.2

  • add WatchDog reconnect when disconnected peripheral

Latest podspec

{
    "name": "MPBluetoothKit",
    "version": "0.1.0",
    "summary": "This is a block-based framework for building Bluetooth iOS apps using the CoreBluetooth Framework.",
    "homepage": "https://github.com/MacPu/MPBluetoothKit",
    "license": "MIT",
    "authors": {
        "MacPu": "[email protected]"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/MacPu/MPBluetoothKit.git",
        "tag": "0.1.0"
    },
    "source_files": "MPBluetoothKit/*.{h,m}"
}

Pin It on Pinterest

Share This