doc-helmut wrote:muntoo,
no, what I mean are program(s) which let me automatically store a file (created by my NXC program) into a PC folder (sent by USB), e.g. every time when I press a specific NXC button.
Ah, OK.
Here would be my approach:
Use the NXC function GetUSBOutputBuffer() and write data to it using some File Transferring Protocol you'll have to implement/create.
Have a program on the PC-side running continuously in the background (resource hog ), receiving input from the USB. Your "FTP" should let it recognize when the data is a new file/etc.
Commit to LEGO Mindstorms Robotics Stack Exchange: bit.ly/MindstormsSE
Commit to LEGO Stack Exchange: bit.ly/Area51LEGOcommit
Sivan Toledo has been carrying out experiments into BT communication between the NXT and a pc. If I have read it correctly, the NXT must be the master if you it want to send messages. Unfortunately, he does not give details of the programs he was using. http://www.tau.ac.il/~stoledo/lego/btperformance.html
A sophistical rhetorician, inebriated with the exuberance of his own verbosity, and gifted with an egotistical imagination that can at all times command an interminable and inconsistent series of arguments to malign an opponent and to glorify himself.
I don't have any experience using fantom and as I wrote I have no idea how to write a program like you suggested running on the PC side using fantom.
It must be something already finished (EXE file).
And I want to transfer complete files, not just bytes.
One idea: imagine that it might work something like the DOS command
XCOPY source destination
* and ? allowed as jokers.
a) Running on the NXT, it should be able to use it like
XCOPY.rxe ????.wpt d:\myfiles\programming\project\FFT\*.*
(of course the routines used by XCOPY.rxe actually should be available as a function
void XCOPY(string source, string destination){...}
used by NXC)
b) Other way round if running on the PC, it might pick up files from the NXT flash drive - mounted e.g. as drive N: or \\NXT\A: - and copy them to a PC directory.
I.e. functionality of the NxtExplorer, but sort of remote-controlled by the NXT.
In these cases this PC-program must be started by a NXT command via USB to the PC:
C:\nXtCOPY.EXE N\????.wpt d:\programming\project\FFT\*.*
or
C:\nXtCOPY.EXE \\NXT\A\????.wpt d:\programming\project\FFT\*.*
(NXT Flash disk accessed like a local USB drive OR mounted like a PC network drive, given a drive letter like a PC drive)
Of course there possibly could be many other ways to copy files from NXT to PC "in a whole"...
Well, there are already NXC codes to send messages via BT and I believe there is also a system call you can use to send files the same way.
I am no expert on this subject but is seems to me that once the NXT has been set as the master, it should be possible to send a file and have the pc respond in the same way it would do for any other BT communication involving information.
What happens when a mobile phone or pda initiates a BT call to a pc? Would the pc not respond in the same way?
A sophistical rhetorician, inebriated with the exuberance of his own verbosity, and gifted with an egotistical imagination that can at all times command an interminable and inconsistent series of arguments to malign an opponent and to glorify himself.
well, an answer like "I believe there is also a system call..it seems to me ... it should be possible to send a file ...would the pc not respond in the same way?" actually doesn't really help me along.
Show me your code, that's what I'm looking for, - and I'll try it!
Can anyone [John] post a link to the SVN Repository to NeXT Explorer's source code? If we can figure out how to download a file from NXT->PC, the rest should be "easy".
NXT tells PC to download a specific file using the NXC API function I mentioned earlier, PC somehow reads it, and gets the file.
Commit to LEGO Mindstorms Robotics Stack Exchange: bit.ly/MindstormsSE
Commit to LEGO Stack Exchange: bit.ly/Area51LEGOcommit
I hope that the code from Explorer will help but I suspect that it uses processes initiated by the PC to get the files.
There is reference in the NXC API to 'INTF_SENDFILE' which is described as 'Send a file over a Bluetooth connection'.
Unfortunately, there are no examples and it is not mentioned in John's book. In the list of low-level calls at the back he mentions a generic call which might be used to invoke this but I don't know nearly enough about NXC to try.
I attempted looking this up in the Lego SDK but got hopelessly lost and gave up!
Quote from the NXC Programmer's Guide by John Hansen :-
SysCommExecuteFunction (CommExecuteFunctionType & args) Function (+)
This function lets you directly execute the Comm module's primary function using the
values specified via the CommExecuteFunctionType structure. The structure type
declaration is shown below. The values for these fields are documented in the table
below. If a field member is shown as 'x' it is ignored by the specified display command.
struct CommExecuteFunctionType {
unsigned int Result;
byte Cmd;
byte Param1;
byte Param2;
byte Param3;
string Name;
unsigned int RetVal;
};
INTF_SENDFILE Send a file over a Bluetooth connection (Connection,x,x,Filename)
A sophistical rhetorician, inebriated with the exuberance of his own verbosity, and gifted with an egotistical imagination that can at all times command an interminable and inconsistent series of arguments to malign an opponent and to glorify himself.