IBM Support

An example of how to Encode and Decode objects outside of Rose RealTime

Troubleshooting


Problem

Data exchanged between a Rose RealTime application and an external application can be encoded and decoded to facilitate the exchange of data. This technote provides an example.

Resolving The Problem

Please find the attached example which includes a Rose RealTime socket application and an external VC++7.0 client application. The example demonstrates the encoding and decoding of exchanged data. This technote depends on the information available in technote 1135770.


External Client Application

  • This is a Microsoft Visual Studio 7.0 C++ project.
  • It uses the ObjectimeTypes.lib library to encode and decode instances of the Class Data.
  • It uses the class Data generated from the Rose RealTime model.
  • It uses the utility class AsciiEncoderDecoder available from technote 1135770.
    Note: the example could have used the class generated in the RoseRT application as was done with the Data class. The AsciiEncoderDecoder class was used within the project for clarity.
  • It calls the method RTTypeInstaller::install(). This installs the known RTTypes referenced in the RoseRT library such as RTType_int. If this is not called at startup then the decode will fail.



  • RoseRT Application
  • This is based on the Socket Interface example shipped with Rose RealTime.
  • It uses the utility class AsciiEncoderDecoder from the technote below to encode and decode the data on the socket.



  • AcsiiEncoderDecoder
  • This class uses a buffer MAXENCODEDSIZE of size 10000 characters. If you are encoding data that is larger than this after ASCII encoding, this value will have to be increased.


  • Overview
    The communication between the two processes is as follows:
    The External Client application encodes an instance of Data and sends it to the RoseRT application. The RoseRT application capsule TCPServer decodes the ASCII string and sends the Data object to another capsule. The receiving capsule increments the values in the data object and then sends it to the capsule TCPServer. The capsule TCPServer then encodes the object and sends it back to the External Client application. The External Client receives the ASCII string and decodes it.


    Instructions
    To run the applications this technote assumes you have RoseRT installed in C:\Program Files\Rational\Rose RealTime and you have VC++7.x installed. Follow the steps below:
    1) Unzip the attached file to some location
    2) Open the model under RoseRTSocketInterface and change the constant Logical View::Application::CONSTANTS::MASTER_HOST to your IP address.
    3) Build the component Server_x86VCpp70. You must do this first, since the VC++ project uses the Data class generated from RoseRT.
    4) Run the RoseRT application. You should see output that it is listening at IP:port
    5) Open the VC++ project ExtClient\Client\Client.vcproj. In Client.h change SERVER to the IP address where your RoseRT application is running.
    6) Build and run the Client Application. It should connect to the RoseRT application and exchange data 5 times.


    Note: This model was created purely for the purpose of demonstrating how to encode/decode data outside of a Rose RealTime model.





    Related Information

    SocketEncDecEx.zip
    [{"Product":{"code":"SSSHKL","label":"Rational Rose RealTime"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Not Applicable","Platform":[{"code":"PF033","label":"Windows"}],"Version":"2003","Edition":"All Editions","Line of Business":{"code":"LOB45","label":"Automation"}}]

    Document Information

    More support for:
    Rational Rose RealTime

    Software version:
    2003

    Operating system(s):
    Windows

    Document number:
    80545

    Modified date:
    16 June 2018

    UID

    swg21190952