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 PAN_MESSAGE_H
17 #define PAN_MESSAGE_H
18 
19 #include <string>
20 
21 #include "message.h"
22 #include "securec.h"
23 #include "pan_defines.h"
24 
25 namespace OHOS {
26 namespace bluetooth {
27 class PanMessage : public utility::Message {
28 public:
29     explicit PanMessage(int what = 0, int arg1 = 0, void *arg2 = nullptr) : utility::Message(what, arg1, arg2)
30     {}
PanMessage(const PanMessage & src)31     PanMessage(const PanMessage &src) : utility::Message(src.what_, src.arg1_, src.arg2_),
32         dev_(src.dev_),
33         ethernetHeader_(src.ethernetHeader_),
34         l2capInfo_(src.l2capInfo_),
35         data_(src.data_),
36         dataLength_(src.dataLength_)
37     {
38     }
39     ~PanMessage() = default;
40     std::string dev_;
41     EthernetHeader ethernetHeader_ {};
42     PanL2capConnectionInfo l2capInfo_ {};
43     std::shared_ptr<std::unique_ptr<uint8_t[]>> data_ = nullptr;
44     int dataLength_ = 0;
45 
46     PanMessage operator=(const PanMessage &src)
47     {
48         if (this != &src) {
49             dev_ = src.dev_;
50             ethernetHeader_ = src.ethernetHeader_;
51             l2capInfo_ = src.l2capInfo_;
52             data_ = src.data_;
53             dataLength_ = src.dataLength_;
54         }
55         return *this;
56     }
57 };
58 }  // namespace bluetooth
59 }  // namespace OHOS
60 #endif  // PAN_MESSAGE_H
61