Exemplo n.º 1
0
        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return(false);
            }
            KomahubOutput other = (KomahubOutput)obj;

            return(type.Equals(other.type) && name.Equals(other.name) && fuseCurrent == other.fuseCurrent);
        }
Exemplo n.º 2
0
 public UIState()
 {
     FactorySettings = new KomahubFactorySettings();
     Status          = new KomahubStatus();
     Outputs         = new KomahubOutput[6];
     for (int i = 0; i < 6; i++)
     {
         Outputs[i]      = new KomahubOutput();
         Outputs[i].type = KomahubOutput.OutputType.OFF;
     }
 }
Exemplo n.º 3
0
        public void configureOutput(int outputNumber, KomahubOutput output)
        {
            byte[] report = new byte[64];
            report[0] = KOMAHUB_MAGIC;
            report[1] = Commands.ConfigureOutput;
            report[2] = (byte)outputNumber;
            report[3] = (byte)output.type;
            report[4] = (byte)(output.fuseCurrent * 10);
            byte[] nameBytes = System.Text.Encoding.UTF8.GetBytes(output.name);
            for (int i = 0; i < 16; i++)
            {
                report[5 + i] = (i < nameBytes.Length ? nameBytes[i] : (byte)0);
            }

            lock (hubLock)
            {
                send(report);
            }
        }
Exemplo n.º 4
0
        public KomahubOutput readOutput(int outputNumber)
        {
            byte[] report = new byte[64];
            byte[] result = new byte[64];
            report[0] = KOMAHUB_MAGIC;
            report[1] = Commands.GetOutputSettings;
            report[2] = (byte)outputNumber;

            lock (hubLock)
            {
                send(report);
                recv(result);
            }
            KomahubOutput output = new KomahubOutput();

            byte[] name = new byte[16];
            Array.Copy(result, name, 16);
            output.name        = System.Text.Encoding.UTF8.GetString(name).TrimEnd('\0');
            output.fuseCurrent = result[16] / 10.0f;
            output.type        = (KomahubOutput.OutputType)result[17];
            return(output);
        }