using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IACommService4CSharp
{
    public enum AXBLOCK_DRIVER
    {
        UNKNOWN = 0,
        NONE,
        TCP,
        COM,
        USB,
        SHM,
        UDP,
        CAN_Client,
        CAN_Server,
        DIRECT_Call
    }

    public class BrowsedDeviceInfo_t : DeviceBaseInfo_t
    {
        public BrowsedDeviceInfo_t() : base()
        {
        }
        //Internal use
        public BrowsedDeviceInfo_t(IDataValue4CSharp value) : base(value)
        {
        }
        public string Version
        {
            get
            {
                uint versionID = (uint)GetFieldValue("DeviceVersionID");
                string version = "";
                for (var i = 0; i < 4; i++)
                {
                    var versionBit = versionID >> ((3 - i) * 8);
                    versionBit = 0xFF & versionBit;
                    version += versionBit.ToString();
                    if (i < 3) version += ".";
                }
                return version;
            }
        }
        public AXBLOCK_DRIVER BlockDriver
        {
            get
            {
                return (AXBLOCK_DRIVER)(Int16)GetFieldValue("BlockDriver");
            }
            set
            {
                SetFieldValue("BlockDriver", value);
            }
        }
    }
}
