Hallo,
I wrote a small program that
connects via bluetooth,
turns some motors on and off and
finally disconnects with the
NXTCommand.close operation.
I ran into two issues:
1.
The close operation somehow leaves the nxt in a state that
allows no new connect via open.
After each program run I have to switch the nxt
off and on again to make connection work.
If the connection doesn't work, the messages are:
-------------------------
NXTCommand.open(): Error while connecting ...
icommand.nxt.comm.BlueZException: Can't connect: Connection refused (111)
at icommand.nxt.comm.NXTCommBluez.rcSocketConnect(Native Method)
at icommand.nxt.comm.NXTCommBluez.open(Unknown Source)
at icommand.nxt.comm.NXTCommBluez.open(Unknown Source)
at icommand.nxt.comm.NXTCommand.open(Unknown Source)
at et.ETframe.Verbindung_actionPerformed(ETframe.java:137)
at et.ETframe_Verbindung_actionAdapter.actionPerformed(ETframe.java:276)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1839)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.JToggleButton$ToggleButtonModel.setPressed(JToggleButton.java:273)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)
at java.awt.Component.processMouseEvent(Component.java:5100)
at java.awt.Component.processEvent(Component.java:4897)
at java.awt.Container.processEvent(Container.java:1569)
at java.awt.Component.dispatchEventImpl(Component.java:3615)
at java.awt.Container.dispatchEventImpl(Container.java:1627)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
at java.awt.Container.dispatchEventImpl(Container.java:1613)
at java.awt.Window.dispatchEventImpl(Window.java:1606)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
-------------------------
(I do work with JBuilder 2005 on a openSUSE Linux machine.)
2.
If the connection fails, a BlueZException is thrown but caught in the
library itself and the program is terminated afterwards.
I would like to be able to catch the Exception and give an error message
and keep my program running. (This is a wish from me, so it should
probably be on a wish list instead a bug thread.)
Bye,
Frank
________
iolite vaporizer

