• 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_SSID_H_
18 #define CHRE_WIFI_OFFLOAD_SSID_H_
19 
20 #include "chre/apps/wifi_offload/wifi_offload.h"
21 
22 #include "chre/apps/wifi_offload/flatbuffers_types_generated.h"
23 
24 namespace wifi_offload {
25 
26 /* SSID of the Access Point, maximum 32 characters */
27 class Ssid {
28  public:
29   /* Corresponding flatbuffers-generated data-type used to serialize and
30    * deserialize instances of this class */
31   using FbsType = fbs::Ssid;
32 
33   static constexpr size_t kMaxSsidLen = CHRE_WIFI_SSID_MAX_LEN;  // = 32
34 
35   Ssid() = default;
36 
37   Ssid(const Ssid &other);
38 
39   Ssid(Ssid &&other) = default;
40 
41   ~Ssid() = default;
42 
43   void SetData(const uint8_t *buff, size_t len);
44 
45   bool operator==(const Ssid &other) const;
46 
47   flatbuffers::Offset<Ssid::FbsType> Serialize(
48       flatbuffers::FlatBufferBuilder *builder) const;
49 
50   bool Deserialize(const Ssid::FbsType &fbs_ssid);
51 
52   void Log() const;
53 
54   void ToChreWifiSsidListItem(chreWifiSsidListItem *chre_ssid) const;
55 
56  private:
57   Vector<uint8_t> ssid_vec_;
58 };
59 
60 }  // namespace wifi_offload
61 
62 #endif  // CHRE_WIFI_OFFLOAD_SSID_H_
63