bluetooth

is there any ble api in Ndk

此生再无相见时 提交于 2020-01-11 13:13:07
问题 Can we use Ble hardware(Bluetooth low energy) direct from Ndk without any java interface. I am new to NDk. So I don't know about jni, or Ndk. I want to control the bluetooth hardware directly from native code , 回答1: NO and YES. NO: There is no BLE API in ndk. YES: You can talk to BT hardware from C code. In AOSP, look under <>/hardware/libhardware/include/hardware/ there are a bunch of headers. bluetooth.h defines the interface for Android's bluetooth module. Bluedroid implements it. You

Get Bluetooth COM Ports

﹥>﹥吖頭↗ 提交于 2020-01-11 12:33:14
问题 I am trying to access specific information about Bluetooth serial ports. I was able to find this window in my Bluetooth settings that showed me the port, direction, and name of a Bluetooth device if it was related to a COM Port. Currently to try and get this information, I have been using WQL to query some of the Windows Management Classes. # I don't really mind if it is run in a Powershell environment gwmi -query "SELECT * FROM Win32_PnPEntity WHERE Name LIKE '%COM%' AND PNPDeviceID LIKE '

List and connect to Bluetooth devices

夙愿已清 提交于 2020-01-11 12:10:09
问题 I'm tryiing to make my Windows tablet app communicate with an other device via Bluetooth. First I want to scan for devices, then i want to connect to the choosen device. I've made a simple test app: Blank front page and added a button and a listboxto it. Then I've tried the following code witch I've forund else where here on SO: ListBox1.Items.Clear(); var devices = await DeviceInformation.FindAllAsync(RfcommDeviceService.GetDeviceSelector(RfcommServiceId.SerialPort)); foreach (var device in

android Bluetooth Pairing request

99封情书 提交于 2020-01-11 10:31:38
问题 Could you help me? How could I check if user denyed bluetooth pairing request? 回答1: As soon as the user press Cancel on the Bluetooth Pairing Request Screen, intent with action android.bluetooth.BluetoothDevice.ACTION_BOND_STATE_CHANGED is fired, and inside it, bundle with int key android.bluetooth.BluetoothDevice.EXTRA_BOND_STATE has value android.bluetooth BluetoothDevice.BONE_NONE For example, after registering broadcast receiver for the action, get int value like below. Then you will know

Android BLE GATT Peripheral Mode Notifications

狂风中的少年 提交于 2020-01-11 07:47:13
问题 I'm trying to set up an app to behave as a BLE peripheral device using the Android 5.0 (21) api. So far, I've set up the server, got advertising and connections working, set up custom GATT services and characteristics, and can read and write between the peripheral device and other testing devices. Now I'm trying to add notifications to a few of the parameters but simply put; they're not working. When defining these characteristics, they include the notify property: BluetoothGattService

Android - Bluetooth device connected broadcast

萝らか妹 提交于 2020-01-11 07:47:12
问题 I want to have a broadcast receiver listening for BT devices connecting. Could anybody tell me which broadcast I have to listen to? I tried android.bluetooth.device.action.ACL_CONNECTED but it doesn't seem to work. Thank you. 回答1: If you are looking whether the device is "connecting" then you'd want android.bluetooth.adapter.action.CONNECTION_STATE_CHANGED However, this does not get triggered when the device is STATE_CONNECTED. So what I did was when the state is connecting, to send a

Android Bluetooth SPP with Galaxy S3

邮差的信 提交于 2020-01-11 07:38:09
问题 I'm trying to establish a bluetooth connexion between a Samsung Galaxy S3 running with Android 4.0.3 and a RN 42 Bluetooth Chip, here is the model : I used lot's of different codes for setting up a bluetooth serial communication, and all of them are working very well on the HTC Wildfire i was using before. But now that i'm using the galaxy s3 phone, it's impossible to establish the connexion. Here is the code i'm using, i found it here : I put the permissions in the android manifest. First,

Writing data to Bluetooth LE characteristic in Android

怎甘沉沦 提交于 2020-01-11 05:25:09
问题 Although similar questions have been asked but it's slightly different. I know how to pass data to a connected BLE device but I think I'm doing something wrong for which I need help. The code below contains all the methods from my class that is extending BroadcastReceiver. I scan and connect to a device specified by `PEN_ADDRESS`. In `onServicesDiscovered` method I look for a service whose `UUID` contains `abcd`. Then I loop through the characteristics of this services and look for three

How to prevent name caching and detect bluetooth name changes on discovery

拟墨画扇 提交于 2020-01-11 04:05:15
问题 I'm writing an Android app which receives information from a Bluetooth device. Our client has suggested that the Bluetooth device (which they produce) will change its name depending on certain conditions - for the simplest example its name will sometimes be "xxx-ON" and sometimes "xxx-OFF". My app is just supposed to seek this BT transmitter (I use BluetoothAdapter.startDiscovery() ) and do different things depending on the name it finds. I am NOT pairing with the Bluetooth device (though I

android bluetooth connection fails after 489 successful connections

一笑奈何 提交于 2020-01-10 19:15:28
问题 unfortunately, I have some problems with android's bluetooth. For my test environment I use a Nexus 4 with Android 4.4.2. I have a Java Application on my PC, which uses bluecove in order to make a SPP connection as client. The programme is looking for a special service name and connects with my android phone. Afterwards it sends 72 bytes to my android phone and waits for an answer. When getting that answer the programme sleeps for 3 seconds and than starts again. On my android phone I have an