htc: implement mux side of connecting (and more)

This commit is contained in:
Michael Scire
2021-02-09 19:07:51 -08:00
committed by SciresM
parent 70aae4e27a
commit 42cf3f50d7
24 changed files with 474 additions and 12 deletions

View File

@@ -57,6 +57,13 @@ namespace ams::htclow::ctrl {
return ResultSuccess();
}
bool HtcctrlStateMachine::IsInformationNeeded() {
/* Lock ourselves. */
std::scoped_lock lk(m_mutex);
return !ctrl::IsDisconnected(m_state) && m_state != HtcctrlState_DriverConnected;
}
bool HtcctrlStateMachine::IsConnected() {
/* Lock ourselves. */
std::scoped_lock lk(m_mutex);
@@ -149,6 +156,16 @@ namespace ams::htclow::ctrl {
return ctrl::IsConnected(m_state) && (it == m_map.end() || it->second.connect != ServiceChannelConnect_ConnectingChecked);
}
void HtcctrlStateMachine::SetConnecting(const impl::ChannelInternalType &channel) {
/* Lock ourselves. */
std::scoped_lock lk(m_mutex);
auto it = m_map.find(channel);
if (it != m_map.end() && it->second.connect != ServiceChannelConnect_ConnectingChecked) {
it->second.connect = ServiceChannelConnect_Connecting;
}
}
void HtcctrlStateMachine::SetNotConnecting(const impl::ChannelInternalType &channel) {
/* Lock ourselves. */
std::scoped_lock lk(m_mutex);