1#!/usr/bin/env python3 2# 3# Copyright 2016 - Google 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16 17###################################################### 18# Aware power settings values for interactive (high power) and 19# non-interactive (low power) modes 20###################################################### 21 22POWER_DW_24_INTERACTIVE = 1 23POWER_DW_5_INTERACTIVE = 1 24POWER_DISC_BEACON_INTERVAL_INTERACTIVE = 0 25POWER_NUM_SS_IN_DISC_INTERACTIVE = 0 26POWER_ENABLE_DW_EARLY_TERM_INTERACTIVE = 0 27 28POWER_DW_24_NON_INTERACTIVE = 4 29POWER_DW_5_NON_INTERACTIVE = 0 30POWER_DISC_BEACON_INTERVAL_NON_INTERACTIVE = 0 31POWER_NUM_SS_IN_DISC_NON_INTERACTIVE = 0 32POWER_ENABLE_DW_EARLY_TERM_NON_INTERACTIVE = 0 33 34###################################################### 35# Broadcast events 36###################################################### 37BROADCAST_WIFI_AWARE_AVAILABLE = "WifiAwareAvailable" 38BROADCAST_WIFI_AWARE_NOT_AVAILABLE = "WifiAwareNotAvailable" 39 40###################################################### 41# ConfigRequest keys 42###################################################### 43 44CONFIG_KEY_5G_BAND = "Support5gBand" 45CONFIG_KEY_MASTER_PREF = "MasterPreference" 46CONFIG_KEY_CLUSTER_LOW = "ClusterLow" 47CONFIG_KEY_CLUSTER_HIGH = "ClusterHigh" 48CONFIG_KEY_ENABLE_IDEN_CB = "EnableIdentityChangeCallback" 49 50###################################################### 51# Publish & Subscribe Config keys 52###################################################### 53 54DISCOVERY_KEY_SERVICE_NAME = "ServiceName" 55DISCOVERY_KEY_SSI = "ServiceSpecificInfo" 56DISCOVERY_KEY_MATCH_FILTER = "MatchFilter" 57DISCOVERY_KEY_MATCH_FILTER_LIST = "MatchFilterList" 58DISCOVERY_KEY_DISCOVERY_TYPE = "DiscoveryType" 59DISCOVERY_KEY_TTL = "TtlSec" 60DISCOVERY_KEY_TERM_CB_ENABLED = "TerminateNotificationEnabled" 61DISCOVERY_KEY_RANGING_ENABLED = "RangingEnabled" 62DISCOVERY_KEY_MIN_DISTANCE_MM = "MinDistanceMm" 63DISCOVERY_KEY_MAX_DISTANCE_MM = "MaxDistanceMm" 64 65PUBLISH_TYPE_UNSOLICITED = 0 66PUBLISH_TYPE_SOLICITED = 1 67 68SUBSCRIBE_TYPE_PASSIVE = 0 69SUBSCRIBE_TYPE_ACTIVE = 1 70 71###################################################### 72# WifiAwareAttachCallback events 73###################################################### 74EVENT_CB_ON_ATTACHED = "WifiAwareOnAttached" 75EVENT_CB_ON_ATTACH_FAILED = "WifiAwareOnAttachFailed" 76 77###################################################### 78# WifiAwareIdentityChangedListener events 79###################################################### 80EVENT_CB_ON_IDENTITY_CHANGED = "WifiAwareOnIdentityChanged" 81 82# WifiAwareAttachCallback & WifiAwareIdentityChangedListener events keys 83EVENT_CB_KEY_REASON = "reason" 84EVENT_CB_KEY_MAC = "mac" 85EVENT_CB_KEY_LATENCY_MS = "latencyMs" 86EVENT_CB_KEY_TIMESTAMP_MS = "timestampMs" 87 88###################################################### 89# WifiAwareDiscoverySessionCallback events 90###################################################### 91SESSION_CB_ON_PUBLISH_STARTED = "WifiAwareSessionOnPublishStarted" 92SESSION_CB_ON_SUBSCRIBE_STARTED = "WifiAwareSessionOnSubscribeStarted" 93SESSION_CB_ON_SESSION_CONFIG_UPDATED = "WifiAwareSessionOnSessionConfigUpdated" 94SESSION_CB_ON_SESSION_CONFIG_FAILED = "WifiAwareSessionOnSessionConfigFailed" 95SESSION_CB_ON_SESSION_TERMINATED = "WifiAwareSessionOnSessionTerminated" 96SESSION_CB_ON_SERVICE_DISCOVERED = "WifiAwareSessionOnServiceDiscovered" 97SESSION_CB_ON_MESSAGE_SENT = "WifiAwareSessionOnMessageSent" 98SESSION_CB_ON_MESSAGE_SEND_FAILED = "WifiAwareSessionOnMessageSendFailed" 99SESSION_CB_ON_MESSAGE_RECEIVED = "WifiAwareSessionOnMessageReceived" 100 101# WifiAwareDiscoverySessionCallback events keys 102SESSION_CB_KEY_CB_ID = "callbackId" 103SESSION_CB_KEY_SESSION_ID = "discoverySessionId" 104SESSION_CB_KEY_REASON = "reason" 105SESSION_CB_KEY_PEER_ID = "peerId" 106SESSION_CB_KEY_SERVICE_SPECIFIC_INFO = "serviceSpecificInfo" 107SESSION_CB_KEY_MATCH_FILTER = "matchFilter" 108SESSION_CB_KEY_MATCH_FILTER_LIST = "matchFilterList" 109SESSION_CB_KEY_MESSAGE = "message" 110SESSION_CB_KEY_MESSAGE_ID = "messageId" 111SESSION_CB_KEY_MESSAGE_AS_STRING = "messageAsString" 112SESSION_CB_KEY_LATENCY_MS = "latencyMs" 113SESSION_CB_KEY_TIMESTAMP_MS = "timestampMs" 114SESSION_CB_KEY_DISTANCE_MM = "distanceMm" 115 116###################################################### 117# WifiAwareRangingListener events (RttManager.RttListener) 118###################################################### 119RTT_LISTENER_CB_ON_SUCCESS = "WifiAwareRangingListenerOnSuccess" 120RTT_LISTENER_CB_ON_FAILURE = "WifiAwareRangingListenerOnFailure" 121RTT_LISTENER_CB_ON_ABORT = "WifiAwareRangingListenerOnAborted" 122 123# WifiAwareRangingListener events (RttManager.RttListener) keys 124RTT_LISTENER_CB_KEY_CB_ID = "callbackId" 125RTT_LISTENER_CB_KEY_SESSION_ID = "sessionId" 126RTT_LISTENER_CB_KEY_RESULTS = "Results" 127RTT_LISTENER_CB_KEY_REASON = "reason" 128RTT_LISTENER_CB_KEY_DESCRIPTION = "description" 129 130###################################################### 131# Capabilities keys 132###################################################### 133 134CAP_MAX_CONCURRENT_AWARE_CLUSTERS = "maxConcurrentAwareClusters" 135CAP_MAX_PUBLISHES = "maxPublishes" 136CAP_MAX_SUBSCRIBES = "maxSubscribes" 137CAP_MAX_SERVICE_NAME_LEN = "maxServiceNameLen" 138CAP_MAX_MATCH_FILTER_LEN = "maxMatchFilterLen" 139CAP_MAX_TOTAL_MATCH_FILTER_LEN = "maxTotalMatchFilterLen" 140CAP_MAX_SERVICE_SPECIFIC_INFO_LEN = "maxServiceSpecificInfoLen" 141CAP_MAX_EXTENDED_SERVICE_SPECIFIC_INFO_LEN = "maxExtendedServiceSpecificInfoLen" 142CAP_MAX_NDI_INTERFACES = "maxNdiInterfaces" 143CAP_MAX_NDP_SESSIONS = "maxNdpSessions" 144CAP_MAX_APP_INFO_LEN = "maxAppInfoLen" 145CAP_MAX_QUEUED_TRANSMIT_MESSAGES = "maxQueuedTransmitMessages" 146CAP_MAX_SUBSCRIBE_INTERFACE_ADDRESSES = "maxSubscribeInterfaceAddresses" 147CAP_SUPPORTED_CIPHER_SUITES = "supportedCipherSuites" 148 149###################################################### 150# WifiAwareNetworkCapabilities keys 151###################################################### 152 153NET_CAP_IPV6 = "aware_ipv6" 154NET_CAP_PORT = "aware_port" 155NET_CAP_TRANSPORT_PROTOCOL = "aware_transport_protocol" 156 157###################################################### 158 159# Aware NDI (NAN data-interface) name prefix 160AWARE_NDI_PREFIX = "aware_data" 161 162# Aware discovery channels 163AWARE_DISCOVERY_CHANNEL_24_BAND = 6 164AWARE_DISCOVERY_CHANNEL_5_BAND = 149 165 166# Aware Data-Path Constants 167DATA_PATH_INITIATOR = 0 168DATA_PATH_RESPONDER = 1 169 170# Maximum send retry 171MAX_TX_RETRIES = 5 172 173# Callback keys (for 'adb shell cmd wifiaware native_cb get_cb_count') 174CB_EV_CLUSTER = "0" 175CB_EV_DISABLED = "1" 176CB_EV_PUBLISH_TERMINATED = "2" 177CB_EV_SUBSCRIBE_TERMINATED = "3" 178CB_EV_MATCH = "4" 179CB_EV_MATCH_EXPIRED = "5" 180CB_EV_FOLLOWUP_RECEIVED = "6" 181CB_EV_TRANSMIT_FOLLOWUP = "7" 182CB_EV_DATA_PATH_REQUEST = "8" 183CB_EV_DATA_PATH_CONFIRM = "9" 184CB_EV_DATA_PATH_TERMINATED = "10" 185