• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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_DM_THREAD_H
17 #define OHOS_DM_THREAD_H
18 
19 #include <pthread.h>
20 #include <map>
21 #include <string>
22 #include<memory>
23 #include "dm_device_info.h"
24 #include "softbus_state_callback.h"
25 
26 namespace OHOS {
27 namespace DistributedHardware {
28 class DmThread {
29 using funcstr = void (*)(std::map<std::string, std::shared_ptr<ISoftbusStateCallback>>, DmDeviceInfo);
30 public:
31     DmThread(funcstr funcname,\
32     std::map<std::string, std::shared_ptr<ISoftbusStateCallback>> parameter1,\
33     DmDeviceInfo parameter2);
34     static void* PthreadDeviceStart(void* parameterInfo);
35     void DmCreatThread();
36 
37 private:
38     struct PthreadCallbackParameter {
39         std::map<std::string, std::shared_ptr<ISoftbusStateCallback>> member1;
40         DmDeviceInfo member2;
41     };
42     static funcstr funcName_;
43     static std::map<std::string, std::shared_ptr<ISoftbusStateCallback>> parameter1_;
44     static DmDeviceInfo parameter2_;
45     PthreadCallbackParameter parameterGroup_;
46 };
47 } // namespace DistributedHardware
48 } // namespace OHOS
49 #endif // OHOS_DM_THREAD_H
50