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_WIFI_COMMON_MSG_H
17 #define OHOS_WIFI_COMMON_MSG_H
18 #include <string>
19 
20 namespace OHOS {
21 namespace Wifi {
22 enum class ServiceType {
23     DEFAULT = 0,
24     WIFI_EXT = 1,
25 };
26 
27 constexpr int RANDOM_DEVICE_ADDRESS = 0;
28 constexpr int REAL_DEVICE_ADDRESS = 1;
29 
30 enum class WifiMacAddrInfoType {
31     WIFI_SCANINFO_MACADDR_INFO     = 0,
32     HOTSPOT_MACADDR_INFO           = 1,
33     P2P_DEVICE_MACADDR_INFO        = 2,
34     P2P_GROUPSINFO_MACADDR_INFO    = 3,
35     P2P_CURRENT_GROUP_MACADDR_INFO = 4,
36     INVALID_MACADDR_INFO
37 };
38 
39 struct WifiMacAddrInfo {
40     std::string bssid; /* mac address */
41     int bssidType; /* mac address type */
42     bool operator == (const WifiMacAddrInfo& mac)
43     {
44         if ((bssid == mac.bssid) && (bssidType == mac.bssidType)) {
45             return true;
46         }
47         return false;
48     }
49     bool operator != (const WifiMacAddrInfo& mac)
50     {
51         if ((bssid != mac.bssid) || (bssidType != mac.bssidType)) {
52             return true;
53         }
54         return false;
55     }
56     bool operator < (const WifiMacAddrInfo& mac) const
57     {
58         if (bssid == mac.bssid) {
59             return bssidType < mac.bssidType;
60         }
61         return bssid < mac.bssid;
62     }
63     WifiMacAddrInfo& operator = (const WifiMacAddrInfo& mac)
64     {
65         bssid = mac.bssid;
66         bssidType = mac.bssidType;
67         return *this;
68     }
69 };
70 }  // namespace Wifi
71 }  // namespace OHOS
72 #endif