How to use AT commands and implement CSD in Android? - android

I've got a challenge: I need to implement CSD into my Android app.
Android Telephony organization is explained here
http://ytd2525.wordpress.com/2012/10/08/android-operating-system-and-radio-interface-layer/.
Since Android API doesn't include methods to work with hardware modem directly (send AT command and get back reply), I suppose I have to work with port which represents modem.
In this post AT command in Android port /dev/smd0 is recommended to use, but my Samsung Galaxy S III does not have such port.
Question: Does anybody knows how to interact with modem (what is hardware port name, how to send AT command, how to get back modem's reply)? Any suggestions?
Thanks in advance.

Related

Android communication to external modem

I new to Android embedded technology. I am working on Android device to external modem communication.
There will a external modem connected to Android device with USB.
now need to run modem command on external modem using Android application.
Should i start with http://code.google.com/p/usb-serial-for-android/ or http://source.android.com/accessories/index.html. Is there any other way to achieve it.
Please let me know your comments based that i will go forward.
Thank you.
I work in a project to make a telephone caller blocker using old 56k serial modem connected to an Android TV stick using an usb to serial adapter. I use USb terminal apk to senh Hayes AT commands to the modem, and it works flawlessly. I can configure the modem with AT#CID=1 to retrieve caller id data. The final process must include a self config part to make the modem act as caller id, a database part, that stores calls and compares with black and white list numbers, and a on hook modem command to block the call. I think that a very beginner android developer can reach it easy, but I have no ability in android. In arduino, I have made the same system working flawlessly.

Communicating with Arduino from Android

i'm trying to communicate with Arduino board (Duemilanove) from Android 3.1 device with USB-host support using Android USB Host API.
The goal is to communicate with the board in the same way as via Serial.
I follow this manual (http://android.serverbox.ch/?p=427) but have few problems (f.e. failed to claim interface) and of coarse dev guide (http://developer.android.com/reference/android/hardware/usb/package-summary.html) but no luck.
The questions are:
how to prepare arduino board (modify firmware) - interruptions or smth?
how to check if it's okay with arduino board (f.e. enumerate USB interfaces and verify that it supports needed. what tools can be used?
how to find needed interface (what are interface class/protocol/subclass)
what can be the reason when interface cannot be claimed? (faced with that)
The arduino Duemilanove board has only a build in FTDI FT232RL USB serial converter. So you don't have to deal with the USB device side. From the AVR controller point of view it is simply an asynchronous serial port. Find out to which UART it is connected to and use it. Maybe you want to implement a simple echo (transmit all received characters again) as a first test.
Use lsusb command under linux to check out the usb device descriptor.
Read about USB in USB in a nutshell or in the official specification to find out how it works (especially chapter 9). Without doing so you can't go on. You would not understand anything.
Then go on and read about CDC class devices in the usb class section.
It might not exist (if you rely on the interface index without checking the device descriptor) or the android kernel has claimed the interface because there is a native driver for that interface. In this case you can call UsbDeviceConnection.claimInterface with true as second argument to disconnect the kernel driver first.

Sending commands from a PC to an Android phone - via physical connection (USB, Serial, etc)

I'm working on a project to automate some tasks (such as play a song, play a video, receive bluetooth data, etc) on an Android phone from a PC.
Basically the PC will send a notifier to the phone and an app or something on the phone would then process the notifier and do 'something'. The opposite of this really:
http://code.google.com/p/android-notifier/
I've seen some examples showing how to send commands to an Android listener app or service via a network connection, but in this case, I would much rather the transmission be over a physical connection.
USB
Ideally, I'd like the connection to be via the USB port. But I've seen some posts online that suggest that the SDK does not natively support this. (Android apps, communicating with a device plugged in the USB port).
Is there some other SDK/API out there that makes this easier?
I've seen some posts on the ADB, but don't really get it... Would that work?
(http://developer.android.com/guide/developing/tools/adb.html)
Serial over USB
I've also seen some sites that show how to use a breakoutbox to perform bi-directional serial communication, but only with the G1. Is this possible with newer phones?
The Phone
I'm open to really any newish phone. I'm currently looking at the Galaxy S, because it has the video out through the headphone jack. I'm open to rooting if need be.
Implement a HTTP server in your app, then put your phone in USB Tether mode. This will create a local network between your phone and your PC. You should then be able to send HTTP request or create websockets using the phone's ip.
EDIT : I tested it, and it works, see here
What you can do is the phone acting as a server and then use adb to forward ports [1].
In this scenario the pc app would connect to localhost which would be redirected to the app on the phone via the usb cable.
But if you go this way, you might just as well simply connect directly to the phone's ip (without the adb port forwarding)...
[1] http://developer.android.com/guide/developing/tools/adb.html#forwardports

Android 2.2. How to set up serial port(com,rfcomm) port?

I a trying to connect my Nexus One with Android version 2.2.1 with my pc and use a terminal program such as windows terminal or hyper terminal to communicate. To do this I believe I need to set up an outgoing serial com port. I have paired the devices. When I go on my PC to Bluetooth -> settings -> "add com port" the android device does not display.
What am I missing?
Does android 2.2.1 support spp? The documentation says it does.
Do I need to root the android to add spp?
Has anyone succeeded in this?
My final goal is to write an android app that communicates with an old school bluetooth device that requires com ports? Getting the android to communicate with the pc is an interim step.
I have tried everything I can think of in my android app to connect to my pc and android device but have not been successful. My android app is essentially the same as Serial over Bluetooth submitted by xCaffeniated but with fewer comments. Any suggestions?
Try beginning with the BluetoothChat sample application. You will then have to alter the UUID used to the generic SPP UUID,
00001101-0000-1000-8000-00805F9B34FB
From this point you pretty much have everything you need.
I have had issues pairing in the BluetoothChat program. So I was required to pair to my computer using the settings menu and then entering the BluetoothChat Program. In BTChat go to the menu and hit connect to a device, choose your computer. I can only speak for windows XP SP3 which is what I'm using. At this point on my machine I receive a task bar pop up asking me if I would like to allow my device to connect as a serial port. I allow it to. Now your phone is associated as the serial port profile on the computer, which you can associate with a specific com port.
Based on bluetooth spec,
http://www.bluetooth.com/SiteCollectionDocuments/SPP_SPEC_V12.pdf,
2.3 User Requirement, "... Any legacy application may be run on either device, using the virtual serial port as if there were a real serial cable connecting the two devices (with RS232 control signalling)." In 4.3 Remote Port Negotiation, "...There is a requirement to do so if the API to the RFCOMM adaptation layer exposes to those settings (e.g. baud rate, parity)... RFCOMM as such will not artificially limit the throughput based on baud rate settings,..."
In my opinion, since Android (2.2) offers no APIs to set up and open a serial port, they may not be necessary as long as you can discover the remote BT device and make a connection to it. I have tried it and it seems working with:
...
sock = device.createRfcommSocketToServiceRecord(myUUID);
sock.connect();
...
where final UUID myUUID= UUID.fromString("00001101-0000-1000-8000-00805F9B34FB"); You may need to take care of Bluetooth Permission and Setup in your application as described in
http://developer.android.com/guide/topics/wireless/bluetooth.html
There might be some issues with the connect() call, i.e. Service is not available or connect is refused, which could be resolved by making sure:
The remote BT device be discovered, and
It must be set to use PIN code (for instance 0000), and
It must be paired successfully with your Android device
These steps must be completed prior to running your application (which has connect call).
Hope this help.
George
There is definitely some funny business regarding how the AT set is implemented on the AOS. The problem is that it is hard to know if you're actually talking directly to Modem or through several abstraction layers (more likely). For a best up-to-date review of the AT Commands available on the AOS platform, plus HW, please see the post:
"How to talk to the Modem with AT commands"
http://forum.xda-developers.com/showthread.php?t=1471241

Read data from an Android USB attachment

Is there anyway to read data from an attachment through the USB port on an Android device? In particular, an EKG. Most the work can be done by the hardware of the device to simplify the output to a single number, a voltage reading. If its not possible, what about modifying an accessory that can already communicate with an android device? Thinking of devices that attach to android phones, what about sending the data as an audio signal to be read as the microphone from a headset and then analyzing the audio signal to convert it to a number that can be used to display a value.
Any ideas on how to make this work?
The Android handset can't be used as a "USB Host" (it's in the google android wishlist as a bug/enhancement request). That's what you'd need to connect regular USB devices like your EKG monitor and memory card readers, etc. to it. I wish it could do this too and star'd that enhancement to vote for it...
I'm not sure if this will work for you, but here's something I did recently for a project where I needed a smartphone to communicate with a host PC.
I used ADB on the PC to do port forwarding and then I used sockets to do the communication. Server socket on the phone, client on the PC. I can give you more details if you want.
Of course, the clear requirement here is to be able to install and execute code on the "device" which I don't think is applicable to your problem. Other than that, I found no other way to communicate over a USB connection through Android.

Categories

Resources