Capabilities.java revision 75bb2a1c3f5c513cde140a8cec417c67423465d2
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
17package com.android.server.wifi.aware;
18
19import android.net.wifi.aware.Characteristics;
20import android.os.Bundle;
21
22/**
23 * A container class for Aware (vendor) implementation capabilities (or
24 * limitations). Filled-in by the firmware.
25 */
26public 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
42    /**
43     * Converts the internal capabilities to a parcelable & potentially app-facing
44     * characteristics bundle. Only some of the information is exposed.
45     */
46    public Characteristics toPublicCharacteristics() {
47        Bundle bundle = new Bundle();
48        bundle.putInt(Characteristics.KEY_MAX_SERVICE_NAME_LENGTH, maxServiceNameLen);
49        bundle.putInt(Characteristics.KEY_MAX_SERVICE_SPECIFIC_INFO_LENGTH,
50                maxServiceSpecificInfoLen);
51        bundle.putInt(Characteristics.KEY_MAX_MATCH_FILTER_LENGTH, maxMatchFilterLen);
52        return new Characteristics(bundle);
53    }
54
55    @Override
56    public String toString() {
57        return "Capabilities [maxConcurrentAwareClusters=" + maxConcurrentAwareClusters
58                + ", maxPublishes=" + maxPublishes + ", maxSubscribes=" + maxSubscribes
59                + ", maxServiceNameLen=" + maxServiceNameLen + ", maxMatchFilterLen="
60                + maxMatchFilterLen + ", maxTotalMatchFilterLen=" + maxTotalMatchFilterLen
61                + ", maxServiceSpecificInfoLen=" + maxServiceSpecificInfoLen
62                + ", maxExtendedServiceSpecificInfoLen=" + maxExtendedServiceSpecificInfoLen
63                + ", maxNdiInterfaces=" + maxNdiInterfaces + ", maxNdpSessions="
64                + maxNdpSessions + ", maxAppInfoLen=" + maxAppInfoLen
65                + ", maxQueuedTransmitMessages=" + maxQueuedTransmitMessages
66                + ", maxSubscribeInterfaceAddresses=" + maxSubscribeInterfaceAddresses
67                + ", supportedCipherSuites=" + supportedCipherSuites
68                + "]";
69    }
70}
71