mirror of
https://gitee.com/openharmony/ability_dmsfwk
synced 2024-11-27 00:20:44 +00:00
commit
21b5b9944d
@ -46,6 +46,7 @@ enum class FocusedReason {
|
||||
NORMAL,
|
||||
INIT,
|
||||
SCREENOFF,
|
||||
ONLINE,
|
||||
MMI,
|
||||
MAX
|
||||
};
|
||||
@ -75,6 +76,7 @@ public:
|
||||
void NotifyDied(const sptr<IRemoteObject>& obj);
|
||||
int32_t SetMissionContinueState(const int32_t missionId, const AAFwk::ContinueState& state);
|
||||
void OnMMIEvent();
|
||||
uint32_t NotifyDeviceOnline();
|
||||
|
||||
private:
|
||||
int32_t GetCurrentMissionId();
|
||||
|
@ -97,7 +97,6 @@ void DnetworkAdapter::DmsDeviceStateCallback::OnDeviceOffline(const DmDeviceInfo
|
||||
|
||||
void DnetworkAdapter::DmsDeviceStateCallback::OnDeviceChanged(const DmDeviceInfo& deviceInfo)
|
||||
{
|
||||
HILOGI("called");
|
||||
std::string networkId = deviceInfo.networkId;
|
||||
HILOGI("OnDeviceChanged netwokId = %{public}s", AnonymizeNetworkId(networkId).c_str());
|
||||
auto onlineNotifyTask = [deviceInfo]() {
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "deviceManager/dms_device_info.h"
|
||||
#include "dtbschedmgr_device_info_storage.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
#include "mission/dms_continue_send_manager.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedSchedule {
|
||||
@ -32,6 +33,7 @@ void DistributedDeviceNodeListener::OnDeviceOnline(const DistributedHardware::Dm
|
||||
auto dmsDeviceInfo = std::make_shared<DmsDeviceInfo>(
|
||||
deviceInfo.deviceName, deviceInfo.deviceTypeId, deviceInfo.networkId);
|
||||
DtbschedmgrDeviceInfoStorage::GetInstance().DeviceOnlineNotify(dmsDeviceInfo);
|
||||
DMSContinueSendMgr::GetInstance().NotifyDeviceOnline();
|
||||
}
|
||||
|
||||
void DistributedDeviceNodeListener::OnDeviceOffline(const DistributedHardware::DmDeviceInfo& deviceInfo)
|
||||
|
@ -539,5 +539,15 @@ void DMSContinueSendMgr::OnMMIEvent()
|
||||
HILOGD("OnMMIEvent, missionId = %{public}d", info_.currentMissionId);
|
||||
DMSContinueSendMgr::GetInstance().NotifyMissionFocused(info_.currentMissionId, FocusedReason::MMI);
|
||||
}
|
||||
|
||||
uint32_t DMSContinueSendMgr::NotifyDeviceOnline()
|
||||
{
|
||||
HILOGD("NotifyDeviceOnline called");
|
||||
if (GetCurrentMissionId() <= 0) {
|
||||
return INVALID_MISSION_ID;
|
||||
}
|
||||
NotifyMissionFocused(info_.currentMissionId, FocusedReason::ONLINE);
|
||||
return ERR_OK;
|
||||
}
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
|
@ -696,5 +696,18 @@ HWTEST_F(DMSContinueManagerTest, testSendSoftbusEvent001, TestSize.Level1)
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
DTEST_LOG << "DMSContinueManagerTest testSendSoftbusEvent001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testNotifyDeviceOnline001
|
||||
* @tc.desc: NotifyDeviceOnline
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DMSContinueManagerTest, testNotifyDeviceOnline001, TestSize.Level1)
|
||||
{
|
||||
DTEST_LOG << "DMSContinueManagerTest testNotifyDeviceOnline001 start" << std::endl;
|
||||
uint32_t ret = DMSContinueSendMgr::GetInstance().NotifyDeviceOnline();
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
DTEST_LOG << "DMSContinueManagerTest testNotifyDeviceOnline001 end" << std::endl;
|
||||
}
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
Loading…
Reference in New Issue
Block a user