Simple application that simulates a bluetooth accessory - java

I'm looking for a no-brain application that allows me to send a pre-defined list of commands through a bluetooth connection, or an equivalent Java/Scala library that works decently in OSX (64bits).
In short, I want to use my computer to "simulate" a bluetooth accessory, so I must be able to control the pairing, the exchanged code, and so on...
Thoughts?

Simulating jsr-82 can be done with the BlueCove Emulator Module:
http://bluecove.org/bluecove-emu/
http://bluecove.org/ works on OS/X and am sure there wouldn't be any issues with a 64bit OS.
I'd refer you to this Answer: https://askubuntu.com/questions/20195/bluetooth-emulator
You may want to reconsider your question...
To emulate a bluetooth device you would need to develop a bluetooth driver getting it's input from a different source, this would be far more complex than buying a real device.
If you are looking to get some NMEA data though, you may be interested in this:
Most bluetooth enabled phones have apps that do that:
Android: https://market.android.com/details?id=com.cajax.gps2bt2
Any J2ME: http://www.digitalmobilemap.com/bluetooth-gps-simulator-for-j2me-phone
Haven't found one for iPhone, only reference it can be done: http://spench.net/drupal/software/iphone-gps
Hope that helps!

Can you be more exact?
Simulate a Bluetooth accessory for ..?
There are different BT accessories for different smartphones...
Making a BT accessory for iPhone usually requires an authentication chip from Apple...I don't know if a Mac can do it, probably it could - however I'm pretty sure it couldn't describe itself as an accessory.
Accessories usually imply a piece of hardware, in my understanding at least.

Related

Is there a way to find out what a bluetooth LE device listens to?

I have a bluetooth LE device that is powered by its developer's app.
Sadly it is not maintained anymore and therefore I intend to rewrite the app from scratch.
Additionally it is not possible to pair to the device. It only listens to BLE.
Is it possible in any way to find out, how the device is being controlled?
I tried to decompile the code via JADX but since the manufacturer is chinese and decompilation already comes with its own problems, I thought if it would be possible to find it out without this procedure. (GitHub)App-Decompiled-Code (External)Original-APK-Download-Page
It depends what the device is really. There are number of profiles/services defined in the Bluetooth standard. If the device uses one of them then you could design from the specification rather than the device/app.
A good place to start is to use a generic Bluetooth Low Energy scanning and exploration tool such as nRF Connect to explore the device. Find out the UUIDs of the services and characteristics and compare it to the assigned 16-bit UUIDs values on https://www.bluetooth.com/specifications/assigned-numbers/
If it has a custom BLE profile/service then you can still use the nRF Connect app to explore it. If it is not obvious how to access the data or what commands need to be sent, then looking at the HCI logs on the phone after using the developer's app might be helpful.

How to control a rc toy with Android app

I have a rc drone. I want to create an Android app to control it but I do not know where to begin and how. I browsed the internet and found only one useful tutorial but it required use of Adruino and was through Bluetooth but I want to create my own Android app and not use Adruino or Raspberry Pi. Please help
First you need to connect via bluetooth (If you have no documentation of your RC drone it will be had to figure out the commands etc).
Maybe you can find a bluetooth sniffer program on the www to record what is going on when using the original hardware.
But I think its not worth the effort. To figure all this out will most likely take a lot of time and might not lead to success at all. So I recommend: next time by a drone where the communication protocol is documented or better a SDK is provided with it.
First, you have to figure out, if this drone uses Wifi or Bluetooth for control, or, some custom- build wireless device. If it use custom adapter, working on another frequency, you won't be able to do anything from software, only reverse- engineer control schematics.

Get info about computer to which Android device is connected

I have the problem. When Android device connected to computer through USB, I need to get information about this computer(such IP, Host Name or something like this). Is it really to get?
Thanks.
As #home indicated, this is not possible.
I believe this may be interesting read for you:
http://code.google.com/p/android/issues/detail?id=738
however, USB host feature has just been released and is available starting with honeycomb. this may eventually help you introduce your own communication between devices, but you'll need to write some code for PC too.
If you hope to do it directly while device is working as UMS, WMS or vendor specific portal - well, it could be possible, but this certainly will be phone specific (especially when your phone turns into multi-function device the way Motorola Droid does).
There is no typical mechanism to do that.

GPS Devices and Programming

Alright.. I guess to start this off I am looking to sometime in the near future start building a web based or browser based application that I want to build a part of the interface to be a gps module. this will be for a self hosted application likely on tablets or laptops where it will use the data for tracking information amongst other things. Any way most of the application is being handled in PHP, mySQL, jQuery. So with that my question is, is there any way to build a gps application with that as the core languages used. If it is possible, whats the best gps unit I can use? remember im not nessisarily looking for a fancy gps unit to do this with.. just a transmitter/reciever is fine so long as I can build software of my own around it, also is it actually possible to do this with something like php/jquery? or is this something I would have to go the route of maybe java to handle the hardware transactions of which I can tie php/jquery into that..
I have used a bluetooth GSP receiver before..(HOLUX m1200)
When connected, it sets up a serial connection (COM port). You can't communicate with serial ports using only javascript (or jQuery). The easiest way is using a java applet.
You can hide the applet on your page an communicate with the applet using javascript (jQuery). You can find an example here.
Alternatives are using Flash or WPF with XBAP.
The GPS unit outputs series of location messages etc.. More info about that you can find in the GPS protocol (google it) or here
Hope this helps :)
Some tables and laptops have GPS devices integrated. You should consider whether you are targetting iOS (iPad) or other systems.
For iDevices you can use the native stuff, which I won't bother explaining here.
For Linux or BSD systems I suggest gpsd, which is a service you install which abstracts the details of different GPS devices for you and gives you a sort of web service to query for location data. This would be easy to access from PHP or jQuery obviously.
For Windows 7, check out the new Sensor API.
For other systems, you may need to communicate directly with the GPS devices using the standard NMEA protocol (this is what gpsd does under the hood). This will be substantially more work and probably would mean writing a Java program or similar (basically to do what gpsd does).

using serial port RS-232 in android?

I want to send signals via serial port using the JavaComm API classes on an Android device, and here is how I imagine it:
1- the Android device would be: Archos 3.2 which has android 2.2 and USB host mode.
2- include RxTx lib package with my Android app. and include RxTx native code using Android NDK.
3- a short cable which is usb-->serial.
Could you explain to me where I might face problems?
I just ported the JavaCOMM ( GNU RXTX ) library to the Android. Here is the link http://v-lad.org/projects/gnu.io.android/
You still might need to rebuild your kernel and maybe recompile the shared library for your environment. But this should get you started.
As noted above, you'll need to come up with device drivers for whatever USB<->Serial device you have. Many of these devices use the Prolific PL2303 chip:
http://www.qbik.ch/usb/devices/showdr.php?id=175
which the stock linux kernel has support for, and has had for a long time. I've used this and it works fine, so I would recommend you stick with USB<->Serial devices that use this chip.
Beyond that, with udev these devices normally show up as /dev/ttyUSB#. How that happens with Android, I don't know, so you'll need to figure that out.
Finally, you will need to build the RxTx native code. This code is pretty crufty - I had problems building it on a fairly modern Angstrom, and I was not trying to cross-compile at all.
Unlike the regular PCs, most of the stock kernels for the android devices come with minimum compiled modules. You need to recompile the kernel with enabled drivers for USB to serial converters. You luck depends on the specific device that you using. A lot of manufactures violate GPL, by not providing the kernel source code. Some manufactures like Motorola with the Droid 2 require signed kernel. Which makes it impossible to load custom kernel on the device.
Also, although many devices have USB host mode you have to jump through the hoops to switch the device mode. For example Motrola droid requires a special dongle to be plugged in into the USB port before powering on to switch into the host mode.
Here are some links for you that explain what you need to do:
“More on Droid host mode,” http://www.tombom.co.uk/blog/?p=134.
“USB Host mode on Motorola Droid,” http://www.tombom.co.uk/blog/?p=124.
Yes, it's definitely a mess to use the serial devices from the phone side on the Android. The problem is that the various devices present on the AOS is not documented, and rarely coincides with standard Linux ones. Thus you are never sure what/who you are actually talking to, some device, abstraction layer (HAL, UART,PCI etc). Here is a tutorial on how to talk to a serial device (the modem) from an externally USB connected PC.
In any case, if your phone does support USB host mode, there have to be another way to reach your serial port/devices using that. After all, backward compatibility does often insure some kind of FAX, telephony or external modem support from your USB cable. Also there is tehtering which may also contain some virtual serial device...
There is a tutorial for some of this here.
PS. The main problem of such programs (like that of Vlad) and applications (like serial-api) are that they make too strong assumptions on the device/port names and the permissions needed to reach (read/write) these...
Probably not exactly what you're looking for, but this instructable might point you in the right direction
The biggest problem is probably the USB->Serial Adapter:
You need the either a device driver for the USB Serial Driver, which is probably not included in the android kernel.
The other option is to use something like libusb (which may have to be ported to android as well) and a user space driver based on libusb.
What you need to do first is to root the tablet in order to get Read/Write access to the serial ports.
After you do this take a look at Android Serial Port API. You can download the source code and see how it is implemented.
It has a native lib that gets a file descriptor to the serial ports and then you can read and write to the ports. Usually the app may not list all the available ports on the tablet. To see where your device is connected, plug it in the USB with HostMode, and in an Emulator type "dmesg | tail". It should give you details about the device, and the port that is connected to.
I also used an Archos Tablet, mine device was connected to "/dev/ttyACM0".
Good Luck!
I've done this.
You need to:
1. Root the device.
Create your own module for the specific USB chiset you're about to use: Building kernel module for Android
I recommend using the ported usb-serial-for-android library, which has the PL2303 driver already implemented:
https://code.google.com/r/felixhaedicke-usb-serial-for-android

Categories