Skip to content

Getting Started

Note

This page is only available in English.

Welcome to the Home I/O SDK guide. This guide describes what the SDK is, how it works and where to look for additional information.

Home I/O SDK is made of a .NET 2.0 assembly (EngineIO.dll), corresponding documentation, tools and some samples to help you getting started. This assembly enables custom code to access the simulation I/O points.

How It Works

The inter-process communication (IPC) is done through a memory mapped file (EngineIO.dll). The memory is divided into three groups: Inputs, Outputs, and Memories. These groups are a convention defined by us, standing from the point of view of a controller. Every I/O point, despite being an input, output or memory, has a unique Memory Address, Name, and Value.

Some considerations to take into account when using the assembly EngineIO.dll:

  • The MemoryMap class is a Singleton, meaning that only one instance can exist at any given time. This instance represents a Cached Copy of the memory mapped file;
  • The MemoryMap.Instance.Update() method is responsible for synchronizing your cached copy with the memory mapped file. This method must be called every time you want to access the latest I/O points or receive event notifications.

Simple example showing how to switch the living room lights on/off using C#.

using System;
using System.Threading;

using EngineIO;

namespace EngineIO.Samples
{
    class Program
    {
        //In this sample we are switching the living room light on and off 10 times.
        static void Main(string[] args)
        {
            //We are using a MemoryBit which we get from the MemoryMap.
            //You can find all the memory addresses at the Memory Addresses page.
            MemoryBit livingRoomLight = MemoryMap.Instance.GetBit(0, MemoryType.Output);

            for (int i = 0; i < 10; i++)
            {
                livingRoomLight.Value = !livingRoomLight.Value;

                //When using a memory value before calling the Update method we are using a cached value.
                Console.WriteLine("Light is on? " + livingRoomLight.Value);

                //Calling the Update method will write the livingRoomLight.Value to the memory map.
                MemoryMap.Instance.Update();

                Thread.Sleep(1000);
            }

            //When we no longer need the MemoryMap we should call the Dispose method to release all the allocated resources.
            MemoryMap.Instance.Dispose();

            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();
        }
    }
}

Each group (Inputs, Outputs and Memories) support the following Data Types:

Data Types Range Notes
Bit True or False
Byte 0 to 255
Short -3,768 to 32,767
Int -2,147,483,648 to 2,147,483,647
Long 9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
Float -3.403 × 1038 to 3.403 × 1038
Double -1.798 × 10 308 to 1.798 × 10308
String 64 UNICODE Characters
DateTime 00:00:00, January 1, 0001 through 23:59:59, December 31, 9999 Represents an instant in time, typically expressed as a date and time of day.
TimeSpan -10675199.02:48:05.4775808 to 10675199.02:48:05.4775807 Represents a time interval that is measured as a positive or negative number of days, hours, minutes, seconds, and fractions of a second.

Engine I/O Explorer Tool

You will find the Engine I/O Explorer inside the SDK zip file. This tool allows you to easily browse the I/O points memory address, name, type, and value. It is a valuable tool when used during the development phase.

Additional Information

Please take a look at the included samples, they show good practices on how to use the EngineIO.dll assembly.