====================================================================================================
== TDS/Sample0 : To start the sample program (32bit compatible) for the time being =================

0. Start two Cmd.exe (Command Prompt) and move the current directory to the directory where TDS
   package is installed.
   Sample programs other than TDSSample1.exe are run on the started Cmd.exe.
   To start TDSSample1.exe, perform the following 1. and then double-click it.

1. Copy the following files to "Sample0_Makefile/bin32/".
   + Win32/TDS.dll
   + Win32/TDCSS.dll
   + Win32/TDVBS.dll
   + Sample0_Makefile/Sample.ini
   + Sample0_Makefile/Sample.sml

2. To run Java sample, do the following in addition to 1.
   (Assuming that the Java execution environment is already installed)
  a. Copy the following files to "Sample0_Makefile/bin32/".
    + TDJVS.jar
  b. Download "jna-versoin.jar" ("jna-5.4.0.jar" etc.) from "https://github.com/twall/jna#download"
     and place it as "Sample0_Makefile/bin32/jna.jar".
    + Jna.jar
  c. In each Cmd.exe, set CLASSPATH with the following command.
      "set CLASSPATH=.;TDJVS.jar;jna.jar;%CLASSPATH%"

3. To run Python and Ruby sample, do the following in addition to 1.
   (Assuming that the Python, Ruby execution environment is already installed)
  a. Copy the following files to "Sample0_Makefile/bin32/".
    + Sample0_Makefile/SimpleIo.py
    + Sample0_Makefile/PythonIo.py
    + Sample0_Makefile/SimpleIo.rb
    + Sample0_Makefile/RubyIo.rb

4-1. Execution of SimpleIo.exe
  a. Execute "SimpleIo h" in one of the launched Cmd.exe.
  b. Execute "SimpleIo e" in the other Cmd.exe.
  c. To exit, enter "Ctrl-C".

4-2. Execution of SimpleIo.py and SimpleIo.rb
  a. Launch SimpleIo.py: "python SimpleIo.py h" or "python PythonIo.py e"
  b. Launch SimpleIo.rb: "python SimpleIo.rb h" or "python PythonIo.rb e"
  c. The connection partner can be SimpleIo.exe, SimpleIo.py, or SimpleIo.rb.
  d. To exit, enter "Ctrl-C".

4-3. Execution of BasicIo.exe and CallbackIo.exe
  a. Execute "BasicIo h" or "CallbackIo h" in one of the launched Cmd.exe.
  b. Execute "BasicIo e" or "CallbackIo h" in the other Cmd.exe.
  c. Refer to the comments in the header part of each source code for operations after startup.
  d. The connection partner may be BasicIo, CallbackIo, CSIo, VBIo, JVIo, PythonIo, RubyIo, or
     TDSSample1.
     The easiest way to do this is to start "CallbackIo h" or TDSSample1 (as host) on the host
     side and start other programs on the device side.

4-4. Execution of CSIo,exe and VBIo.exe
  a. Start in the same way as 4-3.
  b. Refer to the comments in the header part of each source code for operations after startup.
  c. Refer to 4-3. d.

4-5 Execution of JVIo.class, PythonIo.py and RubyIo.rb
  a. Launch JVIo.class  : "java   JVIo     h"  or  "java   JVIo     e"
  b. Launch PythonIo.py : "python PythonIo h"  or  "python PythonIo e"
  c. Launch RubyIo.py   : "ruby   RubyIo   h"  or  "ruby   RubyIo   e"
  d. Refer to the comments in the header part of each source code for operations after startup.
  e. Refer to 4-3. d.


(Note) To execute each .exe included in this package, the DLL of VC execution environment is
   required.
   If it cannot be executed due to a message such as "Cannot execute because VCRuntimeXXX.dll does
   not exist", download the DLL for VC execution environment from the Microsoft website and install
   it on your PC.



====================================================================================================
== Executable file =================================================================================

[] bin32/SimpleIo.exe
[] bin64/SimpleIo.exe

   Executable created by SimpleIo.c by Makefile.Win32 or Makefile.Win64 using VS2010.
   To execute bin32/SimpleIo.exe, you need ../Win32/TDS.dll.
   To execute bin64/SimpleIo.exe, you need ../Win64/TDS.dll.


[] bin32/BasicIo.exe
[] bin64/BasicIo.exe

   Executable created by BasicIO.c  by Makefile.Win32 or Makefile.Win64 using VS2010.
   To execute bin32/BasicIo.exe, you need ../Win32/TDS.dll.
   To execute bin64/BasicIo.exe, you need ../Win64/TDS.dll.


[] bin32/CallbackIo.exe
[] bin64/CallbackIo.exe

   Executable created by CalbakIo.c by Makefile.Win32 or Makefile.Win64 using VS2010.
   To execute bin32/CallbackIo.exe, you need ../Win32/TDS.dll.
   To execute bin64/CallbackIo.exe, you need ../Win64/TDS.dll.


[] bin32/CSIo.exe
[] bin64/CSIo.exe

   Executable created by CsIo.cs    by Makefile.Win32 or Makefile.Win64 using VS2010.
   To execute bin32/CSIo.exe, you need ../Win32/TDCSS.dll and TDS.dll.
   To execute bin64/CSIo.exe, you need ../Win64/TDCSS.dll and TDS.dll.


[] bin32/VBIo.exe
[] bin64/VBIo.exe

   Executable created by VBIo.vb    by Makefile.Win32 or Makefile.Win64 using VS2010.
   To execute bin32/VBIo.exe, you need ../Win32/TDVBS.dll and TDS.dll.
   To execute bin64/VBIo.exe, you need ../Win64/TDVBS.dll and TDS.dll.


[] bin32/JVIo.class, bin32/JVIo$RecvProcThread.class
[] bin64/JVIo.class, bin64/JVIo$RecvProcThread.class

   Executable created by JVIo.java  by Makefile.Win32 using JDK 1.7.
   To execute, you need ../TDJVS.jar and ../Win32/TDS.dll.
   Also, since TDJVS.jar uses Java JNA, it is necessary to set up the JNA execution environment
   described in TDSE.pdf Appendix D.


[] bin32/JavaIo.class, bin32/JavaIo$RecvProcThread.class
[] bin64/JavaIo.class, bin64/JavaIo$RecvProcThread.class

   Executable created by JavaIo.java by Makefile.Win32 using JDK 1.7.
   To execute, you need ../TDS.jar.
   TDS.jar does not use JNA, so it does not need TDS.dll to execute.

   (Note 1) TDS.jar is not included in our HP and downloadable products.
      If you are interested in using TDS.jar, please contact us (info@trust-design.co.jp).


[] bin32/ExTraceAP.exe
[] bin64/ExTraceAP.exe

   Executable form of ExTraceAP.c made by Makefile.Win32 or Makefile.Win64 using VS2010.


[] bin32/SimpleIo.py, bin32/PythonIo.py
[] bin64/SimpleIo.py, bin64/PythonIo.py

   Python 3 sample
   Execution requires a Python 3 execution environment, and use ../Win32/TDS.dll or ../Win64/
   TDL.dll tailored to that environment.


[] bin32/SimpleIo.rb, bin32/RubyIo.rb
[] bin64/SimpleIo.rb, bin64/RubyIo.rb

   Ruby 2 sample
   Execution requires a Python 3 execution environment, and use ../Win32/TDS.dll or ../Win64/
   TDL.dll tailored to that environment.


[] bin32/TDSSample1.exe

   Executable that built the sample code stored in ../Sample1/ using VS2010.
   To execute, you need ../Win32/TDS.dll.


[] bin64/TDSSample2.exe

   Executable that built the sample code stored in ../Sample2/ using VS2010.
   To execute, you need ../Win64/TDS.dll.


(Note 2) The make process described below such as "== How to create sample programs ==" be
   performed to prepare the execution environment.

(Note 3) To execute each .exe included in this package, the DLL of VC execution environment is
   required.
   If it cannot be executed due to a message such as "Cannot execute because VCRuntimeXXX.dll does
   not exist", download the DLL for VC execution environment from the Microsoft website and install
   it on your PC.



====================================================================================================
== Source code file ================================================================================

[] SimpleIo.c

  + The simplest use case of constructing a SECS message in the AP and simply repeating sending and
    receiving S1F1 and S1F2



[] BasicIo.c

  + An example of basic processing that performs SECS Send/Receive processing of SECS message
    sequentially.

  + The processing method can be changed for the following items by changing the value of the macro
    constant defined internally.
    - SECS-1 or HSMS-SS
      (Note) TDS determines SECS1 or HSMS based on the setting in configuration file (.ini), not
         this setting.  At the same time as this setting change, setting file (.ini) must also be
         changed.
    - Type of function to use (_TDSCommXxxxx() or _TDSUDrvXxxxx())
    - Whether to use message definition file
    - List expression form of message
    - How to get each data item in the message



[] CallbackIo.c

  + An example of processing similar to normal processing in which Receive processing of the SECS
    message is performed in the Callback function, and when the primary message is received, the
    corresponding secondary message is also sent at that time.

  + The processing method can be changed for the following items by changing the value of the macro
    constant defined internally.
    - SECS-1 or HSMS-SS
      (Note) TDS determines SECS1 or HSMS based on the setting in configuration file (.ini), not
         this setting.  At the same time as this setting change, setting file (.ini) must also be
         changed.
    - Type of function to use (_TDSCommXxxxx() or _TDSUDrvXxxxx())
    - Use of message definition file and secondary message automatic response do or not
    - List expression form of message
    - How to get each data item in the message
    - Presence of communication trace output by user function

  + The communication trace is also illustrated in the user function.
    By using the message definition file, use the automatic response function using the definition
    file.

  + Outputs information such as item names specified in the definition file in the trace message.

  + Continuous transmission/reception processing at fixed intervals (100 ms) is continuously
    executed until the CNTL-C input according to the request code.



[] SubFunctions.h

  + Source code file containing function entities called from BasicIo.c and CallbackIo.c.
    For each source code file, include it in yourself by #include.



[] CSIo.cs

  + C# version of BaseicIo.c.
    Callback processing is also possible by changing the internally defined variable.

  + To start this sample, .NetFramework 2.0 is required.
  + This sample is available only for Windows version.

  + The processing method can be changed for the following items by changing the value of the
    constant defined internally.
    - SECS-1 or HSMS-SS
      (Note) TDS determines SECS1 or HSMS based on the setting in configuration file (.ini), not
         this setting.  At the same time as this setting change, setting file (.ini) must also be
         changed.
    - Type of function to use (_CommXxxxx() or _UDrvXxxxx())
    - Use of Callback function
    - Use of message definition file and secondary message automatic response do or not
    - List expression form of message
    - How to get each data item in the message



[] VBIo.vb

  + Visual Basic version of BaseicIo.c.
    Callback processing is also possible by changing the internally defined variable.

  + To start this sample, .NetFramework 2.0 is required.
  + This sample is available only for Windows version.

  + The processing method can be changed for the following items by changing the value of the
    constant defined internally.
    - SECS-1 or HSMS-SS
      (Note) TDS determines SECS1 or HSMS based on the setting in configuration file (.ini), not
         this setting.  At the same time as this setting change, setting file (.ini) must also be
         changed.
    - Type of function to use (_TDSCommXxxxx() or _TDSUDrvXxxxx())
    - Use of Callback function
    - Use of message definition file and secondary message automatic response do or not
    - List expression form of message
    - How to get each data item in the message



[] JVIo.java

  + Java version of BaseicIo.c.
    Callback processing is also possible by changing the internally defined variable.

  + The following is required to build and start this sample
    - JavaVM 1.7 or later
    - JDK    1.7 or later
    - JNA    4.1 or later

  + The processing method can be changed for the following items by changing the value of the
    constant defined internally.
    - SECS-1 or HSMS-SS
      (Note) TDS determines SECS1 or HSMS based on the setting in configuration file (.ini), not
         this setting.  At the same time as this setting change, setting file (.ini) must also be
         changed.
    - Type of function to use (_TDJVSCommXxxxx() or _TDJVSUDrvXxxxx())
    - Use of Callback function
    - Use of message definition file and secondary message automatic response do or not
    - List expression form of message
    - How to get each data item in the message

  (Note 1) Refer to Programmer's Manual (TDSE.pdf) Appendix D for development and execution
     environment settings.



[] JavaIo.java

  + Changed JVIo.c to an API that uses TDS.jar without using JNA (and TDS.dll) instead of TDJVS.jar.

  + The following is required to build and start this sample
    - JavaVM 1.7 or later
    - JDK    1.7 or later

  + The processing method can be changed for the following items by changing the value of the
    constant defined internally.
    - Type of function to use (_TDSCommXxxxx() or _TDSUDrvXxxxx())
    - Use of Callback function
    - Use of message definition file and secondary message automatic response do or not
    - List expression form of message
    - How to get each data item in the message

  (Note 2) Refer to Programmer's Manual (TDSE.pdf) Appendix E for development and execution
     environment settings.

  (Note 3) The attached Makefile does not include JavaIo.java's make in the all entry.
     To make JavaIo.java, uncomment for description of JavaIo.java ($(PD)) in the 'all' entry of
     Makefile, and start the JavaIo.class entry.

  (Note 4) The product file downloaded from our company HP does not include TDS.jar.
     Please contact us (info@trust-design.co.jp) for TDS.jar.



[] ExTraceAP.c

  + Sample of external communication trace processing AP that receives communication trace output
    by TCP/IP connection from TDS.

  + To use this sample, set the following parameters in the .ini file.
    - TRCTHOST : Host name or IP-Address that operates this sample.
                 Specify "127.0.0.1" when operating on the same PC as the AP that uses TDS.
    - TRCTPORT : TCP/IP Port# used by this sample
                 If you do not specify TCP/IP Port# when starting this sample, specify 6000.



[] SimpleIo.py
[] PythonIo.py

  + Python 3 sample



[] SimpleIo.rb
[] RubyIo.rb

  + Ruby 2 sample



====================================================================================================
== Files to build and run the sample program =======================================================

[] Makefile.Win32    , Makefile.Win64  
   Makefile.Linux32  , Makefile.Linux64
   Makefile.FreeBSD32, Makefile.FreeBSD64
   Makefile.MacOS32  , Makefile.MacOS64
   Makefile.SunOS32  , Makefile.SunOS64
   Makefile.HP-UX32  , Makefile.HP-UX64

  + Makefile that creates the above eight programs (SimpleIo, BasicIo, CallbackIo, CSIo, VBIo, JVIo,
    JavaIo, ExTraceAP).
    (Note 1) CSIo and VBIo are only for Windows version.
    (Note 2) JavaIo is not included in the all: entry.

  + Samples that do not need to be made should be removed from the all: entry.

  + Refer to Makefile.*32 when supporting 32-bit applications.
  + Refer to Makefile.*64 when supporting 64-bit applications.

  + Depending on the architecture (32bit or 64bit) to be adopted, adopt appropriate ones that exist
    in .lib, .dll etc., ../Win32, ../Win64, ../Linux32, ../Linux64 etc.



[] SampleE.ini

  + This is an example of the setting file of this library, and used by this sample program.
  + Set the items common to the host side and the equipment side in the [DEFAULT] section, set the
    host side specific settings in the [HOST] section, and set the equipment side specific settings
    in the [EQUIP] section.
  + This setting assumes that equipment with deviceID=0x20 and host will perform loopback test in
    one PC using HSMS connection.
  + The maximum length of the SECS message is 100000 bytes, and when using a larger message, it is
    necessary to change the parameter value with reference to the comment described at the top of
    this setting file.
  + The following settings are made for log output performed by this library.
    - A communication trace is output in the form of a list of the format of this library.
      Hexadecimal numbers are not displayed.
    - Processing trace and user I/F function trace are not performed. Communication trace is output
      to file only
    - The trace file switches over 5MB.
  + Refer to the Programmer's Manual (TDSE.pdf) for details of setting values.



[] SampleE.sml

  + A file in which the SECS message used by this sample code is defined in SML format.
  + The message definition file is not always necessary.
  + In this library, it is possible to construct SECS message without message definition.
  + When using a message definition, item names can be used to reference and set each item value
    that composes the message. In addition, automatic response (automatic message selection) of the
    secondary message can be performed.
  + In this sample, when constructing a SECS message using this message definition file, both cases
    of constructing without using it are illustrated.
  + Refer to the Programmer's Manual (TDSE.pdf) for details on the structure of the message
    definition file.



[] SemiStandard.sml

  + A file defined in SML format that conforms to defined in the SEMI standard "E5".
  + Although the form as it is is usable, the variable type, number, etc. of the parameters that
    make up each message are just samples, and when actually used, it is necessary to decide
    according to the specifications of the applicable system.



[] setup32.bat
[] setup64.bat

  + Example of a batch command to set up a build environment and a Java execution environment of a
    program using makefile on Windows.



(Note 1) The end of each sample program and Makefile line is "LF" code only.
   Therefore, Windows Notepad can not refer correctly. Refer to it using a text editor that supports
   files whose line feed code is "LF" only.
   Configuration files etc. can also be viewed with Notepad.

(Note 2) Since the TAB Stop position of each sample program etc. is every 8 digits, make the setting
   of the text editor to be used like that.
   However, each source code in Sample1 and Sample2 is every 4 digits of Visual Studio standard.



====================================================================================================
== How to create sample programs ===================================================================

[] Build a program using makefile on Windows

  + Start cmd.exe and work in it.

  + In order to use a development environment such as Microsoft Visual Studio compiler, start the
    following batch file prepared by Visual Studio and prepare the development environment.

    - In case of 32bit application
       [Directory where you installed Visual Studio]\VC\vcvarsall.bat x86

    - In case of 64bit application
       [Directory where you installed Visual Studio]\VC\vcvarsall.bat x64

  + Use Makefile.Win32 in the case of 32bit environment and Makefile.Win64 in the case of 64bit
    environment.

  + Execute Build with the following command.
    - nmake -f Makefile.Win32   or   nmake -f Makefile.Win64
      ~~~~~~~~~~~~~~~~~~~~~~~        ~~~~~~~~~~~~~~~~~~~~~~~

  + Build results are placed in ./bin32/ or ./bin64/.
    .dll, .ini, .sml, etc. necessary for execution are also copied to the same directory.


  (Note 1) Refer to "setup32.bat" or "setup64.bat" for setting up the environment, and it is also
     possible to change "setup32.bat" or "setup64.bat" appropriately and use it.

  (Note 2) This library package supports the following development environments.
     (Since the attached project file is from VS2010, when using a later version of VS, convert it
     to the version of VS to be used (or with automatic conversion) using the project file
     conversion function of VS.)
    + Microsoft .. Visual Studio 2005  (Microsoft Visual Studio 8)  ...... (Not support)
    + Microsoft .. Visual Studio 2008  (Microsoft Visual Studio 9.0)  .... (Not support)
    + Microsoft .. Visual Studio 2010  (Microsoft Visual Studio 10.0)  ... (32bit, 64bit)
    + Microsoft .. Visual Studio 2012  (Microsoft Visual Studio 11.0)  ... (32bit, 64bit)
    + Microsoft .. Visual Studio 2013  (Microsoft Visual Studio 12.0)  ... (32bit, 64bit)
    + Microsoft .. Visual Studio 2015  (Microsoft Visual Studio 14.0)  ... (32bit, 64bit)
    + Microsoft .. Visual Studio 2017  (Microsoft Visual Studio 14.1)  ... (32bit, 64bit)
    + Microsoft .. Visual Studio 2019  (Microsoft Visual Studio 14.2)  ... (32bit, 64bit)
    + Oracle ..... JDK 1.7 or lator

  (Note 3)
     For build of JVIo.java   include TDJVS.jar in CLASSPATH.
     For build of JavaIo.java include TDS.jar   in CLASSPATH.



[] Build of program in UNIX-like OS

  + Use Makefile.*32 or Makefile.*64 according to the development environment of 32bit and 64bit,
    and execute the following command.

    Linux   : make -f Makefile.Linux32      or   make -f Makefile.Linux64
    FreeBSD : make -f Makefile.FreeBSD32    or   make -f Makefile.FreeBSD64
    MacOS X : make -f Makefile.MacOS32      or   make -f Makefile.MacOS64
    Solaris : make -f Makefile.SunOS32      or   make -f Makefile.SunOS64
    HP-UX   : make -f Makefile.HP-UX32      or   make -f Makefile.HP-UX64
              ~~~~~~~~~~~~~~~~~~~~~~~~~~         ~~~~~~~~~~~~~~~~~~~~~~~~~~

  (Note 4)
     For build of JVIo.java   include TDJVS.jar in CLASSPATH.
     For build of JavaIo.java include TDS.jar   in CLASSPATH.

  (Note 5) If make fails, modify Makefile.Linux etc. accordingly.



====================================================================================================
== How to start and operate sample programs ========================================================


[] Refer to the header section of each source code for how to start and operate each sample program.

  (Note1) Windows : Put     TDS.dll      in the executable PATH.
  (Note2) Linux   : Include libTDS.so    in LD_LIBRARY_PATH.
  (Note3) FreeBSD : Include libTDS.so    in LD_LIBRARY_PATH or LD_32_LIBRARY_PATH.
  (Note4) MacOS X : Include libTDS.dylib in DYLD_LIBRARY_PATH.
  (Note5) Solaris : Include libTDS.so    in LD_LIBRARY_PATH.
  (Note6) HP-UX   : Include libTDS.sl    in SHLIB_PATH.

  (Note 7) To run the JVIo.java sample, Include TDJVS.jar and jna.jar in the CLASSPATH.
     To run JavaIo.java sample, Include TDS.jar in CLASSPATH.
     Please obtain jna.jar from "https://github.com/twall/jna#download" etc.

  (Note 8) In Windows, when launching CSIo.exe and VBIo.exe, place TDCSS.dll and TDVBS.dll
     respectively in the folder indicated by the same PATH as shown in (Note 1).

  (Note 9) This sample is not sufficient for exception handling etc. because of its nature (as
     simply as possible to understand how to use TDS). When coding, be sure to code sufficient
     exception handling etc. according to the TDS operating environment, operating mode, etc.

