• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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     static constexpr int ERR_INVALD_DESC = -1;
37     const std::string PERMISSION_UDID = "ohos.permission.sec.ACCESS_UDID";
38 };
39 } // namespace device_info
40 } // namespace OHOS
41 
42 #define DINFO_LOGI(fmt, ...) STARTUP_LOGI("begetctrl.log", "DeviceInfoKits", fmt, ##__VA_ARGS__)
43 #define DINFO_LOGE(fmt, ...) STARTUP_LOGE("begetctrl.log", "DeviceInfoKits", fmt, ##__VA_ARGS__)
44 #define DINFO_LOGV(fmt, ...) STARTUP_LOGV("begetctrl.log", "DeviceInfoKits", fmt, ##__VA_ARGS__)
45 
46 #define DINFO_CHECK(ret, exper, ...) \
47     if (!(ret)) { \
48         DINFO_LOGE(__VA_ARGS__); \
49         exper; \
50     }
51 #define DINFO_ONLY_CHECK(ret, exper, ...) \
52     if (!(ret)) { \
53         exper; \
54     }
55 
56 #endif // OHOS_SYSTEM_IDEVICEID_H