1 /* 2 * Copyright (c) 2021 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_SYSTEM_IDEVICEID_H 17 #define OHOS_SYSTEM_IDEVICEID_H 18 19 #include <iostream> 20 #include "beget_ext.h" 21 #include "iremote_broker.h" 22 #include "iremote_proxy.h" 23 24 namespace OHOS { 25 namespace device_info { 26 class IDeviceInfo : public OHOS::IRemoteBroker { 27 public: 28 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.system.IDeviceInfo"); 29 30 virtual int32_t GetUdid(std::string& result) = 0; 31 virtual int32_t GetSerialID(std::string& result) = 0; 32 33 static constexpr int COMMAND_GET_UDID = MIN_TRANSACTION_ID + 0; 34 static constexpr int COMMAND_GET_SERIAL_ID = MIN_TRANSACTION_ID + 1; 35 static constexpr int ERR_FAIL = -1; 36 const std::string PERMISSION_UDID = "ohos.permission.sec.ACCESS_UDID"; 37 }; 38 } // namespace device_info 39 } // namespace OHOS 40 41 #ifndef DINFO_DOMAIN 42 #define DINFO_DOMAIN (BASE_DOMAIN + 8) 43 #endif 44 45 #define DINFO_LOGI(fmt, ...) STARTUP_LOGI(DINFO_DOMAIN, "DeviceInfoKits", fmt, ##__VA_ARGS__) 46 #define DINFO_LOGE(fmt, ...) STARTUP_LOGE(DINFO_DOMAIN, "DeviceInfoKits", fmt, ##__VA_ARGS__) 47 #define DINFO_LOGV(fmt, ...) STARTUP_LOGV(DINFO_DOMAIN, "DeviceInfoKits", fmt, ##__VA_ARGS__) 48 49 #define DINFO_CHECK(ret, exper, ...) \ 50 if (!(ret)) { \ 51 DINFO_LOGE(__VA_ARGS__); \ 52 exper; \ 53 } 54 #define DINFO_ONLY_CHECK(ret, exper, ...) \ 55 if (!(ret)) { \ 56 exper; \ 57 } 58 59 #endif // OHOS_SYSTEM_IDEVICEID_H