×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Jan 2011
    Posts
    2

    Detecting USB power up event in j2me.

    Hello, I am new to this forum, but not new to programming. However, I am somewhat new to j2me specific programming. I have not written any fully fledged j2me applications yet, but have written various test programs to see how things work. fun.

    Currently I have a problem. I want to use my cellphone to monitor an external device. The cellphone only needs to respond to a 5 volt signal ( on signal ) coming from that device. I have been playing with the USB port on my Nokia. I see that if you apply 5volts power to the nokia's usb port by the power connectors it will respond to it and attempt to communicate with whatever was plugged into the usb port. Thats really what I want, I want my j2me program to detect this event. USB power received event, or in other words: plugged in event. I have been looking at the j2me API's and have been unable to find anything yet that will work for this kind of thing. If it would be possible to read the state of the usb port at any given time then that would also work. Like if you can read its RX and TX lines, just to see if they are 0's or 1's. As I say I only need to read an on or off from an external device. I don't need a fully fledged communications set up with the device. This is really a very low level thing. But if I an use a higher level interface that will work then thats great.

    Would anyone please give a code segment that would work or that I can try. I want this to work on a Nokia 2710 and the older Nokia 7210 supernova.

    thanks

  2. #2
    Registered User
    Join Date
    Feb 2007
    Location
    India
    Posts
    1,128

    Re: Detecting USB power up event in j2me.

    Firstly, Warm Welcome to Forum Nokia Dibo:-)

    Hope you would be some of interest in reading this article with example....
    MIDP: Using Cable Connection In Nokia Devices (With Example)
    http://www.forum.nokia.com/info/sw.n..._v1_0.zip.html

  3. #3
    Registered User
    Join Date
    Jan 2011
    Posts
    2

    Re: Detecting USB power up event in j2me.

    Hi kis_spn and other readers, Thanks for your input.

    I have already looked at that code and tried it. However, no serial ports are detected by this line:
    String ports = System.getProperty("microedition.commports"); But one USB port is detected. So this line:
    comm = (CommConnection)Connector.open("comm:COM1"); I changed to this:
    comm = (CommConnection)Connector.open("comm:USB1"); It appears the program is a bit old.

    Everywhere COM1 appeard I made it USB1. So then the program would run on my Nokias. BUT the program never returns from the Connector.open("comm:USB1"); call. It just gets stuck in it end thever throws an Exception. If I plug in the usb to my laptop ( other end connected to the phone of course ) the program still does not return from the Connector.open call. It just never returns from it. Maybe waiting for something...

    If the j2me program is running on my Nokia 2710 and I plug the usb into my laptop the pone's firmware detects this event and will ask in which mode the usb port must be used in. PC suite mode Data Storage etc... Then my Nokia 2710 will actually atomatically close the j2me progam which is trying to access the USB1 port.

    I don't even want full communications through the USB, as I said before I just want a j2me program to be able to detect USB plugged in event. I looked at the jsr80 API which has a mothod or event called USBPluggedIn or something I cant remember the exact naming. Thats just perfect, however jsr80 don't seem to work for nokias or other phones for that matter. When will jsr80 be implemented on Nokia phones ?

    So what am I dealing with ? Nokia 2710 and 7210 have no way to use the USB port via j2me ? Where can one get proper technical specifications on what is properly supported by Nokia phones ?

    Do nokia technical representatives ever give advice on this forum ?

    Any help with regards to what I have mentioned in my thread starter would be appreciated.

    thanks.

  4. #4
    Registered User
    Join Date
    Sep 2010
    Posts
    6

    Re: Detecting USB power up event in j2me.

    Hi truthliker,

    ""
    If the j2me program is running on my Nokia 2710 and I plug the usb into my laptop the pone's firmware detects this event and will ask in which mode the usb port must be used in. PC suite mode Data Storage etc... Then my Nokia 2710 will actually atomatically close the j2me progam which is trying to access the USB1 port.

    ""

    Your j2me application is coming in the level of application layer. Before that there are so many driver level programs are waiting for singal form usb port.

    ** One thing you try is try to put this mode as automatic selection and try it.?

  5. #5
    Registered User
    Join Date
    Feb 2012
    Posts
    2

    Re: Detecting USB power up event in j2me.

    Hello trutliker,
    I am trying to do exactly the same task you are trying to do. I also want to detect a high signal on my Nokia c1-01 USB port and run a application. I don't want any data communication to be done between the connected device and the Mobile. So, Can you please update me about your task. Whether you fond any solution?? I also welcome solutions from any of th Nokia developer.

    Thanx..

  6. #6
    Registered User
    Join Date
    Feb 2012
    Posts
    2

    Re: Detecting USB power up event in j2me.

    Hello trutliker,
    I am trying to do exactly the same task you are trying to do. I also want to detect a high signal on my Nokia c1-01 USB port and run a application. I don't want any data communication to be done between the connected device and the Mobile. So, Can you please update me about your task. Whether you fond any solution?? I also welcome solutions from any of th Nokia developer.

    Thanx..

  7. #7
    Registered User
    Join Date
    Mar 2003
    Posts
    4,105

    Re: Detecting USB power up event in j2me.

    I do not see a way, because the COM ports in J2ME are very high level and need a com connection. Furthermore, I am not aware of a Nokia which allows Push Registry for USB CDC ACM. However, you could go for Bluetooth and autostart your MIDlet this way.

  8. #8
    Nokia Developer Expert
    Join Date
    Aug 2007
    Posts
    1,595

    Re: Detecting USB power up event in j2me.

    Quote Originally Posted by traud View Post
    Furthermore, I am not aware of a Nokia which allows Push Registry for USB CDC ACM.
    Correct, this is not supported on Nokia devices via Java ME.

    Regards,
    r2j7
    [URL="http://library.forum.nokia.com/java"][B] >>> Java Developer's Library <<<[/B][/URL]
    [URL="https://www.developer.nokia.com/Resources/Support/Technical_support.xhtml"] [B]>>> Technical Support for Java ME development <<<[/B][/URL]
    [URL="https://publish.ovi.com/info/"][B]>>> Nokia Publish: reach millions of Nokia users worldwide through Nokia Store <<<[/B][/URL]

Similar Threads

  1. Detecting softkey press event
    By jawarnerjr in forum Symbian
    Replies: 8
    Last Post: 2009-09-03, 00:44
  2. Detecting Key up / down
    By juannoguera in forum Symbian User Interface
    Replies: 1
    Last Post: 2009-06-12, 05:38
  3. Detecting GPS in j2me?
    By sunil_bhambani123 in forum Mobile Java Networking & Messaging & Security
    Replies: 5
    Last Post: 2008-10-08, 15:35
  4. detecting power off event
    By dhaenik in forum Mobile Java General
    Replies: 1
    Last Post: 2005-01-03, 20:06
  5. detecting power off event
    By dhaenik in forum Symbian
    Replies: 1
    Last Post: 2004-12-28, 10:34

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×