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" 64DISCOVERY_KEY_INSTANT_COMMUNICATION_MODE = "InstantModeEnabled" 65 66PUBLISH_TYPE_UNSOLICITED = 0 67PUBLISH_TYPE_SOLICITED = 1 68 69SUBSCRIBE_TYPE_PASSIVE = 0 70SUBSCRIBE_TYPE_ACTIVE = 1 71 72###################################################### 73# WifiAwareAttachCallback events 74###################################################### 75EVENT_CB_ON_ATTACHED = "WifiAwareOnAttached" 76EVENT_CB_ON_ATTACH_FAILED = "WifiAwareOnAttachFailed" 77 78###################################################### 79# WifiAwareIdentityChangedListener events 80###################################################### 81EVENT_CB_ON_IDENTITY_CHANGED = "WifiAwareOnIdentityChanged" 82 83# WifiAwareAttachCallback & WifiAwareIdentityChangedListener events keys 84EVENT_CB_KEY_REASON = "reason" 85EVENT_CB_KEY_MAC = "mac" 86EVENT_CB_KEY_LATENCY_MS = "latencyMs" 87EVENT_CB_KEY_TIMESTAMP_MS = "timestampMs" 88 89###################################################### 90# WifiAwareDiscoverySessionCallback events 91###################################################### 92SESSION_CB_ON_PUBLISH_STARTED = "WifiAwareSessionOnPublishStarted" 93SESSION_CB_ON_SUBSCRIBE_STARTED = "WifiAwareSessionOnSubscribeStarted" 94SESSION_CB_ON_SESSION_CONFIG_UPDATED = "WifiAwareSessionOnSessionConfigUpdated" 95SESSION_CB_ON_SESSION_CONFIG_FAILED = "WifiAwareSessionOnSessionConfigFailed" 96SESSION_CB_ON_SESSION_TERMINATED = "WifiAwareSessionOnSessionTerminated" 97SESSION_CB_ON_SERVICE_DISCOVERED = "WifiAwareSessionOnServiceDiscovered" 98SESSION_CB_ON_MESSAGE_SENT = "WifiAwareSessionOnMessageSent" 99SESSION_CB_ON_MESSAGE_SEND_FAILED = "WifiAwareSessionOnMessageSendFailed" 100SESSION_CB_ON_MESSAGE_RECEIVED = "WifiAwareSessionOnMessageReceived" 101SESSION_CB_ON_SERVICE_LOST = "WifiAwareSessionOnServiceLost" 102 103# WifiAwareDiscoverySessionCallback events keys 104SESSION_CB_KEY_CB_ID = "callbackId" 105SESSION_CB_KEY_SESSION_ID = "discoverySessionId" 106SESSION_CB_KEY_REASON = "reason" 107SESSION_CB_KEY_PEER_ID = "peerId" 108SESSION_CB_KEY_SERVICE_SPECIFIC_INFO = "serviceSpecificInfo" 109SESSION_CB_KEY_MATCH_FILTER = "matchFilter" 110SESSION_CB_KEY_MATCH_FILTER_LIST = "matchFilterList" 111SESSION_CB_KEY_MESSAGE = "message" 112SESSION_CB_KEY_MESSAGE_ID = "messageId" 113SESSION_CB_KEY_MESSAGE_AS_STRING = "messageAsString" 114SESSION_CB_KEY_LATENCY_MS = "latencyMs" 115SESSION_CB_KEY_TIMESTAMP_MS = "timestampMs" 116SESSION_CB_KEY_DISTANCE_MM = "distanceMm" 117SESSION_CB_KEY_LOST_REASON = "lostReason" 118 119# WifiAwareDiscoverySessionCallback onServiceLost reason code 120REASON_PEER_NOT_VISIBLE = 1 121 122###################################################### 123# WifiAwareRangingListener events (RttManager.RttListener) 124###################################################### 125RTT_LISTENER_CB_ON_SUCCESS = "WifiAwareRangingListenerOnSuccess" 126RTT_LISTENER_CB_ON_FAILURE = "WifiAwareRangingListenerOnFailure" 127RTT_LISTENER_CB_ON_ABORT = "WifiAwareRangingListenerOnAborted" 128 129# WifiAwareRangingListener events (RttManager.RttListener) keys 130RTT_LISTENER_CB_KEY_CB_ID = "callbackId" 131RTT_LISTENER_CB_KEY_SESSION_ID = "sessionId" 132RTT_LISTENER_CB_KEY_RESULTS = "Results" 133RTT_LISTENER_CB_KEY_REASON = "reason" 134RTT_LISTENER_CB_KEY_DESCRIPTION = "description" 135 136###################################################### 137# Capabilities keys 138###################################################### 139 140CAP_MAX_CONCURRENT_AWARE_CLUSTERS = "maxConcurrentAwareClusters" 141CAP_MAX_PUBLISHES = "maxPublishes" 142CAP_MAX_SUBSCRIBES = "maxSubscribes" 143CAP_MAX_SERVICE_NAME_LEN = "maxServiceNameLen" 144CAP_MAX_MATCH_FILTER_LEN = "maxMatchFilterLen" 145CAP_MAX_TOTAL_MATCH_FILTER_LEN = "maxTotalMatchFilterLen" 146CAP_MAX_SERVICE_SPECIFIC_INFO_LEN = "maxServiceSpecificInfoLen" 147CAP_MAX_EXTENDED_SERVICE_SPECIFIC_INFO_LEN = "maxExtendedServiceSpecificInfoLen" 148CAP_MAX_NDI_INTERFACES = "maxNdiInterfaces" 149CAP_MAX_NDP_SESSIONS = "maxNdpSessions" 150CAP_MAX_APP_INFO_LEN = "maxAppInfoLen" 151CAP_MAX_QUEUED_TRANSMIT_MESSAGES = "maxQueuedTransmitMessages" 152CAP_MAX_SUBSCRIBE_INTERFACE_ADDRESSES = "maxSubscribeInterfaceAddresses" 153CAP_SUPPORTED_CIPHER_SUITES = "supportedCipherSuites" 154CAP_SUPPORTED_INSTANT_COMMUNICATION_MODE = "isInstantCommunicationModeSupported" 155 156###################################################### 157# WifiAwareNetworkCapabilities keys 158###################################################### 159 160NET_CAP_IPV6 = "aware_ipv6" 161NET_CAP_PORT = "aware_port" 162NET_CAP_TRANSPORT_PROTOCOL = "aware_transport_protocol" 163 164###################################################### 165 166# Aware NDI (NAN data-interface) name prefix 167AWARE_NDI_PREFIX = "aware_data" 168 169# Aware discovery channels 170AWARE_DISCOVERY_CHANNEL_24_BAND = 6 171AWARE_DISCOVERY_CHANNEL_5_BAND = 149 172 173# Aware Data-Path Constants 174DATA_PATH_INITIATOR = 0 175DATA_PATH_RESPONDER = 1 176 177# Maximum send retry 178MAX_TX_RETRIES = 5 179 180# Callback keys (for 'adb shell cmd wifiaware native_cb get_cb_count') 181CB_EV_CLUSTER = "0" 182CB_EV_DISABLED = "1" 183CB_EV_PUBLISH_TERMINATED = "2" 184CB_EV_SUBSCRIBE_TERMINATED = "3" 185CB_EV_MATCH = "4" 186CB_EV_MATCH_EXPIRED = "5" 187CB_EV_FOLLOWUP_RECEIVED = "6" 188CB_EV_TRANSMIT_FOLLOWUP = "7" 189CB_EV_DATA_PATH_REQUEST = "8" 190CB_EV_DATA_PATH_CONFIRM = "9" 191CB_EV_DATA_PATH_TERMINATED = "10" 192