• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2016 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 package com.android.server.wifi.aware;
18 
19 import android.net.wifi.aware.Characteristics;
20 import android.os.Bundle;
21 
22 /**
23  * A container class for Aware (vendor) implementation capabilities (or
24  * limitations). Filled-in by the firmware.
25  */
26 public class Capabilities {
27     public int maxConcurrentAwareClusters;
28     public int maxPublishes;
29     public int maxSubscribes;
30     public int maxServiceNameLen;
31     public int maxMatchFilterLen;
32     public int maxTotalMatchFilterLen;
33     public int maxServiceSpecificInfoLen;
34     public int maxExtendedServiceSpecificInfoLen;
35     public int maxNdiInterfaces;
36     public int maxNdpSessions;
37     public int maxAppInfoLen;
38     public int maxQueuedTransmitMessages;
39     public int maxSubscribeInterfaceAddresses;
40     public int supportedCipherSuites;
41     public boolean isInstantCommunicationModeSupported;
42 
43     /**
44      * Converts the internal capabilities to a parcelable & potentially app-facing
45      * characteristics bundle. Only some of the information is exposed.
46      */
toPublicCharacteristics()47     public Characteristics toPublicCharacteristics() {
48         Bundle bundle = new Bundle();
49         bundle.putInt(Characteristics.KEY_MAX_SERVICE_NAME_LENGTH, maxServiceNameLen);
50         bundle.putInt(Characteristics.KEY_MAX_SERVICE_SPECIFIC_INFO_LENGTH,
51                 maxServiceSpecificInfoLen);
52         bundle.putInt(Characteristics.KEY_MAX_MATCH_FILTER_LENGTH, maxMatchFilterLen);
53         bundle.putInt(Characteristics.KEY_SUPPORTED_CIPHER_SUITES, supportedCipherSuites);
54         bundle.putBoolean(Characteristics.KEY_IS_INSTANT_COMMUNICATION_MODE_SUPPORTED,
55                 isInstantCommunicationModeSupported);
56         bundle.putInt(Characteristics.KEY_MAX_NDP_NUMBER, maxNdpSessions);
57         bundle.putInt(Characteristics.KEY_MAX_NDI_NUMBER, maxNdiInterfaces);
58         bundle.putInt(Characteristics.KEY_MAX_PUBLISH_NUMBER, maxPublishes);
59         bundle.putInt(Characteristics.KEY_MAX_SUBSCRIBE_NUMBER, maxSubscribes);
60         return new Characteristics(bundle);
61     }
62 
63     @Override
toString()64     public String toString() {
65         return "Capabilities [maxConcurrentAwareClusters=" + maxConcurrentAwareClusters
66                 + ", maxPublishes=" + maxPublishes + ", maxSubscribes=" + maxSubscribes
67                 + ", maxServiceNameLen=" + maxServiceNameLen + ", maxMatchFilterLen="
68                 + maxMatchFilterLen + ", maxTotalMatchFilterLen=" + maxTotalMatchFilterLen
69                 + ", maxServiceSpecificInfoLen=" + maxServiceSpecificInfoLen
70                 + ", maxExtendedServiceSpecificInfoLen=" + maxExtendedServiceSpecificInfoLen
71                 + ", maxNdiInterfaces=" + maxNdiInterfaces + ", maxNdpSessions="
72                 + maxNdpSessions + ", maxAppInfoLen=" + maxAppInfoLen
73                 + ", maxQueuedTransmitMessages=" + maxQueuedTransmitMessages
74                 + ", maxSubscribeInterfaceAddresses=" + maxSubscribeInterfaceAddresses
75                 + ", supportedCipherSuites=" + supportedCipherSuites
76                 + ", isInstantCommunicationModeSupport=" + isInstantCommunicationModeSupported
77                 + "]";
78     }
79 }
80