bluetooth

How to establish connection and then read characteristics in one activity?

本小妞迷上赌 提交于 2020-01-25 16:34:25
问题 Currently modifying the sample code and I am encountering an error when try to establish a connection and then read a characteristic in one activity. I am getting BleAlreadyConnectedException when attempting to read from the device. I am first connecting on onCreate. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_device); // How to listen for connection state changes bleDevice.observeConnectionStateChanges()

How can i scanning the mobile phone's bluetooth by using bluetoothLescanner?

醉酒当歌 提交于 2020-01-25 07:25:14
问题 I asked this question a few hours ago, but I still can't solve it. I'm trying to catch the BLE signal, and get the rssi vlue by using "BluetoothLeScanner" to measure the distance between two phone. But, my program detects every BLE_signal except the Bluetooth signal on my phone. The following is what I printed out with Log.e as I ran the program. ''' 2019-12-01 00:21:16.319 22089-22089/com.example.bluetooth E/get_RSSI: name: null, addr: 33:DC:55:32:73:96, rssi: -88, distance: 8

Registering Bluetooth BR/EDR (Classic) connection in iOS13

蓝咒 提交于 2020-01-25 06:59:44
问题 From iOS 13 it should be possibile to register for connection events of BR/EDR Bluetooth (Classic) devices. I have followed the instructions provided in the WWDC keynote, in particular I init my CBCentralManager in this way: func initCentralManager() { if self.centralManager == nil{ self.centralManager = CBCentralManager.init(delegate: self, queue: nil, options:[CBCentralManagerOptionRestoreIdentifierKey:"myCentralManagerIdentifier"]); if #available(iOS 13.0, *) { let matchingOptions =

Bluetooth connectivity using PWA

耗尽温柔 提交于 2020-01-25 06:50:13
问题 According to PWA Web Bluetooth documentation, it supports "either a BR/EDR or LE connection". I am trying to test using the following code at the console of the Chrome devtools: navigator.bluetooth.requestDevice({ acceptAllDevices: true, }) .then(device => { // Human-readable name of the device. console.log(device.name); console.log(device.id); // Attempts to connect to remote GATT Server. return device.gatt.connect(); }) .then(server => { /* ... */ }) .catch(error => { console.error(error);

How to use the pyjnius read and write arguments for Bluetooth getInputStream and getOutputStream?

自闭症网瘾萝莉.ら 提交于 2020-01-25 03:59:05
问题 I have been fumbling with getting data from a bluetooth RS232 converter using the python for android jnius library. I had thought that it would be as simple as the PySerial library, but as I am still new to java the implementation is quite different. I created the bluetooth connection quite easily, but as soon as I try to read or write data I get a jnius.jnius.JavaException that No methods matching your arguments, and that the methods available for read are: '()I', '([B)I', '([BII)I' and for

Understanding long and short form of UUID

佐手、 提交于 2020-01-25 02:53:08
问题 I am trying to learn some bluetooth programming in android I have been able to make a rudimentary program that discovers and connects to a (currently just a single) development board with Bluetooth features built in I want to be able to send commands to the board as well as receive messages from it using RFCOMM I have been told that I will probably not be able to move any further without knowing the UUID for the board as well as the phone While digging around for this, I found out that the

ios background task notification for BLE devices

天涯浪子 提交于 2020-01-25 00:34:31
问题 I'm developing a "background task enabled" app that connects to a BLE (bluetooth low energy) device. The user opens the app and connects to the BLE while the app is in the foreground. Once the app goes to the background it will keep communication open with the device (if in range) and be alert of any information received from such device. Now my question is how do I handle or even notice that data is coming from the device? It seems that right now my notifications are queued and are only

Android send audio file via Bluetooth using BluetoothChat example

南笙酒味 提交于 2020-01-24 06:15:44
问题 I am trying to send audio file via Bluetooth using the sample BluetoothChat code. I have created a class that converts audio into bytes and vise-versa. Here are the modifications I have made in the sample code private void sendMessage(String message) { // Check that we're actually connected before trying anything if (mChatService.getState() != BluetoothChatService.STATE_CONNECTED) { Toast.makeText(getActivity(), R.string.not_connected, Toast.LENGTH_SHORT).show(); return; } // Check that there

Android send audio file via Bluetooth using BluetoothChat example

不羁的心 提交于 2020-01-24 06:14:49
问题 I am trying to send audio file via Bluetooth using the sample BluetoothChat code. I have created a class that converts audio into bytes and vise-versa. Here are the modifications I have made in the sample code private void sendMessage(String message) { // Check that we're actually connected before trying anything if (mChatService.getState() != BluetoothChatService.STATE_CONNECTED) { Toast.makeText(getActivity(), R.string.not_connected, Toast.LENGTH_SHORT).show(); return; } // Check that there

How to simply pass a string from android studio (kotlin) to arduino serial bluetooth module (HC-05)?

前提是你 提交于 2020-01-24 01:10:34
问题 I'm making an android app for a school project, using Android Studio ( Kotlin ). I need to send strings to an Arduino Genuino Uno module, passing by a HC-05 bluetooth module. The Arduino will already be connected (paired) to my android device when the app will be launched. Can someone help me to find a right and easy way to only SEND these datas ? Thanks a lot. 回答1: I finally got the answer, I did that : private fun CheckBt() { Toast.makeText(applicationContext, "It has started", Toast.LENGTH