mirror of
https://github.com/openharmony/distributedhardware_distributed_input.git
synced 2026-07-19 17:43:35 -04:00
@@ -55,7 +55,6 @@ private:
|
||||
void CheckKeyboardState(std::string &dhid, std::string &keyboardNodePath,
|
||||
std::vector<uint32_t> &keyboardPressedKeys, int &fd);
|
||||
void SpecEventInject(const int32_t &sessionId, std::vector<std::string> dhids);
|
||||
bool IsDhidExist(const std::string &dhid);
|
||||
void RecordEventLog(const input_event &event);
|
||||
void WriteEventToDev(int &fd, const input_event &event);
|
||||
void CheckMouseKeyState(const int32_t &sessionId, const std::string &mouseNodePath,
|
||||
|
||||
@@ -58,11 +58,7 @@ int32_t DInputState::RecordDhids(const std::vector<std::string> &dhids, DhidStat
|
||||
std::unique_lock<std::mutex> mapLock(operationMutex_);
|
||||
for (auto &dhid : dhids) {
|
||||
DHLOGD("add dhid : %s, state : %d.", GetAnonyString(dhid).c_str(), state);
|
||||
if (IsDhidExist(dhid)) {
|
||||
DHLOGI("dhid : %s already exist.", GetAnonyString(dhid).c_str());
|
||||
} else {
|
||||
dhidStateMap_[dhid] = state;
|
||||
}
|
||||
dhidStateMap_[dhid] = state;
|
||||
}
|
||||
|
||||
if (state == DhidState::THROUGH_OUT) {
|
||||
@@ -77,32 +73,21 @@ int32_t DInputState::RemoveDhids(const std::vector<std::string> &dhids)
|
||||
std::unique_lock<std::mutex> mapLock(operationMutex_);
|
||||
for (auto &dhid : dhids) {
|
||||
DHLOGD("delete dhid : %s", GetAnonyString(dhid).c_str());
|
||||
if (!IsDhidExist(dhid)) {
|
||||
DHLOGE("dhid : %s not exist.", GetAnonyString(dhid).c_str());
|
||||
} else {
|
||||
dhidStateMap_.erase(dhid);
|
||||
}
|
||||
dhidStateMap_.erase(dhid);
|
||||
}
|
||||
return DH_SUCCESS;
|
||||
}
|
||||
|
||||
DhidState DInputState::GetStateByDhid(std::string &dhid)
|
||||
{
|
||||
if (!IsDhidExist(dhid)) {
|
||||
std::unique_lock<std::mutex> mapLock(operationMutex_);
|
||||
if (dhidStateMap_.find(dhid) == dhidStateMap_.end()) {
|
||||
DHLOGE("dhid : %s not exist.", GetAnonyString(dhid).c_str());
|
||||
return DhidState::THROUGH_IN;
|
||||
}
|
||||
return dhidStateMap_[dhid];
|
||||
}
|
||||
|
||||
bool DInputState::IsDhidExist(const std::string &dhid)
|
||||
{
|
||||
if (dhidStateMap_.find(dhid) == dhidStateMap_.end()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void DInputState::CreateSpecialEventInjectThread(const int32_t &sessionId, const std::vector<std::string> &dhids)
|
||||
{
|
||||
DHLOGI("CreateSpecialEventInjectThread enter, dhids.size = %d, sessionId = %d.", dhids.size(), sessionId);
|
||||
|
||||
Reference in New Issue
Block a user