Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/MacPu/MPBluetoothKit
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
https://github.com/MacPu/MPBluetoothKit
Last synced: about 2 months ago
JSON representation
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
- Host: GitHub
- URL: https://github.com/MacPu/MPBluetoothKit
- Owner: MacPu
- License: mit
- Created: 2015-10-29T07:17:02.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-12-13T15:20:26.000Z (about 9 years ago)
- Last Synced: 2024-11-14T08:18:24.284Z (2 months ago)
- Language: Objective-C
- Size: 218 KB
- Stars: 164
- Watchers: 7
- Forks: 30
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - MPBluetoothKit - 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. (OOM-Leaks-Crash / Bluetooth)
README
#MPBluetoothKit
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
```object-c
import "MPBluetoothKit.h"
```
### cocoapods
```
pod 'MPBluetoothKit','~> 0.1.0'
```
then
```
import "MPBluetoothKit.h"
```###Scan for peripheral
```object-c
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
```object-c
[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```object-c
[peripheral readValueForCharacteristic:(nullable MPCharacteristic *)characteristic withBlock:^(MPPeripheral *peripheral,MPCharacteristic *characteristic,NSError *error){}];
```
```object-c
[characteristic readValueWithBlock:^(MPPeripheral *peripheral,MPCharacteristic *characteristic,NSError *error){}];
```
###Write to a Characteristic
there is two way to write to a characteristic```object-c
[peripheral writeValue:(nullable NSData *)data
forCharacteristic:(nullable MPCharacteristic *)characteristic
type:(CBCharacteristicWriteType)type
withBlock:^(MPPeripheral *peripheral,MPCharacteristic *characteristic,NSError *error){
}];
```
```object-c
[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