Error NXTComm.getSingleton().

This is where you talk about the NXJ software itself, installation issues, and programming talk.

Moderators: 99jonathan, roger, imaqine

Error NXTComm.getSingleton().

Postby edward » Fri Apr 06, 2012 8:59 pm

Hi I'm developing an application for NXT Platform.

The problem is that my application works fine with Lejos 0.9.0 but I'm interested to use de libraries of Lejos 0.9.1 and when I use the Lejos 0.9.1 my application doesn't compile.

The error is that line:

NXTCommand.getSingleton().setNXTComm(connection.getNXTComm());

Error Message:

Cannont Find Symbol
Symbol: Method getSingleton()

I want to control my bot with the PC over bluetooth.
edward
New User
 
Posts: 2
Joined: Fri Apr 06, 2012 8:39 pm

Re: Error NXTComm.getSingleton().

Postby skoehler » Fri Apr 06, 2012 9:41 pm

Try NXTCommandConnector.setNXTCommand
skoehler
leJOS Team Member
 
Posts: 1413
Joined: Thu Oct 30, 2008 4:54 pm

Re: Error NXTComm.getSingleton().

Postby edward » Sat Apr 07, 2012 12:08 am

skoehler wrote:Try NXTCommandConnector.setNXTCommand


Hi skoehler, thanks for the answer but sorry I didn't understand how to implement that in my code.

This is the part of my code that made the connection with the bot

Code: Select all
private NXTConnector connection;
   
private void ConectarActionPerformed(java.awt.event.ActionEvent evt) {                                         
// TODO add your handling code here:
    connection.addLogListener(new NXTCommLogListener() {
        public void logEvent(String message) {
            System.out.println(message);
        }

        public void logEvent(Throwable throwable) {
            System.err.println(throwable.getMessage());
        }});
   
    connection.setDebug(true);
    if (!connection.connectTo("Robot-2", NXTComm.LCP)) {
        System.err.println("Error in conection");
        System.exit(1);
    }
    else{
       
        NXTCommand.getSingleton().setNXTComm(connection.getNXTComm()); // This line is the problem
       
               
        System.out.println("Connected");
    }

}     
edward
New User
 
Posts: 2
Joined: Fri Apr 06, 2012 8:39 pm

Re: Error NXTComm.getSingleton().

Postby Xfel » Tue Apr 10, 2012 12:37 pm

The API changed from 0.9.0 to 0.9.1 and the NXTCommand.getSingleton() method was removed.
This has the same result:
Code: Select all
NXTCommandConnector.setNXTCommand(new NXTCommand(connection.getNXTComm()));


By the way: You should add the log listener on creation of the NXTConnector, not every time the action is performed.
Xfel
New User
 
Posts: 11
Joined: Mon Jan 30, 2012 3:29 pm


Return to NXJ Software

Who is online

Users browsing this forum: No registered users and 2 guests

more stuff