1 /*
2  * Copyright (c) 2024 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 I_EVENT_BEAN_H
17 #define I_EVENT_BEAN_H
18 
19 #include <map>
20 #include "media_monitor_info.h"
21 #include "iremote_proxy.h"
22 
23 namespace OHOS {
24 namespace Media {
25 namespace MediaMonitor {
26 
27 class EventBean {
28 public:
29     EventBean();
30     EventBean(const ModuleId &mId, const EventId &eId,
31         const EventType &type);
32     ~EventBean() = default;
33 
34     void Add(const std::string &key, int32_t value);
35     void Add(const std::string &key, std::string value);
36     void Add(const std::string &key, uint64_t value);
37     void Add(const std::string &key, float value);
38 
39     std::map<std::string, int32_t> GetIntMap();
40     std::map<std::string, std::string> GetStringMap();
41     std::map<std::string, uint64_t> GetUint64Map();
42     std::map<std::string, float> GetFloatMap();
43 
44     void UpdateIntMap(const std::string &key, int32_t value);
45     void UpdateStringMap(const std::string &key, std::string value);
46     void UpdateUint64Map(const std::string &key, uint64_t value);
47     void UpdateFloatMap(const std::string &key, float value);
48 
49     int32_t GetIntValue(const std::string &key);
50     std::string GetStringValue(const std::string &key);
51     uint64_t GetUint64Value(const std::string &key);
52     float GetFloatValue(const std::string &key);
53 
54     ModuleId GetModuleId();
55     EventId GetEventId();
56     EventType GetEventType();
57 
58     void SetModuleId(const ModuleId &mId);
59     void SetEventId(const EventId &eId);
60     void SetEventType(const EventType &type);
61 
62     bool WriteToParcel(MessageParcel &parcel);
63     void ReadFromParcel(MessageParcel &parcel);
64 
65 private:
66     ModuleId moduleId_ = UNKNOW_MODULEID;
67     EventId eventId_ = UNKNOW_EVENTID;
68     EventType eventType_ = UNKNOW_EVENTTYPE;
69     std::map<std::string, int32_t> intMap_;
70     std::map<std::string, std::string> stringMap_;
71     std::map<std::string, uint64_t> uint64Map_;
72     std::map<std::string, float> floatMap_;
73 };
74 } // namespace MediaMonitor
75 } // namespace Media
76 } // namespace OHOS
77 
78 #endif // I_EVENT_BEAN_H