Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

GetFile from Loggernet


past12 Sep 15, 2014 04:21 PM

Hi all,
I have a question: is it possible to transfer a file from a Loggernet server (located, for instance, on the C:\ drive) to the CPU or USR drive of the CR1000, using CRBasic commands?

I've seen that the GetFile method accepts 4094 as source address for the file, but the instruction does not work, i.e. it creates an empty file in the Destination, but it seems not to be able to read the source file (in fact the ResultCode variable get positive increments each time it tries but fails).

Any clues?


Dana Sep 15, 2014 06:42 PM

Two ways to send a file using LoggerNet would be to use Corascript's send-file command, or if connected to the datalogger via IP, send the file via FTP using a third party FTP client. Both of these methods can be set up in LoggerNet's Task Master to have the event triggered on a schedule, or you could set up a dashboard using RTMC Pro to execute the event if you wanted to trigger it manually.

Corascript is a scripting utility that comes with LoggerNet. There's a help file that is included, where you can read more about send-file.

Dana


past12 Oct 1, 2014 09:12 AM

Thank you Dana, I chose the Corascript method and it worked flawlessly.


past12 Oct 28, 2014 02:22 PM

Hello, I've successfully used the ModemCallback instruction to call a Loggernet server, plus Corascript to send a file to my CR1000 station from a loggernet pc.
I've read, in ModemCallback manual, that:

"Note that once executed, this instruction runs in the background. The datalogger will not wait for successful communication before moving on to the next instruction."

Now, I need to be sure that the file I'm receiving from Loggernet is completely written before accessing it in my crbasic code. Is there a way to "sync" the modemcallback, in order to know when it finished its execution? Maybe something dealing with SlowSequence?


Dana Nov 5, 2014 04:10 PM

You might be able to determine if the file has been written using FileList. FileList does not list files that are still opened for writing. If you knew the file name you were expecting, you could FileList, do some sort of StringComp, and then access the file based on the results of that comparison.

Note that FileList does not clear the array that has been written to, so you would want to clear it out before "listing". (This fact is currently not in the help file, but will be soon). Also, you might need to delete the existing file prior to receiving the new one.

I hope this sparks some ideas...

Dana


Sam Nov 10, 2014 12:49 AM

Dana mentioned FileList().
You may also find helpful
+ NewFile() - lets you know if file is new
+ FileTime() - develop your own alternative to NewFile()
+ FileSize() - see if size of file has changed by X bytes


past12 Nov 17, 2014 03:10 PM

FileList seems to work, but requires a lot of instructions to see if a new version of the file has been created. I think I will give NewFile() a try, as suggested by Sam

Log in or register to post/reply in the forum.