Use Bluetooth to transfer gyroscope data to another computer - java

I want to do a simple project where I send the phone's gyroscope data to a computer, where both are connected over Bluetooth. The receiving computer will be using C++, which I assume has its own Bluetooth communication protocols.
I have no idea how to get started - does anyone have sample code or tutorials for this? Preferably for both the client (phone) and the server (computer).

I think you should use the SPP BT profile to continuously sending data over bluetooth.
You can see a SPP link over BT as an normal RS232 serial cable.
Here are a sample code how to create an app (bluetooth chat) in android using the spp profile.
http://developer.android.com/guide/topics/connectivity/bluetooth.html
On the computer side, are you using windows?
If so, the bluetooth stack on computer will create an COM port for you with the SPP data from phone.
I haven't create any application that read and write from a COM port in windows but I guess it will be tutorials on the net.
First step could be to connect an Hyper terminal to that COM port and see that you can read data from it.

Related

USB-connection from android to phone

I'm trying to send data from android to a computer via USB,
I found the USB Accessory introduction, http://developer.android.com/guide/topics/connectivity/usb/accessory.html (Basically I want to send a few bytes to a programm on the computer) So, am i right on using the accessory on android? What would i use for the pc programm, and can I/ Do i have to create a socket connection from my application to the programm
You will need access to the USB device plugged in to the PC which lets you send USB Control Request and Bulk Transfer requests.
If you are using linux, you could try libusb - which is pretty straight forward to use. For windows am not sure though.

Reading SMS from PC

Scenario : 1
Suppose there are two phones A and B. phone B sends a message to phone A. Phone A has that message in its inbox. Both the phones are nokia multimedia phones that can be connected with my laptop via nokia pc-suite.They can also be connected via Bluetooth with my HP laptop.
Scenario : 2
A valid sim card of my local operator is inserted into a modem and the modem is connected with my laptop. I can read messages sent in that number(sim) by using the software provided with the modem.
Question:
The received text message will be the input of my java program. How can I read that message with my java program. Solution for any of the two scenarios will solve my problem.
It would be very helpful for me if someone provide me some resources regarding this issue. I am interested to implement it by java but it would be also helpful if the resources are not in java platform but relevant to my task.
You can connect GSM modem built in Mobile Phone via bluetooth or RF232 connection, then send AT Commands. Pure java conenction functions should not be enough to make it possible. So you can use low level API coded by C programming language then connect it with Java applicatio via JNI.

Java: Reading the incoming sms messages from a phone connected to PC over USB (from the PC side)

I'd like to intercept SMS messages from an Android phone connected to PC over USB. Java app on PC side.
Where should I start? Would it be apps on both sides? Or is there some PC-side lib for that?
I've only found tips for serial port access like SmsJ.
Background :
When you attach phone with USB cable, your computer creates a virtual COMM Port and a new port number is assign to it. You can see the port number detail in Device Manager List.
Development Part:
For the starting you can read the Java's Port reading example. Just study this example and you will be able to connect and send SMS from your android phone. It will allow to fire you command in Computer that will actually goes to attached Phone. For sending command to COMM Port you will be requiring AT Commands to Send SMS. Using AT Commands, you will also be able to read SMS and perform other functions on the phone.
You can also connect your phone through bluetooth, It will also assign same virtual COMM Port and you can do all functionality as well.

WiFi connection via android

I need a tutorial on how to process data on android via wifi. F.e., I need to send some message to PC and receive some other message. How should I establish the connection? What should I do to be able to transfer data and how?
Sorry for the dummy question, but I can't find good manual. I'll be grateful for as detailed manual as possible, or for ome simple example on etablishing wifi connection and sending/receiving simple mesages.
You don't have to use any API for connect to wifi its only requires if you want to manually start your wifi in device,
Just make sure your device has a WiFi enable, and make a simple TCP/IP Socket application. With this you can communication with your system and device, And Use System's public IP to connect with your system.
Also don't forget to give permission Internet in your manifest file..
Here some nice links for Socket Programing in Android..
Simple connection example part II - TCP communication
Networking with Android
Simple communication using java.net.Socket
http://www.anddev.org/tcp_sockets-t276.html
http://www.anddev.org/socket_programming-t325-s30.html
EDIT:: Android WiFi examples,
Scan for Wireless Networks
Using WiFi API
SO Question Android: Is there any way to get notified when known wifi networks get in/out of range?

Java com port problem

I am trying to read some data of GPS from COM1 port. I have to show a message that the device is not connected if the gps device is not attached with the com port. I am using rxtxComm.jar, rxtxSerial.dll, gpsinput.jar in my project.
I am also facing problem from reading GPS data from com port.In my input stream no data is coming but the gps device is throughing data at the com port (I checked it by using hyper terminal).
code
Please refer to this.
How to send data to COM PORT using JAVA?

Categories