Home AMX User Forum Duet/Cafe Duet

Get Netlinx file name

Has any body found a way to get the NetLinx file name in Duet? In NL, you can use __file__, but I can't seem to find anything in Duet where I can get that.

It appears the only option I might have is to telnet into the machine and get it that way, though that is too much of a round about way to do it. Also, I *DO NOT* want to pass this information to the module, it should grab it automatically.

Any suggestions would be great.

Comments

  • __file__ is a compile time resolution in which the NetLinx filename is inserted in place as a string into the token file. There is no way to retrieve this value from within Java. NetLinx Applications and Java Duet modules are separately compiled entities with no knowledge of each others internal definitions. If you want access to this value in Java, you will have to pass it into the Duet module from your NetLinx application.
  • jjamesjjames Posts: 2,908
    I figured as much. That's a major drag . . .

    So - as a feature request for version 4 firmware, maybe in amx.com.duet.core you can add getNetLinxFileName(); you can get nearly everything else as far as system information goes. I'd imagine this would be something you guys could add into the VxWorks layer and ultimately could be interfaced with NetLinx OR Duet . . . I do see in boot up that VxWorks is aware of which program is loaded:
    (0000001045) CIpUffHandler::Load - Begin...PROG.TKN
    (0000001045) CIpUffHandler::Root
    (0000001045) CIpUffHandler::Project Name=Demo Code, 2011-08-23, Rev 1
    (0000001045) CIpUffHandler::Module Header
    
  • That's actually the Interpreter that's logging the name. Regarding the feature request, I don't quite understand the use case as to why you would want the name of the NetLinx program inside of a Duet module, but OK.
  • jjamesjjames Posts: 2,908
    To me, the power of Java is in what NetLinx cannot do easily. NetLinx can control devices just fine, through TCP, UDP, Serial, or IR so I don't use Java for that. I use it as more as a service or a "utility" to the end-user and to our company.
  • svTechsvTech Posts: 44
    There are two similar variables, __FILE__ and __NAME__. __FILE__ is used to grab the file name in which that keyword is located. This could be an .AXB, .AXS, or .AXI file. __NAME__ is the program that the keyword is attached to, no matter where it is retrieved. If you were to retrieve __FILE__ from Duet, following the existing functionality, it would seem that all you would ever retrieve would be the AXS carrier file that loads the Duet module.

    If there is a specific file that you want retrieved by your Duet module, simply issue a SEND_COMMAND to Duet from that AXS or AXI file at startup to set the value. Then whenever you need to use the new, pseudo __FILE__ within Duet, you'll have it there waiting for you. You can do the same with __NAME__.
  • jjamesjjames Posts: 2,908
    As noted in my original post, I *DO NOT* want to pass the information in whatsoever into the JAR. Was looking for a way for the JAR to get the information without interaction with NetLinx.

    As Mr. Engineer pointed out - impossible.
Sign In or Register to comment.