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" 100SESSION_CB_ON_SERVICE_LOST = "WifiAwareSessionOnServiceLost" 101 102# WifiAwareDiscoverySessionCallback events keys 103SESSION_CB_KEY_CB_ID = "callbackId" 104SESSION_CB_KEY_SESSION_ID = "discoverySessionId" 105SESSION_CB_KEY_REASON = "reason" 106SESSION_CB_KEY_PEER_ID = "peerId" 107SESSION_CB_KEY_SERVICE_SPECIFIC_INFO = "serviceSpecificInfo" 108SESSION_CB_KEY_MATCH_FILTER = "matchFilter" 109SESSION_CB_KEY_MATCH_FILTER_LIST = "matchFilterList" 110SESSION_CB_KEY_MESSAGE = "message" 111SESSION_CB_KEY_MESSAGE_ID = "messageId" 112SESSION_CB_KEY_MESSAGE_AS_STRING = "messageAsString" 113SESSION_CB_KEY_LATENCY_MS = "latencyMs" 114SESSION_CB_KEY_TIMESTAMP_MS = "timestampMs" 115SESSION_CB_KEY_DISTANCE_MM = "distanceMm" 116SESSION_CB_KEY_LOST_REASON = "lostReason" 117 118# WifiAwareDiscoverySessionCallback onServiceLost reason code 119REASON_PEER_NOT_VISIBLE = 1 120 121###################################################### 122# WifiAwareRangingListener events (RttManager.RttListener) 123###################################################### 124RTT_LISTENER_CB_ON_SUCCESS = "WifiAwareRangingListenerOnSuccess" 125RTT_LISTENER_CB_ON_FAILURE = "WifiAwareRangingListenerOnFailure" 126RTT_LISTENER_CB_ON_ABORT = "WifiAwareRangingListenerOnAborted" 127 128# WifiAwareRangingListener events (RttManager.RttListener) keys 129RTT_LISTENER_CB_KEY_CB_ID = "callbackId" 130RTT_LISTENER_CB_KEY_SESSION_ID = "sessionId" 131RTT_LISTENER_CB_KEY_RESULTS = "Results" 132RTT_LISTENER_CB_KEY_REASON = "reason" 133RTT_LISTENER_CB_KEY_DESCRIPTION = "description" 134 135###################################################### 136# Capabilities keys 137###################################################### 138 139CAP_MAX_CONCURRENT_AWARE_CLUSTERS = "maxConcurrentAwareClusters" 140CAP_MAX_PUBLISHES = "maxPublishes" 141CAP_MAX_SUBSCRIBES = "maxSubscribes" 142CAP_MAX_SERVICE_NAME_LEN = "maxServiceNameLen" 143CAP_MAX_MATCH_FILTER_LEN = "maxMatchFilterLen" 144CAP_MAX_TOTAL_MATCH_FILTER_LEN = "maxTotalMatchFilterLen" 145CAP_MAX_SERVICE_SPECIFIC_INFO_LEN = "maxServiceSpecificInfoLen" 146CAP_MAX_EXTENDED_SERVICE_SPECIFIC_INFO_LEN = "maxExtendedServiceSpecificInfoLen" 147CAP_MAX_NDI_INTERFACES = "maxNdiInterfaces" 148CAP_MAX_NDP_SESSIONS = "maxNdpSessions" 149CAP_MAX_APP_INFO_LEN = "maxAppInfoLen" 150CAP_MAX_QUEUED_TRANSMIT_MESSAGES = "maxQueuedTransmitMessages" 151CAP_MAX_SUBSCRIBE_INTERFACE_ADDRESSES = "maxSubscribeInterfaceAddresses" 152CAP_SUPPORTED_CIPHER_SUITES = "supportedCipherSuites" 153 154###################################################### 155# WifiAwareNetworkCapabilities keys 156###################################################### 157 158NET_CAP_IPV6 = "aware_ipv6" 159NET_CAP_PORT = "aware_port" 160NET_CAP_TRANSPORT_PROTOCOL = "aware_transport_protocol" 161 162###################################################### 163 164# Aware NDI (NAN data-interface) name prefix 165AWARE_NDI_PREFIX = "aware_data" 166 167# Aware discovery channels 168AWARE_DISCOVERY_CHANNEL_24_BAND = 6 169AWARE_DISCOVERY_CHANNEL_5_BAND = 149 170 171# Aware Data-Path Constants 172DATA_PATH_INITIATOR = 0 173DATA_PATH_RESPONDER = 1 174 175# Maximum send retry 176MAX_TX_RETRIES = 5 177 178# Callback keys (for 'adb shell cmd wifiaware native_cb get_cb_count') 179CB_EV_CLUSTER = "0" 180CB_EV_DISABLED = "1" 181CB_EV_PUBLISH_TERMINATED = "2" 182CB_EV_SUBSCRIBE_TERMINATED = "3" 183CB_EV_MATCH = "4" 184CB_EV_MATCH_EXPIRED = "5" 185CB_EV_FOLLOWUP_RECEIVED = "6" 186CB_EV_TRANSMIT_FOLLOWUP = "7" 187CB_EV_DATA_PATH_REQUEST = "8" 188CB_EV_DATA_PATH_CONFIRM = "9" 189CB_EV_DATA_PATH_TERMINATED = "10" 190