1 
2 package com.android.server.wifi;
3 
4 import android.annotation.NonNull;
5 
6 import java.io.FileDescriptor;
7 import java.io.PrintWriter;
8 
9 /**
10  *
11  */
12 public class BaseWifiDiagnostics {
13     public static final byte CONNECTION_EVENT_STARTED = 0;
14     public static final byte CONNECTION_EVENT_SUCCEEDED = 1;
15     public static final byte CONNECTION_EVENT_FAILED = 2;
16     public static final byte CONNECTION_EVENT_TIMEOUT = 3;
17 
18     protected final WifiNative mWifiNative;
19 
20     protected String mFirmwareVersion;
21     protected String mDriverVersion;
22     protected int mSupportedFeatureSet;
23 
BaseWifiDiagnostics(WifiNative wifiNative)24     public BaseWifiDiagnostics(WifiNative wifiNative) {
25         mWifiNative = wifiNative;
26     }
27 
28     /**
29      * start wifi HAL dependent logging features
30      * @param ifaceName requesting to start logging
31      */
startLogging(@onNull String ifaceName)32     public synchronized void startLogging(@NonNull String ifaceName) {
33         mFirmwareVersion = mWifiNative.getFirmwareVersion();
34         mDriverVersion = mWifiNative.getDriverVersion();
35         mSupportedFeatureSet = mWifiNative.getSupportedLoggerFeatureSet();
36     }
37 
startPacketLog()38     public synchronized void startPacketLog() { }
39 
stopPacketLog()40     public synchronized void stopPacketLog() { }
41 
42     /**
43      * stop wifi HAL dependent logging features
44      * @param ifaceName requesting to stop logging
45      */
stopLogging(@onNull String ifaceName)46     public synchronized void stopLogging(@NonNull String ifaceName) { }
47 
48     /**
49      * Inform the diagnostics module of a connection event.
50      * @param event The type of connection event (see CONNECTION_EVENT_* constants)
51      */
reportConnectionEvent(byte event)52     public synchronized void reportConnectionEvent(byte event) {}
53 
captureBugReportData(int reason)54     public synchronized void captureBugReportData(int reason) { }
55 
captureAlertData(int errorCode, byte[] alertData)56     public synchronized void captureAlertData(int errorCode, byte[] alertData) { }
57 
dump(FileDescriptor fd, PrintWriter pw, String[] args)58     public synchronized void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
59         dump(pw);
60         pw.println("*** logging disabled, no debug data ****");
61     }
62 
63     /**
64      * Starts taking a standard android bugreport
65      * android will prompt the user to send the bugreport when it's complete
66      * @param bugTitle Title of bugreport to generate
67      * @param bugDetail Description of the bugreport to generate
68      */
takeBugReport(String bugTitle, String bugDetail)69     public void takeBugReport(String bugTitle, String bugDetail) { }
70 
dump(PrintWriter pw)71     protected synchronized void dump(PrintWriter pw) {
72         pw.println("Chipset information :-----------------------------------------------");
73         pw.println("FW Version is: " + mFirmwareVersion);
74         pw.println("Driver Version is: " + mDriverVersion);
75         pw.println("Supported Feature set: " + mSupportedFeatureSet);
76     }
77 
78     /** enables/disables wifi verbose logging */
enableVerboseLogging(boolean verboseEnabled)79     public synchronized void enableVerboseLogging(boolean verboseEnabled) { }
80 
81     /** enables packet fate monitoring */
startPktFateMonitoring(@onNull String ifaceName)82     public void startPktFateMonitoring(@NonNull String ifaceName) {}
83 
84 }
85