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; GetDiskSN(std::string & result)32 virtual int32_t GetDiskSN(std::string& result) { return 0; } 33 34 static constexpr int ERR_FAIL = -1; 35 }; 36 } // namespace device_info 37 } // namespace OHOS 38 39 #ifndef DINFO_DOMAIN 40 #define DINFO_DOMAIN (BASE_DOMAIN + 8) 41 #endif 42 43 #ifndef DINFO_TAG 44 #define DINFO_TAG "DeviceInfoKits" 45 #endif 46 47 #define DINFO_LOGI(fmt, ...) STARTUP_LOGI(DINFO_DOMAIN, DINFO_TAG, fmt, ##__VA_ARGS__) 48 #define DINFO_LOGE(fmt, ...) STARTUP_LOGE(DINFO_DOMAIN, DINFO_TAG, fmt, ##__VA_ARGS__) 49 #define DINFO_LOGV(fmt, ...) STARTUP_LOGV(DINFO_DOMAIN, DINFO_TAG, fmt, ##__VA_ARGS__) 50 51 #define DINFO_CHECK(ret, exper, ...) \ 52 if (!(ret)) { \ 53 DINFO_LOGE(__VA_ARGS__); \ 54 exper; \ 55 } 56 #define DINFO_ONLY_CHECK(ret, exper, ...) \ 57 if (!(ret)) { \ 58 exper; \ 59 } 60 61 #endif // OHOS_SYSTEM_IDEVICEID_H