cbperipheral

Class does not conform to 'CBPeripheralManagerDelegate' in Swift

被刻印的时光 ゝ 提交于 2021-02-10 07:19:08
问题 I'm trying to build iBeacon emitter in Swift and I cannot get my class to adopt the CBPeripheralManagerDelegate protocol. This protocol is required in Objective-C for initializing the PeripheralManager object, but in Swift, I will get the following error: class MyBeacon: CBPeripheralManagerDelegate { // ... } gives error: 'MyBeacon' does not conform to 'CBPeripheralManagerDelegate' Since my class is not adopting the protocol, I also get an error when I try to initialize the PeripheralManager

CBPeripheral.ancsAuthorized info is unreliable

烂漫一生 提交于 2020-05-13 14:31:51
问题 Our app works with a paired Bluetooth peripheral that uses ANCS, that is why I dug early into the brand new privacy setting "Share System Notifications" to make our app ready for iOS13... However there is an issue, the CBPeripheral property ancsAuthorized(Bool) is unreliable, so then it is impossible to know if the user granted the authorization or not. It is unreliable in 2 ways: Once connected to the peripheral, asking peripheral.ancsAuthorized returns always false at first, then after some

How do I write <1100> or <2200> to the value of a characteristic on my CBPeripheral?

我的未来我决定 提交于 2020-01-17 05:04:24
问题 When I NSLog characteristic.value it shows as either <1100> or <2200> . I know this is a hexadecimal. I'm confused as what to write when I'm changing the value. Any help would be much appreciated. At the moment I'm doing the following, but getting null when I change the values. - (IBAction)deviceSwitchPressed:(id)sender { if ([sender isOn]) { [activePeripheral writeValue:[@"1100" dataUsingEncoding:NSUTF8StringEncoding] forCharacteristic:switchCharacterictic type

iOs CoreBluetooth Central Server and Peripheral Client

天涯浪子 提交于 2020-01-05 19:29:30
问题 Currently, iOS does not support the combination GAP Central role and ATT Server role as well as the combination GAP Peripheral role and ATT Client role. Is Apple working on this? Does someone know when it will be possible to do so ? 回答1: If you develop a non iOS peripheral, then you should be able to start acting as ATT client once the iOS central connected to you. The ATT database is shared accross applications and should be accessible this way. You can initialize it in a separate app or in

How to send RGB signal to BLE device using iPhone application?

烂漫一生 提交于 2020-01-03 03:15:08
问题 We are working on iOS application and in which we need to pass the RGB signal to the BLE device and based on RGB code the device LED will glow. We are doing the connection using CBCentralManager for the CBPeripheral object of Bluetooth Framework in iOS app. We are setting the characteristic and descriptor UUID but still we are not able to send the signal on the BLE device. Here is the code we are using to pass RGB data in hex bytes format. - (void)centralManager:(CBCentralManager )central

CoreBluetooth Central --> Peripheral

倾然丶 夕夏残阳落幕 提交于 2020-01-01 16:49:53
问题 I'm quite new to bluetooth communication. My first project intends to transfer data from an iOS device to a BLEshield (small chip). To test my central code, I decided to setup an iPhone as peripheral (the role the chip will have, once I got it) and an iPad as Central. I can connect the devices and also send data from the peripheral to the central. It's quite easy though: - (void)startService { _readChar = [[CBMutableCharacteristic alloc] initWithType:[CBUUID ...] properties

iOS CoreBluetooth - Peripheral connect to Central within range

霸气de小男生 提交于 2019-12-25 01:34:02
问题 I have a basic BLE App that I am running with Objective-C. I am using PeripheralManager and running my iPhone8 as a peripheral with serivces, characteristics added. What I would like to do is connect to a central device that I know by Device ID or when it comes within range. I have written a BLE App for Android that does this now. All I have to do is trigger the device.connectGatt() when onConnectionStateChange() is connected. This is in the BluetoothGattServerCallback() eventHandler. What is

Integrating iBeacon and coreBluetooth peripheral

落爺英雄遲暮 提交于 2019-12-24 14:12:28
问题 I'd like to know if its possible to advertise services through coreBluetooth with a device acting as a peripheral and also range for iBeacons, also accomplish both in the background? Essentially the purpose being to range for beacons and then if a beacon is within .Near or .Immediate range update the characteristics of a service advertised by the device. I can happily accomplish the ranging task, and although I've found information on device acting as a peripheral slim I think i can manage

iOS peripheral service still empty after discovering

爱⌒轻易说出口 提交于 2019-12-24 01:15:41
问题 I am trying to use Bluetooth I have something like this : func centralManager(central: CBCentralManager, didConnectPeripheral peripheral: CBPeripheral) { Connected = true TableView.reloadData() Activityview.stopAnimating() TabBar.topItem!.rightBarButtonItem = UIBarButtonItem(title: "Suivant", style: UIBarButtonItemStyle.Done, target: nil, action: #selector(Connexion.next)) CM.stopScan() Scanning = false Refresh_Button.setTitle("Deconnecté", forState: UIControlState.Normal) let AlertMessage =

How long is a CBPeripheral's stored UUID valid for reconnection? [duplicate]

爷,独闯天下 提交于 2019-12-23 02:48:35
问题 This question already has an answer here : CoreBluetooth: What is the lifetime of unique UUIDs (1 answer) Closed 5 years ago . I've been playing with Corebluetooth and I've learnt that besides going through the tedious process of scanning for a peripheral every time I want to connect, I can also store the peripheral's UUID and use it with retrievePeripheralsWithIdentifiers and connectPeripheral for further reconnections. Turns out that it only works for a certain amount of time, apparently