Android - Ionic - Bluetooth pairing - android

I am developing 2 applications : one Android specific and one with ionic (Android + iPhone).
I wish to use Bluetooth between my 2 applications and I can't display the popup with the code to confirm the association between both devices because the Android apps run on a device without screen.
My both applications communicate via the Internet, I think I can use this to share the code ?
My idea :
The Android app without screen is the bluetooth server
This app generate a code and send the code to the Ionic App by Internet
The Ionic app use this code to open the Bluetooth connection
Is there a way to do this ?
Thank you and have a nice year

Related

Communicate between two (and more) Flutter applications using flutter_bluetooth_serial

I'm developing Flutter app for Android, where I want to exchange some data between few instances of my app on different devices via Bluetooth. I'm using flutter_bluetooth_serial package (this is the only package I found which supports Bluetooth Classic, not Bluetooth Low Energy). I'm able to make connection
between device 1 and device 2 using BluetoothConnection.toAddress(device.address); (but even there was a problem, I had to modify the plugin and apply this workaround to make connection work).
Now I want to run my app on device 2 (which is connected with device 1) and send or receive some data, but I have no idea how I can do that using flutter_bluetooth_serial. In device 1 where I create connection I can use result of BluetoothConnection.toAddress(device.address) to send or listen for some data, but on device 2 I can't use it, because connection is already established by device 1 and I can't see another API for communication.
To simplify: let's say I want to achieve something more or less like Bluetooth chat functionality in this example application, but between multiple Flutter applications, not Flutter app and raspberry pi.
Is there any way of solving it with use of flutter_bluetooth_serial or any other package? Or I have to write some native Android code?

How to test OBD-II device ( for car ) response on android and iOS?

Currently I am upgrading an android and iOS app that will show Car RPM, speed, turbo and other things using OBD-II device (bluetooth). Most of the code was written on an old app source code and I am using that code on a new screen.
The problem is that I don't have a device for testing (I have just used code from an old source code ). I have a text file that has the response returned by the device. How can I send that response to mobile app using any windows/mac software ?
I mean is there any software available that will allow to connect mobile app via bluetooth and then I can send response. eg RPM, SPEED etc ?
Here is a sample response that I want to send via bluetooth (PC) to mobile app.
,$OBD-RT=2,76,1193,-40,0,103,-26,75,15.29,12.0,48,29.41,0,581.3,14.7,0.00,3.70,0.000,0.855,0.000,0.000,0
,$OBD-RT=2,76,1181,-40,0,103,-26,75,18.82,12.0,48,38.43,0,581.3,14.7,0.00,3.67,0.000,0.855,0.000,0.000,0
,$OBD-RT=2,76,1183,-40,0,103,2,103,18.82,12.0,48,38.43,0,579.1,14.7,0.00,5.04,0.000,0.845,0.000,0.000,0
I have attached 1 screenshot of the app
So is any software available ( for OBD-II) that will allow the mobile app to connect via bluetooth so I can send the response to the app ?
There isn't such an emulator as far as I know and if there is, normally not so reliable. But there are some devices such as Freematics that can emulate the vehicle's OBD II. In such devices there is a lack of multiple response from emulated ECU. (which as I see in your app is necessary and you probably want to have 6 requests together).
If you're serious about developing an OBD2-app, you should acquire a hardware simulator, i.e. the DIAMEX OBD2 Simulator. It's the next best thing apart from using a real car.
1
I did run into an obd II simulator I found in the google app store which I installed on one of my development phones https://play.google.com/store/apps/details?id=com.beastovest.obd.simulator
On a second phone, I installed the Car Scanner from the store (free) https://play.google.com/store/apps/details?id=com.ovz.carscanner
The setup is pretty simple. Just pair the device from the simulator to the scanner.
In the simulator, I can change engine values and I can see the commands and the changes in the scanner. You can see the rest of the communication as well. The simulator is $5. Very nice for that price. I can also see the complete communication which I need for my app development. I also speed up the understanding of the ELM327 commands. Here is the spec: https://www.elmelectronics.com/wp-content/uploads/2017/01/ELM327DS.pdf
Hope that helps anybody.

BLE Discovering Result different between Windows 10 and Android 6

I'm today in front of a problem with bluetooth and web app.
Introduction
First, here is my goal:
I want to connect a KDC (barcode scanner) in a web application (which will be probably write in C#, ASP.Net Core and JS). You can find the model and characteristic of this scanner here : koamtac.com/wp-content/uploads/KDC300.pdf .
The goal of this project is to use this website mostly on tablet and mobile, and not to use scanner with windows (but we would like to be able to see the website in computer aswell)
Sadly, Koamtac gives a SDK for windows local applications, for Android applications, but not really for web applications...
BLE tool
With this objective in mind, i discovered BLE technologies and the new Web Bluetooth API powered by google : Google Web Bluetooth API Implementations Status.
As you can see, we could use it with windows to discover devices but not to be connect with them. (But with android 6+, it is possible to do both).
This tool seems to be just in line with my project but currently i didn't knew really if my KDC could be use as a BLE device. I decided to make a simple web application where i could test if i saw (or not) the KDC device.
Application
navigator.bluetooth.requestDevice(
{
acceptAllDevices: true,
optionalServices: ['battery_service']
})
.then(device => {
console.log('> Found ' + device.name);
console.log('Connecting to GATT Server...');
return device.gatt.connect();
})
I did it on a github rep to get the HTTPS protocol which is needed to empowered the Web Bluetooth API. You can see this app here : My GitHub Repository
Finally, i tried this application with 3 differents states:
With Windows 10, in local (using Chrome Dev Tool)
With Windows, connected to rlamotte.github.io
With Android 6+ on my smartphone, connected to rlamotte.github.io
Before giving my results, you can see every bluetooth device in range of windows/android on the picture named "Device_In_Range_......" in the Github Rep
Results
I had those results:
In local, KDC device is every time found (see Request_Device_Result_Windows_Local). I can't connect to it (see KDC_connect_Windows) because Windows is not able to connect to GATT.
In this page (see Request_Device_Result_Windows), KDC is found 10% of time, and it takes much time to get it (approx 1 min). As you can see, Request found Gwladys, and 81PRMX1.
(see Request_Device_Result_Android), KDC is never found, and the request found EST (a beacon) and JBL Flip 3 (a bluetooth speaker).
Conclusion:
As you can see, the result of request_device is not the same with windows 10 and android 6. But when we use the bluetooth manager of those device, we saw exactly the same devices (the sum of devices found by each request_device).
I'm new to Bluetooth API area and i don't know why Android doesn't show all bluetooth device with request_device.
THANKS for you help ;)
EDIT #1
It seems that KDC 300 doesn't support BLE. I'm currently searching a way to connect bluetooth classic device to web app. If anyone has an idea you can tell me. If i don't find any powerful way to solve it, i'm gonna try to make an hybrid app android/windows with xamarin to use native bluetooth connection.

Inter-device communication via Bluetooth using Phonegap on Android?

I'm wondering if it's possible for a Phonegap-based app on one android device to communicate with another Phonegap-based app on another device via Bluetooth?
If it's possible to do this kind of thing with some native Java code for Android, then it should be possible via Phonegap by wrapping that code up as a Phonegap plugin, right...?
From the Android documentation on Bluetooth, I understand one device needs to act as a server and listen for incoming connections and the other "client" needs to initiate by connecting to the server. This would work in the scenario I'm envisaging with two slightly different apps, a "master" app running on a tablet which controls a "slave" app running on a phone, for example.
This BluetoothSerial plugin seems like it might be useful, as it provides functionality for both listening and for initiating a connection. Has anyone use this plugin for communication between android devices?
Check the following two links hope it will answer your question:
https://github.com/don/BluetoothSerial/blob/e1f1b330747c7c656e567bbd51a568067337e756/README.md
https://github.com/don/BluetoothSerial

Setup simple bluetooth server console?

Hi i wanna work with some bluetooth communication using my Android device.
How can i test bluetooth connections easy?
Let say im creating a simple application that will send the message "Hello World" upon connection. I would like some sort of server application console i could fire up on my iMac and have my android application connect to.
The server application should just be a console or something that displays all the data it receives and maybe a input to back a response.
Is there anykind of program that allow this ?
Or do i really need 2x android devices to create a simple server / client interaction with bluetooth?
this Android Bluetooth Chat App will be good starting point .
you can make this connect to the mac over serial port profile.
The example above is for the latest Android versions (it is possible to accomplish this with 1.x versions of android also, you will have to use the appropriate api that are supported in older android versions also)
For Programming in the Mac refer to This

Categories

Resources