mirror of
https://github.com/openharmony/device_manager.git
synced 2026-07-21 06:05:22 -04:00
@@ -39,9 +39,9 @@ AbilityStatus DmAbilityManager::StartAbility(AbilityRole role)
|
||||
|
||||
void DmAbilityManager::waitForTimeout(uint32_t timeout_s)
|
||||
{
|
||||
struct timespec ts;
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
ts.tv_sec += timeout_s;
|
||||
ts.tv_sec += (int32_t)timeout_s;
|
||||
sem_timedwait(&mSem_, &ts);
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ void DmAbilityManager::waitForTimeout(uint32_t timeout_s)
|
||||
{
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
ts.tv_sec += timeout_s;
|
||||
ts.tv_sec += (int32_t)timeout_s;
|
||||
sem_timedwait(&mSem_, &ts);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ void DmAbilityManager::waitForTimeout(uint32_t timeout_s)
|
||||
{
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
ts.tv_sec += timeout_s;
|
||||
ts.tv_sec += (int32_t)timeout_s;
|
||||
sem_timedwait(&mSem_, &ts);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ AbilityStatus DmAbilityManager::StartAbility(AbilityRole role)
|
||||
AAFwk::AbilityManagerClient::GetInstance()->Connect();
|
||||
ErrCode result = AAFwk::AbilityManagerClient::GetInstance()->StartAbility(want);
|
||||
if (result != OHOS::ERR_OK) {
|
||||
LOGE("Start Ability faild");
|
||||
LOGE("Start Ability failed");
|
||||
mStatus_ = ABILITY_STATUS_FAILED;
|
||||
return mStatus_;
|
||||
}
|
||||
|
||||
@@ -91,11 +91,15 @@ void DmNapiInitCallback::OnRemoteDied()
|
||||
return;
|
||||
}
|
||||
deviceManagerNapi->OnEvent("serviceDie", 0, nullptr);
|
||||
delete work;
|
||||
if (work != nullptr) {
|
||||
delete work;
|
||||
}
|
||||
});
|
||||
if (ret != 0) {
|
||||
LOGE("Failed to execute OnRemoteDied work queue");
|
||||
delete work;
|
||||
if (work != nullptr) {
|
||||
delete work;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,11 +127,15 @@ void DmNapiDeviceStateCallback::OnDeviceOnline(const DmDeviceInfo &deviceInfo)
|
||||
return;
|
||||
}
|
||||
deviceManagerNapi->OnDeviceStateChange(DmNapiDevStateChangeAction::ONLINE, callback->deviceInfo_);
|
||||
delete work;
|
||||
if (work != nullptr) {
|
||||
delete work;
|
||||
}
|
||||
});
|
||||
if (ret != 0) {
|
||||
LOGE("Failed to execute OnDeviceOnline work queue");
|
||||
delete work;
|
||||
if (work != nullptr) {
|
||||
delete work;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,11 +163,15 @@ void DmNapiDeviceStateCallback::OnDeviceReady(const DmDeviceInfo &deviceInfo)
|
||||
return;
|
||||
}
|
||||
deviceManagerNapi->OnDeviceStateChange(DmNapiDevStateChangeAction::READY, callback->deviceInfo_);
|
||||
delete work;
|
||||
if (work != nullptr) {
|
||||
delete work;
|
||||
}
|
||||
});
|
||||
if (ret != 0) {
|
||||
LOGE("Failed to execute OnDeviceReady work queue");
|
||||
delete work;
|
||||
if (work != nullptr) {
|
||||
delete work;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,11 +199,15 @@ void DmNapiDeviceStateCallback::OnDeviceOffline(const DmDeviceInfo &deviceInfo)
|
||||
return;
|
||||
}
|
||||
deviceManagerNapi->OnDeviceStateChange(DmNapiDevStateChangeAction::OFFLINE, callback->deviceInfo_);
|
||||
delete work;
|
||||
if (work != nullptr) {
|
||||
delete work;
|
||||
}
|
||||
});
|
||||
if (ret != 0) {
|
||||
LOGE("Failed to execute OnDeviceOffline work queue");
|
||||
delete work;
|
||||
if (work != nullptr) {
|
||||
delete work;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,11 +235,15 @@ void DmNapiDeviceStateCallback::OnDeviceChanged(const DmDeviceInfo &deviceInfo)
|
||||
return;
|
||||
}
|
||||
deviceManagerNapi->OnDeviceStateChange(DmNapiDevStateChangeAction::CHANGE, callback->deviceInfo_);
|
||||
delete work;
|
||||
if (work != nullptr) {
|
||||
delete work;
|
||||
}
|
||||
});
|
||||
if (ret != 0) {
|
||||
LOGE("Failed to execute OnDeviceChanged work queue");
|
||||
delete work;
|
||||
if (work != nullptr) {
|
||||
delete work;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,11 +273,15 @@ void DmNapiDiscoveryCallback::OnDeviceFound(uint16_t subscribeId, const DmDevice
|
||||
return;
|
||||
}
|
||||
deviceManagerNapi->OnDeviceFound(callback->subscribeId_, callback->deviceInfo_);
|
||||
delete work;
|
||||
if (work != nullptr) {
|
||||
delete work;
|
||||
}
|
||||
});
|
||||
if (ret != 0) {
|
||||
LOGE("Failed to execute OnDeviceFound work queue");
|
||||
delete work;
|
||||
if (work != nullptr) {
|
||||
delete work;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -288,11 +312,15 @@ void DmNapiDiscoveryCallback::OnDiscoveryFailed(uint16_t subscribeId, int32_t fa
|
||||
return;
|
||||
}
|
||||
deviceManagerNapi->OnDiscoveryFailed(callback->subscribeId_, callback->reason_);
|
||||
delete work;
|
||||
if (work != nullptr) {
|
||||
delete work;
|
||||
}
|
||||
});
|
||||
if (ret != 0) {
|
||||
LOGE("Failed to execute OnDiscoveryFailed work queue");
|
||||
delete work;
|
||||
if (work != nullptr) {
|
||||
delete work;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,11 +374,15 @@ void DmNapiAuthenticateCallback::OnAuthResult(const std::string &deviceId, const
|
||||
return;
|
||||
}
|
||||
deviceManagerNapi->OnAuthResult(callback->deviceId_, callback->token_, callback->status_, callback->reason_);
|
||||
delete work;
|
||||
if (work != nullptr) {
|
||||
delete work;
|
||||
}
|
||||
});
|
||||
if (ret != 0) {
|
||||
LOGE("Failed to execute OnAuthResult work queue");
|
||||
delete work;
|
||||
if (work != nullptr) {
|
||||
delete work;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -378,11 +410,15 @@ void DmNapiVerifyAuthCallback::OnVerifyAuthResult(const std::string &deviceId, i
|
||||
return;
|
||||
}
|
||||
deviceManagerNapi->OnVerifyResult(callback->deviceId_, callback->resultCode_, callback->flag_);
|
||||
delete work;
|
||||
if (work != nullptr) {
|
||||
delete work;
|
||||
}
|
||||
});
|
||||
if (ret != 0) {
|
||||
LOGE("Failed to execute OnVerifyAuthResult work queue");
|
||||
delete work;
|
||||
if (work != nullptr) {
|
||||
delete work;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1047,11 +1083,15 @@ void DmNapiDeviceManagerFaCallback::OnCall(const std::string ¶mJson)
|
||||
return;
|
||||
}
|
||||
deviceManagerNapi->OnDmfaCall(callback->token_);
|
||||
delete work;
|
||||
if (work != nullptr) {
|
||||
delete work;
|
||||
}
|
||||
});
|
||||
if (ret != 0) {
|
||||
LOGE("Failed to execute OnCall work queue");
|
||||
delete work;
|
||||
if (work != nullptr) {
|
||||
delete work;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ void DmAbilityManager::waitForTimeout(uint32_t timeout_s)
|
||||
{
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
ts.tv_sec += timeout_s;
|
||||
ts.tv_sec += (int32_t)timeout_s;
|
||||
sem_timedwait(&mSem_, &ts);
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ void DmAbilityManager::waitForTimeout(uint32_t timeout_s)
|
||||
{
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
ts.tv_sec += timeout_s;
|
||||
ts.tv_sec += (int32_t)timeout_s;
|
||||
sem_timedwait(&mSem_, &ts);
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,6 @@ void DmTimer::Stop(int32_t code)
|
||||
LOGI("DmTimer is not init");
|
||||
return;
|
||||
}
|
||||
LOGI("DmTimer %s Stop code (%d)", mTimerName_.c_str(), code);
|
||||
if (mTimeFd_[1]) {
|
||||
char event = 'S';
|
||||
if (write(mTimeFd_[1], &event, 1) < 0) {
|
||||
|
||||
@@ -51,8 +51,7 @@ std::string GetAnonyInt32(const int32_t value)
|
||||
tempString[0] = '*';
|
||||
return tempString;
|
||||
}
|
||||
|
||||
for (int32_t i = 1; i < length - 1; i++) {
|
||||
for (size_t i = 1; i < length - 1; i++) {
|
||||
tempString[i] = '*';
|
||||
}
|
||||
return tempString;
|
||||
|
||||
Reference in New Issue
Block a user