mirror of
https://github.com/openharmony/distributedhardware_distributed_input.git
synced 2026-07-21 05:45:23 -04:00
Description: modify just stop one dhid, all dhid stoped
Match-id-6a64fb681bf999b88ac9af4daaf9142e5cd7ac24
This commit is contained in:
@@ -1032,7 +1032,7 @@ void InputHub::GetDevicesInfoByDhId(std::vector<std::string> dhidsVec, std::map<
|
||||
}
|
||||
}
|
||||
|
||||
bool InputHub::GetAllDevicesStoped()
|
||||
bool InputHub::IsAllDevicesStoped()
|
||||
{
|
||||
std::unique_lock<std::mutex> deviceLock(devicesMutex_);
|
||||
for (const auto &[id, device] : devices_) {
|
||||
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
void GetDevicesInfoByType(int32_t inputTypes, std::map<int32_t, std::string> &datas);
|
||||
void GetDevicesInfoByDhId(std::vector<std::string> dhidsVec, std::map<int32_t, std::string> &datas);
|
||||
void GetShareMousePathByDhId(std::vector<std::string> dhIds, std::string &path, std::string &dhId);
|
||||
bool GetAllDevicesStoped();
|
||||
bool IsAllDevicesStoped();
|
||||
void ScanInputDevices(const std::string& dirname);
|
||||
|
||||
private:
|
||||
|
||||
@@ -40,7 +40,8 @@ public:
|
||||
void SetSharingTypes(const uint32_t &inputType);
|
||||
void SetSharingDhIds(bool enabled, std::vector<std::string> dhIds);
|
||||
void GetMouseNodePath(std::vector<std::string> dhIds, std::string &mouseNodePath, std::string &dhid);
|
||||
bool GetAllDevicesStoped();
|
||||
// false for sharing device exist, true for all devices stop sharing
|
||||
bool IsAllDevicesStoped();
|
||||
|
||||
private:
|
||||
DistributedInputCollector();
|
||||
|
||||
@@ -172,9 +172,9 @@ void DistributedInputCollector::GetMouseNodePath(
|
||||
inputHub_->GetShareMousePathByDhId(dhIds, mouseNodePath, dhid);
|
||||
}
|
||||
|
||||
bool DistributedInputCollector::GetAllDevicesStoped()
|
||||
bool DistributedInputCollector::IsAllDevicesStoped()
|
||||
{
|
||||
return inputHub_->GetAllDevicesStoped();
|
||||
return inputHub_->IsAllDevicesStoped();
|
||||
}
|
||||
} // namespace DistributedInput
|
||||
} // namespace DistributedHardware
|
||||
|
||||
@@ -171,8 +171,8 @@ void DistributedInputSinkManager::DInputSinkListener::onStartRemoteInput(
|
||||
void DistributedInputSinkManager::DInputSinkListener::onStopRemoteInput(
|
||||
const int32_t& sessionId, const uint32_t& inputTypes)
|
||||
{
|
||||
DHLOGI("onStopRemoteInput called, sessionId: %s, inputTypes: %d",
|
||||
GetAnonyInt32(sessionId).c_str(), inputTypes);
|
||||
DHLOGI("onStopRemoteInput called, sessionId: %s, inputTypes: %d, curInputTypes: %d",
|
||||
GetAnonyInt32(sessionId).c_str(), inputTypes, sinkManagerObj_->GetInputTypes());
|
||||
|
||||
sinkManagerObj_->SetInputTypes(sinkManagerObj_->GetInputTypes() -
|
||||
(sinkManagerObj_->GetInputTypes() & inputTypes));
|
||||
@@ -185,7 +185,7 @@ void DistributedInputSinkManager::DInputSinkListener::onStopRemoteInput(
|
||||
std::string smsg = jsonStr.dump();
|
||||
DistributedInputSinkTransport::GetInstance().RespStopRemoteInput(sessionId, smsg);
|
||||
|
||||
bool isAllClosed = DistributedInputCollector::GetInstance().GetAllDevicesStoped();
|
||||
bool isAllClosed = DistributedInputCollector::GetInstance().IsAllDevicesStoped();
|
||||
if (isAllClosed) {
|
||||
DistributedInputSinkSwitch::GetInstance().StopAllSwitch();
|
||||
if (DistributedInputSinkSwitch::GetInstance().GetSwitchOpenedSession() ==
|
||||
@@ -250,8 +250,11 @@ void DistributedInputSinkManager::DInputSinkListener::onStopRemoteInputDhid(cons
|
||||
StringSplitToSet(strDhids, INPUT_STRING_SPLIT_POINT, setStr);
|
||||
sinkManagerObj_->DeleteStopDhids(sessionId, setStr, stopStr);
|
||||
DistributedInputCollector::GetInstance().SetSharingDhIds(false, stopStr);
|
||||
DHLOGE("onStopRemoteInputDhid called, sessionId: %d is closed.", sessionId);
|
||||
DistributedInputSinkSwitch::GetInstance().StopSwitch(sessionId);
|
||||
|
||||
if (DistributedInputCollector::GetInstance().IsAllDevicesStoped()) {
|
||||
DHLOGE("onStopRemoteInputDhid called, all dhid stop sharing, sessionId: %d is closed.", sessionId);
|
||||
DistributedInputSinkSwitch::GetInstance().StopSwitch(sessionId);
|
||||
}
|
||||
|
||||
nlohmann::json jsonStr;
|
||||
jsonStr[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SINK_MSG_DHID_ONSTOP;
|
||||
@@ -260,7 +263,7 @@ void DistributedInputSinkManager::DInputSinkListener::onStopRemoteInputDhid(cons
|
||||
std::string smsg = jsonStr.dump();
|
||||
DistributedInputSinkTransport::GetInstance().RespStopRemoteInput(sessionId, smsg);
|
||||
|
||||
bool isAllClosed = DistributedInputCollector::GetInstance().GetAllDevicesStoped();
|
||||
bool isAllClosed = DistributedInputCollector::GetInstance().IsAllDevicesStoped();
|
||||
if (isAllClosed) {
|
||||
DistributedInputSinkSwitch::GetInstance().StopAllSwitch();
|
||||
sinkManagerObj_->SetInputTypes(static_cast<uint32_t>(DInputDeviceType::NONE));
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
#include "distributed_input_inject.h"
|
||||
#include "distributed_input_source_proxy.h"
|
||||
#include "distributed_input_source_transport.h"
|
||||
#include "dinput_utils_tool.h"
|
||||
#include "hisysevent_util.h"
|
||||
#include "hidumper.h"
|
||||
#include "ipublisher_listener.h"
|
||||
|
||||
@@ -137,7 +137,7 @@ std::string GetNodeDesc(std::string parameters)
|
||||
nodeName = parObj.at("name").get<std::string>();
|
||||
classes = parObj.at("classes").get<int32_t>();
|
||||
}
|
||||
return "{ NodeName: " + nodeName + ", classes: " + std::to_string(classes) + " }";
|
||||
return "{ nodeName: " + nodeName + ", classes: " + std::to_string(classes) + " }";
|
||||
}
|
||||
} // namespace DistributedInput
|
||||
} // namespace DistributedHardware
|
||||
|
||||
Reference in New Issue
Block a user