//
// BluetoothUtils.h
// ble sps
//
// Created by shenhark on 15/4/9.
// Copyright (c) 2015年 shenhark. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreBluetooth/CoreBluetooth.h>
#import <CoreBluetooth/CBService.h>
@protocol BluetoothUtilsDelegate <NSObject>
@optional
-(void) ScanNewPeripheralDevice:(CBPeripheral *)peripheral WithAdvertisementData:(NSDictionary*)advertiseData;
-(void) ScanCompleteNotify;
-(void) ServiceDiscCompleteNotify;
-(void) CharacterDiscCompleteNotify;
-(void) DataComeNotify:(NSUInteger)len;
-(void) DisconnectNotify;
-(void)rssiUpdate:(NSNumber *)rssi withPeripheral:(CBPeripheral *)p;
@end
@interface BluetoothUtils : NSObject <CBCentralManagerDelegate,CBPeripheralDelegate>{
}
@property (nonatomic,assign) id <BluetoothUtilsDelegate> delegate;
@property (strong, nonatomic) NSMutableArray *peripherals;
@property (strong, nonatomic) NSMutableArray *devRssi;
@property (strong, nonatomic) CBCentralManager *CM;
@property (strong, nonatomic) NSTimer *scanTimer;
@property (strong, nonatomic) CBPeripheral *activePeripheral;
@property (strong, nonatomic) NSMutableData *readBuffer;
//For Class Use
-(void) getAllCharacteristics:(CBPeripheral *)p;
- (const char *)centralManagerStateToString:(int)state;
-(CBService *)findServiceFromUUID:(CBUUID *)UUID p:(CBPeripheral *)p;
-(UInt16)swap:(UInt16)s ;
-(int) compareCBUUID:(CBUUID *) UUID1 UUID2:(CBUUID *)UUID2 ;
-(const char *)UUIDToString:(CFUUIDRef)UUID ;
-(const char *)CBUUIDToString:(CBUUID *) UUID ;
-(UInt16) CBUUIDToInt:(CBUUID *) UUID ;
-(CBCharacteristic *)findCharacteristicFromUUID:(CBUUID *)UUID service:(CBService*)service ;
//For User Use
- (int)initBLE;
- (int)beginScan:(int) timeout withServiceUUID:(NSArray *)uuids;
- (void)stopScan;
- (void)connectPeripheral:(CBPeripheral *)peripheral;
- (void) notification:(int)serviceUUID characteristicUUID:(int)characteristicUUID p:(CBPeripheral *)p on:(BOOL)on ;
- (void) writeValue:(int)serviceUUID characteristicUUID:(int)characteristicUUID p:(CBPeripheral *)p data:(NSData *)data;
- (void) readValue: (int)serviceUUID characteristicUUID:(int)characteristicUUID p:(CBPeripheral *)p ;
-(NSData *)readSppData:(NSUInteger)length;
@end
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
ble sps_iOS_Hark.zip (65个子文件)
ble sps
ble sps.xcodeproj
project.xcworkspace
contents.xcworkspacedata 152B
xcuserdata
hark.xcuserdatad
UserInterfaceState.xcuserstate 22KB
xcuserdata
hark.xcuserdatad
xcdebugger
Breakpoints_v2.xcbkptlist 3KB
xcschemes
xcschememanagement.plist 569B
ble sps.xcscheme 4KB
project.pbxproj 17KB
.DS_Store 6KB
ble sps
ViewController.m 13KB
.DS_Store 6KB
Info.plist 1KB
main.m 332B
Base.lproj
Main.storyboard 2KB
LaunchScreen.xib 4KB
Images.xcassets
AppIcon.appiconset
Contents.json 1KB
ViewController.h 1KB
AppDelegate.h 275B
AppDelegate.m 2KB
ble spsTests
Info.plist 753B
ble_spsTests.m 857B
.git
logs
HEAD 168B
refs
heads
master 168B
info
exclude 40B
index 1KB
COMMIT_EDITMSG 15B
objects
pack
b8
3b1ac181ad0f17d7cc52f96fd6adb65066e701 307B
ca
940bce50ae3103818610354489d62e5b5c8366 158B
info
db
3f0ce163c8033a175d27de6a4e96aadc115625 59B
fb
d7f9d4637f766d9b1acadd17d37068218a242c 175B
a2
be9cb618a6742cd0e9322089f53a2b3c4e944a 358B
48
98fbcc1a11bb364abaf1156cf2174761927b95 217B
36
d2c80d8893178d7e1f2964085b273959bfdc28 201B
53
bdaece5e3cb60eda1d564b876e92e7d45bc92a 99B
f5
6d2f3bb56e8474d49393008be744986bd41c3c 719B
8e
4da0401aaa843d0ecd18a79bf706612cc44a4a 69B
91
51594e2c7758e2e96f62d537eefffaad818bfe 254B
c3
bbe5ce94d2ac673b4d0e82ed7f4d46b1775518 544B
4c221ebe50e18087084bee5a796863ed47e37a 131B
76
9431c40e7b2f6d4ad25e7d3a108f26f8c23745 437B
10
47ab630a2a6045bbc1b3c5b77ceeb9803f5e57 133B
12
a8d8e497694ecbbf3d69663ce37a4bf2fad21f 3KB
3cff074d8bc519975fdada5a9fad95aff55870 163B
19
52b700156896b66c73deef105eeabc68dad16f 113B
e2
d71c164cee4cd225adbf3bb86d6762a0999079 96B
83
644d8bec1ed178f2c3a8ec46b7ad7e897a4742 289B
3e
30c7a2ec7909a8325ae740fb21d061705ab261 909B
22
e6dd120b02115e64d83a487b81717248a86937 92B
ec
1f54b33709d3496757b37a204dfe9b9a23908d 1KB
4c7ec923f31ee83ef48093c416622ae91c9f62 170B
c7
e6f6c9d02ede8cef39cb53023424778117fa0f 143B
b0
4364089fdc64fe3b81bcd41462dd55edb7a001 57B
HEAD 23B
config 137B
refs
heads
master 41B
tags
branches
hooks
pre-applypatch.sample 398B
pre-push.sample 1KB
commit-msg.sample 896B
pre-commit.sample 2KB
applypatch-msg.sample 452B
prepare-commit-msg.sample 1KB
update.sample 4KB
post-update.sample 189B
pre-rebase.sample 5KB
description 73B
BluetoothUtils
BluetoothUtils.h 2KB
BluetoothUtils.m 23KB
共 65 条
- 1
资源评论
Jims8
- 粉丝: 2
- 资源: 28
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功