Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 70
Registered: ‎11-30-2009
My Device: Not Specified

Possible conflict with the USBPortListener interface ?

 

          Hi everybody,

 

     I had recently posted a thread about this issue (http://supportforums.blackberry.com/t5/Java-Development/No-event-caught-on-USBPortListener/m-p/47626...), I thought it was solved, but it actually wasn't.

 

     * Let me introduce this issue with more detailled. First I've registered the listener like this :

 

theApp.addGlobalEventListener(ModelFacade.getConnectionManager());
theApp.addIOPortListener(ModelFacade.getConnectionManager());

     * Secondly I've implemented the interface like this :

 

public class ConnectionManager implements GlobalEventListener, CoverageStatusListener, USBPortListener

     * Eventually I've implemented the corresponding methods of IOPortListener and USBPortListener interfaces (I'll show you only one though) :

 

public void connectionRequested() {
     UiApplication.getUiApplication().invokeLater(
          new Runnable() {
               public void run() {
                    SimpleDialog.inform("USBPortListener : connectionRequested()");
               }            
          }
     );		
		
     LOGGER.info("USBPortListener : connectionRequested()");
}

 

     The weird thing is that events dedicated for GlobalListener are correctly caught in the eventOccured() method. But all events dedicated for the USBPortListener are not caught or may be not even launched. When I plug or unplug USB wire nothing happens.

 

     Does anyone have a clue on what could be happening or what I could have forgotten to do ? I'm pretty sure the problem is obvious but I can't see it right now.

 

     Could it be a possible conflict between GlobalListener and USBPortListener interfaces ?

 

 

          Thanks in advance for your answers.

          ++

 

 

Highlighted
Visitor
Posts: 1
Registered: ‎04-18-2010
My Device: Not Specified

Re: Possible conflict with the USBPortListener interface ?

Based on my experience, you won't get a connectionRequested event on your device-side USB listener until the host application opens the channel (i.e. the channel whose name was registered on the device via the USBPort.registerChannel() method).  The host application does that by invoking the OpenChannel() method in the COM interface that is exposed by BBDEVMGR.EXE.