/// <summary> /// /// </summary> /// <param name="aDeviceName"></param> /// <param name="aHdmiPort"></param> public Client(string aDeviceName, byte aHdmiPort, CecDeviceType aDeviceType = CecDeviceType.PlaybackDevice) { Config = new LibCECConfiguration(); Config.DeviceTypes.Types[0] = aDeviceType; Config.DeviceName = aDeviceName; Config.HDMIPort = aHdmiPort; //Config.ClientVersion = LibCECConfiguration.CurrentVersion; Config.SetCallbacks(this); iLib = new LibCecSharp(Config); iLib.InitVideoStandalone(); if (Static != null) { Trace.WriteLine("WARNING: CEC client static already exists"); } else { Static = this; } //Trace.WriteLine("CEC Parser created - libCEC version " + Lib.VersionToString(Config.ServerVersion)); Trace.WriteLine("INFO: CEC Parser created - libCEC version " + Config.ServerVersion); }
public CecSharpClient() { Config = new LibCECConfiguration(); Config.DeviceTypes.Types[0] = CecDeviceType.RecordingDevice; Config.DeviceName = "Pulse Eight USB CEC Adapter"; Config.ClientVersion = LibCECConfiguration.CurrentVersion; Config.SetCallbacks(this); LogLevel = (int)CecLogLevel.All; Lib = new LibCecSharp(Config); Lib.InitVideoStandalone(); }
public CECClient() { Config = new LibCECConfiguration(); Config.DeviceTypes.Types[0] = CecDeviceType.RecordingDevice; Config.DeviceName = "Cenero Conferencing System"; Config.ClientVersion = LibCECConfiguration.CurrentVersion; Config.SetCallbacks(this); LogLevel = (int)CecLogLevel.All; Lib = new LibCecSharp(Config); Lib.InitVideoStandalone(); }
/// <summary> /// Constructor /// </summary> public CecClient() { CecConfig = new LibCECConfiguration(); CecConfig.DeviceTypes.Types[0] = CecDeviceType.RecordingDevice; CecConfig.DeviceName = "Avid TV Switch"; CecConfig.ClientVersion = LibCECConfiguration.CurrentVersion; CecConfig.ActivateSource = false; CecConfig.SetCallbacks(this); CecLib = new LibCecSharp(CecConfig); CecLib.InitVideoStandalone(); }
public CecSharpClient() { Config = new LibCECConfiguration(); Config.DeviceTypes.Types[0] = CecDeviceType.RecordingDevice; Config.DeviceName = "CEC Tester"; Config.ClientVersion = CecClientVersion.Version1_5_0; Config.SetCallbacks(this); LogLevel = (int)CecLogLevel.All; Lib = new LibCecSharp(Config); Console.WriteLine("CEC Parser created - libcec version " + Lib.ToString(Config.ServerVersion)); }
public CecConfigGUI() { Config = new LibCECConfiguration(); Config.DeviceTypes.Types[0] = CecDeviceType.RecordingDevice; Config.DeviceName = "CEC Config"; Config.GetSettingsFromROM = true; Config.ClientVersion = CecClientVersion.Version1_5_1; Callbacks = new CecCallbackWrapper(this); Config.SetCallbacks(Callbacks); LoadXMLConfiguration(ref Config); Lib = new LibCecSharp(Config); InitializeComponent(); LoadButtonConfiguration(); ActiveProcess = new ConnectToDevice(ref Lib, Config); ActiveProcess.EventHandler += ProcessEventHandler; (new Thread(ActiveProcess.Run)).Start(); }
/// <summary> /// Initialize the Cec bus without callback methods (no need) /// </summary> /// <param name="timeout">Timeout for the connections to the bus. Must be positive</param> /// <exception cref="CecException">Unable to initialize Cec Bus or can't find controller</exception> /// <exception cref="ArgumentOutOfRangeException">timeout not strictly positive</exception> public CecBus(int timeout) { if (timeout <= 0) { throw new ArgumentOutOfRangeException(nameof(timeout)); } this.timeout = timeout; configuration = new LibCECConfiguration(); configuration.DeviceTypes.Types[0] = CecDeviceType.PlaybackDevice; configuration.DeviceName = Resources.StrCecDeviceName; configuration.ClientVersion = LibCECConfiguration.CurrentVersion; configuration.SetCallbacks(this); connection = new LibCecSharp(configuration) ?? throw new CecException(Resources.ErrorNoCecBus); connection.InitVideoStandalone(); // Get the controller on the bus controller = null; CecAdapter[] adapters = connection.FindAdapters(string.Empty); if (adapters.Length > 0) { controller = adapters[controllerId]; } else { throw new CecException(Resources.ErrorNoCecController); } // Connection must be openned before going to suspend mode as the SCM stop the thread if we try to open // the connection during power event because it's an async operation if (!connection.Open(controller.ComPort, timeout)) { throw new CecException(Resources.ErrorNoCecControllerConnection); } // Register active source of the connection connection.SetActiveSource(CecDeviceType.PlaybackDevice); }
public LibCECClient() { var config = new LibCECConfiguration(); config.DeviceTypes.Types[0] = CecDeviceType.PlaybackDevice; config.DeviceName = "MP-S"; config.ClientVersion = LibCECConfiguration.CurrentVersion; config.SetCallbacks(this); //config.PhysicalAddress = 1000; config.HDMIPort = 1; config.AdapterType = CecAdapterType.PulseEightExternal; config.TvVendor = CecVendorId.Philips; config.ActivateSource = false; _logLevel = (int)CecLogLevel.All; Lib = new LibCecSharp(config); Lib.InitVideoStandalone(); Log("LibCECClient: Successfully created LibCEC Parser with version: " + Lib.VersionToString(config.ServerVersion)); }
public virtual void LoadConfig() { WriteLog("Loading configuration..."); if (_cecConfig == null) { WriteLog("Configuration not set, abort"); return; } _fastScrolling = _cecConfig.FastScrolling; _fastScrollingKeyCount = _cecConfig.FastScrollingRepeatDelay; _repeatTimer = new System.Timers.Timer(_cecConfig.FastScrollingRepeatRate); _extensiveLogging = _cecConfig.ExtensiveLogging; _disableScreensaver = _cecConfig.DisableScreensaver; _requireDelayBetweenKeys = _cecConfig.RequireDelayBetweenKeys; if (_fastScrolling) { _repeatTimer.Elapsed += new ElapsedEventHandler(OnRepeatKeyPressEvent); _repeatTimer.AutoReset = true; } // Build configuration for new Lib try { if (_libConfig == null) { _libConfig = new LibCECConfiguration(); _libConfig.SetCallbacks(this); } _libConfig.DeviceTypes.Types[0] = _cecConfig.DeviceType; _libConfig.DeviceName = _cecConfig.OsdName; _libConfig.ClientVersion = LibCECConfiguration.CurrentVersion; _libConfig.WakeDevices.Clear(); _libConfig.PowerOffDevices.Clear(); _libConfig.PhysicalAddress = 0; _libConfig.ActivateSource = false; // Control this manually based on settings. _libConfig.HDMIPort = (byte)_cecConfig.HdmiPort; _libConfig.BaseDevice = _cecConfig.ConnectedTo; if (_cecConfig.ForcePhysicalAddress) { WriteLog("Physical address overriding enabled, ignoring HDMI port an using address: " + _cecConfig.PhysicalAddress); _libConfig.PhysicalAddress = ushort.Parse(_cecConfig.PhysicalAddress, System.Globalization.NumberStyles.AllowHexSpecifier); } WriteLog("Configuration loaded succesfully."); if (_lib == null) { _lib = new LibCecSharp(_libConfig); WriteLog("Lib created succesfully."); } else { _lib.SetConfiguration(_libConfig); _lib.EnableCallbacks(this); WriteLog("Lib configuration updated"); } } catch (Exception ex) { WriteLog("Could not configure libCec." + ex.ToString()); throw; } }
public void Start() { Config = new LibCECConfiguration(); Config.DeviceTypes.Types[0] = CecDeviceType.RecordingDevice; Config.DeviceName = "CEC Tester"; Config.ClientVersion = CecClientVersion.CurrentVersion; Config.SetCallbacks(this); LogLevel = (int)CecLogLevel.All; Lib = new LibCecSharp(Config); Lib.InitVideoStandalone(); CecAdapter[] adapters = Lib.FindAdapters(string.Empty); if (adapters.Length > 0) { Console.WriteLine("Found CEC adapters"); Lib.Open(adapters[0].ComPort, 1000); this.EnsureActive(); } else { Console.WriteLine("Did not find any CEC adapters"); } }