You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
106 lines
1.7 KiB
106 lines
1.7 KiB
// |
|
// BluetoothTool.h |
|
// BluetoothDemo |
|
// |
|
// Created by mac on 17/3/16. |
|
// Copyright © 2017年 . All rights reserved. |
|
// |
|
|
|
#import <Foundation/Foundation.h> |
|
#import <AddressBook/AddressBook.h> //通讯录库 |
|
#import "BlueToothEume.h" |
|
|
|
@interface BluetoothTool : NSObject |
|
|
|
/** |
|
CRC校验数据是否正确 |
|
*/ |
|
+ (BOOL)checkCRCWithData:(NSMutableData *)data; |
|
|
|
|
|
/** |
|
* 16进制字符串转10进制数字 |
|
* |
|
* @param hexString 16进制字符串 |
|
* |
|
* @return 十进制数据 |
|
*/ |
|
+ (int)intFromHexSrting:(NSString *)hexString; |
|
|
|
|
|
/** |
|
10进制转16进制字符串 |
|
|
|
@param hexNumber 10进制 |
|
|
|
@return 十六进制字符串 |
|
*/ |
|
+ (NSString *)stringWithHexNumber:(int)hexNumber; |
|
|
|
|
|
/** |
|
获取系统当前时区时间数据 |
|
*/ |
|
+ (NSData *)getCurrenTime; |
|
|
|
|
|
/** |
|
获取当前手机中的通讯录(字节流) |
|
|
|
@return 20个联系人为一个数据,用数组将所有返回 |
|
*/ |
|
+ (NSMutableArray *)getCurrenContactPeploe; |
|
|
|
/** |
|
获取当前手机中的通讯录 |
|
|
|
@return 所有联系人数据 |
|
*/ |
|
+ (NSMutableArray *)contactPeploe; |
|
|
|
|
|
/** |
|
将时间戳转数组为Data发送给设备 |
|
|
|
@param timeArr 时间戳数组 |
|
@param type 请求类型 |
|
|
|
*/ |
|
+ (NSData *)getTimeDataWithTime:(NSArray *)timeArr |
|
cmdType:(BleCMD)type; |
|
|
|
/** |
|
将闹钟数据转成Data |
|
|
|
@param arr 闹钟数组 |
|
|
|
*/ |
|
+ (NSData *)getAlarmClockDataWithArr:(NSArray *)arr; |
|
|
|
|
|
/** |
|
构造L1层第二个字节 |
|
|
|
@param err 1:对的 0:错的 |
|
@param ack 1:回复 0:命令 |
|
@param vision 版本 |
|
*/ |
|
+ (Byte)stitchWithErr:(int)err |
|
Ack:(int)ack |
|
Vision:(int)vision; |
|
|
|
|
|
/** |
|
倒序mac地址 |
|
*/ |
|
+ (NSString *)getInvertedOrderMacWithData:(NSData *)data; |
|
|
|
|
|
/** |
|
正序mac地址 |
|
*/ |
|
+ (NSString *)getPositiveSequenceMacWithData:(NSData *)data; |
|
|
|
|
|
|
|
@end
|
|
|