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 #include "netsys_event_message.h"
17 
18 #include "netnative_log_wrapper.h"
19 
20 namespace OHOS {
21 namespace nmd {
PushMessage(NetsysEventMessage::Type type,const std::string & value)22 void NetsysEventMessage::PushMessage(NetsysEventMessage::Type type, const std::string &value)
23 {
24     messageMap_[type] = value;
25 }
26 
GetMessage(NetsysEventMessage::Type type)27 const std::string NetsysEventMessage::GetMessage(NetsysEventMessage::Type type)
28 {
29     const std::string empty = "";
30     if (messageMap_.find(type) == messageMap_.end()) {
31         return empty;
32     }
33     return messageMap_[type];
34 }
35 
DumpMessage()36 void NetsysEventMessage::DumpMessage()
37 {
38     NETNATIVE_LOG_D("DumpMessage: Action: %{public}d; SybSys: %{public}d; SeqNum: %{public}d; ", action_, subSys_,
39                     seqNum_);
40     for (auto &item : messageMap_) {
41         NETNATIVE_LOG_D("type: %{public}d", item.first);
42     }
43 }
44 } // namespace nmd
45 } // namespace OHOS