From 44b8c54a7cea061225fd5263bc06642052416e46 Mon Sep 17 00:00:00 2001 From: renguang1116 Date: Mon, 7 Mar 2022 14:18:19 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E4=B8=8A=E6=8A=A5=E5=A4=9A=E4=B8=AA=E8=AE=BE=E5=A4=87=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20Signed-off-by:=20renguang1116=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kits/js/include/native_devicemanager_js.h | 31 ++++ .../kits/js/src/native_devicemanager_js.cpp | 143 ++++++++++-------- 2 files changed, 110 insertions(+), 64 deletions(-) diff --git a/interfaces/kits/js/include/native_devicemanager_js.h b/interfaces/kits/js/include/native_devicemanager_js.h index f3a0f1a53..88d3fe8f4 100644 --- a/interfaces/kits/js/include/native_devicemanager_js.h +++ b/interfaces/kits/js/include/native_devicemanager_js.h @@ -80,6 +80,37 @@ struct AuthAsyncCallbackInfo { int32_t authType = -1; }; +struct DmNapiStateJsCallback { + std::string bundleName_; + uint16_t subscribeId_; + int32_t reason_; + OHOS::DistributedHardware::DmDeviceInfo deviceInfo_; + + DmNapiStateJsCallback(std::string bundleName, uint16_t subscribeId, int32_t reason, OHOS::DistributedHardware::DmDeviceInfo deviceInfo) + : bundleName_(bundleName), subscribeId_(subscribeId), reason_(reason), deviceInfo_(deviceInfo) {} +} + +struct DmNapiAuthJsCallback { + std::string bundleName_; + std::string deviceId_; + std::string token_; + int32_t status_; + int32_t reason_; + + DmNapiAuthJsCallback(std::string bundleName, std::string deviceId, std::string token, int32_t status, int32_t reason) + : bundleName_(bundleName), deviceId_(deviceId), token_(token), status_(status), reason_(reason) {} +} + +struct DmNapiVerifyJsCallback { + std::string bundleName_; + std::string deviceId_; + int32_t resultCode_; + int32_t flag_; + + DmNapiVerifyJsCallback(std::string bundleName, std::string deviceId, int32_t resultCode, int32_t flag) + : bundleName_(bundleName), deviceId_(deviceId), resultCode_(resultCode), flag_(flag) {} +} + enum DmNapiDevStateChangeAction { ONLINE = 0, READY = 1, OFFLINE = 2, CHANGE = 3 }; class DmNapiInitCallback : public OHOS::DistributedHardware::DmInitCallback { diff --git a/interfaces/kits/js/src/native_devicemanager_js.cpp b/interfaces/kits/js/src/native_devicemanager_js.cpp index c56e41381..c2e740800 100644 --- a/interfaces/kits/js/src/native_devicemanager_js.cpp +++ b/interfaces/kits/js/src/native_devicemanager_js.cpp @@ -68,16 +68,20 @@ void DmNapiInitCallback::OnRemoteDied() return; } uv_work_t *work = new (std::nothrow) uv_work_t; - if (loop == nullptr) { + if (work == nullptr) { LOGE("DmNapiInitCallback: OnRemoteDied, No memory"); return; } - static std::string staticBundleName = bundleName_; + DmDeviceInfo info; + std::unique_ptr jsCallback = std::make_unique(bundleName_, 0, 0, info); + work->data = reinterpret_cast(jsCallback.get()); + int ret = uv_queue_work(loop, work, [] (uv_work_t *work) {}, [] (uv_work_t *work, int status) { - DeviceManagerNapi *deviceManagerNapi = DeviceManagerNapi::GetDeviceManagerNapi(staticBundleName); + DmNapiStateJsCallback *callback = reinterpret_cast(work->data); + DeviceManagerNapi *deviceManagerNapi = DeviceManagerNapi::GetDeviceManagerNapi(callback->bundleName_); if (deviceManagerNapi == nullptr) { - LOGE("OnRemoteDied, deviceManagerNapi not find for bunderName %s", staticBundleName.c_str()); + LOGE("OnRemoteDied, deviceManagerNapi not find for bunderName %s", callback->bundleName_.c_str()); return; } deviceManagerNapi->OnEvent("serviceDie", 0, nullptr); @@ -97,20 +101,22 @@ void DmNapiDeviceStateCallback::OnDeviceOnline(const DmDeviceInfo &deviceInfo) return; } uv_work_t *work = new (std::nothrow) uv_work_t; - if (loop == nullptr) { + if (work == nullptr) { LOGE("DmNapiDeviceStateCallback: OnDeviceOnline, No memory"); return; } - static std::string staticBundleName = bundleName_; - static DmDeviceInfo staticDeviceInfo = deviceInfo; + std::unique_ptr jsCallback = std::make_unique(bundleName_, 0, 0, deviceInfo); + work->data = reinterpret_cast(jsCallback.get()); + int ret = uv_queue_work(loop, work, [] (uv_work_t *work) {}, [] (uv_work_t *work, int status) { - DeviceManagerNapi *deviceManagerNapi = DeviceManagerNapi::GetDeviceManagerNapi(staticBundleName); + DmNapiStateJsCallback *callback = reinterpret_cast(work->data); + DeviceManagerNapi *deviceManagerNapi = DeviceManagerNapi::GetDeviceManagerNapi(callback->bundleName_); if (deviceManagerNapi == nullptr) { - LOGE("OnDeviceOnline, deviceManagerNapi not find for bunderName %s", staticBundleName.c_str()); + LOGE("OnDeviceOnline, deviceManagerNapi not find for bunderName %s", callback->bundleName_.c_str()); return; } - deviceManagerNapi->OnDeviceStateChange(DmNapiDevStateChangeAction::ONLINE, staticDeviceInfo); + deviceManagerNapi->OnDeviceStateChange(DmNapiDevStateChangeAction::ONLINE, callback->deviceInfo_); delete work; }); if (ret != 0) { @@ -127,20 +133,22 @@ void DmNapiDeviceStateCallback::OnDeviceReady(const DmDeviceInfo &deviceInfo) return; } uv_work_t *work = new (std::nothrow) uv_work_t; - if (loop == nullptr) { + if (work == nullptr) { LOGE("DmNapiDeviceStateCallback: OnDeviceReady, No memory"); return; } - static std::string staticBundleName = bundleName_; - static DmDeviceInfo staticDeviceInfo = deviceInfo; + std::unique_ptr jsCallback = std::make_unique(bundleName_, 0, 0, deviceInfo); + work->data = reinterpret_cast(jsCallback.get()); + int ret = uv_queue_work(loop, work, [] (uv_work_t *work) {}, [] (uv_work_t *work, int status) { - DeviceManagerNapi *deviceManagerNapi = DeviceManagerNapi::GetDeviceManagerNapi(staticBundleName); + DmNapiStateJsCallback *callback = reinterpret_cast(work->data); + DeviceManagerNapi *deviceManagerNapi = DeviceManagerNapi::GetDeviceManagerNapi(callback->bundleName_); if (deviceManagerNapi == nullptr) { - LOGE("OnDeviceReady, deviceManagerNapi not find for bunderName %s", staticBundleName.c_str()); + LOGE("OnDeviceReady, deviceManagerNapi not find for bunderName %s", callback->bundleName_.c_str()); return; } - deviceManagerNapi->OnDeviceStateChange(DmNapiDevStateChangeAction::READY, staticDeviceInfo); + deviceManagerNapi->OnDeviceStateChange(DmNapiDevStateChangeAction::READY, callback->deviceInfo_); delete work; }); if (ret != 0) { @@ -157,20 +165,22 @@ void DmNapiDeviceStateCallback::OnDeviceOffline(const DmDeviceInfo &deviceInfo) return; } uv_work_t *work = new (std::nothrow) uv_work_t; - if (loop == nullptr) { + if (work == nullptr) { LOGE("DmNapiDeviceStateCallback: OnDeviceOffline, No memory"); return; } - static std::string staticBundleName = bundleName_; - static DmDeviceInfo staticDeviceInfo = deviceInfo; + std::unique_ptr jsCallback = std::make_unique(bundleName_, 0, 0, deviceInfo); + work->data = reinterpret_cast(jsCallback.get()); + int ret = uv_queue_work(loop, work, [] (uv_work_t *work) {}, [] (uv_work_t *work, int status) { - DeviceManagerNapi *deviceManagerNapi = DeviceManagerNapi::GetDeviceManagerNapi(staticBundleName); + DmNapiStateJsCallback *callback = reinterpret_cast(work->data); + DeviceManagerNapi *deviceManagerNapi = DeviceManagerNapi::GetDeviceManagerNapi(callback->bundleName_); if (deviceManagerNapi == nullptr) { - LOGE("OnDeviceOffline, deviceManagerNapi not find for bunderName %s", staticBundleName.c_str()); + LOGE("OnDeviceOffline, deviceManagerNapi not find for bunderName %s", callback->bundleName_.c_str()); return; } - deviceManagerNapi->OnDeviceStateChange(DmNapiDevStateChangeAction::OFFLINE, staticDeviceInfo); + deviceManagerNapi->OnDeviceStateChange(DmNapiDevStateChangeAction::OFFLINE, callback->deviceInfo_); delete work; }); if (ret != 0) { @@ -192,15 +202,17 @@ void DmNapiDeviceStateCallback::OnDeviceChanged(const DmDeviceInfo &deviceInfo) return; } - static std::string staticBundleName = bundleName_; - static DmDeviceInfo staticDeviceInfo = deviceInfo; + std::unique_ptr jsCallback = std::make_unique(bundleName_, 0, 0, deviceInfo); + work->data = reinterpret_cast(jsCallback.get()); + int ret = uv_queue_work(loop, work, [] (uv_work_t *work) {}, [] (uv_work_t *work, int status) { - DeviceManagerNapi *deviceManagerNapi = DeviceManagerNapi::GetDeviceManagerNapi(staticBundleName); + DmNapiStateJsCallback *callback = reinterpret_cast(work->data); + DeviceManagerNapi *deviceManagerNapi = DeviceManagerNapi::GetDeviceManagerNapi(callback->bundleName_); if (deviceManagerNapi == nullptr) { - LOGE("OnDeviceChanged, deviceManagerNapi not find for bunderName %s", staticBundleName.c_str()); + LOGE("OnDeviceChanged, deviceManagerNapi not find for bunderName %s", callback->bundleName_.c_str()); return; } - deviceManagerNapi->OnDeviceStateChange(DmNapiDevStateChangeAction::CHANGE, staticDeviceInfo); + deviceManagerNapi->OnDeviceStateChange(DmNapiDevStateChangeAction::CHANGE, callback->deviceInfo_); delete work; }); if (ret != 0) { @@ -219,21 +231,22 @@ void DmNapiDiscoveryCallback::OnDeviceFound(uint16_t subscribeId, const DmDevice return; } uv_work_t *work = new (std::nothrow) uv_work_t; - if (loop == nullptr) { + if (work == nullptr) { LOGE("DmNapiDiscoveryCallback: OnDeviceFound, No memory"); return; } - static std::string staticBundleName = bundleName_; - static uint16_t staticSubscribeId = subscribeId; - static DmDeviceInfo staticDeviceInfo = deviceInfo; + std::unique_ptr jsCallback = std::make_unique(bundleName_, subscribeId, 0, deviceInfo); + work->data = reinterpret_cast(jsCallback.get()); + int ret = uv_queue_work(loop, work, [] (uv_work_t *work) {}, [] (uv_work_t *work, int status) { - DeviceManagerNapi *deviceManagerNapi = DeviceManagerNapi::GetDeviceManagerNapi(staticBundleName); + DmNapiStateJsCallback *callback = reinterpret_cast(work->data); + DeviceManagerNapi *deviceManagerNapi = DeviceManagerNapi::GetDeviceManagerNapi(callback->bundleName_); if (deviceManagerNapi == nullptr) { - LOGE("OnDeviceFound, deviceManagerNapi not find for bunderName %s", staticBundleName.c_str()); + LOGE("OnDeviceFound, deviceManagerNapi not find for bunderName %s", callback->bundleName_.c_str()); return; } - deviceManagerNapi->OnDeviceFound(staticSubscribeId, staticDeviceInfo); + deviceManagerNapi->OnDeviceFound(callback->subscribeId_, callback->deviceInfo_); delete work; }); if (ret != 0) { @@ -252,21 +265,22 @@ void DmNapiDiscoveryCallback::OnDiscoveryFailed(uint16_t subscribeId, int32_t fa return; } uv_work_t *work = new (std::nothrow) uv_work_t; - if (loop == nullptr) { + if (work == nullptr) { LOGE("DmNapiDiscoveryCallback: OnDiscoveryFailed, No memory"); return; } - static std::string staticBundleName = bundleName_; - static uint16_t staticSubscribeId = subscribeId; - static int32_t staticReason = failedReason; + std::unique_ptr jsCallback = std::make_unique(bundleName_, subscribeId, failedReason, deviceInfo); + work->data = reinterpret_cast(jsCallback.get()); + int ret = uv_queue_work(loop, work, [] (uv_work_t *work) {}, [] (uv_work_t *work, int status) { - DeviceManagerNapi *deviceManagerNapi = DeviceManagerNapi::GetDeviceManagerNapi(staticBundleName); + DmNapiStateJsCallback *callback = reinterpret_cast(work->data); + DeviceManagerNapi *deviceManagerNapi = DeviceManagerNapi::GetDeviceManagerNapi(callback->bundleName_); if (deviceManagerNapi == nullptr) { - LOGE("OnDiscoveryFailed, deviceManagerNapi not find for bunderName %s", staticBundleName.c_str()); + LOGE("OnDiscoveryFailed, deviceManagerNapi not find for bunderName %s", callback->bundleName_.c_str()); return; } - deviceManagerNapi->OnDiscoveryFailed(staticSubscribeId, staticReason); + deviceManagerNapi->OnDiscoveryFailed(callback->subscribeId_, callback->reason_); delete work; }); if (ret != 0) { @@ -309,23 +323,22 @@ void DmNapiAuthenticateCallback::OnAuthResult(const std::string &deviceId, const return; } uv_work_t *work = new (std::nothrow) uv_work_t; - if (loop == nullptr) { + if (work == nullptr) { LOGE("DmNapiAuthenticateCallback: OnAuthResult, No memory"); return; } - static std::string staticBundleName = bundleName_; - static std::string staticDeviceId = deviceId; - static std::string staticToken = token; - static int32_t staticStatus = status; - static int32_t staticReason = reason; + std::unique_ptr jsCallback = std::make_unique(bundleName_, deviceId, token, status, reason); + work->data = reinterpret_cast(jsCallback.get()); + int ret = uv_queue_work(loop, work, [] (uv_work_t *work) {}, [] (uv_work_t *work, int status) { - DeviceManagerNapi *deviceManagerNapi = DeviceManagerNapi::GetDeviceManagerNapi(staticBundleName); + DmNapiAuthJsCallback *callback = reinterpret_cast(work->data); + DeviceManagerNapi *deviceManagerNapi = DeviceManagerNapi::GetDeviceManagerNapi(callback->bundleName_); if (deviceManagerNapi == nullptr) { - LOGE("OnAuthResult, deviceManagerNapi not find for bunderName %s", staticBundleName.c_str()); + LOGE("OnAuthResult, deviceManagerNapi not find for bunderName %s", callback->bundleName_.c_str()); return; } - deviceManagerNapi->OnAuthResult(staticDeviceId, staticToken, staticStatus, staticReason); + deviceManagerNapi->OnAuthResult(callback->deviceId_, callback->token_, callback->status_, callback->reason_); delete work; }); if (ret != 0) { @@ -342,22 +355,22 @@ void DmNapiVerifyAuthCallback::OnVerifyAuthResult(const std::string &deviceId, i return; } uv_work_t *work = new (std::nothrow) uv_work_t; - if (loop == nullptr) { + if (work == nullptr) { LOGE("DmNapiVerifyAuthCallback: OnVerifyAuthResult, No memory"); return; } - static std::string staticBundleName = bundleName_; - static std::string staticDeviceId = deviceId; - static int32_t staticCode = resultCode; - static int32_t staticFlag = flag; + std::unique_ptr jsCallback = std::make_unique(bundleName_, deviceId, resultCode, flag); + work->data = reinterpret_cast(jsCallback.get()); + int ret = uv_queue_work(loop, work, [] (uv_work_t *work) {}, [] (uv_work_t *work, int status) { - DeviceManagerNapi *deviceManagerNapi = DeviceManagerNapi::GetDeviceManagerNapi(staticBundleName); + DmNapiVerifyJsCallback *callback = reinterpret_cast(work->data); + DeviceManagerNapi *deviceManagerNapi = DeviceManagerNapi::GetDeviceManagerNapi(callback->bundleName_); if (deviceManagerNapi == nullptr) { - LOGE("OnVerifyAuthResult, deviceManagerNapi not find for bunderName %s", staticBundleName.c_str()); + LOGE("OnVerifyAuthResult, deviceManagerNapi not find for bunderName %s", callback->bundleName_.c_str()); return; } - deviceManagerNapi->OnVerifyResult(staticDeviceId, staticCode, staticFlag); + deviceManagerNapi->OnVerifyResult(callback->deviceId_, callback->resultCode_, callback->flag_); delete work; }); if (ret != 0) { @@ -1013,20 +1026,22 @@ void DmNapiDeviceManagerFaCallback::OnCall(const std::string ¶mJson) return; } uv_work_t *work = new (std::nothrow) uv_work_t; - if (loop == nullptr) { + if (work == nullptr) { LOGE("DmNapiDeviceManagerFaCallback: OnCall, No memory"); return; } - static std::string staticBundleName = bundleName_; - static std::string staticParamJson = paramJson; + std::unique_ptr jsCallback = std::make_unique(bundleName_, "", paramJson, 0, 0); + work->data = reinterpret_cast(jsCallback.get()); + int ret = uv_queue_work(loop, work, [] (uv_work_t *work) {}, [] (uv_work_t *work, int status) { - DeviceManagerNapi *deviceManagerNapi = DeviceManagerNapi::GetDeviceManagerNapi(staticBundleName); + DmNapiAuthJsCallback *callback = reinterpret_cast(work->data); + DeviceManagerNapi *deviceManagerNapi = DeviceManagerNapi::GetDeviceManagerNapi(callback->bundleName_); if (deviceManagerNapi == nullptr) { - LOGE("OnCall, deviceManagerNapi not find for bunderName %s", staticBundleName.c_str()); + LOGE("OnCall, deviceManagerNapi not find for bunderName %s", callback->bundleName_.c_str()); return; } - deviceManagerNapi->OnDmfaCall(staticParamJson); + deviceManagerNapi->OnDmfaCall(callback->token_); delete work; }); if (ret != 0) { -- Gitee From b54c42fdf78e78ea8d124c9690280011200ec453 Mon Sep 17 00:00:00 2001 From: renguang1116 Date: Mon, 7 Mar 2022 14:18:19 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E4=B8=8A=E6=8A=A5=E5=A4=9A=E4=B8=AA=E8=AE=BE=E5=A4=87=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20Signed-off-by:=20renguang1116=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kits/js/include/native_devicemanager_js.h | 16 ++++++ .../kits/js/src/native_devicemanager_js.cpp | 50 +++++++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/interfaces/kits/js/include/native_devicemanager_js.h b/interfaces/kits/js/include/native_devicemanager_js.h index 88d3fe8f4..dd7930cdc 100644 --- a/interfaces/kits/js/include/native_devicemanager_js.h +++ b/interfaces/kits/js/include/native_devicemanager_js.h @@ -86,8 +86,14 @@ struct DmNapiStateJsCallback { int32_t reason_; OHOS::DistributedHardware::DmDeviceInfo deviceInfo_; +<<<<<<< HEAD DmNapiStateJsCallback(std::string bundleName, uint16_t subscribeId, int32_t reason, OHOS::DistributedHardware::DmDeviceInfo deviceInfo) : bundleName_(bundleName), subscribeId_(subscribeId), reason_(reason), deviceInfo_(deviceInfo) {} +======= + DmNapiStateJsCallback(std::string bundleName, uint16_t subscribeId, int32_t reason, + OHOS::DistributedHardware::DmDeviceInfo deviceInfo) + : bundleName_(bundleName), subscribeId_(subscribeId), reason_(reason), deviceInfo_(deviceInfo) {} +>>>>>>> b286a70 (修改无法上报多个设备问题) } struct DmNapiAuthJsCallback { @@ -97,8 +103,14 @@ struct DmNapiAuthJsCallback { int32_t status_; int32_t reason_; +<<<<<<< HEAD DmNapiAuthJsCallback(std::string bundleName, std::string deviceId, std::string token, int32_t status, int32_t reason) : bundleName_(bundleName), deviceId_(deviceId), token_(token), status_(status), reason_(reason) {} +======= + DmNapiAuthJsCallback(std::string bundleName, std::string deviceId, std::string token, int32_t status, + int32_t reason) + : bundleName_(bundleName), deviceId_(deviceId), token_(token), status_(status), reason_(reason) {} +>>>>>>> b286a70 (修改无法上报多个设备问题) } struct DmNapiVerifyJsCallback { @@ -108,7 +120,11 @@ struct DmNapiVerifyJsCallback { int32_t flag_; DmNapiVerifyJsCallback(std::string bundleName, std::string deviceId, int32_t resultCode, int32_t flag) +<<<<<<< HEAD : bundleName_(bundleName), deviceId_(deviceId), resultCode_(resultCode), flag_(flag) {} +======= + : bundleName_(bundleName), deviceId_(deviceId), resultCode_(resultCode), flag_(flag) {} +>>>>>>> b286a70 (修改无法上报多个设备问题) } enum DmNapiDevStateChangeAction { ONLINE = 0, READY = 1, OFFLINE = 2, CHANGE = 3 }; diff --git a/interfaces/kits/js/src/native_devicemanager_js.cpp b/interfaces/kits/js/src/native_devicemanager_js.cpp index c2e740800..6261b1d97 100644 --- a/interfaces/kits/js/src/native_devicemanager_js.cpp +++ b/interfaces/kits/js/src/native_devicemanager_js.cpp @@ -74,7 +74,12 @@ void DmNapiInitCallback::OnRemoteDied() } DmDeviceInfo info; +<<<<<<< HEAD std::unique_ptr jsCallback = std::make_unique(bundleName_, 0, 0, info); +======= + std::unique_ptr jsCallback = + std::make_unique(bundleName_, 0, 0, info); +>>>>>>> b286a70 (修改无法上报多个设备问题) work->data = reinterpret_cast(jsCallback.get()); int ret = uv_queue_work(loop, work, [] (uv_work_t *work) {}, [] (uv_work_t *work, int status) { @@ -106,7 +111,12 @@ void DmNapiDeviceStateCallback::OnDeviceOnline(const DmDeviceInfo &deviceInfo) return; } +<<<<<<< HEAD std::unique_ptr jsCallback = std::make_unique(bundleName_, 0, 0, deviceInfo); +======= + std::unique_ptr jsCallback = + std::make_unique(bundleName_, 0, 0, deviceInfo); +>>>>>>> b286a70 (修改无法上报多个设备问题) work->data = reinterpret_cast(jsCallback.get()); int ret = uv_queue_work(loop, work, [] (uv_work_t *work) {}, [] (uv_work_t *work, int status) { @@ -138,7 +148,12 @@ void DmNapiDeviceStateCallback::OnDeviceReady(const DmDeviceInfo &deviceInfo) return; } +<<<<<<< HEAD std::unique_ptr jsCallback = std::make_unique(bundleName_, 0, 0, deviceInfo); +======= + std::unique_ptr jsCallback = + std::make_unique(bundleName_, 0, 0, deviceInfo); +>>>>>>> b286a70 (修改无法上报多个设备问题) work->data = reinterpret_cast(jsCallback.get()); int ret = uv_queue_work(loop, work, [] (uv_work_t *work) {}, [] (uv_work_t *work, int status) { @@ -170,7 +185,12 @@ void DmNapiDeviceStateCallback::OnDeviceOffline(const DmDeviceInfo &deviceInfo) return; } +<<<<<<< HEAD std::unique_ptr jsCallback = std::make_unique(bundleName_, 0, 0, deviceInfo); +======= + std::unique_ptr jsCallback = + std::make_unique(bundleName_, 0, 0, deviceInfo); +>>>>>>> b286a70 (修改无法上报多个设备问题) work->data = reinterpret_cast(jsCallback.get()); int ret = uv_queue_work(loop, work, [] (uv_work_t *work) {}, [] (uv_work_t *work, int status) { @@ -202,7 +222,12 @@ void DmNapiDeviceStateCallback::OnDeviceChanged(const DmDeviceInfo &deviceInfo) return; } +<<<<<<< HEAD std::unique_ptr jsCallback = std::make_unique(bundleName_, 0, 0, deviceInfo); +======= + std::unique_ptr jsCallback = + std::make_unique(bundleName_, 0, 0, deviceInfo); +>>>>>>> b286a70 (修改无法上报多个设备问题) work->data = reinterpret_cast(jsCallback.get()); int ret = uv_queue_work(loop, work, [] (uv_work_t *work) {}, [] (uv_work_t *work, int status) { @@ -236,7 +261,12 @@ void DmNapiDiscoveryCallback::OnDeviceFound(uint16_t subscribeId, const DmDevice return; } +<<<<<<< HEAD std::unique_ptr jsCallback = std::make_unique(bundleName_, subscribeId, 0, deviceInfo); +======= + std::unique_ptr jsCallback = + std::make_unique(bundleName_, subscribeId, 0, deviceInfo); +>>>>>>> b286a70 (修改无法上报多个设备问题) work->data = reinterpret_cast(jsCallback.get()); int ret = uv_queue_work(loop, work, [] (uv_work_t *work) {}, [] (uv_work_t *work, int status) { @@ -270,7 +300,12 @@ void DmNapiDiscoveryCallback::OnDiscoveryFailed(uint16_t subscribeId, int32_t fa return; } +<<<<<<< HEAD std::unique_ptr jsCallback = std::make_unique(bundleName_, subscribeId, failedReason, deviceInfo); +======= + std::unique_ptr jsCallback = + std::make_unique(bundleName_, subscribeId, failedReason, deviceInfo); +>>>>>>> b286a70 (修改无法上报多个设备问题) work->data = reinterpret_cast(jsCallback.get()); int ret = uv_queue_work(loop, work, [] (uv_work_t *work) {}, [] (uv_work_t *work, int status) { @@ -328,7 +363,12 @@ void DmNapiAuthenticateCallback::OnAuthResult(const std::string &deviceId, const return; } +<<<<<<< HEAD std::unique_ptr jsCallback = std::make_unique(bundleName_, deviceId, token, status, reason); +======= + std::unique_ptr jsCallback = + std::make_unique(bundleName_, deviceId, token, status, reason); +>>>>>>> b286a70 (修改无法上报多个设备问题) work->data = reinterpret_cast(jsCallback.get()); int ret = uv_queue_work(loop, work, [] (uv_work_t *work) {}, [] (uv_work_t *work, int status) { @@ -360,7 +400,12 @@ void DmNapiVerifyAuthCallback::OnVerifyAuthResult(const std::string &deviceId, i return; } +<<<<<<< HEAD std::unique_ptr jsCallback = std::make_unique(bundleName_, deviceId, resultCode, flag); +======= + std::unique_ptr jsCallback = + std::make_unique(bundleName_, deviceId, resultCode, flag); +>>>>>>> b286a70 (修改无法上报多个设备问题) work->data = reinterpret_cast(jsCallback.get()); int ret = uv_queue_work(loop, work, [] (uv_work_t *work) {}, [] (uv_work_t *work, int status) { @@ -1031,7 +1076,12 @@ void DmNapiDeviceManagerFaCallback::OnCall(const std::string ¶mJson) return; } +<<<<<<< HEAD std::unique_ptr jsCallback = std::make_unique(bundleName_, "", paramJson, 0, 0); +======= + std::unique_ptr jsCallback = + std::make_unique(bundleName_, "", paramJson, 0, 0); +>>>>>>> b286a70 (修改无法上报多个设备问题) work->data = reinterpret_cast(jsCallback.get()); int ret = uv_queue_work(loop, work, [] (uv_work_t *work) {}, [] (uv_work_t *work, int status) { -- Gitee