• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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_NDK_DM_CLIENT_H
17 #define OHOS_NDK_DM_CLIENT_H
18 
19 #include <mutex>
20 #include <string>
21 #include "device_manager_callback.h"
22 
23 namespace OHOS {
24 namespace DistributedHardware {
25 class DmClient {
26 public:
27     static DmClient &GetInstance();
28 public:
29     int32_t Init();
30     int32_t UnInit();
31     int32_t ReInit();
32     int32_t GetLocalDeviceName(std::string &deviceName);
33 private:
34     DmClient() = default;
35     ~DmClient() = default;
36     DmClient(const DmClient &) = delete;
37     DmClient &operator=(const DmClient &) = delete;
38     DmClient(DmClient &&) = delete;
39     DmClient &operator=(DmClient &&) = delete;
40 private:
41     std::mutex initMtx_;
42     std::string pkgName_ = "";
43     std::shared_ptr<DmInitCallback> dmInitCallback_;
44 
45 class InitCallback : public DmInitCallback {
46 public:
47     void OnRemoteDied() override;
48 };
49 };
50 } // namespace DistributedHardware
51 } // namespace OHOS
52 #endif // OHOS_NDK_DM_CLIENT_H
53