Example Device Implementation

The following is a very simple IDevice implementation.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SIM.IO.API;

namespace MyNamespace
{
    public class MyDevice : IDevice
    {
        private bool _isInitialized = false;

        // SetInMotion will assign this InputHostConnector to the device when it is first
        // initialized - no need to do anything except allow get / set
        public SIM.IO.API.HostConnectors.IHostConnector InputHostConnector { get; set; }

        public void DoBackgroundProcess()
        {
            // do any background processes here
        }

        public TimeSpan? GetBackgroundProcessInterval()
        {
            // have SetInMotion call DoBackgroundProcesses every 1 second
            return TimeSpan.FromSeconds(1);
        }

        public DeviceFaultStatus GetFaultStatus()
        {
            // no problems!
            return new DeviceFaultStatus(false);
        }

        public string GetFriendlyName()
        {
            // user will see the friendly name of this device on their screen
            return "My Device";
        }

        public void Initialize()
        {
            // perform any initialization code necessary
            InputHostConnector.SetChannelValue("MyChannel", "Value", "0");
            _isInitialized = true;
        }

        public bool IsInitialized
        {
            get { 
                // let SetInMotion know if the device is already initialized
                return _isInitialized;
            }
        }

        public void OnChannelValueChange(string channelId, string property, string value)
        {
            // do something with received channel events, if necessary
        }

        public void Shutdown()
        {
            // perform any clean shutdown related items here - leave nothing behind!
        }

        public void ExecuteCommand(DeviceCommand command)
        {
            // if your device supports scriptable commands, they arrive here
        }
    }
}