11 #if !defined(HAVE_LIBCEC) 12 #include "Peripheral.h" 21 bool HasAudioControl(
void) {
return false; }
22 void VolumeUp(
void) {}
23 void VolumeDown(
void) {}
24 bool IsMuted(
void) {
return false; }
25 void ToggleMute(
void) {}
26 bool ToggleDeviceState(CecStateChange mode = STATE_SWITCH_TOGGLE,
bool forceType =
false)
31 int GetButton(
void) {
return 0; }
32 unsigned int GetHoldTime(
void) {
return 0; }
33 void ResetButton(
void) {}
39 #include "PeripheralHID.h" 40 #include "XBDateTime.h" 41 #include "interfaces/AnnouncementManager.h" 42 #include "threads/CriticalSection.h" 43 #include "threads/Thread.h" 53 #include <libcec/cectypes.h> 64 class CPeripheralCecAdapterUpdateThread;
70 unsigned int iDuration;
85 friend class CPeripheralCecAdapterUpdateThread;
94 void Announce(ANNOUNCEMENT::AnnouncementFlag flag,
95 const std::string& sender,
96 const std::string& message,
100 bool HasAudioControl(
void);
102 void VolumeDown(
void);
103 void ToggleMute(
void);
112 unsigned int GetHoldTime(
void);
113 void ResetButton(
void);
116 void ActivateSource(
void);
117 void StandbyDevices(
void);
118 bool ToggleDeviceState(CecStateChange mode = STATE_SWITCH_TOGGLE,
bool forceType =
false);
122 void ResetMembers(
void);
123 void Process(
void)
override;
124 bool IsRunning(
void)
const;
126 bool OpenConnection(
void);
127 bool ReopenConnection(
bool bAsync =
false);
129 void SetConfigurationFromSettings(
void);
130 void SetConfigurationFromLibCEC(
const CEC::libcec_configuration&
config);
131 void SetVersionInfo(
const CEC::libcec_configuration& configuration);
133 static void ReadLogicalAddresses(
const std::string& strString,
134 CEC::cec_logical_addresses& addresses);
135 static void ReadLogicalAddresses(
int iLocalisedId, CEC::cec_logical_addresses& addresses);
136 bool WriteLogicalAddresses(
const CEC::cec_logical_addresses& addresses,
137 const std::string& strSettingName,
138 const std::string& strAdvancedSettingName);
140 void ProcessActivateSource(
void);
141 void ProcessStandbyDevices(
void);
142 void ProcessVolumeChange(
void);
144 void PushCecKeypress(
const CEC::cec_keypress& key);
145 void PushCecKeypress(
const CecButtonPress& key);
146 void GetNextKey(
void);
148 void SetAudioSystemConnected(
bool bSetTo);
149 void SetMenuLanguage(
const char* strLanguage);
150 void OnTvStandby(
void);
153 static void CecLogMessage(
void* cbParam,
const CEC::cec_log_message* message);
154 static void CecCommand(
void* cbParam,
const CEC::cec_command* command);
155 static void CecConfiguration(
void* cbParam,
const CEC::libcec_configuration* config);
156 static void CecAlert(
void* cbParam,
157 const CEC::libcec_alert alert,
158 const CEC::libcec_parameter data);
159 static void CecSourceActivated(
void* param,
160 const CEC::cec_logical_address address,
161 const uint8_t activated);
162 static void CecKeyPress(
void* cbParam,
const CEC::cec_keypress* key);
164 CEC::ICECAdapter* m_cecAdapter;
168 bool m_bHasConnectedAudioSystem;
169 std::string m_strMenuLanguage;
171 std::vector<CecButtonPress> m_buttonQueue;
172 CecButtonPress m_currentButton;
173 std::queue<CecVolumeChange> m_volumeChangeQueue;
174 std::chrono::time_point<std::chrono::steady_clock> m_lastKeypress;
175 CecVolumeChange m_lastChange;
178 bool m_bGoingToStandby;
180 bool m_bDeviceRemoved;
181 CPeripheralCecAdapterUpdateThread* m_queryThread;
182 CEC::ICECCallbacks m_callbacks;
183 mutable CCriticalSection m_critSection;
184 CEC::libcec_configuration m_configuration;
185 bool m_bActiveSourcePending;
186 bool m_bStandbyPending;
188 bool m_bActiveSourceBeforeStandby;
189 bool m_bOnPlayReceived;
190 bool m_bPlaybackPaused;
191 std::string m_strComPort;
192 bool m_bPowerOnScreensaver;
193 bool m_bUseTVMenuLanguage;
194 bool m_bSendInactiveSource;
195 bool m_bPowerOffScreensaver;
196 bool m_bShutdownOnStandby;
199 class CPeripheralCecAdapterUpdateThread :
public CThread 203 CEC::libcec_configuration* configuration);
204 ~CPeripheralCecAdapterUpdateThread(
void)
override;
207 bool UpdateConfiguration(CEC::libcec_configuration* configuration);
210 void UpdateMenuLanguage(
void);
211 std::string UpdateAudioSystemStatus(
void);
212 bool WaitReady(
void);
213 bool SetInitialConfiguration(
void);
214 void Process(
void)
override;
218 CCriticalSection m_critSection;
219 CEC::libcec_configuration m_configuration;
220 CEC::libcec_configuration m_nextConfiguration;
221 bool m_bNextConfigurationScheduled;
This is an Event class built from a ConditionVariable.
Definition: Event.h:35
Definition: PeripheralCecAdapter.h:18
Definition: deflate.c:123
Definition: PeripheralTypes.h:318
Definition: PeripheralCecAdapter.cpp:1749
Definition: RetroPlayerInput.h:15
Definition: IAnnouncer.h:70
Definition: PeripheralHID.h:16
Definition: PeripheralBusCEC.h:19
virtual bool InitialiseFeature(const PeripheralFeature feature)
Initialise one of the features of this peripheral.
Definition: Peripheral.h:120
DateTime class, which uses FileTime as it's base.
Definition: XBDateTime.h:63
Definition: PeripheralBus.h:34
virtual void OnSettingChanged(const std::string &strChangedSetting)
Called when a setting changed.
Definition: Peripheral.h:138
Definition: Peripheral.h:62
Definition: Peripherals.h:49
virtual void OnDeviceRemoved(void)
Called when this device is removed, before calling the destructor.
Definition: Peripheral.h:143