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 BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_SERVICES_ANS_INCLUDE_DISTRIBUTED_DEVICE_STATUS_H 17 #define BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_SERVICES_ANS_INCLUDE_DISTRIBUTED_DEVICE_STATUS_H 18 19 #include <cstdint> 20 #include <singleton.h> 21 #include <string> 22 23 #include "errors.h" 24 #include "ans_log_wrapper.h" 25 #include "safe_map.h" 26 27 namespace OHOS { 28 namespace Notification { 29 class DistributedDeviceStatus : public DelayedSingleton<DistributedDeviceStatus> { 30 public: 31 DistributedDeviceStatus(); 32 ~DistributedDeviceStatus(); 33 ErrCode SetDeviceStatus(const std::string &deviceType, const uint32_t status); 34 35 uint32_t GetDeviceStatus(const std::string &deviceType); 36 private: 37 SafeMap<std::string, uint32_t> deviceStatus_; 38 39 public: 40 static constexpr int32_t STATUS_SIZE = 4; 41 static constexpr int32_t USING_FLAG = 0; 42 static constexpr int32_t LOCK_FLAG = 1; 43 static constexpr int32_t OWNER_FLAG = 2; 44 static constexpr int32_t DISTURB_MODE_FLAG = 3; 45 }; 46 } // namespace Notification 47 } // namespace OHOS 48 49 #endif // BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_SERVICES_ANS_INCLUDE_DISTRIBUTED_DEVICE_STATUS_H 50