WML and J2ME

hi,
I have a WML page and have a midlet.
Using the file connection API, i will request for the WML to my server.
My midlet will get the WML response.
But, the output of the WML should be reflected on my MIDLET, without the mobile browser.
Have anyone tried this. Please help me out.
with regards,
Shirish.

WML and J2ME are not directly related.
1) If you want to download a WML page in your midlet you will need to use a HTTP connection. The downloaded WML markup can be displayed or processed in your midlet. To render the WML, you will need to write a parser and the rendering components.
If you need to extract information from the WML document, I would suggest not using WML at all and starting with an XML document, tailored for your use.
If you do not need to extract information from the WML document, consider using a PlatformRequest to launch the browser and render the WML document.
2) You can host and create WML page similar to the methods you would use to create and host a HTML page. There are tools to help you author the pages, and emulators to help test your pages.
I would suggest starting with one of the phone manufacturers developer groups, i.e. sony ericsson or Nokia. You can find support and tools on their sites.

Similar Messages

  • Mp3 and j2me supporting reliance mobile

    hi,
    if anyone know abt mp3 and j2me supporting Reliance phone in market.if so please give me the link where to get teh details I already checking it with reliance website and i want more information please help me.
    thanx in advance
    laxmi

    hi laxmi
    i dont know did you check this URL
    www.dadp.com
    there is one forum also avail for the j2me and realience phone you will get all the information tehre
    regards
    [email protected]

  • Connecting databeses with WML and JSP pages..!

    I need information about how to connect databases with wap technologies using wml and jsp , I am waiting your resources, codes and helps.. And I would like to remind you , I am beginner about this topic , Only things that I know are Jsp and WML , I have no experience about wap and how to combine wml and jsp , So please be helper while you send your messages , If all your messages contains much detailed and supported complete sources and files , it will more helpfull for me ..
    Thanks in Advance.
    P.S : 1- ) if you want to contact direclty , mail address : [email protected]
    2-) Don't post me complex references' URL , I have already made search on google,yahoo and etc

    Additionally , I would like to learn what I have to need for this project .. Now , I already have winwap wap emulator and Websphere Studio.. Do I need special wap server or something else to test my applications..
    Please , hurry up .. I really need your helps..
    Ergin

  • Bluetooth communication  between J2SE server and J2ME client

    Hi everyone!
    I'm new here in this forum...
    I try to make a small project to my studies,
    My project will include J2SE server and J2ME client.
    I'm stuck in the step of finding the server with the wireless toolkit emulator.
    I found this issue in old subject: here
    I try the solution in reply 6 but I don't understand exactly who to define kvem.home, and I got this error:
    " You must define the system property "kvem.home" "
    maybe someone can help me and explain how to do that?
    thanks!

    Hello,
    I want to find out how this can be done, too. I tried with
    System.setProperty("kvem.home", "C:\\WTK2.5.2");but I get an error:
    java.lang.UnsatisfiedLinkError: com.sun.kvem.jsr082.impl.bluetooth.BluetoothController.setSystemProperty(Ljava/lang/String;Ljava/lang/String;)I included these files in the build path:
    c:\WTK2.5.2\wtklib\gcf-op.jar
    c:\WTK2.5.2\wtklib\kenv.zip
    c:\WTK2.5.2\wtklib\kvem.jar
    and I import com.sun.kvem.bluetooth.*;
    I'd appreciate any help.

  • Educational Use of JMF and J2ME WTS

    Dear all,
    I have tried to find legal information about education use of JMF and J2ME WTS. I want to install these two packages in the computers of a tutorial room for student use.
    Would any kind soul please enlighten me where I can get such information?
    Thank you.
    Cheers,
    Andrew Lui
    The Open University of Hong Kong

    Maybe from Sun? If it's not mentioned in the terms and conditions of the libraries or their download sites, I wouldn't know where else to get more information.

  • SVG Tiny and J2ME?

    Is there any support for SVG (tiny or basic) in the standard libs or are you forced to use 3:rd party libs (alternatevly creating your own)? Since I havn't found it I'm guessing that your stuck with third party libs or the diys-rule but quite new to j2me and i havnt quite got the hang of all the diferent apis provided. Anyway, would be greatfull if anyone could straighten my questionmarks.
    Best Regards,
    John

    Hi,
    I'm currently working with SVG and J2ME and I've seen many products...but I think that TinyLine is the most useful (if you are looking for something free).
    There's also a jsr, "Scalable 2D Vector Graphics API for J2ME" (jsr 226)
    http://www.jcp.org/en/jsr/detail?id=226
    maybe you can find it interesting
    Another link, containing some interesting hints about Mobile SVG
    http://www.xml.com/pub/a/2004/08/18/sacre.html
    I don't know if I've told you news or not...hope to have been helpful :-)
    bye
    melian

  • Wml and servlet

    package alpha;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class KuisServlet extends HttpServlet {
    String soal, jawabanA, jawabanB, jawabanC, jawabanD, betul;
    String docType =
    "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\"\n" +
         " \"http://www.wapforum.org/DTD/wml_1.1.xml\">\n";
    public void init() throws ServletException {
    soal = getInitParameter("soal");
    jawabanA = getInitParameter("jawabanA");
    jawabanB = getInitParameter("jawabanB");
    jawabanC = getInitParameter("jawabanC");
    jawabanD = getInitParameter("jawabanD");
    betul = getInitParameter("betul");
    if (soal == null || jawabanA == null || jawabanB == null ||
    jawabanC == null || jawabanD == null || betul == null) {
    throw new ServletException("error sintaks init parameter(s)!");
    public void doGet(HttpServletRequest req, HttpServletResponse rsp)
    throws ServletException, IOException {
    rsp.setContentType("text/vnd.wap.wml");
    PrintWriter out = rsp.getWriter();
    String jawaban = req.getParameter("jawaban");
    out.println("<?xml version=\"1.0\"?>");
    out.println(docType);
    out.println("<wml>");
    out.println("<!-- card test kuis -->");
    out.println("<card id=\"main\" title=\"tes kuis\">");
    if (jawaban == null) {
    StringBuffer action = HttpUtils.getRequestURL(req);
    out.println("<p> Testing pake wml </p>");
    out.println("<p> Soal : " + soal + "</p>");
    out.println("<select name=\"pilih\" value=\"0\">");
    out.println("<option value=\"A\" /> " + jawabanA + "</option>");
    out.println("<option value=\"B\" /> " + jawabanB + "</option>");
    out.println("<option name=\"jawaban\" value=\"B\" /> "
         + jawabanB + "<br/>");
         out.println("<option name=\"jawaban\" value=\"C\" /> "
    + jawabanC + "<br/>");
    out.println("<option name=\"jawaban\" value=\"D\" /> "
         + jawabanD + "<br/>");
    out.println("</select>");
    out.println("<anchor title=\"Ok\">Ok");
    out.println("<go method=\"post\" href=\"" + action + "\" >\n");
    out.println("<postfield name=\"pilih\" value=\"$(pilih)\"/>");
         out.println("<postfield name=\"jawab\" value=\"" + betul + "\"/>");
    out.println("</go>");
    out.println("</anchor><br/>");
    } else {
    if (jawaban.equals(betul))
    out.println("<p><b>YEAH!</b> jawaban benar!</p>");
    else
    out.println("<p><b>Maaf</b> jawaban salah .</p>");
    out.println("</card>");
    out.println("</wml>");
    public void doPost(HttpServletRequest req, HttpServletResponse rsp)
    throws ServletException, IOException {
    doGet(req,rsp);
    plis help with this , syntax wml doesnt work in emulator ponsel any suggest ...?

    from wml syntax , i changes like this :
    out.println("<p> Testing pake wml </p>");
    out.println("<p>" + soal );
    out.println("<select name=\"jawab\" value=\"0\">");
    out.println("<option value=\"A\" name=\"jawaban\" >" + jawabanA + "</option>");
    out.println("<option value=\"B\" name=\"jawaban\" >" + jawabanB + "</option>");
    out.println("<option value=\"C\" name=\"jawaban\" >" + jawabanC + "</option>");
    out.println("<option value=\"D\" name=\"jawaban\" >" + jawabanD + "</option>");
    out.println("</select>");
    out.println("</p>");
    out.println("<anchor title=\"Ok\">Ok");
    out.println("<go method=\"post\" href=\"" + aksi );
    out.println("<postfield name=\"jawab\" value=\"0\"/>");
    out.println("</go>");
    out.println("</anchor>");
    out.println("</card>");
    out.println("</wml>");
    and web.xml for description deployment :
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <servlet>
    <servlet-name>
    test
    </servlet-name>
    <servlet-class>
    test.KuisServlet
    </servlet-class>
    <!-- Servlet Mapping -->
    <servlet-mapping>
    <servlet-name>KuisServlet</servlet-name>
    <url-pattern>/KuisServlet</url-pattern>
    </servlet-mapping>
    <init-param>
    <param-name>soal</param-name>
    <param-value>Presiden pertama RI ?</param-value>
    </init-param>
    <init-param>
    <param-name>jawabanA</param-name>
    <param-value>Sukarno</param-value>
    </init-param>
    <init-param>
    <param-name>jawabanB</param-name>
    <param-value>Suharti</param-value>
    </init-param>
    <init-param>
    <param-name>jawabanC</param-name>
    <param-value>Suharto</param-value>
    </init-param>
    <init-param>
    <param-name>jawabanD</param-name>
    <param-value>tidak ada yang benar</param-value>
    </init-param>
    <init-param>
    <param-name>betul</param-name>
    <param-value>A</param-value>
    </init-param>
    </servlet>
    <!-- mime mappings -->
    <mime-mapping>
    <extension>
    wml
    </extension>
    <mime-type>
    text/vnd.wap.wml
    </mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>
    wbmp
    </extension>
    <mime-type>
    image/vnd.wap.wbmp
    </mime-type>
    </mime-mapping>
    <!-- welcome file quiz.wml -->
    <welcome-file-list>
    <welcome-file>
    trivia.wml
    </welcome-file>
    </welcome-file-list>
    </web-app>
    but script wml still error when running emulator ponsel .
    any suggest ?

  • Javacard and j2me

    hi all,recently i want to plan a project that is about
    i want to make a connection between javacard and j2me(on pda)
    i.e. a j2me game can communicate with javacard..
    but i don't know has any existed solution ??
    at beginning i only want to make project in the simulation environment (pda simulatior<->javacard simulator) ,i hope u can give me any solution that can communicate between pda and javacard
    thx in advance!!

    AFAIK the j2me (the MIDP profile) does not support smartcard communication
    i.e. a j2me gsm phone cannot communicate with the sim card inside
    unless something has changed in this subject recently
    regards
    Kuba

  • SyncML and J2ME

    Hello 2 all,
    is there example avail for the SyncML and j2me?
    does anybody know how to realte j2me wiht SyncML?
    waiitg for the reply
    [email protected]

    Also look at funambol.com (sync4j). They have a J2ME sync client API.

  • Wap and j2me

    Hi,
    iam having a general doubt on wap vs j2me.i find in some places like (getrid of wap) or (say goodbye to wap) replacing it with j2me.But, how is data sent from a server to client and viceversa.(ie) what is the transport layer and the protocol thru which the data is sent!.
    Thanks,
    RP

    Hi,
    iam having a general doubt on wap vs j2me.i find in
    some places like (getrid of wap) or (say goodbye to
    wap) replacing it with j2me.But, how is data sent from
    a server to client and viceversa.(ie) what is the
    transport layer and the protocol thru which the data
    is sent!.
    Thanks,
    RPThe network/transport layer of j2me is implementation dependant. It can be TCP/IP or it can be other protocols like bluetooth ... etc...
    J2ME implementation must talk HTTP as an application level protocol. It generally is also able to make socket connections so user defined protocol may be used.
    However, I don't believe that WAP and WML should be got rid of. They do serve a great purpose.

  • JAR files and J2ME

    Just starting a J2ME project.
    An embarrassingly Noobie Question:
    1) All the classes that are supposedly "built-in" to my device (phone)
    do NOT need to be included in the deployed JAR file, right?
    2) Anyone know how to do that in Netbeans 5.0?
    Project -> Properties -> Build shows sources filtering
    but that doesn't include anything from my "input"/library .JARS.
    However, all the com.*, javax.* and java.* files are being included in
    my output JAR file and it causes failures in preverify and loading
    on the phone.
    HELP!!

    hi,
    any know this question
    please send me the procedures about how load my J2ME
    application(jad and jar file) into CDMA mobiles
    like(Nokia 6255,6235,6235i etc..).
    its very urgent for me,
    please anybody known this answer reply very soon.
    thanks a lot
    laxmi.Hi
    I am also having the same problem , any one has found solutions kindly inform. I want to install the spreadsheet viewer. Has any body developed solutions for the same - Please help
    Thanks a lot
    Ragupathi

  • MySQL and J2ME

    Hello.
    I'm building an application for mobile phones that should get data from an mySQL database.
    I would like to know what's the simplest way to do this. The database will be very small. Can I do this directly, doing a query to the database or I have to use PHP or some kind of servlet?
    In case of servlets, do they need to be installed on the server or they're just those JSP files?
    Thanks for the help.
    Wilian Segatto
    Computer Engineering Student
    UNISINOS University
    S�o Leopoldo - RS - Brazil
    Current Projects:
    -Pervasive game:
    moBIO Threat // Disease Control
    Articles (in Portuguese):
    -Paradigma Imperativo versus Paradigma Orientado a Objetos
    -Linguagem de Montagem

    You're not helping me. yes I am.
    You are basically saying to me
    to look for information on Google.
    No I didn't! But I should have. Your question is very vague.
    Let me try again. Your question is not specific to J2ME. Do you understand that?
    So you can do it one of two ways.
    1) Just a normal web page created with whatever. There is no need for a code sample for this. There are many, many examples and tutorials available.
    2) Create a webservice and access it like that.
    I posted the link to Wikipedia because I wanted YOU to read it and then come back and say if you want a webservice or not. If you don't know what a webservice is than that link explains it.
    Can anyone give me specific directions, please?Please refrain from being rude and unpleasant.
    And .jsp = J2EE?
    JSP is part of J2EE yes.
    >
    >
    Wilian Segatto
    Please DESIST from posting your lengthy signature on everyone of your posts Wilian. Thank you.

  • JNI and J2ME

    Hello all. These days i've been asked to make a little aplication for a PDA and while looking for information about j2me it says jni its not supported. But the app i need to make needs to use some library written in C, and my question is if there is any way o making an application in j2me that can use those libraries.
    Thanks all.

    Yes i've found a compiler for my target platform and compiling and running the C libraries doesnt seem a problem at the time. My main problem is that I can't call them from my java application because jni is not supported and i dont know how to import them.
    Thanks for your answer
    Message was edited by:
    trospito

  • Bluetooth and j2me, a frustrating scenario...

    Hello all,
    I don't want to use propeitory sdk's so I need to get a bluetooth stack working with the wireless toolkit but I am not going to pay for it so I downloaded the stack from javabluetooth.org, but when trying to compile a program which uses the javax.bluetooth package I get an error...
    Error preverifying class org.javabluetooth.distributed.BluetoothTCPServer
        VERIFIER ERROR org/javabluetooth/distributed/BluetoothTCPServer.run()V:
    Cannot find class java/net/SocketI guess j2me api does not include the package socket at all?
    Does anyone have any ideas how to get a bluetooth stack working with j2me?
    Thanks for your time
    poncenby

    the WTK 2.2b is available since June 26 or so.
    To the JSR-82 API: the classes from sun (javax.bluetooth.* and javax.obex.*) are part of the WTK 2.2b and can be used. But remember: to use a bt app on a phone, the phone must support JSR82, not only MIDP and CLDC.
    I am too good for this world. You should check http://java.sun.com/j2me . There can at least 2 articles be found regarding the development of J2ME and Bluetooth, as well as the WTK downloads and many other interesting things ;-)
    here is the link to the WTK 2.2b
    http://java.sun.com/products/j2mewtoolkit/download-2_2.html
    good luck and have fun
    Killer_2001

  • Bluetooth simulation between J2SE server and J2ME client

    hi there,
    I have a working bluetooth client/server application (using BlueCove), with the server on a PC (the PC has bluetooth hardware) and the client on a mobile telephone.
    I wish to move the application to a bluetooth simulated environment, however.
    To simulate bluetooth between 2 mobiles, I could open 2 instances of the WTK simulator and the mobiles will find each other -- but this doesn't meet my needs. I wish to simulate the bluetooth environment between a J2SE server and a J2ME client.
    Can I do this using the wireless toolkit? Does anyone have other ideas?
    thanks,
    Manoj

    OK - I have the solution.
    My PC (server) code used BlueCove to talk to the bluetooth stack. The trick is to use Sun's own KVM packages. This creates a virtual bluetooth device on your machine, shared by the WTK emulator.
    Here's the server code:
    package com.encube;
    import java.awt.BorderLayout;
    import java.io.InputStream;
    import javax.microedition.io.Connector;
    import javax.microedition.io.StreamConnection;
    import javax.microedition.io.StreamConnectionNotifier;
    import javax.swing.JFrame;
    import javax.swing.JList;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    import com.sun.kvem.bluetooth.BluetoothStateException;
    import com.sun.kvem.bluetooth.DiscoveryAgent;
    import com.sun.kvem.bluetooth.LocalDevice;
    public class Server {
         public static final String UUID_STRING = "A781FDBA229B486A8C21CEBD00000000";
         public static final String SERVICE_NAME = "BTCHATSVR";
         private StreamConnectionNotifier server;
         JFrame jframe;
         JTextArea textArea;
         public static void main(String[] args) {
              Server svr = new Server();
              svr.doWork();
         public void doWork() {
              this.jframe = new JFrame("BT Server");
              this.jframe.setLayout(new BorderLayout());
              this.textArea = new JTextArea(6, 20);
              JScrollPane jsp = new JScrollPane(this.textArea);
              this.jframe.add(jsp, BorderLayout.CENTER);
              this.jframe.pack();
              this.jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              this.jframe.setVisible(true);
              startServer();
         public void logMessage(String message) {
              this.textArea.setText(this.textArea.getText() + message + "\n");
              this.textArea.setCaretPosition(this.textArea.getText().length());
         public void startServer() {
              LocalDevice local;
              try {
                   local = LocalDevice.getLocalDevice();
                   local.setDiscoverable(DiscoveryAgent.GIAC);
                   this.logMessage("max of "
                             + LocalDevice
                                       .getProperty("bluetooth.connected.devices.max")
                             + " connection(s) supported");
                   String url = "btspp://localhost:" + UUID_STRING + ";name="
                             + SERVICE_NAME;
                   server = (StreamConnectionNotifier) Connector.open(url);
                   this.logMessage("waiting for connection...");
                   StreamConnection conn = server.acceptAndOpen();
                   this.logMessage("connection opened");
                   InputStream is = conn.openInputStream();
                   byte buffer[] = new byte[1000];
                   while (true) {
                        int numChars = is.read(buffer);
                        String s = new String(buffer);
                        logMessage("received from mobile phone: " + s.substring(0, numChars));
              } catch (Exception e) {
                   this.logMessage(e.getMessage());
    }You need to include the location of WTK as the kvem.home define. If its installed in c:\wtk22 (the default), start the server with the parameter -Dkvem.home="c:\wtk22". You also need to include these 3 libraries:
    c:\wtk22\wtklib\gcf-op.jar
    c:\wtk22\wtklib\kenv.zip
    c:\wtk22\wtklib\kvem.jar
    That's it for the server. My code of the sample client (the mobile phone, running in the WTK emulator) is messy (sorry about that -- still cleaning it up)!
    import java.io.IOException;
    import java.io.OutputStream;
    import java.util.Enumeration;
    import java.util.Timer;
    import java.util.TimerTask;
    import java.util.Vector;
    import javax.bluetooth.BluetoothStateException;
    import javax.bluetooth.DeviceClass;
    import javax.bluetooth.DiscoveryAgent;
    import javax.bluetooth.DiscoveryListener;
    import javax.bluetooth.LocalDevice;
    import javax.bluetooth.RemoteDevice;
    import javax.bluetooth.ServiceRecord;
    import javax.bluetooth.UUID;
    import javax.microedition.io.Connector;
    import javax.microedition.io.StreamConnection;
    import javax.microedition.lcdui.Display;
    import javax.microedition.lcdui.Form;
    import javax.microedition.lcdui.StringItem;
    import javax.microedition.midlet.MIDlet;
    import javax.microedition.midlet.MIDletStateChangeException;
    public class MainMIDlet extends MIDlet {
         protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
              // TODO Auto-generated method stub
         protected void pauseApp() {
              // TODO Auto-generated method stub
         protected void startApp() throws MIDletStateChangeException {
              MainForm mainForm = new MainForm();
              Display.getDisplay(this).setCurrent(mainForm);
              mainForm.initializeDisplay();
    class MainForm extends Form {
         public static final String UUID_STRING = "A781FDBA229B486A8C21CEBD00000000";
         private StringItem log;
         private DiscoveryAgent agent;
         Object lock = new Object();
         static EndPoint currentEndPoint;
         static Vector serviceRecords = new Vector();
         public MainForm() {
              super("BT Client");
         public void initializeDisplay() {
              this.log = new StringItem("", "");
              this.append(this.log);
              try {
                   LocalDevice local = LocalDevice.getLocalDevice();
                   agent = local.getDiscoveryAgent();
                   agent.startInquiry(DiscoveryAgent.GIAC, new Listener(this, agent));
              } catch (BluetoothStateException e) {
                   this.logMessage(e.getMessage());
         public void logMessage(String message) {
              this.log.setText(this.log.getText() + message + "\n");
         public void processServiceRecord(ServiceRecord sr) {
              try {
                   String url = sr.getConnectionURL(
                             ServiceRecord.NOAUTHENTICATE_NOENCRYPT, false);
                   logMessage("opening URL " + url);
                   StreamConnection conn = (StreamConnection) Connector.open(url);
                   OutputStream os = conn.openOutputStream();
                   String smessage = "test message from phone emulator";
                   os.write(smessage.getBytes());
              } catch (IOException e) {
                   logMessage("error while processing service record: "
                             + e.getMessage());
         class Listener implements DiscoveryListener {
              private MainForm mainForm;
              private Vector pendingEndPoints;
              private DiscoveryAgent agent;
              public Listener(MainForm mainForm, DiscoveryAgent agent) {
                   this.mainForm = mainForm;
                   this.agent = agent;
                   this.pendingEndPoints = new Vector();
              public void deviceDiscovered(RemoteDevice dev, DeviceClass deviceClass) {
                   this.mainForm.logMessage("found device");
                   this.pendingEndPoints.addElement(new EndPoint(dev));
              public void inquiryCompleted(int arg0) {
                   this.mainForm.logMessage("done searching for devices");
                   for (Enumeration enm = this.pendingEndPoints.elements(); enm
                             .hasMoreElements();) {
                        EndPoint ep = (EndPoint) enm.nextElement();
                        ep.calculateRemoteName();
                        this.mainForm.logMessage("device name: " + ep.getRemoteName());
                   new Timer().schedule(new DoServiceDiscovery(), 100);
              public void servicesDiscovered(int transID, ServiceRecord[] arg1) {
                   mainForm.logMessage("found " + arg1.length
                             + " service(s) on device "
                             + currentEndPoint.getRemoteName());
                   for (int i = 0; i < arg1.length; i++) {
                        serviceRecords.addElement(arg1);
              public void serviceSearchCompleted(int arg0, int arg1) {
                   synchronized (lock) {
                        * unlock to proceed to service search on next device see
                        * DoServiceDiscovery.run()
                        lock.notifyAll();
                   mainForm.logMessage("done searching for services on "
                             + currentEndPoint.getRemoteName());
              * Inner class. Called a short time after the last device is found.
              class DoServiceDiscovery extends TimerTask {
                   public void run() {
                        try {
                             UUID uuids[] = new UUID[2];
                             * ok, we are interesting in btspp services only and only
                             * known ones -- check for our UUID
                             uuids[0] = new UUID(0x1101);
                             uuids[1] = new UUID(MainForm.UUID_STRING, false);
                             for (Enumeration enm = pendingEndPoints.elements(); enm
                                       .hasMoreElements();) {
                                  EndPoint ep = (EndPoint) enm.nextElement();
                                  mainForm.logMessage("searching for services on "
                                            + ep.getRemoteName());
                                  currentEndPoint = ep;
                                  ep.transId = agent.searchServices(null, uuids,
                                            ep.remoteDev, new Listener(mainForm, agent));
                                  synchronized (lock) {
                                       try {
                                            lock.wait();
                                       } catch (InterruptedException e) {
                                            // do nothing
                                            mainForm.logMessage("exception while waiting: "
                                                      + e.getMessage());
                             mainForm.logMessage("discovered all services; found "
                                       + serviceRecords.size() + " record(s)");
                             * assume we have just 1 service record
                             if (serviceRecords.size() > 0) {
                                  processServiceRecord((ServiceRecord) serviceRecords
                                            .elementAt(0));
                        } catch (Exception e) {
                             mainForm.logMessage("error during service discovery: "
                                       + e.getMessage());
    class MiscUtils {
         * Get the friendly name for a remote device. On the Nokia 6600, we're able
         * to get the friendlyname while doing device discovery, but on the Nokia
         * 6230i, an exception is thrown. On the 6230i, we get the friendly name
         * only after all devices have been discovered -- when the callback
         * inquiryCompleted is called.
         * @param dev
         * the device to examine
         * @return a friendly name for the device, otherwise the IP address as a
         * hex-string
         public static String getDeviceName(RemoteDevice dev) {
              String devName;
              try {
                   devName = dev.getFriendlyName(false);
              } catch (IOException e) {
                   devName = dev.getBluetoothAddress();
              return devName;
         public static EndPoint findEndPointByTransId(Vector endpoints, int id) {
              for (int i = 0; i < endpoints.size(); i++) {
                   EndPoint endpt = (EndPoint) endpoints.elementAt(i);
                   if (endpt.getTransId() == id) {
                        return endpt;
              return null; // not found, return null
    class EndPoint {
         // remote device object
         RemoteDevice remoteDev;
         // remote device class
         DeviceClass remoteClass;
         // remote service URL
         String remoteUrl;
         // service hosted on this device -- populated after searching for devices
         ServiceRecord serviceRecord;
         // bluetooth discovery transId, obtainsed from searchServices
         int transId = -1; // -1 must be used for default. cannot use 0
         // local user nick name
         String localName;
         // remote user nick name
         String remoteName;
         // vector of ChatPacket pending to be sent to remote service.
         // when message is sent, it is removed from the vector.
         Vector msgs = new Vector();
         public EndPoint(RemoteDevice rdev) {
              remoteDev = rdev;
         * This functionality isn't called in the constructor because we cannot
         * retrieve the friendly name while searching for devices on all phones. On
         * some phones we have to wait until after devices have been discovered.
         public void calculateRemoteName() {
              this.remoteName = MiscUtils.getDeviceName(this.remoteDev);
         public RemoteDevice getRemoteDev() {
              return remoteDev;
         public String getRemoteName() {
              return remoteName;
         public ServiceRecord getServiceRecord() {
              return serviceRecord;
         public void setServiceRecord(ServiceRecord serviceRecord) {
              this.serviceRecord = serviceRecord;
         public int getTransId() {
              return transId;
    ...and that's it. Start the server, then the client (all on the same machine) and you've simulated bluetooth between the 2.
    To get the server working with a real mobile, you'll need to use the BlueCove library instead of the 3 WTK jars (and can remove the kvem.home directive as well). The rest of the code should remain the same (haven't quite tested that yet!).
    cheers
    Manoj
    null

Maybe you are looking for

  • How do I stop Firefox from opening all programs like iTunes and even regular things like my download folder?

    I am running on Windows 7. I do not know what happened exactly. My little brother used the computer and tried to uninstall Power Point. Ever since then, everything opens in Firefox. I cannot use the shortcut to my folders. All icons are the Firefox o

  • Can Intermedia Help Me

    Hello Gurus, We have a application runs two times a day , which fetches data from a remote server. We have a table in which we store URL to access a finance document which is in TIFF format. What we have to do is to get the finance document in to one

  • Other ac3 codec than the 0.4 plug-in

    hey guys its been a pain in the azz that since apple release the new update for qt (.0.2 & .0.3) the commonly known ac3 codec for qt 0.4 doesn't work no more under qt. so i am just wonderin that if there's another ac3 codec out there that will work w

  • How can i hook up my droid 2 to get netflix on hdtv

    how can i hook up my droid2 to my tv to get netflix

  • IDVD Menu Help

    I am new to iDVD and jere is the issue. I brought my movie in with 12 chapters in the "Revolution" theme. On the first page it has "Scenes 1-6" with just a simple link to that chapter. But when I go to the next page it has "Scenes 7-12" but with litt