1 /* 2 * Copyright (c) 2023-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_DP_CONTENT_SENSOR_MANAGER_UTILS_H 17 #define OHOS_DP_CONTENT_SENSOR_MANAGER_UTILS_H 18 19 #include <atomic> 20 #include <map> 21 #include <mutex> 22 #include <string> 23 #include "single_instance.h" 24 25 namespace OHOS { 26 namespace DistributedDeviceProfile { 27 class ContentSensorManagerUtils { 28 DECLARE_SINGLE_INSTANCE(ContentSensorManagerUtils); 29 public: 30 std::string ObtainProductModel(); 31 std::string ObtainDeviceType(); 32 std::string ObtainDeviceTypeId(); 33 std::string ObtainManufacture(); 34 std::string ObtainSerial(); 35 std::string ObtainMarketName(); 36 std::string ObtainOsFullName(); 37 std::string ObtainDisplayVersion(); 38 std::string ObtainLocalUdid(); 39 std::string ObtainProductId(); 40 void ObtainDeviceDataSyncMode(); 41 bool IsDeviceE2ESync(); 42 int32_t GetProtType(); 43 std::string GetSubProductId(); 44 45 private: 46 bool IsWifiOnly(); 47 std::string GetBackcolor(); 48 std::map<std::string, std::string> GetSubProdIdMap(); 49 50 std::string deviceModel_ = ""; 51 std::string deviceType_ = ""; 52 std::string manufacture_ = ""; 53 std::string serial_ = ""; 54 std::string marketName_ = ""; 55 std::string osFullName_ = ""; 56 std::string displayVersion_ = ""; 57 std::string localUdid_ = ""; 58 std::string productId_ = ""; 59 std::string deviceTypeId_ = ""; 60 std::atomic<bool> isDeviceE2ESync_ {false}; 61 int32_t protType_ = 0; 62 std::string backcolor_ = ""; 63 std::map<std::string, std::string> subProdIdMap_ = {}; 64 std::mutex csMutex_; 65 }; 66 } 67 } 68 #endif // OHOS_DP_MANAGER_CONTENT_SENSOR_MANAGER_UTILS_H 69