1/*
2 * Copyright (c) 2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#ifndef OHOS_DISTRIBUTED_UE_H
17#define OHOS_DISTRIBUTED_UE_H
18
19#include <cstdint>
20#include <chrono>
21#include <string>
22#include <vector>
23
24#include "dsched_continue.h"
25#include "dtbschedmgr_device_info_storage.h"
26#include "dtbschedmgr_log.h"
27#include "single_instance.h"
28
29namespace OHOS {
30namespace DistributedSchedule {
31const std::string CONTINUATION_BEHAVIOR = "CONTINUATION_BEHAVIOR";
32const std::string ERROR_CODE_UE = "ERROR_CODE_UE";
33const std::string PNAMEID = "PNAMEID";
34const std::string PVERSIONID = "PVERSIONID";
35const std::string BUNDLE_NAME = "BUNDLE_NAME";
36const std::string ABILITY_NAME = "ABILITY_NAME";
37const std::string SOURCE_DEVICE_TYPE = "SOURCE_DEVICE_TYPE";
38
39const std::string CONTINUATION_STATE = "CONTINUATION_STATE";
40const std::string FAILED_EXTRAINFO = "FAILED_EXTRAINFO";
41const std::string CONTINUATION_DURATION = "CONTINUATION_DURATION";
42
43const std::string SWITCH_STATE = "SWITCH_STATE";
44
45const std::string SHOW_CONTINUATION_ICON = "SHOW_CONTINUATION_ICON";
46const std::string CLICK_CONTINUATION_ICON = "CLICK_CONTINUATION_ICON";
47const std::string COMPLETE_OF_CONTINUATION = "COMPLETE_OF_CONTINUATION";
48const std::string ORIGINAL_SWITCH_STATE = "ORIGINAL_SWITCH_STATE";
49const std::string CHANGED_SWITCH_STATE = "CHANGED_SWITCH_STATE";
50
51constexpr char CONTINUATION_DOMAIN[] = "CONTINUATION_UE";
52
53enum class continuationState : int32_t {
54    CONTINUATION_SUCC = 0,
55    CONTINUATION_FAIL = -1,
56};
57
58class DmsUE {
59    DECLARE_SINGLE_INSTANCE(DmsUE);
60public:
61    bool NotifyDockShowIcon(const std::string& bundleName, const std::string& abilityName,
62        const std::string& networkId, int32_t errCode);
63    bool TriggerDmsContinue(const std::string& bundleName, const std::string& abilityName,
64        const std::string& networkId, int32_t errCode);
65    bool DmsContinueComplete(const std::string& bundleName, const std::string& abilityName,
66        const std::string& networkId, int32_t errCode);
67    bool OriginalSwitchState(bool isContinueSwitchOn, int32_t errCode);
68    bool ChangedSwitchState(bool isContinueSwitchOn, int32_t errCode);
69
70    int32_t GetDeviceTypeByNetworkId(std::string networkId);
71    std::string ConvertErrCodeToStr(int32_t errorCode);
72};
73} // namespace DistributedSchedule
74} // namespace OHOS
75#endif // OHOS_DISTRIBUTED_UE_H