谁有腾讯来电lightalkhroon的 id号

iOS 问题:有谁在做蓝牙4.0吗?咱一起探讨探讨。 -
有谁在做蓝牙4.0吗?咱一起探讨探讨。
共有 64 个回答
哥们,情况如何?
登录后方可回复
哪位哥们处理个这个问题呢?
//中心读取外设实时数据
- (void)peripheral:(CBPeripheral *)peripheral didUpdateNotificationStateForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error {
if (error) {
NSLog(@"Error changing notification state: %@", error.localizedDescription);
打印错误如下:
EMS[1687:60b] Notification stopped on &CBCharacteristic: 0x15584ea0 UUID = FF01, Value = (null), Properties = 0x4, Notifying = NO, Broadcasting = NO&.
Disconnecting
登录后方可回复
写服务的时候传值很郁闷
登录后方可回复
@有些人注定是用来怀念的 : 哥们儿
为什么我只要通过这种方法创建中心角色cm = [[CBCentralManager alloc] initWithDelegate:self queue:nil];程序一运行就直接崩溃
但是CBCentralManager*cm = [[CBCentralManager alloc] initWithDelegate:self queue:nil];这样创建又没事了?求指点
刚接触蓝牙被逼着搞这块儿
登录后方可回复
看看这个:
登录后方可回复
设备断开后调用的函数是哪个呢?CoreBluetooth
登录后方可回复
You can search "TemperatureSensor" in the XCode Organizer documentation
And you need to restart the scanning function if the device is disconnected:
/** Once the disconnection happens, we need to clean up our local copy of the peripheral
- (void)centralManager:(CBCentralManager *)central didDisconnectPeripheral:(CBPeripheral *)peripheral error:(NSError *)error
NSLog(@"Peripheral Disconnected");
[discoveredPeripheral release];
discoveredPeripheral =
// We're disconnected, so start scanning again
[self scan];
登录后方可回复
@Code4appDev : mark
登录后方可回复
谢谢,我找到这个方法了。还有一个问题,我扫描到服务后,然后调用- (void)connectPeripheral:(CBPeripheral *)peripheral options:(NSDictionary *)方法,有时候回调方法-(void)centralManager:(CBCentralManager *)central didConnectPeripheral:(CBPeripheral *)peripheral执行的很慢,很久才能连接上遍历服务,请问这是怎么回事?
登录后方可回复
Since the CoreBluetooth framework for the iOS is not really stable, sometimes it will spend about 4s to connect the device.
It should be according to the bluetooth device that you want to connect.
If it is the other external bluetooth hardware, it should be connected within 1s.
If you use back the other iOS device and waiting for the connection, it will take much longer time or fail to connect.
So I suggest you to implement the this delegate:
/** If the connection fails for whatever reason, we need to deal with it.
- (void)centralManager:(CBCentralManager *)central didFailToConnectPeripheral:(CBPeripheral *)peripheral error:(NSError *)error
NSLog(@"Failed to connect to %@. (%@)", peripheral, [error localizedDescription]);
[self cleanup];
But sometime, the CoreBluetooth will become hang in status while it try to connect to the iOS device.
And it may be fixed by restarting the bluetooth in the iOS device or you need to restart your iOS device.
It seems that we need to wait for Apple to fix this issue.
登录后方可回复
@Code4appDev : 你好,碰到一个类似的问题。反复连接单片机a之后,会出现再也连接不上的情况。只要重启蓝牙或者先去连接另外一块单片机b之后,再回来连接单片机a就可以连接成功。不知道如何解决,请教!!!
登录后方可回复
for the -(void)cleanup function:
/** Call this when things either go wrong, or you're done with the connection.
This cancels any subscriptions if there are any, or straight disconnects if not.
(didUpdateNotificationStateForCharacteristic will cancel the connection if a subscription is involved)
- (void)cleanup
// Don't do anything if we're not connected
if (!discoveredPeripheral.isConnected) {
// See if we are subscribed to a characteristic on the peripheral
if (discoveredPeripheral.services != nil) {
for (CBService *service in discoveredPeripheral.services) {
if (service.characteristics != nil) {
for (CBCharacteristic *characteristic in service.characteristics) {
if ([characteristic.UUID isEqual:[CBUUID UUIDWithString:myCharacteristicUUID]]) {
if (characteristic.isNotifying) {
// It is notifying, so unsubscribe
[discoveredPeripheral setNotifyValue:NO forCharacteristic:characteristic];
// And we're done.
// If we've got this far, we're connected, but we're not subscribed, so we just disconnect
[centralManager cancelPeripheralConnection:discoveredPeripheral];
登录后方可回复
@Code4appDev : 你好,在ios8之后,readRSSI的代理方法不回调,不知道有没有什么解决方法,
登录后方可回复
@za&&j : 扫描的时候
用下面的语句
但是我没有测试这样
会不会对发送数据和接受数据有影响
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber
numberWithBool:YES], CBCentralManagerScanOptionAllowDuplicatesKey, nil];
[_centralManager scanForPeripheralsWithServices:nil options:options];
会调用这个方法返回RSSI
- (void)peripheral:(CBPeripheral *)peripheral didReadRSSI:(NSNumber *)RSSI error:(NSError *)error
登录后方可回复
@za&&j : 你好,看到你说iOS8之后怎么样,想必你用过iOS8开发蓝牙程序了。我之前一直用的iOS7.1,现在升级之后运行在iOS8.0及以上版本,无法扫描到蓝牙,但是我用7.1.2的时候没出现这种问题。如果你能帮我解答的话,不胜感激
登录后方可回复
@za&&j : 交流一下,在吗?
登录后方可回复
@失-静-求 : 蓝牙模块不兼容
登录后方可回复
@可乐加冰 : ios 8以上的蓝牙 扫描不到设备,怎么处理呢?谢谢啊
登录后方可回复
可以简单讲一下蓝牙4.0连接的步骤吗?
是不是因为我步骤错误,所以连接有问题呢?
登录后方可回复
First of All, in the .h, you should implement the CoreBluetooth delegate
@interface BlueToothClient : NSObject & CBCentralManagerDelegate, CBPeripheralDelegate&
And then create the CBCentralManager instance in .m,
// Start up the CBCentralManager
centralManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil];
---------------Step 1---------------
/** Scan for peripherals - specifically for our service's 128bit CBUUID
- (void)scan
[centralManager scanForPeripheralsWithServices:@[[CBUUID UUIDWithString:myServicUUID]]
options:@{ CBCentralManagerScanOptionAllowDuplicatesKey : @YES }];
---------------Step 2---------------
/** This callback comes whenever a peripheral that is advertising the TRANSFER_SERVICE_UUID is discovered.
We check the RSSI, to make sure it's close enough that we're interested in it, and if it is,
we start the connection process
- (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI
//NSLog(@"Discovered %@ at %@", peripheral.name, RSSI);
// Ok, it's in range - have we already seen it?
if (discoveredPeripheral != peripheral) {
// Save a local copy of the peripheral, so CoreBluetooth doesn't get rid of it
discoveredPeripheral =
[discoveredPeripheral retain];
// And connect
NSLog(@"Connecting to peripheral %@", peripheral);
[centralManager connectPeripheral:peripheral options:nil];
---------------Step 3---------------
/** We've connected to the peripheral, now we need to discover the services and characteristics to find the 'transfer' characteristic.
- (void)centralManager:(CBCentralManager *)central didConnectPeripheral:(CBPeripheral *)peripheral
NSLog(@"Peripheral Connected");
// Stop scanning
[centralManager stopScan];
NSLog(@"Scanning stopped");
// Make sure we get the discovery callbacks
peripheral.delegate =
// Search only for services that match our UUID
[peripheral discoverServices:@[[CBUUID UUIDWithString:myServicUUID]]];
---------------Step 4---------------
/** The Transfer Service was discovered
- (void)peripheral:(CBPeripheral *)peripheral didDiscoverServices:(NSError *)error
if (error) {
NSLog(@"Error discovering services: %@", [error localizedDescription]);
[self cleanup];
// Discover the characteristic we want...
// Loop through the newly filled peripheral.services array, just in case there's more than one.
for (CBService *service in peripheral.services) {
[peripheral discoverCharacteristics:@[[CBUUID UUIDWithString:myCharacteristicUUID]] forService:service];
---------------Step 5---------------
/** The Transfer characteristic was discovered.
Once this has been found, we want to subscribe to it, which lets the peripheral know we want the data it contains
- (void)peripheral:(CBPeripheral *)peripheral didDiscoverCharacteristicsForService:(CBService *)service error:(NSError *)error
// Deal with errors (if any)
if (error) {
NSLog(@"Error discovering characteristics: %@", [error localizedDescription]);
[self cleanup];
// Again, we loop through the array, just in case.
for (CBCharacteristic *characteristic in service.characteristics) {
// And check if it's the right one
if ([characteristic.UUID isEqual:[CBUUID UUIDWithString:myCharacteristicUUID]]) {
// If it is, subscribe to it
[peripheral setNotifyValue:YES forCharacteristic:characteristic];
// Once this is complete, we just need to wait for the data to come in.
---------------Step 6---------------
/** This callback lets us know more data has arrived via notification on the characteristic
- (void)peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error
NSString *stringFromData = [[NSString alloc] initWithData:characteristic.value encoding:NSUTF8StringEncoding];
printf("stringFromData %s\n", [stringFromData UTF8String]);
if (error) {
NSLog(@"Error didUpdateValueForCharacteristic: %@", [error localizedDescription]);
NSLog(@"Received: %@", stringFromData);
---------------Step 7---------------
//For status change handling
/** The peripheral letting us know whether our subscribe/unsubscribe happened or not
- (void)peripheral:(CBPeripheral *)peripheral didUpdateNotificationStateForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error
if (error) {
NSLog(@"Error changing notification state: %@", error.localizedDescription);
// Exit if it's not the transfer characteristic
if (![characteristic.UUID isEqual:[CBUUID UUIDWithString:myCharacteristicUUID]]) {
// Notification has started
if (characteristic.isNotifying) {
NSLog(@"Notification began on %@", characteristic);
// Notification has stopped
// so disconnect from the peripheral
NSLog(@"Notification stopped on %@.
Disconnecting", characteristic);
[centralManager cancelPeripheralConnection:peripheral];
/** Once the disconnection happens, we need to clean up our local copy of the peripheral
- (void)centralManager:(CBCentralManager *)central didDisconnectPeripheral:(CBPeripheral *)peripheral error:(NSError *)error
NSLog(@"Peripheral Disconnected");
[discoveredPeripheral release];
discoveredPeripheral =
// We're disconnected, so start scanning again
[self scan];
登录后方可回复
谢啦!我再仔细研究研究。
我以前是先扫描列表,然后再点击列表进行连接,遍历服务。
您的做法是遍历所有设备的服务,这样的话会不会太浪费资源啊?
登录后方可回复
No, It will only scan for the specific myServicUUID
[centralManager scanForPeripheralsWithServices:@[[CBUUID UUIDWithString:myServicUUID]]
// Search only for services that match our UUID
[peripheral discoverServices:@[[CBUUID UUIDWithString:myServicUUID]]];
登录后方可回复
CBConcretePeripheral: 0x8abf020 UUID =
16E72F7B-3DE9-0D33-1ADC-CB7FB4CB523A
这个128位的CBUUID是设备连接的唯一标示,但是当手机重置后这个CBUUID会改变,我怎么确定我的设备的CBUUID呢?
登录后方可回复
In delegate of - (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI
your can get back the target bluetooth device UUID by peripheral.UUID
登录后方可回复
You can try to see the demo save and load function:
- (void) addSavedDevice:(CFUUIDRef) uuid
*storedDevices = [[NSUserDefaults standardUserDefaults] arrayForKey:@"StoredDevices"];
NSMutableArray *newDevices
CFStringRef
uuidString
if (![storedDevices isKindOfClass:[NSArray class]]) {
NSLog(@"Can't find/create an array to store the uuid");
newDevices = [NSMutableArray arrayWithArray:storedDevices];
uuidString = CFUUIDCreateString(NULL, uuid);
if (uuidString) {
[newDevices addObject:(NSString*)uuidString];
CFRelease(uuidString);
/* Store */
[[NSUserDefaults standardUserDefaults] setObject:newDevices forKey:@"StoredDevices"];
[[NSUserDefaults standardUserDefaults] synchronize];
- (void) loadSavedDevices
NSArray *storedDevices = [[NSUserDefaults standardUserDefaults] arrayForKey:@"StoredDevices"];
if (![storedDevices isKindOfClass:[NSArray class]]) {
NSLog(@"No stored array to load");
for (id deviceUUIDString in storedDevices) {
if (![deviceUUIDString isKindOfClass:[NSString class]])
CFUUIDRef uuid = CFUUIDCreateFromString(NULL, (CFStringRef)deviceUUIDString);
if (!uuid)
[centralManager retrievePeripherals:[NSArray arrayWithObject:(id)uuid]];
CFRelease(uuid);
And the delegate function for the Retrieve Peripheral
- (void) centralManager:(CBCentralManager *)central didRetrieveConnectedPeripherals:(NSArray *)peripherals
CBPeripheral *
/* Add to list. */
for (peripheral in peripherals) {
[central connectPeripheral:peripheral options:nil];
- (void) centralManager:(CBCentralManager *)central didRetrievePeripheral:(CBPeripheral *)peripheral
[central connectPeripheral:peripheral options:nil];
登录后方可回复
我想再请问一下,如果我想让程序在后台调用回调方法- (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI方法改怎么办?
我发现在后台的时候程序只能调用启-(void)centralManagerDidUpdateState:(CBCentralManager *)central
登录后方可回复
First of all, if you want to use this delegate "- (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI" in background, you need to follow two step:
Step 1: Add the key "Required background modes" in the info plist with value "App communicates using CoreBluetooth"
Step 2: You can only scan the bluetooth 4.0 device with the specific service in background.
You are not allowed to scan any of the bluetooth 4.0 device in background. This means that you cannot pass nil in the service array of the scanning method. You need to pass the specific service array, e.g.
[centralManager scanForPeripheralsWithServices:@[[CBUUID UUIDWithString:@"180d"]] options:options];
//Scan for the any bluetooth 4.0 device with "Heart beat service" support
登录后方可回复
@Code4appDev :
thanks for all your answers!
Its' so useful to me.
登录后方可回复
@Code4appDev :你好,我想请问一下,为什么当我进行一次扫描时只会触发-(void)centralManagerDidUpdateState:(CBCentralManager *)central 方法,需要再次进行扫描才会触发- (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI方法。
登录后方可回复
感谢您对我问题的回答,麻烦了。
登录后方可回复
正好需要这方面的东西 mark下。。。。
登录后方可回复
有个问题想请教一下 ,我现在扫描外设的UUID 为什么扫描不到呢?
我是这么写的
[_centralManger scanForPeripheralsWithServices:@[[CBUUID UUIDWithString:@“0xFFE0”] ] options:@{ CBCentralManagerScanOptionAllowDuplicatesKey : @YES, CBCentralManagerOptionRestoreIdentifierKey :@YES }];
现在奇怪的是我想要连接的外设的SeverUUID确实是0xFFE0,但是我扫描这个UUID的时候就是扫描不到,
当我[_centralManger scanForPeripheralsWithServices:nil options:nil];这么写的时候就能扫描到外设,连接成功后打印出来的SeverUUID也是0xFFE0
登录后方可回复
I think you service uuid should be [CBUUID UUIDWithString:@"ffe0"] instead of [CBUUID UUIDWithString:@"0xFFE0"].
The service UUID should be a string and 0xFFE0 looks like a hex string.
or you can try this remove the option CBCentralManagerOptionRestoreIdentifierKey:
[centralManager scanForPeripheralsWithServices:@[[CBUUID UUIDWithString:@"0xFFE0"] ] options:@{ CBCentralManagerScanOptionAllowDuplicatesKey : @YES}];
登录后方可回复
@Code4appDev : 能不能告诉我如何才能将ios设备写成外设的形式
updateValue:forCharacteristic:onSubscribedCentrals:
这个方法该怎么用
怎样才能让它一直发送数据呢
用另一台设备发送setnotify的时候会执行这个方法: peripheralManager:central:didSubscribeToCharacteristic:
登录后方可回复
My apps same as below code,but can`t get data from remote peripheral device using - (void)peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error
Any comment and pointer will be welcome. Thanks.
;==============================================
// Start up the CBCentralManager
centralManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil];
---------------Step 1---------------
/** Scan for peripherals - specifically for our service's 128bit CBUUID
- (void)scan
[centralManager scanForPeripheralsWithServices:@[[CBUUID UUIDWithString:myServicUUID]]
options:@{ CBCentralManagerScanOptionAllowDuplicatesKey : @YES }];
---------------Step 2---------------
/** This callback comes whenever a peripheral that is advertising the TRANSFER_SERVICE_UUID is discovered.
* We check the RSSI, to make sure it's close enough that we're interested in it, and if it is,
* we start the connection process
- (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI
//NSLog(@"Discovered %@ at %@", peripheral.name, RSSI);
// Ok, it's in range - have we already seen it?
if (discoveredPeripheral != peripheral) {
// Save a local copy of the peripheral, so CoreBluetooth doesn't get rid of it
discoveredPeripheral =
[discoveredPeripheral retain];
// And connect
NSLog(@"Connecting to peripheral %@", peripheral);
[centralManager connectPeripheral:peripheral options:nil];
---------------Step 3---------------
/** We've connected to the peripheral, now we need to discover the services and characteristics to find the 'transfer' characteristic.
- (void)centralManager:(CBCentralManager *)central didConnectPeripheral:(CBPeripheral *)peripheral
NSLog(@"Peripheral Connected");
// Stop scanning
[centralManager stopScan];
NSLog(@"Scanning stopped");
// Make sure we get the discovery callbacks
peripheral.delegate =
// Search only for services that match our UUID
[peripheral discoverServices:@[[CBUUID UUIDWithString:myServicUUID]]];
---------------Step 4---------------
/** The Transfer Service was discovered
- (void)peripheral:(CBPeripheral *)peripheral didDiscoverServices:(NSError *)error
if (error) {
NSLog(@"Error discovering services: %@", [error localizedDescription]);
[self cleanup];
// Discover the characteristic we want...
// Loop through the newly filled peripheral.services array, just in case there's more than one.
for (CBService *service in peripheral.services) {
[peripheral discoverCharacteristics:@[[CBUUID UUIDWithString:myCharacteristicUUID]] forService:service];
---------------Step 5---------------
/** The Transfer characteristic was discovered.
* Once this has been found, we want to subscribe to it, which lets the peripheral know we want the data it contains
- (void)peripheral:(CBPeripheral *)peripheral didDiscoverCharacteristicsForService:(CBService *)service error:(NSError *)error
// Deal with errors (if any)
if (error) {
NSLog(@"Error discovering characteristics: %@", [error localizedDescription]);
[self cleanup];
// Again, we loop through the array, just in case.
for (CBCharacteristic *characteristic in service.characteristics) {
// And check if it's the right one
if ([characteristic.UUID isEqual:[CBUUID UUIDWithString:myCharacteristicUUID]]) {
// If it is, subscribe to it
[peripheral setNotifyValue:YES forCharacteristic:characteristic];
// Once this is complete, we just need to wait for the data to come in.
---------------Step 6---------------
/** This callback lets us know more data has arrived via notification on the characteristic
- (void)peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error
NSString *stringFromData = [[NSString alloc] initWithData:characteristic.value encoding:NSUTF8StringEncoding];
printf("stringFromData %s\n", [stringFromData UTF8String]);
if (error) {
NSLog(@"Error didUpdateValueForCharacteristic: %@", [error localizedDescription]);
NSLog(@"Received: %@", stringFromData);
---------------Step 7---------------
//For status change handling
/** The peripheral letting us know whether our subscribe/unsubscribe happened or not
- (void)peripheral:(CBPeripheral *)peripheral didUpdateNotificationStateForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error
if (error) {
NSLog(@"Error changing notification state: %@", error.localizedDescription);
// Exit if it's not the transfer characteristic
if (![characteristic.UUID isEqual:[CBUUID UUIDWithString:myCharacteristicUUID]]) {
// Notification has started
if (characteristic.isNotifying) {
NSLog(@"Notification began on %@", characteristic);
// Notification has stopped
// so disconnect from the peripheral
NSLog(@"Notification stopped on %@. Disconnecting", characteristic);
[centralManager cancelPeripheralConnection:peripheral];
/** Once the disconnection happens, we need to clean up our local copy of the peripheral
- (void)centralManager:(CBCentralManager *)central didDisconnectPeripheral:(CBPeripheral *)peripheral error:(NSError *)error
NSLog(@"Peripheral Disconnected");
[discoveredPeripheral release];
discoveredPeripheral =
// We're disconnected, so start scanning again
[self scan];
登录后方可回复
My peripheral device is OEM device and can working fine with OEM iOS apps, but my apps and light blue can`t get any data after paired, but if I open OEM apps and pair with it then closed OEM apps, and then open my apps or light blue, at this time my apps or lighteblue tools can update data by using [peripheral setNotifyValue:YES forCharacteristic:characteristic];
I don`t know that the OEM device used which encryption method then cause my apps can`t get data? Please give me a hand. Thanks.
登录后方可回复
做过一个蓝牙的
传输肌电信号的
登录后方可回复
@傻狍子 : 你好,我们最近在做iOS蓝牙与医疗设备连接的,我连接上以后,过大概3秒钟后就自动断开了,这是为什么啊,因为我们要一直获取波形,所以是不能让他断开的,有什么办法么?我们的外设是蓝牙双模的,
登录后方可回复
@若相惜、卟弃 : 你好
蓝牙连接后断开的问题找到了么
能解决了不
登录后方可回复
还是不要尝试,调用苹果私有api。。。。
登录后方可回复
遇到这么热心的人,多谢Bruce,能够回答这么详细。
我想请问一下,每个Bluetooth设备是不是只一个唯一的UUID? 如果多个iOS设备来同时连接这唯一的UUID,Bluetooth设置到底响应谁?
登录后方可回复
我还真的搞定了BLE,最主要是用UUID来确定你要干的事情,特征和服务的UUID都是外设定义好的。我们只需要读取,确定你要读取什么的时候,就去判断UUID是否相符。
一般来说我们使用的iPhone都是做centralManager的,蓝牙模块是peripheral的,所以我们是want datas,需要接受数据。
1.判断状态为powerOn,然后执行扫描
2.停止扫描,连接外设
3.连接成功,寻找服务
4.在服务里寻找特征
5.为特征添加通知
5.通知添加成功,那么就可以实时的读取value[也就是说只要外设发送数据[一般外设的频率为10Hz],代理就会调用此方法]。
6.处理接收到的value,[hex值,得转换]
之后就自由发挥了,在这期间都是通过代理来实现的,也就是说你只需要处理你想要做的事情,代理会帮你调用方法。[别忘了添加代理]
登录后方可回复
@芯片公司 : 大神,可以请教一下不,我现在遇到了问题:
我发送命令是OK的,设备可以接收数据,设备发送到手机的时候,下面这个回调报Error,外设返回的值为空,并且发送数据之前我设置了setNotifyValue:Y
- (void)peripheral:(CBPeripheral *)peripheral didUpdateNotificationStateForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error {
if (error) {
NSLog(@"Error changing notification state: %@", error.localizedDescription);
error 的信息为&CBCharacteristic: 0x175c31f0 UUID = FF01, Value = (null), Properties = 0x4, Notifying = NO, Broadcasting = NO&
登录后方可回复
点击连接,在app中进行蓝牙搜索, 怎样把搜索到的蓝牙设备显示到tableview中呢?CoreBluetooth 框架
UUID又是什么意思呢?代码里要写特定的吗?
登录后方可回复
当身边有多个蓝牙设备的时候,请问靠啥区分是哪个是应当正确连接的蓝牙设备呢?
peripheral.UUID
? 这个好像也变化啊?
peripheral.Name
? 还是啥呢?
登录后方可回复
@左岸龙空 : 找到你要连接的蓝牙名称,然后找到对应的peripheral connection 就可以了
登录后方可回复
问下 当我的程序搜索不到蓝牙设备时有没有代理方法可以走啊 因为我有些方法要在他没有搜索到蓝牙设备时调用
登录后方可回复
我通过scanForPeripheralsWithServices找不到UUID为1800的设备。。。不知道怎么弄了,同样的UUID在android代码上可以读、写数据。
登录后方可回复
mark mark .好东西
登录后方可回复
请问一下,能不能获得扫描蓝牙列表的各个蓝牙的名字,我想做一款通过扫描到特定蓝牙名字,就能执行一些操作的软件。不知道可不可以,安卓的貌似就可以,苹果的可以吗?
登录后方可回复
请问一下,能不能获得扫描蓝牙列表的各个蓝牙的名字,我想做一款通过扫描到特定蓝牙名字,就能执行一些操作的软件。不知道可不可以,安卓的貌似就可以,苹果的可以吗?
登录后方可回复
@小船漂沧海 : centralManager 有个协议 就是发现蓝牙设备,Peripheral.name就能能拿到名字
登录后方可回复
苹果手机软件可以连接蓝牙打印机吗?
登录后方可回复
手机蓝牙连接打印如何发送数据,请问各位大神
登录后方可回复
@love玖灵 : 应该有通讯协议把,根据那个协议发送数据.
登录后方可回复
我也有个问题
第二次尝试连接BLE时,连接成功后立刻自动断开连接;之后不论怎么连接,都是立刻就断开,只有在系统设置的蓝牙里面把这个蓝牙设备忽略掉,变成未配对状态,才能再次进行连接,但是这时候就要重新配对,可这不是我想要的结果:我希望iOS设备与BLE断开连接后,能够自动的进行新一次的连接,而不需要再次配对。
网上很有名的LightBlue程序,也是这样的表现,都是无法成功进行后续的自动连接;系统设置的蓝牙程序,也是一样的结果,都是不能进行后续的自动连接。
登录后方可回复
蓝牙4.0 有没有办法,IOS 调用corebluetools框架拿到蓝牙的mac 地址, 共有和私有的方法都可以提供。谢谢了。
登录后方可回复
@水蓝云/mg : 好像没有吧?
登录后方可回复
为什么我收不到蓝牙传给我的数据
没走下面这个方法
- (void)peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error
登录后方可回复
我在做蓝牙后台扫描。我已在info.plist 加入蓝牙的两个key。现在按home键可以退出来调用扫描方法,但是一锁屏就没法回调扫描方法。有没有人知道为什么?
NSArray * services = [NSArray arrayWithObjects:[CBUUID UUIDWithString:@"FFF0"], nil];
//Begin scanning 扫描开始
[cbcentralmanager scanForPeripheralsWithServices:services options:@{CBCentralManagerScanOptionAllowDuplicatesKey : @YES}];
回调方法:(锁屏后不能调用)
-(void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI{
登录后方可回复
现在能收到数据, 但是我想把数据传给下个页面进行显示 (实时传输,
一次1个字节),请问有什么方法可以实现 实时传输嘛?
登录后方可回复
没有调用到 didDiscoverPeripheral 是怎么回事?
登录后方可回复
@兜兜爱红莲 : 是不是没签协议?
登录后方可回复
蓝牙接收数据方法中的 characteristic.value (NSData)类型, 转化成字符串为什么是空
characteristic.value 传过来的数据是
有人知道吗
登录后方可回复
登录后方可回答
耗时 0.8122 秒

我要回帖

更多关于 腾讯来电lightalk 的文章

 

随机推荐