This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java Micro Edition and the fly likes Few questions regarding connecting several phones to a computer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "Few questions regarding connecting several phones to a computer" Watch "Few questions regarding connecting several phones to a computer" New topic
Author

Few questions regarding connecting several phones to a computer

Chris Blanchard
Greenhorn

Joined: Jan 02, 2007
Posts: 24
HI,

I've never done any form of mobile phone programming but am thinking about doing a project which involves several phones being connected to and contacting a PC at the same time.

I want to provide the mobile phone users with my own interface which provides them with several tools, what is the best way to do this...

1) Writing an application that is installed onto the phone(using J2ME), or
2) Having the user log into some kind of web site/portal that is provided by the PC (is this possible?)

I think 2) sounds better because it means the user doesn't have to install any software onto their phone to be able to access my interface, although 1) sounds easier to make, what do people think?

Secondly what is the best way to connect several phones to a computer? Will bluetooth be fine? Can several phones all connect to the same bluetooth dongle at the same time?

Thanks!
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15951
    
  19

There are a number of strategies you can pursue, but in most cases, it's a good idea to setup the phones to use HTTP and talk to a web server. It's simple, it's a well-proven and well-documented approach, and you can test the server communications using a desktop web browser. The one drawback to HTTP is that it's no good if you need the server to post unsolicited output to the phones, since HTTP can only respond to client requests.

Bluetooth is a peer-to-peer type of protocol. You can have multiple client/server conversations going at once. However, one drawback is that the client and server both be within the relatively short communications range of Bluetooth radio.

You can also use other channels, such as the TCP/IP protocol of your choice on Wi-Fi, if the phone supports it, or various phone-network channels, such as SMS.


Customer surveys are for companies who didn't pay proper attention to begin with.
Chris Blanchard
Greenhorn

Joined: Jan 02, 2007
Posts: 24
Ok thanks for the reply.

If I was to go with the HTTP approach, what sort phone do I need to be able to connect to this webserver, obviously bluetooth would be required, would the only other requirement be an integrated web browser in the phone?

Also what would be involved with setting up the webserver. Would it simply involve plugging a bluetooth adapter into the computer and then writing a Java application which accepts connections over bluetooth?
Chris Blanchard
Greenhorn

Joined: Jan 02, 2007
Posts: 24
Also, how fast is the connection likely to be?

I want the users to be able to make 'real-time' control over what is happening on the television.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15951
    
  19

I'm assuming that your phones all support J2ME, since you're asking on the J2ME forum. Without actually checking, I think that the core J2ME spec includes the HTTPRLConnection class, and that's all you need to make a java app (or MIDLet) talk to an HTTP server.

You don't need anything special on the server. All you need is hardware that allows establishing a TCP/IP connection between your devices and a network access point. Depending on the devices, this can be done via WiFi, Bluetooth, and/or the phone system. For example, my phone can easily be configured to use the Sprint EVDO data transmission system, which is rated at a nominal 400KB/sec. Or it can network via 802.11B WiFi at up to the limits of that protocol (I think that's about 11MB/sec). I'm reasonably sure I can also use the Bluetooth interface to access the TCP/IP stack, but I mostly just use that with file transfer utilities. WiFi is fastest. EVDO works in more places, but is a billable telephone company service.

EVDO is a Sprint thing, though I think AT&T also supports it. GSM commonly uses the EDGE network, which is slower, but has more international support.

If you're looking to primarily use phones as TV remote controls, another option may be to use the Infrared port, if you've got one. An Infrared usb adapter is fairly inexpensive and can be plugged into just about any computer that supports USB. Some computers - laptops - in particular - come with builtin Infrared. It's handly to talk to printers. Jacking an infrared dongle or Bluetooth dongle into a gateway server is almost the same process - they share a lot of the same software.
[ August 09, 2007: Message edited by: Tim Holloway ]
Chris Blanchard
Greenhorn

Joined: Jan 02, 2007
Posts: 24
I originally posted here because I thought I'd used j2me to write the mobile software with - I don't actually have any recent phones at the moment, I'll look into buying one when I know what I need from it.

Ideally I wanted a way where the user did not to install any extra software on their phone to be able to connect to server, i.e. they'd simply connect to the server which would then send them the menu screens to display on the mobile. Is this possible at all?

If not I think I'll invest in a phone that supports j2me and blueetooth and buy a bluetooth dongle for my PC.

Thanks
Chris Blanchard
Greenhorn

Joined: Jan 02, 2007
Posts: 24
Can anybody recommend a good phone to replace my 3310 with that is ideal for this project.

It obviously needs to support j2me as well as bluetooth, and needs to be cheap as well.

Also, will any bluetooth dongle do, such as this one...

http://www.memorybits.co.uk/categories/bluetooth-dongles/765?campaign=google_bluetooth_dongles&kw=bluetooth+dongle
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15951
    
  19

The easiest way to provide mobile services is via a web server - it's so easy that even the iPhone can do it! The only real requirement is that your phone have web/internet capabilities, and that's pretty common. If your phone supports the web and also supports J2ME then you're pretty much set. If you want zero client software, just make the functions all server-based and use the web browser.

When shopping for a J2ME device, look to see what JSR's it provides. Java Bluetooth, for example is JSR-82.

Smartphones often also support hooking up as TCP/IP LAN clients via Bluetooth, which can be quite useful.

I bought a Bluetooth Dongle pretty much off the shelf and jacked it into a latop running Ubuntu Linux. I was pleased to see that it was essentially plug and play. Passing files back and forth to the phone was almost easy enough that even ordinary phone users could do it without (much) help.
Chris Blanchard
Greenhorn

Joined: Jan 02, 2007
Posts: 24
Ok thanks.

One last question...

If I go down the zero client software route, then the phone won't need to support j2me at all will it? Surely it'll only need a web browser and bluetooth connection?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Few questions regarding connecting several phones to a computer
 
Similar Threads
Connecting a mobile phone to PC via Bluetooth
dev for specific phones/services
How to control PC from mobile device
running application in C on mobile phone with Android
problem with including jsapi library; sending SMS to server