mirror of
https://github.com/openharmony/distributedhardware_distributed_input.git
synced 2026-07-19 17:43:35 -04:00
@@ -53,7 +53,6 @@ private:
|
||||
DistributedInputHandler();
|
||||
~DistributedInputHandler();
|
||||
void StructTransJson(const InputDevice &pBuf, std::string &strDescriptor);
|
||||
int32_t GetDeviceInfo(std::string &deviceId);
|
||||
std::shared_ptr<PluginListener> m_listener;
|
||||
bool InitCollectEventsThread();
|
||||
void NotifyHardWare(int iCnt);
|
||||
@@ -62,7 +61,7 @@ private:
|
||||
bool isCollectingEvents_;
|
||||
bool isStartCollectEventThread;
|
||||
static void *CollectEventsThread(void *param);
|
||||
void StartInputMonitorDeviceThread(const std::string deviceId);
|
||||
void StartInputMonitorDeviceThread();
|
||||
void StopInputMonitorDeviceThread();
|
||||
|
||||
// The event queue.
|
||||
|
||||
@@ -149,21 +149,6 @@ void DistributedInputHandler::UnRegisterPluginListener()
|
||||
this->m_listener = nullptr;
|
||||
}
|
||||
|
||||
int32_t DistributedInputHandler::GetDeviceInfo(std::string &deviceId)
|
||||
{
|
||||
std::unique_lock<std::mutex> my_lock(operationMutex_);
|
||||
auto localNode = std::make_unique<NodeBasicInfo>();
|
||||
int32_t retCode = GetLocalNodeDeviceInfo("ohos.dhardware", localNode.get());
|
||||
if (retCode != 0) {
|
||||
DHLOGE("Could not get device id.");
|
||||
return ERR_DH_INPUT_HANDLER_GET_DEVICE_ID_FAIL;
|
||||
}
|
||||
|
||||
deviceId = localNode->networkId;
|
||||
DHLOGI("device id is %s", GetAnonyString(deviceId).c_str());
|
||||
return DH_SUCCESS;
|
||||
}
|
||||
|
||||
bool DistributedInputHandler::InitCollectEventsThread()
|
||||
{
|
||||
pthread_attr_t attr;
|
||||
@@ -190,15 +175,12 @@ void *DistributedInputHandler::CollectEventsThread(void *param)
|
||||
DHLOGE("CollectEventsThread setname failed.");
|
||||
}
|
||||
DistributedInputHandler *pThis = reinterpret_cast<DistributedInputHandler *>(param);
|
||||
|
||||
std::string deviceId;
|
||||
pThis->GetDeviceInfo(deviceId);
|
||||
pThis->StartInputMonitorDeviceThread(deviceId);
|
||||
pThis->StartInputMonitorDeviceThread();
|
||||
DHLOGI("DistributedInputHandler::CollectEventsThread exist!");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void DistributedInputHandler::StartInputMonitorDeviceThread(const std::string deviceId)
|
||||
void DistributedInputHandler::StartInputMonitorDeviceThread()
|
||||
{
|
||||
if (inputHub_ == nullptr) {
|
||||
DHLOGE("inputHub_ not initialized");
|
||||
|
||||
Reference in New Issue
Block a user