NXTComm.search does not use the name parameter on USB

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

Moderators: 99jonathan, roger, imaqine

NXTComm.search does not use the name parameter on USB

Postby outo » Mon Jan 28, 2008 9:26 pm

Hello,

has anybody noticed that when trying to connect on USB to your NXT the NXTComm.search() method ignores (or at least that is the impression) the name parameter?

Code: Select all
NXTComm nxtComm = NXTCommFactory.createNXTComm(NXTCommFactory.USB);
NXTInfo[] nxtInfo = nxtComm.search("anyname", NXTCommFactory.USB);
if (nxtInfo.length == 0) {
   System.out.println("No NXT Found");
   System.exit(1);
}

if (nxtComm.open(nxtInfo[0])) {
   System.out.println("Name of the brick: " + nxtInfo[0].name);
}


that code will return
Code: Select all
Name of the brick: Unknown


This is another thing, although I have named the brick differently it is not used on USB. It is virtually possible to have many NXT bricks connected into one PC via USB, isn't it?

Thanks for concerns
outo
New User
 
Posts: 4
Joined: Mon Jan 28, 2008 8:36 pm

Postby roger » Mon Jan 28, 2008 9:39 pm

Only one NXT at a time can be connected to the PC via usb cable, so need to search for the NXT.
Try running USBSend on your pc and USBReceive on your NXT. Both are in examples, and study the code to see how it works.
Good luck,
Roger
roger
Moderator
 
Posts: 363
Joined: Fri Jun 01, 2007 4:31 am
Location: Berkeley, CA

Postby outo » Tue Jan 29, 2008 7:10 am

Thanks for reply

USBSend/Receive works fine and the code I have posted is more or less part of USBSend example.

I wonder about the name parameter in search method.

Also, can I change the name of the brick in a way that when search comes back it will return me the NXTInfo objects containing given name? At the minute it comes back with object containing name "Unknown".

roger wrote:Only one NXT at a time can be connected to the PC via usb cable


What is the source of your knowledge, may I ask?
If that is the true constraint, then it will be an answer to my enquiry :)

Thanks
outo
New User
 
Posts: 4
Joined: Mon Jan 28, 2008 8:36 pm

Postby roger » Wed Jan 30, 2008 6:18 am

outo wrote:What is the source of your knowledge, may I ask?
I peeked in the source code for NXTCommLibnxt in src\java\pccomms\lejos\pcc\omm, and noticed that the search() method returns a NXTInfo array of length 0 if it fails or length 1 if it succeeds. No provision for returning information about more bricks than only the one. I assume this is because of the limitations of jlibnxt,
BWT, what lead you to believe multiple simultaneous connections might be possible? Hope that it might be like BlueTooth?
roger
Moderator
 
Posts: 363
Joined: Fri Jun 01, 2007 4:31 am
Location: Berkeley, CA

Postby outo » Wed Jan 30, 2008 11:40 am

Thanks for this information, that makes my answer hunger go away.

roger wrote:what lead you to believe multiple simultaneous connections might be possible? Hope that it might be like BlueTooth?


That is it. I basically did not see a good reason for such architecture not being feasible. I am not in desperate need for it, just want to learn about the limits of NXT.
outo
New User
 
Posts: 4
Joined: Mon Jan 28, 2008 8:36 pm


Return to NXJ Software

Who is online

Users browsing this forum: No registered users and 2 guests

more stuff