Tag: 蓝牙

如何获得可用的蓝牙设备列表?

我目前正在创build一个可以使用蓝牙设备的iPhone应用程序(Xcode 4.3.1,IOS 5)! 这个应用程序的主要目标是室内导航(build筑物内的GPS不是很准确)。 我在这里看到的唯一解决scheme(让我的AppStore上的应用程序)是尝试扫描可用的蓝牙设备! 我试图使用CoreBluetooth框架,但我没有得到可用设备的列表! 也许我不正确地使用这些function #import <UIKit/UIKit.h> #import <CoreBluetooth/CoreBluetooth.h> @interface AboutBhyperView : UIViewController <CBPeripheralDelegate, CBCentralManagerDelegate> { CBCentralManager *mgr; } @property (readwrite, nonatomic) CBCentralManager *mgr; @end – (void)viewDidLoad { [super viewDidLoad]; mgr = [[CBCentralManager alloc] initWithDelegate:self queue:nil]; } – (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI { NSLog([NSString stringWithFormat:@"%@",[advertisementData description]]); } -(void)centralManager:(CBCentralManager *)central […]

多个蓝牙连接

我想通过蓝牙连接3个设备(我的Droid必须连接到2个蓝牙设备)。 我已经连接我的Droid到1设备使用蓝牙聊天我应该如何修改它的多个蓝牙设备? 请问你能帮帮我吗?

Android蓝牙示例

任何人都可以给我Android Bluetooth通信教程链接或提示? 请不要告诉我参考BluetoothChat示例,我只能了解如何发现和连接到设备,但不知道如何通过蓝牙发送和接收数据。 实际上我正在开发一个Android和embedded式Bluetooth设备项目。 请帮我解决

Android:蓝牙UUID如何工作?

我不明白什么是蓝牙UUID表示。 UUID是否表示协议(例如RFCOMM )? 如果是这样,为什么createRfcommSocketToServiceRecord()方法需要UUID,当他们的名字中指定rfcomm? 为什么BluetoothChat示例代码有一个看似任意的硬编码的UUID? 我的问题出现是因为,根据这个问题 ,当运行4.0.4的设备尝试使用reflection连接(到外部的非Android设备)时,我得到空指针exception。 但是,这个问题的解决scheme不适合我。 UUID muuid = device.getUuids()[0].getUuid(); 引发了一个例外。 编辑 :我解决了这个问题,硬编码的串口服务的UUID按照这个答案 (使用UUID.fromString("00001101-0000-1000-8000-00805f9b34fb"); )。 为什么我需要提供一个UUID来使用createInsecureRfcommSocketToServiceRecord(),创build一个不安全的rfcomm套接字createInsecureRfcommSocketToServiceRecord(),但是却没有使用reflection方法createInsecureRfcommSocketToServiceRecord(),我感到更加困惑。 任何人都可以理顺我吗?

如何检查蓝牙是否启用编程?

我想检查是否在任何Android设备上定期启用蓝牙。 是否有任何意图我可以捕捉使用BroadcastReceiver这样做,还是有其他方法来做到这一点?

在特征结果中设置无效句柄错误的通知

使用CoreBluetooth我想从iPhone发送数据到Mac。 为此,我将iPhone的代码编写为“Peripheral”,将Mac编写为“Central”。 它完美的工作,但有时它直接断开,然后不断连接和断开连接。 有时当它试图重新连接时,在中央它直接调用“didDisconnectPeripheral”委托方法。 但有时在“didUpdateNotificationStateForCharacteristic”中出现错误“句柄无效”。 我提到了networking中的所有链接。 但是我无法解决这个问题。 我认为在iPhone它是存储蓝牙caching。 请提出解决scheme如何解决“句柄无效”的错误? 以下是一些重要的方法。 对于外设我写如下代码。 在Appdelegate: – (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.peripheral = [[PeripheralServerObject alloc] init]; self.peripheral.serviceUUID = [CBUUID UUIDWithString:@"4w24"]; return YES; } 在外围目标文件中: //To Check Bluetooth State – (void)peripheralManagerDidUpdateState:(CBPeripheralManager *)peripheral { switch (peripheral.state) { case CBPeripheralManagerStatePoweredOn: [self enableService]; break; case CBPeripheralManagerStatePoweredOff: { [self disableService]; break; } } […]

Android BLE API:未收到GATT通知

用于testing的设备:Nexus 4,Android 4.3 连接工作正常,但我的callback的onCharacteristicChanged方法永远不会被调用。 不过,我正在注册的onServicesDiscovered内使用onServicesDiscovered setCharacteristicNotification(char, true) onServicesDiscovered ,该函数甚至返回true。 设备日志(当通知应该出现/通过蓝牙设备发送时,实际上根本没有消息): 07-28 18:15:06.936 16777-16809/de.ffuf.leica.sketch D/BluetoothGatt: setCharacteristicNotification() – uuid: 3ab10101-f831-4395-b29d-570977d5bf94 enable: true 07-28 18:15:06.936 4372-7645/com.android.bluetooth D/BtGatt.GattService: registerForNotification() – address=C9:79:25:34:19:6C enable: true 07-28 18:15:06.936 4372-7645/com.android.bluetooth D/BtGatt.btif: btif_gattc_reg_for_notification 07-28 18:15:06.946 4372-7645/com.android.bluetooth D/BtGatt.btif: btgattc_handle_event: Event 1018 07-28 18:15:06.946 4372-7645/com.android.bluetooth D/BtGatt.GattService: onRegisterForNotifications() – address=null, status=0, registered=1, charUuid=3ab10101-f831-4395-b29d-570977d5bf94 07-28 18:15:06.946 4372-7645/com.android.bluetooth D/BtGatt.btif: […]

在后台运行iPhone作为iBeacon

是否可以将iOS 7设备作为蓝牙LE外设(iBeacon)运行并在后台投放广告? 我已经能够在下面的代码在前台广告,可以从另一个iOS设备看到它,但只要我回到主屏幕停止广告。 我在plist中添加了蓝牙外设的后台模式,但似乎没有帮助,虽然我得到提示说设备要在后台使用蓝牙。 我做错了什么,或者这只是不可能在iOS 7? peripManager = [[CBPeripheralManager alloc] initWithDelegate:self queue:nil]; – (void)peripheralManagerDidUpdateState:(CBPeripheralManager *)peripheral { if (peripheral.state != CBPeripheralManagerStatePoweredOn) { return; } NSString *identifier = @"MyBeacon"; //Construct the region CLBeaconRegion *beaconRegion = [[CLBeaconRegion alloc] initWithProximityUUID:uuid identifier:identifier]; //Passing nil will use the device default power NSDictionary *payload = [beaconRegion peripheralDataWithMeasuredPower:nil]; //Start advertising [peripManager startAdvertising:payload]; } […]

Android设备可以充当iBeacon吗?

Android设备可以作为一个iBeacon,并找出其他Android设备何时进入其范围? 那些其他Android设备是否需要启用蓝牙? 如果客户进入我的商店,而且他的设备上没有安装我的应用程序,iBeacon可以工作,还是必须先安装应用程序? 有这么多的客户每天都来我们的商店,但如果他们没有安装我的应用程序,iBeacon概念的工作?

在其他平台上使用iOS GameKit的“蓝牙Bonjour”

我有兴趣通过蓝牙连接到基于iOS的设备。 我可以看到“本地networking”服务是暴露的,但我无法find任何额外的信息。 存储在密钥0x0204下的属性看起来像Bonjour键。 使用哪种协议? 如何使用Linux,Mac或自己的embedded式设备与蓝牙芯片进行通话? 这里是使用蓝牙浏览器在OS X下提取的SDP数据,而iOS设备运行Gameloft的Star营。 { 0x0000 = uint32(1330188565), 0x0200 = uint32(2), 0x0202 = string(004wD7l1A..0|0|0|ivucic-À'), 0x030a = uint32(0), 0x0009 = { { uuid16(11 15), uint16(256) } }, 0x0201 = string(_657o30a6rmst07À), 0x0005 = { uuid16(10 02) }, 0x0100 = string(Local Network), 0x0001 = { uuid16(11 15) }, 0x0203 = string(004wd7l1a..0|0|0|ivucic-_657o30a6rmst07À 0xf000 = uint8(2), 0x0204 […]