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 29 namespace OHOS { 30 namespace DistributedSchedule { 31 const std::string CONTINUATION_BEHAVIOR = "CONTINUATION_BEHAVIOR"; 32 const std::string ERROR_CODE_UE = "ERROR_CODE_UE"; 33 const std::string PNAMEID = "PNAMEID"; 34 const std::string PVERSIONID = "PVERSIONID"; 35 const std::string BUNDLE_NAME = "BUNDLE_NAME"; 36 const std::string ABILITY_NAME = "ABILITY_NAME"; 37 const std::string SOURCE_DEVICE_TYPE = "SOURCE_DEVICE_TYPE"; 38 39 const std::string CONTINUATION_STATE = "CONTINUATION_STATE"; 40 const std::string FAILED_EXTRAINFO = "FAILED_EXTRAINFO"; 41 const std::string CONTINUATION_DURATION = "CONTINUATION_DURATION"; 42 43 const std::string SWITCH_STATE = "SWITCH_STATE"; 44 45 const std::string SHOW_CONTINUATION_ICON = "SHOW_CONTINUATION_ICON"; 46 const std::string CLICK_CONTINUATION_ICON = "CLICK_CONTINUATION_ICON"; 47 const std::string COMPLETE_OF_CONTINUATION = "COMPLETE_OF_CONTINUATION"; 48 const std::string ORIGINAL_SWITCH_STATE = "ORIGINAL_SWITCH_STATE"; 49 const std::string CHANGED_SWITCH_STATE = "CHANGED_SWITCH_STATE"; 50 51 constexpr char CONTINUATION_DOMAIN[] = "CONTINUATION_UE"; 52 53 enum class continuationState : int32_t { 54 CONTINUATION_SUCC = 0, 55 CONTINUATION_FAIL = -1, 56 }; 57 58 class DmsUE { 59 DECLARE_SINGLE_INSTANCE(DmsUE); 60 public: 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