Home AMX User Forum Duet/Cafe Duet

*.tko file inside duet modules

Hi,

I have looked into / decompiled several duet modules and each of them contains Netlinx *.tko file.
What is the role of this file ?

Comments

  • ericmedleyericmedley Posts: 4,177
    Judging from your question I'm guessing you've not done any Netlinx programming or worked with the hardware. The Netlinx .tko is compiled code that runs on a Netlinx master. It's the code running at run time which is generated by Netlinx Studio and uploaded by the programmer. "Currently" we do not have access to truly native Java as a main programming environment. It has been rumoured that at some point we will but until then you still need to have at least some Netlinx code which declares a Duet Module and a virtual device to attach to it.

    Decompiling is frwoned upon, just so you know.
  • ericmedley wrote: »
    Judging from your question I'm guessing you've not done any Netlinx programming or worked with the hardware. The Netlinx .tko is compiled code that runs on a Netlinx master. It's the code running at run time which is generated by Netlinx Studio and uploaded by the programmer. "Currently" we do not have access to truly native Java as a main programming environment. It has been rumoured that at some point we will but until then you still need to have at least some Netlinx code which declares a Duet Module and a virtual device to attach to it.

    Decompiling is frwoned upon, just so you know.

    I'm Netlinx programmer and I know what it *.tko file, but was surprised to find it within duet modules.
    So you are saying those *.tko files just contains DEFINE_DEVICE and DEFINE_MODULE sections ?

    Opening *.jar files is supported either in Eclipse or IDEA.
    Since code is not scrambled or obfuscated, it's nice to see how everything is working under the hood.

    BTW, NetLinxPracticalExamEmulator.jar is fun to look in ;)
  • AMXJeffAMXJeff Posts: 450
    tombadger wrote: »
    I'm Netlinx programmer and I know what it *.tko file, but was surprised to find it within duet modules.
    So you are saying those *.tko files just contains DEFINE_DEVICE and DEFINE_MODULE sections ?

    Opening *.jar files is supported either in Eclipse or IDEA.
    Since code is not scrambled or obfuscated, it's nice to see how everything is working under the hood.

    BTW, NetLinxPracticalExamEmulator.jar is fun to look in ;)

    The TKO file inside a duet module is the NetLinx stub code for loading the Duet Module. The Runtime engine extracts it from the .jar file and runs that code.

    The NetLinx stub code does not really change much, just the propeties array.
    MODULE_NAME='TestDuetModule_dr1_0_0' (DEV dvDuetDevice, DEV dvPhysicalDevice)
    (*{{PS_SOURCE_INFO(PROGRAM STATS)                          *)
    (***********************************************************)
    (*  ORPHAN_FILE_PLATFORM: 1                                *)
    (***********************************************************)
    (*}}PS_SOURCE_INFO                                         *)
    (***********************************************************)
    
    (***********************************************************)
    (*               VARIABLE DEFINITIONS GO BELOW             *)
    (***********************************************************)
    DEFINE_VARIABLE
    
    // Setup Duet Module properties
    CHAR DUET_PROPERTIES[9][47] = 
    {
    	'Physical-Device',
    	'Duet-Device',
    	'Duet-Module=TestDuetModule_dr1_0_0',
    	'Bundle-Version=1.0.0',
    	'Device-Category=other',
    	'Device-Make=Test',
    	'Device-Model=DuetModule',
    	'Device-SDKClass=com.amx.duet.devicesdk.Utility',
    	'Device-Revision=1.0.0'
    }
    
    
    (***********************************************************)
    (*                STARTUP CODE GOES BELOW                  *)
    (***********************************************************)
    DEFINE_START
    
    // Load up device numbers as strings
    DUET_PROPERTIES[1] = "'Physical-Device=',FORMAT('%d:',dvPhysicalDevice.NUMBER),FORMAT('%d:',dvPhysicalDevice.PORT),FORMAT('%d',dvPhysicalDevice.SYSTEM)";
    DUET_PROPERTIES[2] = "'Duet-Device=',FORMAT('%d:',dvDuetDevice.NUMBER),FORMAT('%d:',dvDuetDevice.PORT),FORMAT('%d',dvDuetDevice.SYSTEM)";
    
    // Load Duet Module
    LOAD_DUET_MODULE(DUET_PROPERTIES)
    
    (***********************************************************)
    (*                     END OF PROGRAM                      *)
    (*        DO NOT PUT ANY CODE BELOW THIS COMMENT           *)
    (***********************************************************)
    
  • AMXJeff wrote: »
    The TKO file inside a duet module is the NetLinx stub code for loading the Duet Module. The Runtime engine extracts it from the .jar file and runs that code.

    The NetLinx stub code does not really change much, just the propeties array.

    Thank you for explanation. Could you send me blank utility duet module compiled and packed to *.jar ?
Sign In or Register to comment.