/// <summary> /// Switch power state of the given device to the requested power state /// </summary> /// <param name="device"></param> /// <param name="requestedPowerState"></param> /// <returns cref="PowerState">New PowerSate. Power state is unknown if the switch fails</returns> /// <exception cref="CecException">Can't connect to CecBus</exception> public PowerState SwitchDevicePowerState(CecLogicalAddress device, PowerState requestedPowerState) { PowerState state = PowerState.PowerUnknown; switch (requestedPowerState) { case PowerState.PowerOff: if (IsDeviceReady(device) && connection.StandbyDevices(device)) { state = PowerState.PowerOff; } break; case PowerState.PowerOn: // Close and reopen the connection as we lose it when we go to sleep connection.Close(); if (!connection.Open(controller.ComPort, timeout)) { throw new CecException(Resources.ErrorNoCecControllerConnection); } // Register active source of the connection connection.SetActiveSource(CecDeviceType.PlaybackDevice); if (IsDeviceReady(device) && connection.PowerOnDevices(device)) { state = PowerState.PowerOn; } break; default: break; } return(state); }
public virtual void DeInit() { if (_lib != null) { _lib.DisableCallbacks(); _lib.Close(); _lib.Dispose(); } _connected = false; _lib = null; _libConfig = null; _cecConfig = null; _repeatTimer = null; }
public void Close() { Lib.Close(); }
/// <summary> /// Close the connection to the CEC devices /// </summary> public void Close() { CecLib.Close(); }
public void Close() { iLib.Close(); iConnected = false; }
public void Close() { lib.Close(); }