Logo
Telescience Resource Kit
TReK .NET Standard  5.4.0 ART
TReK .NET Standard

Table of Contents

TReK .NET Standard (core) library supports the Telemetry, Command and Data API's from both Windows and Linux. It is built on top of unmanaged native C++.

Note
"Unmanaged" refers to code that is directly executed by the operating system, as opposed to running within a virtual machine environment like .NET, Java, or hosted scripting languages.

This implementation was built using .NET 6.0 Long-Term Support (LTS), but would likely work with later versions.

Getting Starting

The location and syntaxes are slightly different whether you are on Windows or Linux.

Windows

Installation

The Windows installation will provide the necessary Dynamic Link Library in the "extras" folder.

c:\program files\trek 5.4.0\extras\NASA.Trek.dll

Project Setup

You can easily modify your .csproj project file to add a reference to the TReK .NET library DLL. Once added to your project, building your application will automatically copy the DLL into your compilation directory.

Example:

Check the HintPath matches your TReK version.

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Reference Include="NASA.Trek">
<HintPath>c:\program files\trek $(TREK_VERSION)\extras\NASA.Trek.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

Path Variable

Because NASA.Trek.dll depends on an existing TReK installation, the DLL will attempt to find the TreK installion C++ DLLs using operating system environment variables.

For Windows, TReK "bin" directory should be in the users PATH variable after installation.

The DLLs should locate the DLLs and use the binaries there.

However, if the path is not set globally, your application can be launched with a bat file that sets the variable in advance of execution.

rem Set PATH to TReK DLLs
set PATH=%PATH%;"c:\program files\trek $(TREK_VERSION)\bin"
myprogram.exe

Linux

Installation

Linux installation requires the following RPMs.

  1. trek-dotnetcore (Contains the .NET DLL) /extras folder.
  2. trek-nativeinterop (Provides native interoperability between .NET and C++)
  3. trek-data (Supported API)
  4. trek-cmd (Supported API)
  5. trek-core (Supported API)

/usr/trek-5.4.0/extras/NASA.Trek.dll

Project Setup

You can easily modify your .csproj project file to add a reference to the TReK .NET library DLL. Once added to your project, building your application will automatically copy the DLL into your compilation directory.

Example:

Check the HintPath matches your TReK version.

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Reference Include="NASA.Trek">
<HintPath>/usr/trek-$(TREK_VERSION)/extras/NASA.Trek.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

Path Variable

Because NASA.Trek.dll depends on an existing TReK installation, the DLL will attempt to find the TreK installion C++ DLLs using operating system environment variables.

For Linux, TReK "DLL" directory should be assigned to the LD_LIBRARY_PATH environment variable. This can be done in script used to start your application. Placing bash script in the root of your application folder like the example below.

#!/bin/bash
# Set Library Path to find TReK DLLs.
export LD_LIBRARY_PATH="/usr/trek-5.4.0/lib"
dotnet run

Sections