User Tools

Site Tools


nativetool

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
nativetool [2024/07/18 12:12] – created wikiadminnativetool [2024/07/18 14:34] (current) – wikiadmin
Line 1: Line 1:
 + This C example uses the code generated from TransSECS using the //NativeWrapper// deployment option.
 +
 +1. Start TransSECS and load the GEMTool Sample Project. Generate the code with the NativeWrapper option selected for deployment. The code will be generated in the GEMTool\NativeWrapper folder.  If you used the default installation location this will be at C:\Users\Public\ErgoTech\TransSECSProgrammaticTrial\Projects\GEMTool\NativeWrapper.  You may copy the GEMToolRuntime.jar into your project structure or provide a full path when creating the wrapper (see example below): 
 +<code>
 +    new_wrapper_with_classpath("GEMToolRuntime.jar", &wrapper);
 +</code>
 +
 +2. The header file (transsecs.h) is available here: [[https://www.ergotech.com/files/examples/transsecs.h|Download transsecs.h]]
 +
 +3 . The dll (transsecs.dll) is available here: [[https://www.ergotech.com/files/examples/transsecs.dll|Download transsecs.dll]].  This is standard Windows dll and so will need to be on the executable PATH when the application is run.  For Linux (X86-64) the libtranssecs.so is here [[https://www.ergotech.com/files/examples/libtranssecs.so|Download libtranssecs.so]]  (If you need other architectures, such as ARM, please let us know the platform).
 +
 +To prepare for testing this example, please load the SECSTester provided with TransSECS or load GEMHost Sample Project and generate the code so that TransSECS Builder in run/test mode can be used as a test Host. 
 +
 +Here's the full C code example:
 +
 <code c> <code c>
 #include "transsecs.h" #include "transsecs.h"
Line 57: Line 72:
     wrapper_start_main(wrapper, "GEMTool");     wrapper_start_main(wrapper, "GEMTool");
  
 +    double gasflow = 1.0;
     while (1) {     while (1) {
-        // If the program exits the tool will exit as well, so in this case we just stall indefinitely +        // Publish a test float value to the wrapper 
-        sleep(1); // Sleep for 1 second +        publish_float(wrapper, "gemtool/vids/gasflow", gasflow); 
-    } +        gasflow += 1.0; 
-    +        // Trigger the "LOADED" ceid event 
 +        trigger(wrapper, "loaded", ""); 
 +        // Trigger an alarm - to guarantee that the alarm is triggered, for this example we set it to false, then true 
 +        transsecs_alarm(wrapper, "gasflowproblem", false); 
 +        transsecs_alarm(wrapper, "gasflowproblem", true); 
 +        sleep(10); 
 +    }    
     return 0;     return 0;
 } }
 </code> </code>
nativetool.1721319163.txt.gz · Last modified: by wikiadmin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki