11 #if !defined(HAVE_LIBCEC) 12 #include "Peripheral.h" 25 bool HasAudioControl(
void) {
return false; }
26 void VolumeUp(
void) {}
27 void VolumeDown(
void) {}
28 bool IsMuted(
void) {
return false; }
29 void ToggleMute(
void) {}
30 bool ToggleDeviceState(CecStateChange mode = STATE_SWITCH_TOGGLE,
bool forceType =
false)
35 int GetButton(
void) {
return 0; }
36 unsigned int GetHoldTime(
void) {
return 0; }
37 void ResetButton(
void) {}
43 #include "PeripheralHID.h" 44 #include "XBDateTime.h" 45 #include "interfaces/AnnouncementManager.h" 46 #include "threads/CriticalSection.h" 47 #include "threads/Thread.h" 57 #include <libcec/cectypes.h> 68 class CPeripheralCecAdapterUpdateThread;
74 unsigned int iDuration;
89 friend class CPeripheralCecAdapterUpdateThread;
98 void Announce(ANNOUNCEMENT::AnnouncementFlag flag,
99 const std::string& sender,
100 const std::string& message,
104 bool HasAudioControl(
void);
106 void VolumeDown(
void);
107 void ToggleMute(
void);
116 unsigned int GetHoldTime(
void);
117 void ResetButton(
void);
120 void ActivateSource(
void);
121 void StandbyDevices(
void);
122 bool ToggleDeviceState(CecStateChange mode = STATE_SWITCH_TOGGLE,
bool forceType =
false);
126 void ResetMembers(
void);
127 void Process(
void)
override;
128 bool IsRunning(
void)
const;
130 bool OpenConnection(
void);
131 bool ReopenConnection(
bool bAsync =
false);
133 void SetConfigurationFromSettings(
void);
134 void SetConfigurationFromLibCEC(
const CEC::libcec_configuration&
config);
135 void SetVersionInfo(
const CEC::libcec_configuration& configuration);
137 static void ReadLogicalAddresses(
const std::string& strString,
138 CEC::cec_logical_addresses& addresses);
139 static void ReadLogicalAddresses(
int iLocalisedId, CEC::cec_logical_addresses& addresses);
140 bool WriteLogicalAddresses(
const CEC::cec_logical_addresses& addresses,
141 const std::string& strSettingName,
142 const std::string& strAdvancedSettingName);
144 void ProcessActivateSource(
void);
145 void ProcessStandbyDevices(
void);
146 void ProcessVolumeChange(
void);
148 void PushCecKeypress(
const CEC::cec_keypress& key);
149 void PushCecKeypress(
const CecButtonPress& key);
150 void GetNextKey(
void);
152 void SetAudioSystemConnected(
bool bSetTo);
153 void SetMenuLanguage(
const char* strLanguage);
154 void OnTvStandby(
void);
157 static void CecLogMessage(
void* cbParam,
const CEC::cec_log_message* message);
158 static void CecCommand(
void* cbParam,
const CEC::cec_command* command);
159 static void CecConfiguration(
void* cbParam,
const CEC::libcec_configuration* config);
160 static void CecAlert(
void* cbParam,
161 const CEC::libcec_alert alert,
162 const CEC::libcec_parameter data);
163 static void CecSourceActivated(
void* param,
164 const CEC::cec_logical_address address,
165 const uint8_t activated);
166 static void CecKeyPress(
void* cbParam,
const CEC::cec_keypress* key);
168 CEC::ICECAdapter* m_cecAdapter;
172 bool m_bHasConnectedAudioSystem;
173 std::string m_strMenuLanguage;
175 std::vector<CecButtonPress> m_buttonQueue;
176 CecButtonPress m_currentButton;
177 std::queue<CecVolumeChange> m_volumeChangeQueue;
178 std::chrono::time_point<std::chrono::steady_clock> m_lastKeypress;
179 CecVolumeChange m_lastChange;
182 bool m_bGoingToStandby;
184 bool m_bDeviceRemoved;
185 CPeripheralCecAdapterUpdateThread* m_queryThread;
186 CEC::ICECCallbacks m_callbacks;
187 mutable CCriticalSection m_critSection;
188 CEC::libcec_configuration m_configuration;
189 bool m_bActiveSourcePending;
190 bool m_bStandbyPending;
192 bool m_bActiveSourceBeforeStandby;
193 bool m_bOnPlayReceived;
194 bool m_bPlaybackPaused;
195 std::string m_strComPort;
196 bool m_bPowerOnScreensaver;
197 bool m_bUseTVMenuLanguage;
198 bool m_bSendInactiveSource;
199 bool m_bPowerOffScreensaver;
200 bool m_bShutdownOnStandby;
203 class CPeripheralCecAdapterUpdateThread :
public CThread 207 CEC::libcec_configuration* configuration);
208 ~CPeripheralCecAdapterUpdateThread(
void)
override;
211 bool UpdateConfiguration(CEC::libcec_configuration* configuration);
214 void UpdateMenuLanguage(
void);
215 std::string UpdateAudioSystemStatus(
void);
216 bool WaitReady(
void);
217 bool SetInitialConfiguration(
void);
218 void Process(
void)
override;
222 CCriticalSection m_critSection;
223 CEC::libcec_configuration m_configuration;
224 CEC::libcec_configuration m_nextConfiguration;
225 bool m_bNextConfigurationScheduled =
false;
226 bool m_bIsUpdating =
true;
This is an Event class built from a ConditionVariable.
Definition: Event.h:35
Definition: PeripheralCecAdapter.h:22
Definition: deflate.c:123
Definition: PeripheralTypes.h:326
Definition: PeripheralCecAdapter.cpp:1745
Definition: RetroPlayerInput.h:15
Definition: IAnnouncer.h:70
Definition: PeripheralHID.h:19
Definition: PeripheralBusCEC.h:19
virtual bool InitialiseFeature(const PeripheralFeature feature)
Initialise one of the features of this peripheral.
Definition: Peripheral.h:129
DateTime class, which uses FileTime as it's base.
Definition: XBDateTime.h:63
Definition: PeripheralBus.h:36
virtual void OnSettingChanged(const std::string &strChangedSetting)
Called when a setting changed.
Definition: Peripheral.h:147
Definition: Peripheral.h:71
Definition: Peripherals.h:56
virtual void OnDeviceRemoved(void)
Called when this device is removed, before calling the destructor.
Definition: Peripheral.h:152