Bluetooth problems

Post your NXJ projects, project ideas, etc here!

Moderators: 99jonathan, roger, imaqine

Bluetooth problems

Postby corbino91 » Tue May 07, 2013 1:58 am

Hello I have been working on a project where I send numbers to an nxt brick over blue tooth from my computer, it was working perfectly until I tried to run the same program on my friends brick.

I have two bricks, at run time the master brick connects via blue tooth to the slave with no issue. It then wait for a connection from BTSend from my computer, then it starts. After I tried to run it on my friends identical setup, and failed, I tried on mine again, to learn that it now fails. I get the following error messages:

Code: Select all
BlueCove version 2.1.0 on winsock
BTSend Log.listener: Error: Exception connecting to NXT.
Failed to connect to any NXT
BTSend Log.listener: Caused by lejos.pc.comm.NXTCommException: Open of NXT failed.
BTSend Log.listener:    at lejos.pc.comm.NXTCommBluecove.open(NXTCommBluecove.java:136)
BTSend Log.listener: Caused by javax.bluetooth.BluetoothConnectionException: Failed to connect; [10064] A socket operation failed because the destination host was down.
BTSend Log.listener:    at com.intel.bluetooth.BluetoothStackMicrosoft.connect(Native Method)
BTSend Log.listener: Failed to connect to any NXT
BlueCove stack shutdown completed


I tried removing and re-installing the device (running windows 8) and it still doesn't work, the only time it connects now is after the second brick that it was connected to sleeps. But then it acts very strange. I have rebooted my machine and the bricks to no avail. Can anyone explain to me how in the world it would work just fine, but because I paired my friends brick to my computer (deleted it after) mine now stopped working? :?:
corbino91
New User
 
Posts: 1
Joined: Tue May 07, 2013 1:50 am

Re: Bluetooth problems

Postby skoehler » Tue May 07, 2013 9:47 pm

Look for a file called nxj.cache and plase post its contents. Try deleting (or renaming) it and see whether that improves things.
skoehler
leJOS Team Member
 
Posts: 1410
Joined: Thu Oct 30, 2008 4:54 pm

Re: Bluetooth problems

Postby pcProfie » Tue Jan 07, 2014 4:07 pm

cool i have the same problem :s. i tried to find a file like nxj.cache and i deleted it (C:/users/[name]). thats my exception: (new thread?)

Code: Select all
BTSend Log.listener: Searching for any NXT using Bluetooth inquiry
BlueCove version 2.1.0 on winsock
Found: NXT
BTSend Log.listener: Name 0 = NXT
BTSend Log.listener: Address 0 = 0016530F920C
BTSend Log.listener: Error: Exception connecting to NXT.
BTSend Log.listener: Caused by lejos.pc.comm.NXTCommException: Open of NXT failed.
BTSend Log.listener:    at lejos.pc.comm.NXTCommBluecove.open(NXTCommBluecove.java:136)
BTSend Log.listener: Caused by javax.bluetooth.BluetoothConnectionException: Connection timeout; [10060] Ein Verbindungsversuch ist fehlgeschlagen, da die Gegenstelle nach einer bestimmten Zeitspanne nicht richtig reagiert hat, oder die hergestellte Verbindung war fehlerhaft, da der verbundene Host nicht reagiert hat.
BTSend Log.listener:    at com.intel.bluetooth.BluetoothStackMicrosoft.connect(Native Method)
BTSend Log.listener: Failed to connect to any NXT
BlueCove stack shutdown completed

and in error field
Code: Select all
Failed to connect to any NXT

connecting via bluetooth over lejos-bat-files is also not working
new cache file:
Code: Select all
#Results from Bluetooth inquiry
#Tue Jan 07 17:05:19 CET 2014
NXT_0016530F920C=NXT
pcProfie
New User
 
Posts: 23
Joined: Thu Aug 02, 2012 4:18 pm

Re: Bluetooth problems

Postby skoehler » Tue Jan 07, 2014 4:35 pm

What happens if you delete the cache file?
Edit: Oops, sorry, you write you have deleted it. Afterwards, still the same exception exists. I'm not sure what is happening.
skoehler
leJOS Team Member
 
Posts: 1410
Joined: Thu Oct 30, 2008 4:54 pm

Re: Bluetooth problems

Postby pcProfie » Tue Jan 07, 2014 4:42 pm

like i said:
Code: Select all
Found: NXT
BTSend Log.listener: Name 0 = NXT
BTSend Log.listener: Address 0 = 0016530F920C
in the log.
but i see, that its not the same exception. my exeption is [10060] and his is [10064].
i will try this programm on my laptop later (dropbox sync, takes time :)).
in my pc is a small logitech micro usb bluetooth dongle with bt 4.0 and that and that and that ;), maybe it works with an integreted dongle in my laptop
pcProfie
New User
 
Posts: 23
Joined: Thu Aug 02, 2012 4:18 pm

Re: Bluetooth problems

Postby pcProfie » Tue Jan 07, 2014 4:47 pm

but theres a thing i dont understand: i use bluej <- :(, habit
when i upload a programm, this time NxtApp it says this:
Code: Select all
BTSend.java:6: error: package lejos.pc.comm does not exist
import lejos.pc.comm.NXTCommLogListener;
                    ^
BTSend.java:7: error: package lejos.pc.comm does not exist
import lejos.pc.comm.NXTConnector;
                    ^
BTSend.java:11: error: cannot find symbol
      NXTConnector conn = new NXTConnector();
      ^
  symbol:   class NXTConnector
  location: class BTSend
BTSend.java:11: error: cannot find symbol
      NXTConnector conn = new NXTConnector();
                              ^
  symbol:   class NXTConnector
  location: class BTSend
BTSend.java:13: error: cannot find symbol
      conn.addLogListener(new NXTCommLogListener(){
                              ^
  symbol:   class NXTCommLogListener
  location: class BTSend
5 errors
NXTremoteControl_TA.java:1: error: package javax.swing does not exist
import javax.swing.*;
^
NXTremoteControl_TA.java:3: error: package java.awt.event does not exist
import java.awt.event.*;
^
NXTremoteControl_TA.java:6: error: package lejos.pc.comm does not exist
import lejos.pc.comm.NXTConnector;
                    ^
NXTremoteControl_TA.java:8: error: cannot find symbol
public class NXTremoteControl_TA extends JFrame
                                         ^
  symbol: class JFrame
4 errors
NXTtr.java:19: error: unmappable character for encoding Cp1252
 * I use “USBSendâ€? and “USBReceiveâ€? created by Lawrie Griffiths
                     ^
NXTtr.java:19: error: unmappable character for encoding Cp1252
 * I use “USBSendâ€? and “USBReceiveâ€? created by Lawrie Griffiths
                                          ^
2 errors
PcApp.java:1: error: package javax.swing does not exist
import javax.swing.*;
^
PcApp.java:3: error: package java.awt.event does not exist
import java.awt.event.*;
^
PcApp.java:7: error: package com.leapmotion.leap does not exist
import com.leapmotion.leap.*;
^
PcApp.java:8: error: package com.leapmotion.leap.Gesture does not exist
import com.leapmotion.leap.Gesture.State;
                                  ^
PcApp.java:10: error: cannot find symbol
public class PcApp extends Listener {
                           ^
  symbol: class Listener
PcApp.java:98: error: cannot find symbol
    class Gui extends JFrame implements WindowListener {
                      ^
  symbol:   class JFrame
  location: class PcApp
PcApp.java:98: error: cannot find symbol
    class Gui extends JFrame implements WindowListener {
                                        ^
  symbol:   class WindowListener
  location: class PcApp
PcApp.java:12: error: cannot find symbol
    private Controller controller;
            ^
  symbol:   class Controller
  location: class PcApp
PcApp.java:37: error: cannot find symbol
    public void onFrame(Controller controller) {
                        ^
  symbol:   class Controller
  location: class PcApp
PcApp.java:81: error: cannot find symbol
    public void onInit(Controller controller) {
                       ^
  symbol:   class Controller
  location: class PcApp
PcApp.java:85: error: cannot find symbol
    public void onConnect(Controller controller) {
                          ^
  symbol:   class Controller
  location: class PcApp
PcApp.java:90: error: cannot find symbol
    public void onDisconnect(Controller controller) {
                             ^
  symbol:   class Controller
  location: class PcApp
PcApp.java:94: error: cannot find symbol
    public void onExit(Controller controller) {
                       ^
  symbol:   class Controller
  location: class PcApp
PcApp.java:99: error: cannot find symbol
        JLabel[] motor = new JLabel[3];
        ^
  symbol:   class JLabel
  location: class PcApp.Gui
PcApp.java:100: error: cannot find symbol
        JLabel[] werte = new JLabel[3];
        ^
  symbol:   class JLabel
  location: class PcApp.Gui
PcApp.java:117: error: cannot find symbol
        public void windowClosed(WindowEvent e) {}
                                 ^
  symbol:   class WindowEvent
  location: class PcApp.Gui
PcApp.java:119: error: cannot find symbol
        public void windowClosing(WindowEvent e) {
                                  ^
  symbol:   class WindowEvent
  location: class PcApp.Gui
PcApp.java:124: error: cannot find symbol
        public void windowDeactivated(WindowEvent e) {}
                                      ^
  symbol:   class WindowEvent
  location: class PcApp.Gui
PcApp.java:126: error: cannot find symbol
        public void windowDeiconified(WindowEvent e) {}
                                      ^
  symbol:   class WindowEvent
  location: class PcApp.Gui
PcApp.java:128: error: cannot find symbol
        public void windowIconified(WindowEvent e) {}
                                    ^
  symbol:   class WindowEvent
  location: class PcApp.Gui
PcApp.java:130: error: cannot find symbol
        public void windowActivated(WindowEvent e) {}
                                    ^
  symbol:   class WindowEvent
  location: class PcApp.Gui
PcApp.java:132: error: cannot find symbol
        public void windowOpened(WindowEvent e) {}
                                 ^
  symbol:   class WindowEvent
  location: class PcApp.Gui
PcApp.java:22: error: cannot find symbol
        controller = new Controller();
                         ^
  symbol:   class Controller
  location: class PcApp
PcApp.java:30: error: cannot find symbol
            System.in.read();
                  ^
  symbol:   variable in
  location: class System
PcApp.java:38: error: package com.leapmotion.leap does not exist
        com.leapmotion.leap.Frame frame = controller.frame();
                           ^
PcApp.java:41: error: cannot find symbol
        GestureList gestures = frame.gestures();
        ^
  symbol:   class GestureList
  location: class PcApp
PcApp.java:43: error: cannot find symbol
            Gesture gesture = gestures.get(i);
            ^
  symbol:   class Gesture
  location: class PcApp
PcApp.java:45: error: package Gesture does not exist
            if (gesture.type() == Gesture.Type.TYPE_SWIPE && new SwipeGesture(gesture).direction().getX() > 0 && new SwipeGesture(gesture).speed() > 2000 && new SwipeGesture(gesture).position().getX() >= 0) {
                                         ^
PcApp.java:45: error: cannot find symbol
            if (gesture.type() == Gesture.Type.TYPE_SWIPE && new SwipeGesture(gesture).direction().getX() > 0 && new SwipeGesture(gesture).speed() > 2000 && new SwipeGesture(gesture).position().getX() >= 0) {
                                                                 ^
  symbol:   class SwipeGesture
  location: class PcApp
PcApp.java:45: error: cannot find symbol
            if (gesture.type() == Gesture.Type.TYPE_SWIPE && new SwipeGesture(gesture).direction().getX() > 0 && new SwipeGesture(gesture).speed() > 2000 && new SwipeGesture(gesture).position().getX() >= 0) {
                                                                                                                     ^
  symbol:   class SwipeGesture
  location: class PcApp
PcApp.java:45: error: cannot find symbol
            if (gesture.type() == Gesture.Type.TYPE_SWIPE && new SwipeGesture(gesture).direction().getX() > 0 && new SwipeGesture(gesture).speed() > 2000 && new SwipeGesture(gesture).position().getX() >= 0) {
                                                                                                                                                                 ^
  symbol:   class SwipeGesture
  location: class PcApp
PcApp.java:46: error: cannot find symbol
                SwipeGesture swipe = new SwipeGesture(gesture);
                ^
  symbol:   class SwipeGesture
  location: class PcApp
PcApp.java:46: error: cannot find symbol
                SwipeGesture swipe = new SwipeGesture(gesture);
                                         ^
  symbol:   class SwipeGesture
  location: class PcApp
PcApp.java:58: error: cannot find symbol
        Hand hand = frame.hands().rightmost(); // rechteste hand
        ^
  symbol:   class Hand
  location: class PcApp
PcApp.java:60: error: cannot find symbol
        Vector normal = hand.palmNormal(); //oben unten
        ^
  symbol:   class Vector
  location: class PcApp
PcApp.java:61: error: cannot find symbol
        Vector direction = hand.direction(); //links rechts
        ^
  symbol:   class Vector
  location: class PcApp
PcApp.java:87: error: package Gesture does not exist
        controller.enableGesture(Gesture.Type.TYPE_SWIPE, true);
                                        ^
PcApp.java:99: error: cannot find symbol
        JLabel[] motor = new JLabel[3];
                             ^
  symbol:   class JLabel
  location: class PcApp.Gui
PcApp.java:100: error: cannot find symbol
        JLabel[] werte = new JLabel[3];
                             ^
  symbol:   class JLabel
  location: class PcApp.Gui
PcApp.java:103: error: cannot find symbol
            this.setLayout(new GridLayout(4,2));
                               ^
  symbol:   class GridLayout
  location: class PcApp.Gui
PcApp.java:106: error: cannot find symbol
                motor[i] = new JLabel("Motor "+i);
                               ^
  symbol:   class JLabel
  location: class PcApp.Gui
PcApp.java:107: error: cannot find symbol
                werte[i] = new JLabel("0");
                               ^
  symbol:   class JLabel
  location: class PcApp.Gui
PcApp.java:112: error: cannot find symbol
            this.addWindowListener(this);
                ^
  symbol: method addWindowListener(PcApp.Gui)
PcApp.java:113: error: cannot find symbol
            this.pack();
                ^
  symbol: method pack()
PcApp.java:114: error: cannot find symbol
            this.setVisible(true);
                ^
  symbol: method setVisible(boolean)
45 errors
SampleListener.java:1: error: package javax.swing does not exist
import javax.swing.*;
^
SampleListener.java:3: error: package java.awt.event does not exist
import java.awt.event.*;
^
SampleListener.java:6: error: package com.leapmotion.leap does not exist
import com.leapmotion.leap.*;
^
SampleListener.java:7: error: package com.leapmotion.leap.Gesture does not exist
import com.leapmotion.leap.Gesture.State;
                                  ^
SampleListener.java:9: error: cannot find symbol
public class SampleListener extends Listener {
                                    ^
  symbol: class Listener
SampleListener.java:85: error: cannot find symbol
    static class Gui extends JFrame implements WindowListener {
                             ^
  symbol:   class JFrame
  location: class SampleListener
SampleListener.java:85: error: cannot find symbol
    static class Gui extends JFrame implements WindowListener {
                                               ^
  symbol:   class WindowListener
  location: class SampleListener
SampleListener.java:12: error: cannot find symbol
    public void onFrame(Controller controller) {
                        ^
  symbol:   class Controller
  location: class SampleListener
SampleListener.java:69: error: cannot find symbol
    public void onInit(Controller controller) {
                       ^
  symbol:   class Controller
  location: class SampleListener
SampleListener.java:73: error: cannot find symbol
    public void onConnect(Controller controller) {
                          ^
  symbol:   class Controller
  location: class SampleListener
SampleListener.java:77: error: cannot find symbol
    public void onDisconnect(Controller controller) {
                             ^
  symbol:   class Controller
  location: class SampleListener
SampleListener.java:81: error: cannot find symbol
    public void onExit(Controller controller) {
                       ^
  symbol:   class Controller
  location: class SampleListener
SampleListener.java:86: error: cannot find symbol
        JLabel[] motor = new JLabel[3];
        ^
  symbol:   class JLabel
  location: class Gui
SampleListener.java:87: error: cannot find symbol
        JLabel[] werte = new JLabel[3];
        ^
  symbol:   class JLabel
  location: class Gui
SampleListener.java:103: error: cannot find symbol
        public void windowClosed(WindowEvent e) {
                                 ^
  symbol:   class WindowEvent
  location: class Gui
SampleListener.java:107: error: cannot find symbol
        public void windowClosing(WindowEvent e) {}
                                  ^
  symbol:   class WindowEvent
  location: class Gui
SampleListener.java:109: error: cannot find symbol
        public void windowDeactivated(WindowEvent e) {}
                                      ^
  symbol:   class WindowEvent
  location: class Gui
SampleListener.java:111: error: cannot find symbol
        public void windowDeiconified(WindowEvent e) {}
                                      ^
  symbol:   class WindowEvent
  location: class Gui
SampleListener.java:113: error: cannot find symbol
        public void windowIconified(WindowEvent e) {}
                                    ^
  symbol:   class WindowEvent
  location: class Gui
SampleListener.java:115: error: cannot find symbol
        public void windowActivated(WindowEvent e) {}
                                    ^
  symbol:   class WindowEvent
  location: class Gui
SampleListener.java:117: error: cannot find symbol
        public void windowOpened(WindowEvent e) {}
                                 ^
  symbol:   class WindowEvent
  location: class Gui
SampleListener.java:13: error: package com.leapmotion.leap does not exist
        com.leapmotion.leap.Frame frame = controller.frame();
                           ^
SampleListener.java:23: error: cannot find symbol
            Hand hand = frame.hands().get(0);
            ^
  symbol:   class Hand
  location: class SampleListener
SampleListener.java:26: error: cannot find symbol
            FingerList fingers = hand.fingers();
            ^
  symbol:   class FingerList
  location: class SampleListener
SampleListener.java:29: error: cannot find symbol
                Vector avgPos = Vector.zero();
                ^
  symbol:   class Vector
  location: class SampleListener
SampleListener.java:29: error: cannot find symbol
                Vector avgPos = Vector.zero();
                                ^
  symbol:   variable Vector
  location: class SampleListener
SampleListener.java:30: error: cannot find symbol
                for (Finger finger : fingers) {
                     ^
  symbol:   class Finger
  location: class SampleListener
SampleListener.java:43: error: cannot find symbol
            Vector normal = hand.palmNormal();
            ^
  symbol:   class Vector
  location: class SampleListener
SampleListener.java:44: error: cannot find symbol
            Vector direction = hand.direction();
            ^
  symbol:   class Vector
  location: class SampleListener
SampleListener.java:57: error: cannot find symbol
        Controller controller = new Controller();
        ^
  symbol:   class Controller
  location: class SampleListener
SampleListener.java:57: error: cannot find symbol
        Controller controller = new Controller();
                                    ^
  symbol:   class Controller
  location: class SampleListener
SampleListener.java:61: error: cannot find symbol
            System.in.read();
                  ^
  symbol:   variable in
  location: class System
SampleListener.java:86: error: cannot find symbol
        JLabel[] motor = new JLabel[3];
                             ^
  symbol:   class JLabel
  location: class Gui
SampleListener.java:87: error: cannot find symbol
        JLabel[] werte = new JLabel[3];
                             ^
  symbol:   class JLabel
  location: class Gui
SampleListener.java:90: error: cannot find symbol
            this.setLayout(new GridLayout(2,3));
                               ^
  symbol:   class GridLayout
  location: class Gui
SampleListener.java:92: error: cannot find symbol
                motor[i] = new JLabel("Motor "+i);
                               ^
  symbol:   class JLabel
  location: class Gui
SampleListener.java:93: error: cannot find symbol
                werte[i] = new JLabel("0");
                               ^
  symbol:   class JLabel
  location: class Gui
SampleListener.java:98: error: cannot find symbol
            this.addWindowListener(this);
                ^
  symbol: method addWindowListener(Gui)
SampleListener.java:99: error: cannot find symbol
            this.pack();
                ^
  symbol: method pack()
SampleListener.java:100: error: cannot find symbol
            this.setVisible(true);
                ^
  symbol: method setVisible(boolean)
40 errors

but compiling is ok. librarys loaded:
pc/pccomm.jar, pc/3rdparty/bluecove.jar, nxt/classes.jar (and leapjava)
pcProfie
New User
 
Posts: 23
Joined: Thu Aug 02, 2012 4:18 pm

Re: Bluetooth problems

Postby pcProfie » Wed Jan 08, 2014 5:30 pm

I'm so happy :(
lejos-bat-files can connect to nxt via bluetooth. i can control the whole nxt with nxjcontrol.bat.....
but new exception in program (standard example):
Code: Select all
java.lang.NoClassDefFoundError: javax/bluetooth/DiscoveryListener
   at java.lang.ClassLoader.defineClass1(Native Method)
   at java.lang.ClassLoader.defineClass(ClassLoader.java:792)
   at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
   at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
   at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
   at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
   at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
   at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(Class.java:190)
   at lejos.pc.comm.NXTCommFactory.newNXTCommInstance(NXTCommFactory.java:98)
   at lejos.pc.comm.NXTCommFactory.createNXTComm(NXTCommFactory.java:91)
   at lejos.pc.comm.NXTConnector.search(NXTConnector.java:111)
   at lejos.pc.comm.NXTConnector.connectTo(NXTConnector.java:235)
   at lejos.pc.comm.NXTConnector.connectTo(NXTConnector.java:347)
   at lejos.pc.comm.NXTConnector.connectTo(NXTConnector.java:362)
   at BTSend.main(BTSend.java:29)
Caused by: java.lang.ClassNotFoundException: javax.bluetooth.DiscoveryListener
   at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
   at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
   at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
   at java.lang.ClassLoader.defineClass1(Native Method)
   at java.lang.ClassLoader.defineClass(ClassLoader.java:792)
   at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
   at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
   at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
   at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
   at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
   at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(Class.java:190)
   at lejos.pc.comm.NXTCommFactory.newNXTCommInstance(NXTCommFactory.java:98)
   at lejos.pc.comm.NXTCommFactory.createNXTComm(NXTCommFactory.java:91)
   at lejos.pc.comm.NXTConnector.search(NXTConnector.java:111)
   at lejos.pc.comm.NXTConnector.connectTo(NXTConnector.java:235)
   at lejos.pc.comm.NXTConnector.connectTo(NXTConnector.java:347)
   at lejos.pc.comm.NXTConnector.connectTo(NXTConnector.java:362)
   at BTSend.main(BTSend.java:29)
   at __SHELL3.run(__SHELL3.java:6)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at bluej.runtime.ExecServer$3.run(ExecServer.java:725)

at
Code: Select all
boolean connected = conn.connectTo("btspp://");

:(
and corbino91: i think the nxt only connects if it likes the computer...... maybe you have another bluetooth dongle?
pcProfie
New User
 
Posts: 23
Joined: Thu Aug 02, 2012 4:18 pm

Re: Bluetooth problems

Postby pcProfie » Fri Jan 10, 2014 4:11 pm

f.....
so, new try: trying eclipse, not bluej.
other nxt and laptop AND:::::: this exception....#
Code: Select all
BlueCove version 2.1.0 on winsock
BTSend Log.listener: Error: Exception connecting to NXT.
Failed to connect to any NXT
BTSend Log.listener: Caused by lejos.pc.comm.NXTCommException: Open of NXT failed.
BTSend Log.listener:    at lejos.pc.comm.NXTCommBluecove.open(NXTCommBluecove.java:136)
BTSend Log.listener: Caused by javax.bluetooth.BluetoothConnectionException: Connection timeout; [10060] Ein Verbindungsversuch ist fehlgeschlagen, da die Gegenstelle nach einer bestimmten Zeitspanne nicht richtig reagiert hat, oder die hergestellte Verbindung war fehlerhaft, da der verbundene Host nicht reagiert hat.
BTSend Log.listener:    at com.intel.bluetooth.BluetoothStackMicrosoft.connect(Native Method)
BTSend Log.listener: Failed to connect to any NXT
BlueCove stack shutdown completed

so WHAT?!? it is not the bluetooth dongle, not the nxt, not the ide. java is jdk and jre ver7u45 32 bit. lejos last version of 0.9.1
program to send: lejos-example btsend.java
program to recieve, is my own:
Code: Select all
import lejos.nxt.comm.*;
import lejos.nxt.*;
import java.io.DataInputStream;
public class NxtApp
{
    NXTConnection connection;
    DataInputStream dis;

    public NxtApp()
    {
        connect();
        try {
            while(!Button.ENTER.isDown()) {
                if(dis.available() > 0) {
                    System.out.println(dis.readInt());
                }
            }
            dis.close();
            connection.close();
        }
        catch (Exception e) { }
        Bluetooth.reset();
    }

    public static void main(String[] args) {
        System.out.print("Warte auf \nVerbindung");  // = waiting for connection
        new NxtApp();
    }

    public void connect() {
        Bluetooth.reset();
        Bluetooth.setPower(true);
        System.out.println("....");
        connection = Bluetooth.waitForConnection();
        System.out.println("verbunden");  // = connected
        LCD.clear();
        ((BTConnection)connection).openStream();
        dis = connection.openDataInputStream();
    }

}

you saw the exception on my pc. nxt stays on wating for connection.
one pc is on windows7, one is win8.
bluetooth is on at both devices. visibility also on.
nxt can find laptop, but i dont have any password so nxt says unsuccessful.

i dont know what to do now, any idea?
pcProfie
New User
 
Posts: 23
Joined: Thu Aug 02, 2012 4:18 pm

Re: Bluetooth problems

Postby skoehler » Fri Jan 10, 2014 5:10 pm

The NoClassDefFoundError was clearly a problem with your bluej setup. You didn't include all the leJOS JAR files in the classpath/buildpath/or whatever bluej calls it.
The error you posted now is caused by a BluetoothConnectionException. The error message (luckily I'm German and can understand it) might indicate some hardware issue (the NXT's bluetooth module doesn't seem to be the most compatible). So when you write that you can use nxjcontrol to control the NXT, was that on the same PC?
skoehler
leJOS Team Member
 
Posts: 1410
Joined: Thu Oct 30, 2008 4:54 pm

Re: Bluetooth problems

Postby pcProfie » Fri Jan 10, 2014 5:35 pm

finally i reached to get the same status on both pcs. i can use lejos tools and run the program with the same exception on both pcs (i dont know what i changed on the pc) :S
so now: i can connect from pc to nxt (search/pair on nxt doesnt work :() and use the bat files, but ,my java programms wont work :(

i think the problem of bluej was, that in eclipse i have a lejos nxj project and a lejos pc project. the "class not found" was a class of the lejos nxj class so bluej doesnt split this projects. it would be fine to have both files in one project but ok, now its working.
pcProfie
New User
 
Posts: 23
Joined: Thu Aug 02, 2012 4:18 pm

Re: Bluetooth problems

Postby skoehler » Fri Jan 10, 2014 6:10 pm

I'm a bit confused by what you write. You don't mix Java code that's supposed to run on the PC and Java code that's supposed to run on the NXT. Neither in BlueJ nor in Eclipse. Both project types (projects for PC-side code and NXT-side code) need to be setup very differently. For the NXT-side code you need to override the bootclasspath with class.jar - for the PC-side code you need to add a completely different set of JAR files to the classpath and you don't touch the bootclasspath. Now if BlueJ doesn't allow you to override the bootclasspath, well then you shouldn't use BlueJ anyway.

Now on the same machine, your own program should behave just as well/bad as the leJOS tools (say nxjcontrol). Please post the output of your PC-side program on the computer where nxjcontrol works just fine. Also, while your program tries to connect to the NXT, what is running on the NXT. The menu? Or your own program?
skoehler
leJOS Team Member
 
Posts: 1410
Joined: Thu Oct 30, 2008 4:54 pm

Re: Bluetooth problems

Postby pcProfie » Fri Jan 10, 2014 7:02 pm

ok. i think you dont understand me: now i can use the lejos tools on both computers via bluetooth. exception for my java program is finally the same on both computers. output of my java program is this error
Code: Select all
    BlueCove version 2.1.0 on winsock
    BTSend Log.listener: Error: Exception connecting to NXT.
    Failed to connect to any NXT
    BTSend Log.listener: Caused by lejos.pc.comm.NXTCommException: Open of NXT failed.
    BTSend Log.listener:    at lejos.pc.comm.NXTCommBluecove.open(NXTCommBluecove.java:136)
    BTSend Log.listener: Caused by javax.bluetooth.BluetoothConnectionException: Connection timeout; [10060] Ein Verbindungsversuch ist fehlgeschlagen, da die Gegenstelle nach einer bestimmten Zeitspanne nicht richtig reagiert hat, oder die hergestellte Verbindung war fehlerhaft, da der verbundene Host nicht reagiert hat.
    BTSend Log.listener:    at com.intel.bluetooth.BluetoothStackMicrosoft.connect(Native Method)
    BTSend Log.listener: Failed to connect to any NXT
    BlueCove stack shutdown completed

and for those, who doesnt speak german: connection timeout. connecting fails, because the other device didnt answer or the connection was defective, because the connected host didnt replied

first i start my nxtapp.java (go up), and wait until it reaches "wait for connection" with "..." after that (so before line connection = Bluetooth.waitForConnection();). then i start the program on my pc and it gives the error message
pcProfie
New User
 
Posts: 23
Joined: Thu Aug 02, 2012 4:18 pm

Re: Bluetooth problems

Postby skoehler » Fri Jan 10, 2014 8:00 pm

You should try specifying the address of the NXT when you try to make the connection.
skoehler
leJOS Team Member
 
Posts: 1410
Joined: Thu Oct 30, 2008 4:54 pm

Re: Bluetooth problems

Postby pcProfie » Fri Jan 10, 2014 8:04 pm

so connectTo(NXTInfo nxtInfo, int mode) ? can be complicated to set all parameters of NXTInfo(int protocol, java.lang.String name, java.lang.String address) . what is the protocol and the address? :)
pcProfie
New User
 
Posts: 23
Joined: Thu Aug 02, 2012 4:18 pm

Re: Bluetooth problems

Postby pcProfie » Fri Jan 10, 2014 8:11 pm

sry but i dont understand it...................
now it is ok. it sends integers to the nxt and it shows them on the screen.
i did everything like everytime but it works :?
its the same code like before. only with "btspp://". confusing
pcProfie
New User
 
Posts: 23
Joined: Thu Aug 02, 2012 4:18 pm

Next

Return to NXJ Projects

Who is online

Users browsing this forum: No registered users and 1 guest

more stuff