• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef CHRE_WIFI_OFFLOAD_PREFERRED_NETWORK_H_
18 #define CHRE_WIFI_OFFLOAD_PREFERRED_NETWORK_H_
19 
20 #include "chre/apps/wifi_offload/wifi_offload.h"
21 
22 #include "chre/apps/wifi_offload/flatbuffers_types_generated.h"
23 #include "chre/apps/wifi_offload/ssid.h"
24 
25 namespace wifi_offload {
26 
27 enum SecurityMode : uint8_t {
28   UNKNOWN = 0,
29   OPEN = 0x1 << 0,
30   WEP = 0x1 << 1,
31   PSK = 0x1 << 2,
32   EAP = 0x1 << 3,
33   ALL_SECURITY_MODES_MASK = OPEN | WEP | PSK | EAP,
34 };
35 
36 class PreferredNetwork {
37  public:
38   /* Corresponding flatbuffers-generated data-type used to serialize and
39    * deserialize instances of this class */
40   using FbsType = fbs::PreferredNetwork;
41 
42   PreferredNetwork();
43 
44   PreferredNetwork(PreferredNetwork &&other) = default;
45 
46   ~PreferredNetwork() = default;
47 
48   bool operator==(const PreferredNetwork &other) const;
49 
50   flatbuffers::Offset<FbsType> Serialize(
51       flatbuffers::FlatBufferBuilder *builder) const;
52 
53   bool Deserialize(const FbsType &fbs_network);
54 
55   void Log() const;
56 
57   Ssid ssid_;
58   /* SecurityMode flags that are associated with this SSID
59    * More than one security mode can be supported, see SecurityMode */
60   uint8_t security_modes_;
61 };
62 
63 }  // namespace wifi_offload
64 
65 #endif  // CHRE_WIFI_OFFLOAD_PREFERRED_NETWORK_H_
66