예제 #1
0
        public List <string> GetActiveDevices()
        {
            _lib.RescanActiveDevices();

            List <string> devices = new List <string>();

            CecLogicalAddresses addresses = _lib.GetActiveDevices();

            for (int i = 0; i < addresses.Addresses.Length; i++)
            {
                CecLogicalAddress address = (CecLogicalAddress)i;
                if (!addresses.IsSet(address))
                {
                    continue;
                }

                string device = String.Empty;

                device += _lib.ToString(_lib.GetDeviceVendorId(address)) + ',';
                device += _lib.GetDeviceOSDName(address) + ',';
                device += _lib.ToString(_lib.GetDevicePowerStatus(address)) + ',';
                device += _lib.IsActiveDevice(address).ToString() + ',';
                device += _lib.GetDevicePhysicalAddress(address).ToString();

                devices.Add(device);
            }

            return(devices);
        }
예제 #2
0
    private static int SerialiseLogicalAddresses(CecLogicalAddresses addresses)
    {
      var retVal = 0;
      for (int addr = (int)CecLogicalAddress.Tv; addr <= (int)CecLogicalAddress.Broadcast; addr++)
      {
        if (addresses.IsSet((CecLogicalAddress)addr))
        {
          retVal += (int)Math.Pow(2, addr);
        }
      }

      return retVal;
    }
예제 #3
0
        private static int SerialiseLogicalAddresses(CecLogicalAddresses addresses)
        {
            var retVal = 0;

            for (int addr = (int)CecLogicalAddress.Tv; addr <= (int)CecLogicalAddress.Broadcast; addr++)
            {
                if (addresses.IsSet((CecLogicalAddress)addr))
                {
                    retVal += (int)Math.Pow(2, addr);
                }
            }

            return(retVal);
        }
예제 #4
0
        /// <summary>
        ///
        /// </summary>
        public void Scan()
        {
            string scanRes = "";

            scanRes += "CEC bus information\n";
            scanRes += "===================\n";
            CecLogicalAddresses addresses = Lib.GetActiveDevices();

            for (int iPtr = 0; iPtr < addresses.Addresses.Length; iPtr++)
            {
                CecLogicalAddress address = (CecLogicalAddress)iPtr;
                if (!addresses.IsSet(address))
                {
                    continue;
                }

                CecVendorId    iVendorId        = Lib.GetDeviceVendorId(address);
                bool           bActive          = Lib.IsActiveDevice(address);
                ushort         iPhysicalAddress = Lib.GetDevicePhysicalAddress(address);
                string         strAddr          = Lib.PhysicalAddressToString(iPhysicalAddress);
                CecVersion     iCecVersion      = Lib.GetDeviceCecVersion(address);
                CecPowerStatus power            = Lib.GetDevicePowerStatus(address);
                string         osdName          = Lib.GetDeviceOSDName(address);
                string         lang             = Lib.GetDeviceMenuLanguage(address);

                scanRes += "device #" + iPtr + ": " + Lib.ToString(address) + "\n";
                scanRes += "address:       " + strAddr + "\n";
                scanRes += "active source: " + (bActive ? "yes" : "no") + "\n";
                scanRes += "vendor:        " + Lib.ToString(iVendorId) + "\n";
                scanRes += "osd string:    " + osdName + "\n";
                scanRes += "CEC version:   " + Lib.ToString(iCecVersion) + "\n";
                scanRes += "power status:  " + Lib.ToString(power) + "\n";
                if (!string.IsNullOrEmpty(lang))
                {
                    scanRes += "language:      " + lang + "\n";
                }
                scanRes += "===================" + "\n";
            }

            Trace.Write(scanRes);
        }
예제 #5
0
파일: CecClient.cs 프로젝트: rhyek/test-cec
        public void Scan()
        {
            StringBuilder output = new StringBuilder();

            output.AppendLine("CEC bus information");
            output.AppendLine("===================");
            CecLogicalAddresses addresses = Lib.GetActiveDevices();

            for (int iPtr = 0; iPtr < addresses.Addresses.Length; iPtr++)
            {
                CecLogicalAddress address = (CecLogicalAddress)iPtr;
                if (!addresses.IsSet(address))
                {
                    continue;
                }

                CecVendorId    iVendorId        = Lib.GetDeviceVendorId(address);
                bool           bActive          = Lib.IsActiveDevice(address);
                ushort         iPhysicalAddress = Lib.GetDevicePhysicalAddress(address);
                string         strAddr          = Lib.PhysicalAddressToString(iPhysicalAddress);
                CecVersion     iCecVersion      = Lib.GetDeviceCecVersion(address);
                CecPowerStatus power            = Lib.GetDevicePowerStatus(address);
                string         osdName          = Lib.GetDeviceOSDName(address);
                string         lang             = Lib.GetDeviceMenuLanguage(address);

                output.AppendLine("device #" + iPtr + ": " + Lib.ToString(address));
                output.AppendLine("address:       " + strAddr);
                output.AppendLine("active source: " + (bActive ? "yes" : "no"));
                output.AppendLine("vendor:        " + Lib.ToString(iVendorId));
                output.AppendLine("osd string:    " + osdName);
                output.AppendLine("CEC version:   " + Lib.ToString(iCecVersion));
                output.AppendLine("power status:  " + Lib.ToString(power));
                if (!string.IsNullOrEmpty(lang))
                {
                    output.AppendLine("language:      " + lang);
                }
                output.AppendLine("");
            }
            Debug.WriteLine(output.ToString());
        }
예제 #6
0
        private void ShowSelectDevices(CecLogicalAddresses list)
        {
            SelectDevices sel = new SelectDevices();

            sel.StartPosition = FormStartPosition.CenterParent;

            foreach (PropertyInfo property in sel.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly))
            {
                if (property.CanWrite && property.PropertyType.Equals(typeof(System.Boolean)))
                {
                    property.SetValue(sel, false, null);
                    if (list.IsSet((CecLogicalAddress)Enum.Parse(typeof(CecLogicalAddress), property.Name, true)))
                    {
                        property.SetValue(sel, true, null);
                    }
                }
            }

            if (sel.ShowDialog(this) == DialogResult.OK)
            {
                list.Clear();

                foreach (PropertyInfo property in sel.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly))
                {
                    if (property.CanRead && property.PropertyType.Equals(typeof(System.Boolean)))
                    {
                        if ((bool)property.GetValue(sel, null))
                        {
                            list.Set((CecLogicalAddress)Enum.Parse(typeof(CecLogicalAddress), property.Name, true));
                        }
                    }
                }

                sel = null;
            }
        }
예제 #7
0
    private void ShowSelectDevices(CecLogicalAddresses list)
    {

      SelectDevices sel = new SelectDevices();
      sel.StartPosition = FormStartPosition.CenterParent;

      foreach (PropertyInfo property in sel.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly))
      {
        if (property.CanWrite && property.PropertyType.Equals(typeof(System.Boolean)))
        {
          property.SetValue(sel, false, null);
          if (list.IsSet((CecLogicalAddress)Enum.Parse(typeof(CecLogicalAddress), property.Name, true)))
          {
            property.SetValue(sel, true, null);
          }
        }
      }

      if (sel.ShowDialog(this) == DialogResult.OK)
      {
        list.Clear();

        foreach (PropertyInfo property in sel.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly))
        {
          if (property.CanRead && property.PropertyType.Equals(typeof(System.Boolean)))
          {
            if ((bool)property.GetValue(sel, null))
            {
              list.Set((CecLogicalAddress)Enum.Parse(typeof(CecLogicalAddress), property.Name, true));
            }
          }
        }

        sel = null;
      }
    }
예제 #8
0
        public void MainLoop()
        {
            Lib.PowerOnDevices(CecLogicalAddress.Tv);
            FlushLog();

            Lib.SetActiveSource(CecDeviceType.PlaybackDevice);
            FlushLog();

            bool   bContinue = true;
            string command;

            while (bContinue)
            {
                FlushLog();
                Console.WriteLine("waiting for input");

                command = Console.ReadLine();
                if (command.Length == 0)
                {
                    continue;
                }
                string[] splitCommand = command.Split(' ');
                if (splitCommand[0] == "tx" || splitCommand[0] == "txn")
                {
                    CecCommand bytes = new CecCommand();
                    for (int iPtr = 1; iPtr < splitCommand.Length; iPtr++)
                    {
                        bytes.PushBack(byte.Parse(splitCommand[iPtr], System.Globalization.NumberStyles.HexNumber));
                    }

                    if (command == "txn")
                    {
                        bytes.TransmitTimeout = 0;
                    }

                    Lib.Transmit(bytes);
                }
                else if (splitCommand[0] == "on")
                {
                    if (splitCommand.Length > 1)
                    {
                        Lib.PowerOnDevices((CecLogicalAddress)byte.Parse(splitCommand[1], System.Globalization.NumberStyles.HexNumber));
                    }
                    else
                    {
                        Lib.PowerOnDevices(CecLogicalAddress.Broadcast);
                    }
                }
                else if (splitCommand[0] == "standby")
                {
                    if (splitCommand.Length > 1)
                    {
                        Lib.StandbyDevices((CecLogicalAddress)byte.Parse(splitCommand[1], System.Globalization.NumberStyles.HexNumber));
                    }
                    else
                    {
                        Lib.StandbyDevices(CecLogicalAddress.Broadcast);
                    }
                }
                else if (splitCommand[0] == "poll")
                {
                    bool bSent = false;
                    if (splitCommand.Length > 1)
                    {
                        bSent = Lib.PollDevice((CecLogicalAddress)byte.Parse(splitCommand[1], System.Globalization.NumberStyles.HexNumber));
                    }
                    else
                    {
                        bSent = Lib.PollDevice(CecLogicalAddress.Broadcast);
                    }
                    if (bSent)
                    {
                        Console.WriteLine("POLL message sent");
                    }
                    else
                    {
                        Console.WriteLine("POLL message not sent");
                    }
                }
                else if (splitCommand[0] == "la")
                {
                    if (splitCommand.Length > 1)
                    {
                        Lib.SetLogicalAddress((CecLogicalAddress)byte.Parse(splitCommand[1], System.Globalization.NumberStyles.HexNumber));
                    }
                }
                else if (splitCommand[0] == "pa")
                {
                    if (splitCommand.Length > 1)
                    {
                        Lib.SetPhysicalAddress(short.Parse(splitCommand[1], System.Globalization.NumberStyles.HexNumber));
                    }
                }
                else if (splitCommand[0] == "osd")
                {
                    if (splitCommand.Length > 2)
                    {
                        StringBuilder osdString = new StringBuilder();
                        for (int iPtr = 1; iPtr < splitCommand.Length; iPtr++)
                        {
                            osdString.Append(splitCommand[iPtr]);
                            if (iPtr != splitCommand.Length - 1)
                            {
                                osdString.Append(" ");
                            }
                        }
                        Lib.SetOSDString((CecLogicalAddress)byte.Parse(splitCommand[1], System.Globalization.NumberStyles.HexNumber), CecDisplayControl.DisplayForDefaultTime, osdString.ToString());
                    }
                }
                else if (splitCommand[0] == "ping")
                {
                    Lib.PingAdapter();
                }
                else if (splitCommand[0] == "mon")
                {
                    bool enable = splitCommand.Length > 1 ? splitCommand[1] == "1" : false;
                    Lib.SwitchMonitoring(enable);
                }
                else if (splitCommand[0] == "bl")
                {
                    Lib.StartBootloader();
                }
                else if (splitCommand[0] == "lang")
                {
                    if (splitCommand.Length > 1)
                    {
                        string language = Lib.GetDeviceMenuLanguage((CecLogicalAddress)byte.Parse(splitCommand[1], System.Globalization.NumberStyles.HexNumber));
                        Console.WriteLine("Menu language: " + language);
                    }
                }
                else if (splitCommand[0] == "ven")
                {
                    if (splitCommand.Length > 1)
                    {
                        CecVendorId vendor = Lib.GetDeviceVendorId((CecLogicalAddress)byte.Parse(splitCommand[1], System.Globalization.NumberStyles.HexNumber));
                        Console.WriteLine("Vendor ID: " + Lib.ToString(vendor));
                    }
                }
                else if (splitCommand[0] == "ver")
                {
                    if (splitCommand.Length > 1)
                    {
                        CecVersion version = Lib.GetDeviceCecVersion((CecLogicalAddress)byte.Parse(splitCommand[1], System.Globalization.NumberStyles.HexNumber));
                        Console.WriteLine("CEC version: " + Lib.ToString(version));
                    }
                }
                else if (splitCommand[0] == "pow")
                {
                    if (splitCommand.Length > 1)
                    {
                        CecPowerStatus power = Lib.GetDevicePowerStatus((CecLogicalAddress)byte.Parse(splitCommand[1], System.Globalization.NumberStyles.HexNumber));
                        Console.WriteLine("power status: " + Lib.ToString(power));
                    }
                }
                else if (splitCommand[0] == "r")
                {
                    Console.WriteLine("closing the connection");
                    Lib.Close();
                    FlushLog();

                    Console.WriteLine("opening a new connection");
                    Connect(10000);
                    FlushLog();

                    Console.WriteLine("setting active source");
                    Lib.SetActiveSource(CecDeviceType.PlaybackDevice);
                }
                else if (splitCommand[0] == "scan")
                {
                    Console.WriteLine("CEC bus information");
                    Console.WriteLine("===================");
                    CecLogicalAddresses addresses = Lib.GetActiveDevices();
                    for (int iPtr = 0; iPtr < addresses.Addresses.Count(); iPtr++)
                    {
                        CecLogicalAddress address = (CecLogicalAddress)iPtr;
                        if (!addresses.IsSet(address))
                        {
                            continue;
                        }

                        CecVendorId    iVendorId        = Lib.GetDeviceVendorId(address);
                        bool           bActive          = Lib.IsActiveDevice(address);
                        ushort         iPhysicalAddress = Lib.GetDevicePhysicalAddress(address);
                        string         strAddr          = string.Format("{0,4:X}", iPhysicalAddress);
                        CecVersion     iCecVersion      = Lib.GetDeviceCecVersion(address);
                        CecPowerStatus power            = Lib.GetDevicePowerStatus(address);
                        string         osdName          = Lib.GetDeviceOSDName(address);
                        string         lang             = Lib.GetDeviceMenuLanguage(address);

                        StringBuilder output = new StringBuilder();
                        output.AppendLine("device #" + iPtr + ": " + Lib.ToString(address));
                        output.AppendLine("address:       " + strAddr);
                        output.AppendLine("active source: " + (bActive ? "yes" : "no"));
                        output.AppendLine("vendor:        " + Lib.ToString(iVendorId));
                        output.AppendLine("osd string:    " + osdName);
                        output.AppendLine("CEC version:   " + Lib.ToString(iCecVersion));
                        output.AppendLine("power status:  " + Lib.ToString(power));
                        if (!string.IsNullOrEmpty(lang))
                        {
                            output.AppendLine("language:      " + lang);
                        }

                        Console.WriteLine(output.ToString());
                    }
                }
                else if (splitCommand[0] == "h" || splitCommand[0] == "help")
                {
                    ShowConsoleHelp();
                }
                else if (splitCommand[0] == "q" || splitCommand[0] == "quit")
                {
                    bContinue = false;
                }
                else if (splitCommand[0] == "log" && splitCommand.Length > 1)
                {
                    LogLevel = int.Parse(splitCommand[1]);
                }
            }
        }
예제 #9
0
        public string SendCommand(string command)
        {
            if (command == null || command.Length == 0)
            {
                return("No command received");
            }
            string[] splitCommand = command.Split(' ');
            if (splitCommand[0] == "tx" || splitCommand[0] == "txn")
            {
                CecCommand bytes = new CecCommand();
                for (int iPtr = 1; iPtr < splitCommand.Length; iPtr++)
                {
                    bytes.PushBack(byte.Parse(splitCommand[iPtr], System.Globalization.NumberStyles.HexNumber));
                }

                if (command == "txn")
                {
                    bytes.TransmitTimeout = 0;
                }

                Lib.Transmit(bytes);
            }
            else if (splitCommand[0] == "default")
            {
                Lib.SetActiveSource(CecDeviceType.PlaybackDevice);
                return("Set default playback device as active");
            }
            else if (splitCommand[0] == "rescan")
            {
                Lib.RescanActiveDevices();
                return("Rescan active devices");
            }
            else if (splitCommand[0] == "vol")
            {
                if (splitCommand[1] == "up")
                {
                    Lib.VolumeUp(true);
                    return("vol up");
                }
                else if (splitCommand[1] == "down")
                {
                    Lib.VolumeDown(true);
                    return("vol down");
                }
                else if (splitCommand[1] == "mute")
                {
                    Lib.MuteAudio(true);
                    return("Vol mute");
                }
                return("Vol sub command not understood");
            }
            else if (splitCommand[0] == "on")
            {
                if (splitCommand.Length > 1)
                {
                    Lib.PowerOnDevices((CecLogicalAddress)byte.Parse(splitCommand[1], System.Globalization.NumberStyles.HexNumber));
                    return("Signalled ON for device: " + splitCommand[1]);
                }
                else
                {
                    Lib.PowerOnDevices(CecLogicalAddress.Broadcast);
                    return("Signalled broadcast ON");
                }
            }
            else if (splitCommand[0] == "standby")
            {
                if (splitCommand.Length > 1)
                {
                    Lib.StandbyDevices((CecLogicalAddress)byte.Parse(splitCommand[1], System.Globalization.NumberStyles.HexNumber));
                    return("Signalled STANDBY for device: " + splitCommand[1]);
                }
                else
                {
                    Lib.StandbyDevices(CecLogicalAddress.Broadcast);
                    return("Signalled broadcast STANDBY");
                }
            }
            else if (splitCommand[0] == "setDeviceHDMIPort")
            {
                if (splitCommand.Length > 2)
                {
                    if (splitCommand[1] == "Tv")
                    {
                        Lib.SetHDMIPort(CecLogicalAddress.Tv, byte.Parse(splitCommand[2]));
                        return("Set device " + splitCommand[1] + " to HDMI port " + splitCommand[2]);
                    }
                    if (splitCommand[1] == "AudioSystem")
                    {
                        Lib.SetHDMIPort(CecLogicalAddress.AudioSystem, byte.Parse(splitCommand[2]));
                        return("Set device " + splitCommand[1] + " to HDMI port " + splitCommand[2]);
                    }
                }
                return("Incorrect use of setDeviceHDMIPort");
            }
            else if (splitCommand[0] == "poll")
            {
                bool bSent = false;
                if (splitCommand.Length > 1)
                {
                    bSent = Lib.PollDevice((CecLogicalAddress)byte.Parse(splitCommand[1], System.Globalization.NumberStyles.HexNumber));
                }
                else
                {
                    bSent = Lib.PollDevice(CecLogicalAddress.Broadcast);
                }
                if (bSent)
                {
                    Console.WriteLine("POLL message sent");
                }
                else
                {
                    Console.WriteLine("POLL message not sent");
                }
            }
            else if (splitCommand[0] == "la")
            {
                if (splitCommand.Length > 1)
                {
                    Lib.SetLogicalAddress((CecLogicalAddress)byte.Parse(splitCommand[1], System.Globalization.NumberStyles.HexNumber));
                }
            }
            else if (splitCommand[0] == "pa")
            {
                if (splitCommand.Length > 1)
                {
                    Lib.SetPhysicalAddress(ushort.Parse(splitCommand[1], System.Globalization.NumberStyles.HexNumber));
                }
            }
            else if (splitCommand[0] == "osd")
            {
                if (splitCommand.Length > 2)
                {
                    StringBuilder osdString = new StringBuilder();
                    for (int iPtr = 1; iPtr < splitCommand.Length; iPtr++)
                    {
                        osdString.Append(splitCommand[iPtr]);
                        if (iPtr != splitCommand.Length - 1)
                        {
                            osdString.Append(" ");
                        }
                    }
                    Lib.SetOSDString((CecLogicalAddress)byte.Parse(splitCommand[1], System.Globalization.NumberStyles.HexNumber), CecDisplayControl.DisplayForDefaultTime, osdString.ToString());
                }
            }
            else if (splitCommand[0] == "ping")
            {
                return(Lib.PingAdapter().ToString());
            }
            else if (splitCommand[0] == "mon")
            {
                bool enable = splitCommand.Length > 1 ? splitCommand[1] == "1" : false;
                Lib.SwitchMonitoring(enable);
            }
            else if (splitCommand[0] == "bl")
            {
                Lib.StartBootloader();
            }
            else if (splitCommand[0] == "lang")
            {
                if (splitCommand.Length > 1)
                {
                    string language = Lib.GetDeviceMenuLanguage((CecLogicalAddress)byte.Parse(splitCommand[1], System.Globalization.NumberStyles.HexNumber));
                    return("Menu language: " + language);
                }
            }
            else if (splitCommand[0] == "ven")
            {
                if (splitCommand.Length > 1)
                {
                    CecVendorId vendor = Lib.GetDeviceVendorId((CecLogicalAddress)byte.Parse(splitCommand[1], System.Globalization.NumberStyles.HexNumber));
                    return("Vendor ID: " + Lib.ToString(vendor));
                }
            }
            else if (splitCommand[0] == "ver")
            {
                if (splitCommand.Length > 1)
                {
                    CecVersion version = Lib.GetDeviceCecVersion((CecLogicalAddress)byte.Parse(splitCommand[1], System.Globalization.NumberStyles.HexNumber));
                    return("CEC version: " + Lib.ToString(version));
                }
            }
            else if (splitCommand[0] == "pow")
            {
                if (splitCommand.Length > 1)
                {
                    CecPowerStatus power = Lib.GetDevicePowerStatus((CecLogicalAddress)byte.Parse(splitCommand[1], System.Globalization.NumberStyles.HexNumber));
                    return("power status: " + Lib.ToString(power));
                }
            }
            else if (splitCommand[0] == "r")
            {
                Console.WriteLine("closing the connection");
                Lib.Close();

                Console.WriteLine("opening a new connection");
                Connect(10000);

                Console.WriteLine("setting active source");
                Lib.SetActiveSource(CecDeviceType.AudioSystem);
            }
            else if (splitCommand[0] == "setActiveSource")
            {
                if (splitCommand.Length > 1)
                {
                    if (splitCommand[1] == "AudioSystem")
                    {
                        Lib.SetActiveSource(CecDeviceType.AudioSystem);
                        return("setting active source to audio system");
                    }
                    if (splitCommand[1] == "PlaybackDevice")
                    {
                        Lib.SetActiveSource(CecDeviceType.PlaybackDevice);
                        return("setting active source to playback device");
                    }
                    if (splitCommand[1] == "RecordingDevice")
                    {
                        Lib.SetActiveSource(CecDeviceType.RecordingDevice);
                        return("setting active source to Recording device");
                    }
                    if (splitCommand[1] == "Reserved")
                    {
                        Lib.SetActiveSource(CecDeviceType.Reserved);
                        return("setting active source to Reserved device");
                    }
                    if (splitCommand[1] == "Tuner")
                    {
                        Lib.SetActiveSource(CecDeviceType.Tuner);
                        return("setting active source to Tuner");
                    }
                    if (splitCommand[1] == "Tv")
                    {
                        Lib.SetActiveSource(CecDeviceType.Tv);
                        return("setting active source to Tv");
                    }
                }
                return("incorrect use of setActiveSource");
            }
            else if (splitCommand[0] == "scan")
            {
                StringBuilder output = new StringBuilder();
                output.AppendLine("CEC bus information");
                output.AppendLine("===================");
                CecLogicalAddresses addresses = Lib.GetActiveDevices();
                for (int iPtr = 0; iPtr < addresses.Addresses.Length; iPtr++)
                {
                    CecLogicalAddress address = (CecLogicalAddress)iPtr;
                    if (!addresses.IsSet(address))
                    {
                        continue;
                    }

                    CecVendorId    iVendorId        = Lib.GetDeviceVendorId(address);
                    bool           bActive          = Lib.IsActiveDevice(address);
                    ushort         iPhysicalAddress = Lib.GetDevicePhysicalAddress(address);
                    string         strAddr          = Lib.PhysicalAddressToString(iPhysicalAddress);
                    CecVersion     iCecVersion      = Lib.GetDeviceCecVersion(address);
                    CecPowerStatus power            = Lib.GetDevicePowerStatus(address);
                    string         osdName          = Lib.GetDeviceOSDName(address);
                    string         lang             = Lib.GetDeviceMenuLanguage(address);


                    output.AppendLine("device #" + iPtr + ": " + Lib.ToString(address));
                    output.AppendLine("address:       " + strAddr);
                    output.AppendLine("active source: " + (bActive ? "yes" : "no"));
                    output.AppendLine("vendor:        " + Lib.ToString(iVendorId));
                    output.AppendLine("osd string:    " + osdName);
                    output.AppendLine("CEC version:   " + Lib.ToString(iCecVersion));
                    output.AppendLine("power status:  " + Lib.ToString(power));
                    if (!string.IsNullOrEmpty(lang))
                    {
                        output.AppendLine("language:      " + lang);
                    }
                    output.AppendLine("");
                }
                return(output.ToString());
            }
            return("CEC command not understood");
        }