core-bluetooth

iOS CoreBluetooth: State Preservation and Restoration

◇◆丶佛笑我妖孽 提交于 2020-01-01 05:28:05
问题 hope to get some input here. In my current iOS project I am using CoreBluetooth with swift. The app is enabled to communicate using CoreBluetooth in the background which basically works, kind of. The peripheral requires to have an active connection with the iOS device in order to work as expected. Whenever the connection breaks, the peripheral stops it current action. This also happens when the app is closed due to memory pressure. In that case the peripheral should not stop working, so there

iOS Bluetooth LE - Proper Way to Write Without Response

荒凉一梦 提交于 2020-01-01 05:06:10
问题 With iOS CoreBluetooth, when sending a relatively large amount data, it's important to break it up into 20 byte chunks and then write them one at a time into the peripheral object. This is pretty easy to do when using a WriteWithResponse characteristic: write 20 bytes, wait for the callback, write the next 20 bytes, and so on. But what about with a WriteWithoutResponse characteristic? I need to send of 1-2kB of data as quickly as I can over BLE. WriteWithResponse is very inefficient at doing

Raspberry Pi Bluetooth 4.0 Connection

我怕爱的太早我们不能终老 提交于 2020-01-01 04:55:09
问题 I am trying to connect to a Raspberry Pi via iPhone using CoreBluetooth (bluetooth 4.0). I have discovered the device and send out a connection request using this code: if (peripheral != self.foundPeripheral) { NSLog(@"Try to connect to %@", peripheral.name); self.foundPeripheral = peripheral; [self.centralManager stopScan]; [self.centralManager connectPeripheral:peripheral options:nil]; } Neither the didConnectPeripheral or didFailedToConnectPeripheral are called. I also made sure to set the

How to turn CBUUID into string

我是研究僧i 提交于 2019-12-30 00:35:57
问题 I can't find any official way to get a UUID string back out of a CBUUID. These UUIDs can be 2 or 16 bytes long. The goal is to store CBUUIDs in a file somewhere as a string, and then resurrect with [CBUUID UUIDWithString:] etc. Here is what I have so far. // returns a simple 4 byte string for 16bit uuids, 128 bit uuids are in standard 8-4-4-4-12 format // the resulting string can be passed into [CBUUID UUIDWithString:] +(NSString*)CBUUIDToString:(CBUUID*)cbuuid; { NSData* data = cbuuid.data;

iOS Bluetooth dual-mode; connect BLE (GATT) to an already connected BR/EDR (A2DP/HFP) stereo headset simultaneously

断了今生、忘了曾经 提交于 2019-12-29 19:19:06
问题 I'm developing a stereo headset with Bluetooth using the classic profiles (HFP, A2DP, AVRCP) as one would expect Ina stereo headset. However, I want to deploy a remote control app for iOS, and use it simultaneously to the other classic links, but the dual-mode chipset I'm working with in my design does not behave as I'd expect; The headset is setup as a peripheral, letting the iOS device act as central. As such, the peripheral advertise its BLE services (with my specific 128-bit UUIDs) and

Sending image file over Bluetooth 4.0 LE

ⅰ亾dé卋堺 提交于 2019-12-29 03:29:13
问题 I am trying to send an .png image file from one iOS Device to another over Bluetooth 4.0 LE. I am able to simple pieces of data like strings, but unable to successfully send and utilize image files. In the Peripheral device, I start out with this pictureBeforeData = [UIImage imageNamed:@"myImage.png"]; NSData *myData = UIImagePNGRepresentation(pictureBeforeData); Then I make myData a characteristic's value. _myCharacteristic = [[CBMutableCharacteristic alloc] initWithType:

Bluez: advertise service / gatt server example?

白昼怎懂夜的黑 提交于 2019-12-29 03:03:06
问题 Goal I am developping a simple device running Linux. It is BLE capable, and I am currently using bluez 5.8. I want to trigger an action on this device using an iPhone. What already works: I can make the iPhone "see" the device. The iPhone also connects to the device. I setup the bluetooth device like this on linux (thanks to this question): # activate bluetooth hciconfig hci0 up # set advertise data: "hello world" hcitool -i hci0 cmd 0x08 0x0008 48 45 4c 4c 4f 57 4f 52 4c 44 # start

Does blued cache ATT values, and how to clear the cache?

╄→尐↘猪︶ㄣ 提交于 2019-12-28 19:02:12
问题 I am trying to find any workarounds for a Bluetooth LE bug on OSX. In particular, I want to know where OSX goes wrong in reading the Bluetooth LE GATT table. Thus, I am viewing the L2CAP packets in PacketLogger from Hardware IO Tools for XCode. When I use Bluetooth Explorer to connect to the Bluetooth LE device, I am expecting to see 3.4.4.9 Read By Group Type Request (uuid=0x2800 «Primary Service», startingHandle=0x0001, endingHandle=0xffff) to discover primary services (or Find By Type

Maximum number of peripherals on CoreBluetooth?

你说的曾经没有我的故事 提交于 2019-12-28 04:14:36
问题 I am interested in working with BLE proximity sensor on iOS and have been looking up for a few answers to my query but could not find any solid ones. 1) Is there a maximum number of BLE slaves the CoreBluetooth can handle? 2) Will the slaves (about 10 devices) be able to be operated all at once i.e. if any slaves were to disconnect, master will be alerted while not affecting others? 回答1: Theoretically, there is no limit to the number of Bluetooth LE devices that can be connected to a single

Major and Minor on altBeacons under iOS

人盡茶涼 提交于 2019-12-25 16:43:38
问题 Is there a way to find out altBeacon's major and minor values? I am using this library (https://github.com/CharruaLab/AltBeacon) for detecting nearby BLE-devices (whether it beacons or not). Beacons are detected, and I know their uuids. Can I extract major and minor values using iOS CoreBluetooth framework? UPDATE: The code seems fine. Looks like the only way to find out the major or the minor is requesting for beacon's data as it's done in accepted answer below. But the beacons itself is not