I'm writing a PC java app too practice controlling the NXT remotely.
So far I can send commands and text to the brick through a DataOutputStream, but the next step is causing me some trouble.
I want to be able to select a file (on the NXT) and download it to my PC from inside my GUI. I've looked through the source code of NXJBrowse and tried experimenting with the ExtendedFileModel and its fetchFiles() method. But when I run the method, the PC app freezes up. If it had worked, I would have created a JTable with the ExtendedFileModel in the constructor. Is this the only way to access the contents of the file model?
Maybe I'm doing it all wrong? Please help.
The code that's causing me problems:
- Code: Select all
NXTComm connection = NXTCommFactory.createNXTComm(NXTCommFactory.BLUETOOTH);
NXTInfo device = new NXTInfo(2, "MyName", "MyAddress");
NXTCommand nxt = new NXTCommand(connection);
ExtendedFileModel filemodel = new ExtendedFileModel();