@protocol AiIotDelegate <NSObject>
-/// 配置SDK,每次连接上蓝牙设备后调用
-//- (void)configSDK;
-
-
+/// 鉴权状态回调
+/// - Parameter isSuccess:是否鉴权成功
+- (void)aiIotAuthStatus:(BOOL)isSuccess;
/// 发送给蓝牙设备
/// - Parameter data: 传输的数据
@interface AiIot : NSObject
@property (nonatomic, weak) id<AiIotDelegate> delegate;
+/// 单利
+(AiIot *)shared;
-- (void)startLogin;
-
/// 将数据传输给sdk处理
/// - Parameter data: 传输的数据
- (void)sendToSdk:(NSData *)data;
#import "AiIotTools.h"
@interface AiIot()
-@property (nonatomic, strong) AiIotConnectManager *loginManager;
+@property (nonatomic, strong) AiIotConnectManager *authManager;
@property (nonatomic, strong) AiIotAudioManager *audioManager;
@end
return manager;
}
--(AiIotConnectManager *)loginManager{
- if (!_loginManager) {
- _loginManager = [[AiIotConnectManager alloc] init];
+-(AiIotConnectManager *)authManager{
+ if (!_authManager) {
+ _authManager = [[AiIotConnectManager alloc] init];
__weak typeof(self) ws = self;
- _loginManager.outputData = ^(NSData * _Nonnull data) {
+ _authManager.outputData = ^(NSData * _Nonnull data) {
[ws willSendToBle:data];
};
+ _authManager.authCallBack = ^(BOOL isSuccess) {
+
+ };
}
- return _loginManager;
+ return _authManager;
}
-(AiIotAudioManager *)audioManager{
if (!_audioManager) {
}
- (void)startLogin{
- [self.loginManager login];
+ [self.authManager login];
}
- (void)sendToSdk:(NSData *)data{
if([str hasPrefix:@"0affff64"] || [str hasPrefix:@"9c31"]){
//声音
[self.audioManager receiveData:data];
+ }
+ else if([str isEqual:@"000401"]){
+
}
else{
[self showLog:@"未实现指令"];
// uint8_t cmdType = 0x00;
// switch (cmdType) {
// case 0x00:
-// [self.loginManager receiveData:data];
+// [self.authManager receiveData:data];
// break;
// case 0x01:
// [self.audioManager receiveData:data];
- (void)showLog:(NSString *)log{
NSLog(@"%@",log);
}
+
+- (void)sendTestLP{
+ NSString *cmd = @"7B22736964223A22464753222C22766572223A312C2264617461223A227B5C227369647665725C223A312C5C226D73675F747970655C223A5C224647535F4D53475F545950455F53544152545F4647535F5245515C227D227D";
+ NSData *data = [AiIotTools hexStringToData:cmd];
+ [self willSendToBle:data];
+}
@end
self.recvData = nil;
}
else if([str hasPrefix:@"9c31"] && data.length >= 32){
- NSData *sub = [data subdataWithRange:NSMakeRange(2, data.length - 2)];
+// NSData *sub = [data subdataWithRange:NSMakeRange(3, data.length - 3)];
// [self showLog:[NSString stringWithFormat:@"截取的数据 %@",sub]];
- [self.recvData appendData:sub];
+ [self.recvData appendData:data];
}
else{
[self showLog:@"未实现指令"];
- (void)finishRecevice:(NSData *)data{
NSString *doc = NSHomeDirectory();
- NSString *fullPath = [NSString stringWithFormat:@"%@/Documents/1.pcm",doc];
+ NSString *fullPath = [NSString stringWithFormat:@"%@/Documents/2.pcm",doc];
[self showLog:[NSString stringWithFormat:@"%@",fullPath]];
NSError *err;
[data writeToFile:fullPath options:NSDataWritingAtomic error:&err];
NS_ASSUME_NONNULL_BEGIN
@interface AiIotConnectManager : NSObject
+@property (nonatomic,strong)void (^outputLog)(NSString *log);
@property (nonatomic,strong)void (^outputData)(NSData *data);
+@property (nonatomic,strong)void (^authCallBack)(BOOL isSuccess);
- (void)login;
#pragma mark - IotStateDelatege_C
- (void)onIotConnectFailed {
-// if (_stateBlock) _stateBlock(AliIotSDKBizbusState_IOT_CONNECT_FAILED);
+ [self showLog:@"LP连接失败。。。"];
+ if(self.authCallBack)self.authCallBack(false);
}
-- (void)onIotConnected {
-// if (_stateBlock) _stateBlock(AliIotSDKBizbusState_IOT_CONNECTED);
- [self showLog:@"LP连接成功。。。"];
+- (void)onIotConnecting {
+ [self showLog:@"LP连接中。。。"];
}
-- (void)onIotConnecting {
-// if (_stateBlock) _stateBlock(AliIotSDKBizbusState_IOT_CONNECTING);
+- (void)onIotConnected {
+ [self showLog:@"LP连接成功。。。"];
+ if(self.authCallBack)self.authCallBack(true);
}
- (void)onIotDisconeted {
-// if (_stateBlock) _stateBlock(AliIotSDKBizbusState_IOT_DISCONNECTED);
+ [self showLog:@"LP断开连接。。。"];
}
- (void)onLogWithLog:(NSString *)log {
}
- (void)showLog:(NSString *)log {
-// if (self.debugLogBlock) self.debugLogBlock(log);
+ if (self.outputLog) self.outputLog(log);
}
- (void)login{
--- /dev/null
+//
+//
+//#import <Foundation/Foundation.h>
+//@interface opusCodec : NSObject
+//
+//-(void)opusInit;
+//
+//-(NSData*)encodePCMData:(NSData*)data;
+//
+//-(NSData*)decodeOpusData:(NSData*)data;
+//
+//-(void)destroy;
+//
+//@end
--- /dev/null
+//
+//
+//#import "opusCodec.h"
+////
+////#import "opus.h"
+//
+//#define kDefaultSampleRate 8000
+//
+//#define WB_FRAME_SIZE 320
+//
+//@implementation opusCodec
+//
+//{
+//
+//OpusEncoder *enc;
+//
+//OpusDecoder *dec;
+//
+//unsigned char opus_data_encoder[40];
+//
+//}
+//
+//-(void)opusInit
+//
+//{
+//
+//int error;
+//
+//enc = opus_encoder_create(kDefaultSampleRate, 1, OPUS_APPLICATION_VOIP, &error);//(采样率,声道数,,)
+//
+//dec = opus_decoder_create(kDefaultSampleRate, 1, &error);
+//
+//opus_encoder_ctl(enc, OPUS_SET_BITRATE(kDefaultSampleRate));//比特率
+//
+//opus_encoder_ctl(enc, OPUS_SET_BANDWIDTH(OPUS_AUTO));//OPUS_BANDWIDTH_NARROWBAND 宽带窄带
+//
+//opus_encoder_ctl(enc, OPUS_SET_VBR(0));
+//
+//opus_encoder_ctl(enc, OPUS_SET_VBR_CONSTRAINT(1));
+//
+//opus_encoder_ctl(enc, OPUS_SET_COMPLEXITY(8));//录制质量 1-10
+//
+//opus_encoder_ctl(enc, OPUS_SET_PACKET_LOSS_PERC(0));
+//
+//opus_encoder_ctl(enc, OPUS_SET_SIGNAL(OPUS_SIGNAL_VOICE));//信号
+//
+//}
+//
+//- (NSData *)encode:(short *)pcmBuffer length:(NSInteger)lengthOfShorts
+//
+//{
+//
+//// NSLog(@"--->>lengthOfShorts = %ld size -= %lu",(long)lengthOfShorts,sizeof(short));
+//
+//int frame_size = (int)lengthOfShorts / sizeof(short);//WB_FRAME_SIZE;
+//
+//short input_frame[frame_size];
+//
+//opus_int32 max_data_bytes = 2 * WB_FRAME_SIZE ;//随便设大,此时为原始PCM大小
+//
+//memcpy(input_frame, pcmBuffer, lengthOfShorts );//frame_size * sizeof(short)
+//
+//int encodeBack = opus_encode(enc, input_frame, frame_size, opus_data_encoder, max_data_bytes);
+//
+//// NSLog(@"encodeBack===%d",encodeBack);
+//
+//if (encodeBack > 0)
+//
+//{
+//
+//NSData *decodedData = [NSData dataWithBytes:opus_data_encoder length:encodeBack];
+//
+//return decodedData;
+//
+//}
+//
+//else
+//
+//{
+//
+//return nil;
+//
+//}
+//
+//}
+//
+////int decode(unsigned char* in_data, int len, short* out_data, int* out_len) {
+//
+//-(int)decode:(unsigned char *)encodedBytes length:(int)lengthOfBytes output:(short *)decoded
+//
+//{
+//
+//int frame_size = WB_FRAME_SIZE;
+//
+//unsigned char cbits[frame_size*2];
+//
+//memcpy(cbits, encodedBytes, lengthOfBytes);
+//
+//int pcm_num = opus_decode(dec, cbits, lengthOfBytes, decoded, frame_size, 0);
+//
+//// NSLog(@"解压后长度=%d",pcm_num);
+//
+//return frame_size;
+//
+//}
+//
+//-(NSData *)encodePCMData:(NSData*)data
+//
+//{
+//
+//// NSLog(@"原始数据长度--->>%lu",(unsigned long)data.length);
+//
+//return [self encode:(short *)[data bytes] length:[data length]];
+//
+//}
+//
+//-(NSData *)decodeOpusData:(NSData*)data
+//
+//{
+//
+//int len = (int)[data length];
+//
+//Byte *byteData = (Byte*)malloc(len);
+//
+//memcpy(byteData, [data bytes], len);
+//
+//int frame_size = WB_FRAME_SIZE;
+//
+//short decodedBuffer[frame_size ];
+//
+//int nDecodedByte = sizeof(short) * [self decode:byteData length:len output:decodedBuffer];
+//
+//NSData *PCMData = [NSData dataWithBytes:(Byte *)decodedBuffer length:nDecodedByte];
+//
+//return PCMData;
+//
+//}
+//
+//-(void)destroy
+//
+//{
+//
+//opus_encoder_destroy(enc);
+//
+//opus_decoder_destroy(dec);
+//
+//}
+//
+//@end
18BF1E052B81E18800B8D90F /* ConnectKitVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18BF1E042B81E18800B8D90F /* ConnectKitVC.swift */; };
18BF1E222B83066200B8D90F /* BleManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 18BF1E212B83066200B8D90F /* BleManager.m */; };
18BF1E762B832D2E00B8D90F /* ScanVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 18BF1E752B832D2E00B8D90F /* ScanVC.m */; };
- 18BF1E7F2B83472D00B8D90F /* BleTools.m in Sources */ = {isa = PBXBuildFile; fileRef = 18BF1E7E2B83472D00B8D90F /* BleTools.m */; };
18BF1E8A2B8362D300B8D90F /* AiSdk.h in Headers */ = {isa = PBXBuildFile; fileRef = 18BF1E892B8362D300B8D90F /* AiSdk.h */; settings = {ATTRIBUTES = (Public, ); }; };
18BF1E8D2B8362D300B8D90F /* AiSdk.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 18BF1E872B8362D300B8D90F /* AiSdk.framework */; };
18BF1E8E2B8362D300B8D90F /* AiSdk.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 18BF1E872B8362D300B8D90F /* AiSdk.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
18F3238F2B8F4F7300CABA2E /* AiIotAudioManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 18F3238D2B8F4F7300CABA2E /* AiIotAudioManager.m */; };
18F323952B8F525C00CABA2E /* AiIotTools.h in Headers */ = {isa = PBXBuildFile; fileRef = 18F323932B8F525C00CABA2E /* AiIotTools.h */; };
18F323962B8F525C00CABA2E /* AiIotTools.m in Sources */ = {isa = PBXBuildFile; fileRef = 18F323942B8F525C00CABA2E /* AiIotTools.m */; };
+ 18F323A82B9095D300CABA2E /* opusCodec.h in Headers */ = {isa = PBXBuildFile; fileRef = 18F323A62B9095D300CABA2E /* opusCodec.h */; };
+ 18F323A92B9095D300CABA2E /* opusCodec.m in Sources */ = {isa = PBXBuildFile; fileRef = 18F323A72B9095D300CABA2E /* opusCodec.m */; };
8A6657BD1406314D4CBB7CEF /* libPods-MouseSdk.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0311DF3AD67ED792549B96BD /* libPods-MouseSdk.a */; };
/* End PBXBuildFile section */
18BF1E212B83066200B8D90F /* BleManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BleManager.m; sourceTree = "<group>"; };
18BF1E742B832D2E00B8D90F /* ScanVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScanVC.h; sourceTree = "<group>"; };
18BF1E752B832D2E00B8D90F /* ScanVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ScanVC.m; sourceTree = "<group>"; };
- 18BF1E7D2B83472D00B8D90F /* BleTools.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BleTools.h; sourceTree = "<group>"; };
- 18BF1E7E2B83472D00B8D90F /* BleTools.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BleTools.m; sourceTree = "<group>"; };
18BF1E872B8362D300B8D90F /* AiSdk.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AiSdk.framework; sourceTree = BUILT_PRODUCTS_DIR; };
18BF1E892B8362D300B8D90F /* AiSdk.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AiSdk.h; sourceTree = "<group>"; };
18F3235B2B8ED78300CABA2E /* ScanCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScanCell.h; sourceTree = "<group>"; };
18F3238D2B8F4F7300CABA2E /* AiIotAudioManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AiIotAudioManager.m; sourceTree = "<group>"; };
18F323932B8F525C00CABA2E /* AiIotTools.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AiIotTools.h; sourceTree = "<group>"; };
18F323942B8F525C00CABA2E /* AiIotTools.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AiIotTools.m; sourceTree = "<group>"; };
+ 18F323A62B9095D300CABA2E /* opusCodec.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = opusCodec.h; sourceTree = "<group>"; };
+ 18F323A72B9095D300CABA2E /* opusCodec.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = opusCodec.m; sourceTree = "<group>"; };
51DE1118FCBA78EBEE6FE2CD /* Pods-MouseSdk.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MouseSdk.release.xcconfig"; path = "Target Support Files/Pods-MouseSdk/Pods-MouseSdk.release.xcconfig"; sourceTree = "<group>"; };
811936622867478806C1A8BB /* Pods-MouseSdk.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MouseSdk.debug.xcconfig"; path = "Target Support Files/Pods-MouseSdk/Pods-MouseSdk.debug.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
children = (
18BF1E202B83066200B8D90F /* BleManager.h */,
18BF1E212B83066200B8D90F /* BleManager.m */,
- 18BF1E7D2B83472D00B8D90F /* BleTools.h */,
- 18BF1E7E2B83472D00B8D90F /* BleTools.m */,
);
path = Ble;
sourceTree = "<group>";
18F3238D2B8F4F7300CABA2E /* AiIotAudioManager.m */,
18F323822B8F330100CABA2E /* AiIotConnectManager.h */,
18F323832B8F330100CABA2E /* AiIotConnectManager.m */,
+ 18F323A62B9095D300CABA2E /* opusCodec.h */,
+ 18F323A72B9095D300CABA2E /* opusCodec.m */,
);
path = AiSdk;
sourceTree = "<group>";
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
+ 18F323A82B9095D300CABA2E /* opusCodec.h in Headers */,
18F3238E2B8F4F7300CABA2E /* AiIotAudioManager.h in Headers */,
18BF1E8A2B8362D300B8D90F /* AiSdk.h in Headers */,
18F323672B8F1C1900CABA2E /* AiIot.h in Headers */,
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- 18BF1E7F2B83472D00B8D90F /* BleTools.m in Sources */,
18BF1E052B81E18800B8D90F /* ConnectKitVC.swift in Sources */,
18F3235D2B8ED78300CABA2E /* ScanCell.m in Sources */,
18F323622B8F13D700CABA2E /* LogVC.m in Sources */,
buildActionMask = 2147483647;
files = (
18F3238F2B8F4F7300CABA2E /* AiIotAudioManager.m in Sources */,
+ 18F323A92B9095D300CABA2E /* opusCodec.m in Sources */,
18F323682B8F1C1900CABA2E /* AiIot.m in Sources */,
18F323962B8F525C00CABA2E /* AiIotTools.m in Sources */,
18F323852B8F330100CABA2E /* AiIotConnectManager.m in Sources */,
<key>AiSdk.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
- <integer>2</integer>
+ <integer>3</integer>
</dict>
<key>MouseSdk.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
- <integer>3</integer>
+ <integer>2</integer>
</dict>
</dict>
</dict>
#import "BleManager.h"
#import <AiSdk/AiSdk.h>
+
+#define kVoiceUUID @"0783B03E-8535-B5A0-7140-A304D2194CB8"
+//#define kUnUUID @"0783B03E-8535-B5A0-7140-A304D2495CB9"
+#define kAuthUUID @"0783B03E-8535-B5A0-7140-A304D2194CB7"
+
+
+
@interface BleManager ()<CBCentralManagerDelegate,CBPeripheralDelegate,AiIotDelegate>
@property (nonatomic,strong) NSMutableArray *scanArray;
@property(nonatomic, strong) CBCentralManager *centralManager;
@property(nonatomic, strong) CBPeripheral *connectPeripheral;
-@property(nonatomic, strong) CBCharacteristic *writeCha;
-@property(nonatomic, strong) CBCharacteristic *notifyCha;
+@property(nonatomic, strong) CBCharacteristic *authCha;
@end
if(peripheral.name == nil){
return;
}
- NSLog(@"%@",peripheral.name);
+ [self showLog:peripheral.name];
[self.scanArray insertObject:peripheral atIndex:0];
if(self.discoverDevice){
self.discoverDevice(peripheral, advertisementData);
[peripheral discoverServices:nil];
}
-(void)centralManager:(CBCentralManager *)central didDisconnectPeripheral:(CBPeripheral *)peripheral error:(NSError *)error{
-
+ [self showLog:[NSString stringWithFormat:@"断开连接。。。%@",error.description]];
}
- (void)centralManager:(CBCentralManager *)central didFailToConnectPeripheral:(CBPeripheral *)peripheral error:(nullable NSError *)error{
- NSLog(@"连接失败。。。");
+ [self showLog:[NSString stringWithFormat:@"连接失败。。。%@",error.description]];
}
#pragma mark - CBPeripheralDelegate
- (void)peripheral:(CBPeripheral *)peripheral didDiscoverServices:(NSError *)error {
// for (CBService *service in peripheral.services){
// [peripheral discoverCharacteristics:@[[CBUUID UUIDWithString:@"FED7"],[CBUUID UUIDWithString:@"FED8"]] forService:service];
+// }
+// for (CBService *service in peripheral.services){
+// [peripheral discoverCharacteristics:@[[CBUUID UUIDWithString:@"0783B03E-8535-B5A0-7140-A304D2495CB8"]] forService:service];
// }
for (CBService *service in peripheral.services){
- [peripheral discoverCharacteristics:@[[CBUUID UUIDWithString:@"0783B03E-8535-B5A0-7140-A304D2495CB8"]] forService:service];
+ [peripheral discoverCharacteristics:nil forService:service];
}
}
// }
// }
for (CBCharacteristic *characteristic in service.characteristics){
-// if ([characteristic.UUID.UUIDString isEqualToString:@"FED7"]) {
-// self.writeCha = characteristic;
-// //找到写入的uuid后,调用sdk配置方法
-//// [AliIot.shareInstance configSDK];
-// }
- if ([characteristic.UUID.UUIDString isEqualToString:@"0783B03E-8535-B5A0-7140-A304D2495CB8"]) {
- self.notifyCha = characteristic;
+ if ([characteristic.UUID.UUIDString isEqualToString:kAuthUUID]) {
+ self.authCha = characteristic;
+ //找到写入的uuid后,调用sdk配置方法
+// [AliIot.shareInstance configSDK];
+ [peripheral setNotifyValue:YES forCharacteristic:characteristic];
+ }
+ if ([characteristic.UUID.UUIDString isEqualToString:kAuthUUID] ||
+ [characteristic.UUID.UUIDString isEqualToString:kVoiceUUID]
+ ) {
[peripheral setNotifyValue:YES forCharacteristic:characteristic];
}
}
}
- (void)sendToBle:(NSData *)data{
- NSLog(@"[send] %@",data);
- [self.connectPeripheral writeValue:data forCharacteristic:self.writeCha type:CBCharacteristicWriteWithoutResponse];
+ [self showLog:[NSString stringWithFormat:@"[send] %@",data]];
+ [self.connectPeripheral writeValue:data forCharacteristic:self.authCha type:CBCharacteristicWriteWithoutResponse];
}
- (void)receiveDataFromBle:(NSData *)data{
- NSLog(@"[receive] %@",data);
+ [self showLog:[NSString stringWithFormat:@"[receive] %@",data]];
[[AiIot shared] sendToSdk:data];
}
+
+- (void)showLog:(NSString *)log{
+ NSLog(@"%@",log);
+}
@end
+++ /dev/null
-//
-// BleTools.h
-// MouseSdk
-//
-// Created by incar on 2024/2/19.
-//
-
-#import <Foundation/Foundation.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface BleTools : NSObject
-+ (NSData *)dataWithHexString:(NSString *)hexStr;
-@end
-
-NS_ASSUME_NONNULL_END
+++ /dev/null
-//
-// BleTools.m
-// MouseSdk
-//
-// Created by incar on 2024/2/19.
-//
-
-#import "BleTools.h"
-
-@implementation BleTools
-+ (NSData *)dataWithHexString:(NSString *)hexStr {
- hexStr = [hexStr stringByReplacingOccurrencesOfString:@" " withString:@""];
- hexStr = [hexStr lowercaseString];
- NSUInteger len = hexStr.length;
- if (!len) return nil;
- unichar *buf = malloc(sizeof(unichar) * len);
- if (!buf) return nil;
- [hexStr getCharacters:buf range:NSMakeRange(0, len)];
-
- NSMutableData *result = [NSMutableData data];
- unsigned char bytes;
- char str[3] = { '\0', '\0', '\0' };
- int i;
- for (i = 0; i < len / 2; i++) {
- str[0] = buf[i * 2];
- str[1] = buf[i * 2 + 1];
- bytes = strtol(str, NULL, 16);
- [result appendBytes:&bytes length:1];
- }
- free(buf);
- return result;
-}
-@end
#import "LogVC.h"
#import "Ble/BleManager.h"
-#import "Ble/BleTools.h"
@interface LogVC()
@property (nonatomic,strong) NSTextField *textField;
@end
#import "ScanVC.h"
#import "ScanCell.h"
#import "Ble/BleManager.h"
-#import "Ble/BleTools.h"
+//#import "Ble/BleTools.h"
@interface ScanVC ()<NSTableViewDelegate,NSTableViewDataSource>
@property (nonatomic,strong) NSTableView *tableView;
@property (nonatomic,strong) NSMutableArray<CBPeripheral *> *scanArray;
#import "ViewController.h"
#import "ScanVC.h"
-#import "AliIotTools.h"
+#import "AiIotTools.h"
#import "Ble/BleManager.h"
-#import "Ble/BleTools.h"
@interface ViewController ()
}
- (void)checkFGSStatus{
-// [[AiIot shared] startLogin];
+ NSString *cmd = @"7B22736964223A22464753222C22766572223A312C2264617461223A227B5C227369647665725C223A312C5C226D73675F747970655C223A5C224647535F4D53475F545950455F53544152545F4647535F5245515C227D227D";
+ NSData *data = [AiIotTools hexStringToData:cmd];
+ [[BleManager shared] sendToBle:data];
}
- (void)connectLp{