• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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         const uint32_t controlFlag);
35 
36     uint32_t GetDeviceStatus(const std::string &deviceType);
37 private:
38     std::mutex mapLock_;
39     SafeMap<std::string, uint32_t> deviceStatus_;
40 
41 public:
42     static constexpr int32_t STATUS_SIZE = 4;
43     static constexpr int32_t USING_FLAG = 0;
44     static constexpr int32_t LOCK_FLAG = 1;
45     static constexpr int32_t OWNER_FLAG = 2;
46     static constexpr int32_t DISTURB_MODE_FLAG = 3;
47     static constexpr int32_t DISTURB_DEFAULT_FLAG = 13;
48 };
49 }  // namespace Notification
50 }  // namespace OHOS
51 
52 #endif  // BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_SERVICES_ANS_INCLUDE_DISTRIBUTED_DEVICE_STATUS_H
53