I have a bluetooth le server running on an embedded linux system listening on RFCOMM port and I can connect to it using apps from playstore that emulate serial terminal. I want to write an app in react native that can connect to it.
I have found these two following libraries react native ble manager, react native ble plx, but can not find any reference to RFCOMM. Searching through the repos I can't find any reference to any protocol to be honest, whether that is RFCOMM L2CAP or OBEX.
Examples only show how write/read happens, but as opposed to other lower level libraries such as bluez there is no mention of protocol used. Are those libraries restricted to only one way of communicating and as such it is redundant to state what underlying protocol is being utilised?
Related
I am working on BLE mesh for Android and iOS.
We want to work on Addressing scheme for peer to peer communication in Mesh.
Is there any support for IPv6 over BLE (Such as 6LowPAN) in both Android and iOS. Have gone through many documents and not getting it.
Also, is IPSP profile supported over BLE?
It will be helpfull if I can links to some forums.
I have a C++ library which helps in establishing communication to a POS terminal over LAN and serial port, now i want this library to work on android phone only over Bluetooth medium,
If there are native APIs for Bluetooth communication in android, I can port this c++ library to android and write a java application which will use this library through JNI
Are there native APIs for Bluetooth in android, if so where do I find the documentation?
I looked at this general issue (java vs. native Bluetooth on Android) a while ago and eventually concluded that the native API did not provide any extra functionality relative to the Java API - so there was no advantage for me in going native for Bluetooth.
And the Java Bluetooth API, which is well documented, is actually quite limited compared to what you might expect coming from e.g. desktop Linux, Mac, or Windows. You are miles away from the HCI. The point being, that you may well find that the API's required by your library are not available on Android (unless it requires little more then RFCOMM sockets).
If the Android Bluetooth API's do meet the requirements of your library, then yes, you can access them from native code so you could port your library.
Caveat: when I looked at this I saw that devs are strongly advised away from native, so I have not done any native on Android and am only reflecting what I read.
I am new to embedded programming and I am given a project to establish Bluetooth communication between an Android tablet and an ARM development board with Bluetooth capabilities.
Please tell me whether this project can be done or not ??
If it can be done then how should I approach it ??
Thanks
Check out this page: http://www.amarino-toolkit.net/
They are using the arduino board with a bluetooth component to connect to android. You can check the source code of their library to see how they establish and use the connection here:
http://code.google.com/p/amarino/
If what you want is a simple and robust communication method over Bluetooth then SPP is definitely the way to go.
The only issue could be the bandwidth, but if the throughput of a traditional serial cable connection is enough for your application then there certainly won't be any problems there. IIRC then most modules have > 1 Mbit throughput using SPP.
Some information about using SPP on Android is here.
But we need a little bit more information to give suggestions about what you need to do on your ARM kit. Maybe you could post a few details about its type, which Bluetooth module is in use there, how it is connected to the ARM MCU etc.
If you're lucky then your kit's BT module can function as a serial cable replacement and you can treat it as if the Android device is connected to your MCU's UART. Of course prior to that, some configuration is needed over some interface (could be the same UART, depending on module type) to establish a Bluetooth connection.
Oh and to answer your first question: yes, it certainly can be done :)
I haven't worked with Android to ARM board via bluetooth but I have done some work communicating between an Android device and an Arduino using bluetooth. I tried to document what I learned in a series of examples. There are several that might be helpful.
http://digitalhacksblog.blogspot.com/2012/05/arduino-to-android-basic-bluetooth.html
http://digitalhacksblog.blogspot.com/2012/05/arduino-to-android-turning-led-on-and.html
http://digitalhacksblog.blogspot.com/2012/05/android-example-bluetooth-simple-spp.html
The first two examples show how to setup communication via bluetooth from an Android device to an Arduino with a bluetooth board. I would expect that to get some initial connectivity between the Android and the ARM the Android side of things would be the same.
The third example shows how to setup a simple spp client and server between an Android device and a PC running windows.
Hope this helps.
I would like to send data to an android mobile device via a bluegiga module.
My question is, what SDK I need for that, and how can I get it?
What I found is Bluegiga SDK, but there's not a lot of information about it.
BlueGiga modules may come with SSP support. That is, Serial Port Profile. If so, you should be able to connect to the module using RS232 type physical interface and use SPP profile from the android device.
Module documentation should have information about security and pairing e.g. default pin number when Android connects to the module and if there is a pin/button to be initiate connection and pairing.
Firstly, you need to get the knowledge of how BLE works. Its different than classic Bluetooth that BLE (generally) is preferred to communicate by means of service/s (with characterstic/s bundled up into them), be them Standard or Custom. Depending upon your area of application you can select one of the standard services implementation.
For more info on services, check Bluetooth Developer Portal.
About development at BlueGiga device, you will have to device upon which way you would want to proceed: BGAPI or BGScript. BGAPI is incorporated into a readily portable (C-programming based) library: bglib that you can easily port in your main firmware project.
Then you will have to take one of the standard services to get started with and dump the .hex file into the BLE module (either directly or if you have the Eval kit). The .hex file is generated from a BGProject that contains few configuration files like gatt.xml, hardware.xml and few others which are present in the demo projects that you can receive from BlueGiga when you download the SDK and other tools. To dump the .hex into the module, you'll need to get a TI-made CC Debugger.
Understand the GATT implementation and GAP implementation.
Tool that you'll require for setting up the BLE device is: BLEUpdate. It runs on windows platform flawlessly (Window XP service pack 2 onwards). There are plenty of documents and user guides available on BlueGiga product Support Page to get hand on knowledge of how this should be used.
To put it in a simple way:
To start with, pick a standard service probably from a demo project. Dump the .hex file into the BLE module / Eval kit.
Share the UUIDs from gatt.xml with the android application code.
Do necessary implementation at android app in order to discover and connect with the BLE device.
I'm working on an android application using my phone's bluetooth and a bluetooth board that has an RS232 interface and supports the RFCOMM profile.
I have the RFCOMM connection working fine, but I cannot find a way through the android API to access the RTS and CTS signals, which are part of the RFCOMM profile and also exposed on my BT board.
Can anyone tell me how to read/write RTS/CTS from an android device?
A similar question was asked here:
Bluetooth control signals (DTR, DSR, RTS, CTS) on Android
but never answered.
This isn't a complete answer and will not be suitable for most applications, however you can do it using the native C library for Bluedroid from Android 4.2 onwards or BlueZ before that.
The following file: https://android.googlesource.com/platform/external/bluetooth/bluedroid/+/master/stack/rfcomm/port_api.c contains a function called PORT_Control which should set the line status for you and PORT_GetModemStatus will return the line statuses.
There is another question covering the use of the Bluedroid native library here: Android NDK accessing native bluetooth functions bluedroid.