相关疑难解决方法(0)

iOS核心蓝牙不要求配对

在我最近的项目中,我需要通信硬件(蓝牙低功耗).我已经实现了所有委托方法代码.我能够连接硬件和设备,但我没有得到配对警报(附加屏幕截图).为什么不要求配对?谢谢.

  #import "BTWCentralConnectionManager.h"

    @implementation BTWCentralConnectionManager

    @synthesize cbcManager;

    @synthesize discoveredPeripheral;

    @synthesize findMeServiceCharacteristic;

    @synthesize findMeService;

    @synthesize delegate=_delegate;

    static NSString *kFindMeServiceUUID=@"1802";

    static NSString *kFindMeCharacteristicUUID=@"2A06";

    static BTWCentralConnectionManager* connectionManager = nil;

    +(BTWCentralConnectionManager *)sharedConnectionManager{

    @synchronized(self)

    {

        if (!connectionManager){

            connectionManager=[[self alloc] init];


        }

        return connectionManager;

    }

    return nil;

}


    -(void)findMe {

    Byte code=0x02;

    if(self.discoveredPeripheral){

        [self.discoveredPeripheral writeValue:[NSData dataWithBytes:&code length:1] forCharacteristic:self.findMeServiceCharacteristic type:CBCharacteristicWriteWithoutResponse];


    }else{

        UIAlertView *alertView=[[UIAlertView alloc] initWithTitle:@"Test" message:@"Invalid Charactersitcs" delegate:nil cancelButtonTitle:nil     otherButtonTitles:@"OK", nil];

        [alertView show];

        alertView=nil;

    }
}

-(void)searchForDevices{

    self.cbcManager=[[CBCentralManager alloc] initWithDelegate:self queue:nil];

}

    -(void)connect {

    NSDictionary* connectOptions = …
Run Code Online (Sandbox Code Playgroud)

iphone bluetooth ios ios5 core-bluetooth

12
推荐指数
1
解决办法
1万
查看次数

标签 统计

bluetooth ×1

core-bluetooth ×1

ios ×1

ios5 ×1

iphone ×1