• 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 #ifndef HIVIEW_PUBLIC_PLUGIN_EXTRA_INFO_DEFINES_H
16 #define HIVIEW_PUBLIC_PLUGIN_EXTRA_INFO_DEFINES_H
17 #include <string>
18 #include <vector>
19 #include <list>
20 
21 #include "event.h"
22 
23 namespace OHOS {
24 namespace HiviewDFX {
25 static const std::string DISTRIBUTED_COMMUNICATOR_PLUGIN = "DistributedCommunicatorPlugin";
26 struct PluginCapacityInfo {
27     std::string name_; // plugin name
28     std::vector<std::string> capacities_; // capacity list
29     std::string type_; // reserved
30     std::vector<std::string> accessAuth_; // reserved
31 };
32 enum CapacityEventId : uint32_t {
33     CAP_PUBLISH = 0x5a,
34     CAP_OBTAIN
35 };
36 
37 class CapacityPublishEvent : public Event {
38 public:
CapacityPublishEvent(const std::string & sender,const PluginCapacityInfo & pluginCapacityInfo)39     CapacityPublishEvent(const std::string &sender, const PluginCapacityInfo &pluginCapacityInfo)
40         : Event(sender), pluginCapacity_(pluginCapacityInfo) {};
~CapacityPublishEvent()41     virtual ~CapacityPublishEvent() {};
42     PluginCapacityInfo pluginCapacity_;
43 };
44 
45 class CapacityObtainEvent : public Event {
46 public:
CapacityObtainEvent(const std::string & plugin,const std::string capacity)47     CapacityObtainEvent(const std::string &plugin, const std::string capacity)
48         : Event(plugin), plugin_(plugin), capacity_(capacity) {};
~CapacityObtainEvent()49     virtual ~CapacityObtainEvent() {};
50     std::string plugin_;
51     std::string capacity_;
52     std::list<std::string> deviceList_;
53 };
54 } // end of namespace HiviewDFX
55 } // end of namespace OHOS
56 #endif
57