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 ANDROID_LOWPAN_PROVISION_H
18 #define ANDROID_LOWPAN_PROVISION_H
19 
20 #include <binder/Parcelable.h>
21 #include <utils/String16.h>
22 #include <utils/StrongPointer.h>
23 
24 #include "LowpanIdentity.h"
25 #include "LowpanCredential.h"
26 
27 namespace android {
28 
29 namespace net {
30 
31 namespace lowpan {
32 
33 /*
34  * C++ implementation of the Java class android.net.lowpan.LowpanProvision
35  */
36 class LowpanProvision : public Parcelable {
37 public:
38     LowpanProvision() = default;
39     virtual ~LowpanProvision() = default;
40     LowpanProvision(const LowpanProvision& x) = default;
41 
42     bool operator==(const LowpanProvision& rhs);
43     bool operator!=(const LowpanProvision& rhs) { return !(*this == rhs); }
44 
45     LowpanProvision(const LowpanIdentity& identity, const LowpanCredential& credential);
46     LowpanProvision(const LowpanIdentity& identity);
47 
48     const LowpanIdentity* getLowpanIdentity() const;
49     const LowpanCredential* getLowpanCredential() const;
50 
51 public:
52     // Overrides
53     status_t writeToParcel(Parcel* parcel) const override;
54     status_t readFromParcel(const Parcel* parcel) override;
55 
56 private:
57     // Data
58     LowpanIdentity mIdentity;
59     LowpanCredential mCredential;
60     bool mHasCredential;
61 };
62 
63 }  // namespace lowpan
64 
65 }  // namespace net
66 
67 }  // namespace android
68 
69 #endif  // ANDROID_LOWPAN_PROVISION_H
70