Using dial-up modems or GSM modems in Java - java

I want to communicate with my DFM-562IS D-Link modem (that is connected to my computer's mainboard via a PCI slot) using Java. The goal is listening for incoming calls and receive a code that the user enters on the other-side after connection (by his/her phone's keypad).
So far my searching on the Internet didn't give me anything useful and I found some closed old threads only (Here and here for example).
I just want to know if is it possible? and If so, give me a guildline please.
I really appreciate for shedding a light on this issue.
Thanks in advance
Update:
If the goal is achievable with GSM modems, please provide the related solutions for the issue in your answer also.

I'm sure it's possible, but I doubt it's very popular these days!
I don't know much about modems, but presumably if you can't find a higher-level library then you could communicate with them via the serial port using the Java Communications API or RxTx.
To see an exmaple of communication with a GSM modem, have a look at SMSLib.
If you are looking to support IVR, then you may not be able to find Java support for it. Software like FreeSwitch may help.

Related

How can I start/stop a Wireless Router through a Java Application?

I'm facing a problem nowadays with my home router. I want to write a small application that will ensure the router will stop/switch off if no packets transmitted in last 30 minutes. Is there a way to do?
Precisely, I want to switch off my router/start it back through a Java program, desperately looking for some suggestion from some experienced coder.
Any help would be welcome.
Thanks
I guess the answer is that it depends on which router you have and what kind of interface it provides for controlling it.
My own router has no API that I know of which allows it to be directly accessed via a Java program (although yours might be different).
My router does have a web interface and can be accessed over HTTP. Conceivably by making the right post request I would be able to power off my router. I imagine you might find that yours is similar.
EDIT (added text)
To use the web interface you need to first find the IP of the webserver - probably 192.168.1.1 or 192.168.1.254 . Type this into your browser to get the control panel and find the button that turns off the router. Press this button with the network tab open in the developer tools (if you're not sure what this means use google) and capture the url it uses.
Now you have the IP and the request you can mimic this and send the same request directly using your Java code. Again to find out how look online. For example Sending HTTP POST Request In Java
END EDIT
The other problem you have is monitoring traffic to and from your router. You can do this a number of ways. Off the top of my head I would suggest using a raw socket to listen for all traffic and monitor everything that goes across the web interface of the device running your Java program. Alternatively you can use an existing solution like TCPDump which will do the same.
The question you have asked is very broad with a number of reasonable answers - it is also a kind of big question - so I have tried to provide some reasonable thoughts to get you started rather than actually write the code for you.
Hope this helps.

Android -> PC USB Communication

I'm something of a novice when it comes to Android apps, so bear with me. I would like to have communication between an app that I make, and a process on a computer. This could be using TCP, or with some USB-specific protocol. I was thinking I'd write the computer-side application in Java to allow for better cross-platform support.
The research I've done thus far has mentioned a concept of USB hosts, which seems like the sort of thing I need to use. The documentation for all of this has been a little unclear. Could someone please either give me a link to a clearer article, or explain an article? Thanks.
What I'm looking for is a way for a PC to send data to the android device. The device acts on that data, then sends it back to the PC.

Where can I get to download Java comm api?

I want to write some programs using Java comm api. I am not able to find site/page from which I can download this API. Can anyone please tell me where can I get this API?
Basically I want to send SMS to mobile from PC. Mobile will connect to PC through USB cable. I would also like to know what are the possible ways to send SMS to mobile? (I am looking for option which wont incur me money)
Thanks in advance !
EDIT 1
I am not allowed to use third party APIs. It seems that Java comm API is dead now. So is there any other way to send messages to mobile from pc?
Download javax.comm api library from here : http://www.java2s.com/Code/Jar/c/Downloadcomm20jar.htm
In my opinion, the best alternative to javax.comm is rxtx.
Sending SMS over Serial Connection
For sending sms over serial connection you have to use AT command.
Here are some examples on other languages (but the concept is same).
http://linux-101.org/script/python-code-sending-sms-messages-usb-connected-mobile-phone
http://www.developershome.com/sms/howToSendSMSFromPC.asp
http://www.codeproject.com/KB/vb/AT_commands.aspx
I'd suggest you to test the commands on app like hyperterminal( alternative for win 7 : http://helpdeskgeek.com/windows-7/windows-7-hyperterminal/) first.
I would recommend RXTX. It doesn't use the javax.comm package, but it follows the same API, with a little extra.
If this is still relevant for you (maybe others, though);
Serialio.com are the true experts on serial communication. They have an excellent package (SerialPort) which I have used since 1997, and never given me any problems, and since then they have added support for Java Comm API as well as an endless number of platforms.
It might be an older version, but MIT hosts a copy of javaxcomm.zip here.
Try this source at oracle.com:
Misc. Java SE Tools and Libraries Downloads

Device to Device Communication in Android

I have been tasked for university to program a mobile phone application. I have oppted for two mobiles to communicate with each other via message.
I would like the application to connect the mobile to the internet to send the message and the other mobile to connect to the internet to recieve the message.
I am using Eclipse IDE.
Does anyone have any ideas for good examples of similar application source code so I can develop my application using appropriate protocols.
I would appreciate any advice and I am certainly not looking for someone to give me "the answer" I am really looking forward to getting stuck in. Though I have never touched an android phone let alone programed one. So some advice would be amazing!!
Thanks
Si
Get used to this site: http://developer.android.com/index.html Learn it, love it. It's full of useful information. The Videos section gives plenty of live talks about what exactly Android is among other topics. One of the first things you need to do is go to the SDK section. It gives a detailed guide on how to get setup. The Dev Guide is great for learning more about Android and how to program Android apps (not just Java programs) especially while just getting started. Resources is full of code examples and articles on specific issues and Reference is the entire platform documentation. #Matthew Willis has already given a helpful link from the Dev Guide.
Look around the site, download and install the SDK, and come back whenever you have any questions. Good Luck!
Before you determine the technical solution you need to figure out how any two devices that don't know about each other will communicate.
In your case, where you seem to be attempting to develop some kind of peer-to-peer solution you most probably will need some kind of server in between where your phones send messages to and poll for messages.
If you are using WIFI, you would have each phones IP address and could configure each phone to communicate with each other directly.
Once you determine your architecture then something simple like http may be enough to communicate.
You might check out What is Android? to get an idea of the frameworks/libraries that are available on Android. Reading the links in the left pane at that site lead you through a nice series of articles about Android.
In terms of ways for two devices to communicate, they are many and difficult to enumerate. In general you will have much better luck with specific questions here than you will with broad questions.
You might be interested in reading about C2DM for pushing messages to a device; if not, there are many other alternatives involving polling.
GCM CSS is probably your best bet
https://developer.android.com/google/gcm/ccs.html

Networking with ios

I have an application that was written in Java and runs on the users machine. I now want to build an application on the iPhone which will communicate with my java app.
Can somebody point me in the right direction on how I can send and receive TCP packets with the iPhone, I want to of course be able to do that using wifi and 3G.
Thanks,
You use the NSStream classes. I've found it pretty easy to use.
See the SimpleNetworkStreams for an example.
One problem I found is that the iphone sdk does not include the NSStream method getStreamsToHost:port:inputStream:outputStream: which is what Mac OS examples use to open a NStream connection but there are lots of places that show you how to create your own like here.

Categories

Resources