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# Constants for Wifi related events.
18WIFI_CONNECTED = "WifiNetworkConnected"
19WIFI_DISCONNECTED = "WifiNetworkDisconnected"
20SUPPLICANT_CON_CHANGED = "SupplicantConnectionChanged"
21WIFI_STATE_CHANGED = "WifiStateChanged"
22WIFI_FORGET_NW_SUCCESS = "WifiManagerForgetNetworkOnSuccess"
23WIFI_NETWORK_REQUEST_MATCH_CB_ON_MATCH = "WifiManagerNetworkRequestMatchCallbackOnMatch"
24WIFI_NETWORK_REQUEST_MATCH_CB_ON_CONNECT_SUCCESS = "WifiManagerNetworkRequestMatchCallbackOnUserSelectionConnectSuccess"
25WIFI_NETWORK_REQUEST_MATCH_CB_ON_CONNECT_FAILURE = "WifiManagerNetworkRequestMatchCallbackOnUserSelectionConnectFailure"
26WIFI_NETWORK_CB_ON_AVAILABLE = "WifiManagerNetworkCallbackOnAvailable"
27WIFI_NETWORK_CB_ON_UNAVAILABLE = "WifiManagerNetworkCallbackOnUnavailable"
28WIFI_NETWORK_CB_ON_LOST = "WifiManagerNetworkCallbackOnLost"
29WIFI_NETWORK_SUGGESTION_POST_CONNECTION = "WifiNetworkSuggestionPostConnection"
30
31# These constants will be used by the ACTS wifi tests.
32CONNECT_BY_CONFIG_SUCCESS = 'WifiManagerConnectByConfigOnSuccess'
33CONNECT_BY_NETID_SUCCESS = 'WifiManagerConnectByNetIdOnSuccess'
34
35# Softap related constants
36SOFTAP_CALLBACK_EVENT = "WifiManagerSoftApCallback-"
37# Callback Event for softap state change
38# WifiManagerSoftApCallback-[callbackId]-OnStateChanged
39SOFTAP_STATE_CHANGED = "-OnStateChanged"
40SOFTAP_STATE_CHANGE_CALLBACK_KEY = "State"
41WIFI_AP_DISABLING_STATE = 10
42WIFI_AP_DISABLED_STATE = 11
43WIFI_AP_ENABLING_STATE = 12
44WIFI_AP_ENABLED_STATE = 13
45WIFI_AP_FAILED_STATE = 14
46
47# Callback Event for client number change:
48# WifiManagerSoftApCallback-[callbackId]-OnNumClientsChanged
49SOFTAP_NUMBER_CLIENTS_CHANGED = "-OnNumClientsChanged"
50SOFTAP_NUMBER_CLIENTS_CALLBACK_KEY = "NumClients"
51SOFTAP_CLIENTS_MACS_CALLBACK_KEY = "MacAddresses"
52# Callback Event for softap info change
53SOFTAP_INFO_CHANGED = "-OnInfoChanged"
54SOFTAP_INFO_FREQUENCY_CALLBACK_KEY = "frequency"
55SOFTAP_INFO_BANDWIDTH_CALLBACK_KEY = "bandwidth"
56# Callback Event for softap client blocking
57SOFTAP_BLOCKING_CLIENT_CONNECTING = "-OnBlockedClientConnecting"
58SOFTAP_BLOCKING_CLIENT_REASON_KEY = "BlockedReason"
59SOFTAP_BLOCKING_CLIENT_WIFICLIENT_KEY = "WifiClient"
60SAP_CLIENT_BLOCK_REASON_CODE_BLOCKED_BY_USER = 0
61SAP_CLIENT_BLOCK_REASON_CODE_NO_MORE_STAS = 1
62
63# Callback Event for softap capability
64SOFTAP_CAPABILITY_CHANGED = "-OnCapabilityChanged"
65SOFTAP_CAPABILITY_MAX_SUPPORTED_CLIENTS = "maxSupportedClients"
66SOFTAP_CAPABILITY_FEATURE_ACS = "acsOffloadSupported"
67SOFTAP_CAPABILITY_FEATURE_CLIENT_CONTROL = "clientForceDisconnectSupported"
68SOFTAP_CAPABILITY_FEATURE_WPA3_SAE = "wpa3SaeSupported"
69
70DEFAULT_SOFTAP_TIMEOUT_S = 600 # 10 minutes
71
72# AP related constants
73AP_MAIN = "main_AP"
74AP_AUX = "aux_AP"
75SSID = "SSID"
76
77# cnss_diag property related constants
78DEVICES_USING_LEGACY_PROP = ["sailfish", "marlin", "walleye", "taimen", "muskie"]
79CNSS_DIAG_PROP = "persist.vendor.sys.cnss.diag_txt"
80LEGACY_CNSS_DIAG_PROP = "persist.sys.cnss.diag_txt"
81
82# Delay before registering the match callback.
83NETWORK_REQUEST_CB_REGISTER_DELAY_SEC = 2
84