BluetoothUtils

public class BluetoothUtils
extends Object

java.lang.Object
   ↳ com.android.tradefed.util.BluetoothUtils


Fonctions utilitaires pour appeler BluetoothInstrumentation sur l'appareil

Le code BluetoothInstrumentation côté appareil est disponible dans AOSP à l'adresse suivante : frameworks/base/core/tests/bluetoothtests

Résumé

Constantes

String BTSNOOP_API

String BTSNOOP_CMD

String BTSNOOP_DISABLE_CMD

String BTSNOOP_ENABLE_CMD

String GOLD_BTSNOOP_LOG_PATH

String O_BUILD

Constructeurs publics

BluetoothUtils()

Méthodes publiques

static void cleanLogFile(ITestDevice device)

Supprimer le fichier journal de reniflage de l'appareil

static boolean disable(ITestDevice device)

Désactive le Bluetooth sur l'appareil spécifié.

static boolean disableBtsnoopLogging(ITestDevice device, File sl4aApkFile)

Désactiver la journalisation btsnoop par appel sl4a

static boolean disableBtsnoopLogging(ITestDevice device)

Désactiver la journalisation btsnoop par appel sl4a

static boolean enable(ITestDevice device)

Active le Bluetooth sur l'appareil spécifié

static boolean enableBtsnoopLogging(ITestDevice device, File sl4aApkFile)

Activer la journalisation btsnoop par appel sl4a

static boolean enableBtsnoopLogging(ITestDevice device)

Activer la journalisation btsnoop par appel sl4a

static String getBluetoothMac(ITestDevice device)

Récupère l'adresse MAC Bluetooth de l'appareil donné.

static getBondedDevices(ITestDevice device)

Renvoie les adresses MAC Bluetooth des appareils auxquels l'appareil donné est associé.

static String getBtSnoopLogFilePath(ITestDevice device)

Obtenir le chemin d'accès au fichier journal bt snoop à partir du fichier bt_stack.config

static String runBluetoothInstrumentation(ITestDevice device, String command)

Méthode pratique pour exécuter la commande d'instrumentation BT et renvoyer le résultat

static boolean runBluetoothInstrumentationWithRetry(ITestDevice device, String command)
static boolean toggleBtsnoopLogging(Sl4aClient client, boolean onOff)
static boolean unpairWithRetry(ITestDevice device)

Réessayer d'effacer l'association Bluetooth avec un intervalle linéaire entre les tentatives

static void uploadLogFiles(ITestInvocationListener listener, ITestDevice device, String type, int iteration)

Importer le fichier journal snoop pour les résultats des tests

Constantes

BTSNOOP_API

public static final String BTSNOOP_API

Valeur constante : "bluetoothConfigHciSnoopLog"

BTSNOOP_CMD

public static final String BTSNOOP_CMD

Valeur de constante : "setprop persist.bluetooth.btsnoopenable "

BTSNOOP_DISABLE_CMD

public static final String BTSNOOP_DISABLE_CMD

Valeur de constante : "setprop persist.bluetooth.btsnoopenable false"

BTSNOOP_ENABLE_CMD

public static final String BTSNOOP_ENABLE_CMD

Valeur de constante : "setprop persist.bluetooth.btsnoopenable true"

GOLD_BTSNOOP_LOG_PATH

public static final String GOLD_BTSNOOP_LOG_PATH

Valeur de constante : "/data/misc/bluetooth/logs/btsnoop_hci.log"

O_BUILD

public static final String O_BUILD

Valeur constante : "O"

Constructeurs publics

BluetoothUtils

public BluetoothUtils ()

Méthodes publiques

cleanLogFile

public static void cleanLogFile (ITestDevice device)

Supprimer le fichier journal de reniflage de l'appareil

Paramètres
device ITestDevice

Génère
DeviceNotAvailableException

désactiver

public static boolean disable (ITestDevice device)

Désactive le Bluetooth sur l'appareil spécifié.

Renvoie
boolean "True" si la désactivation a réussi, "false" dans le cas contraire.

Génère
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

disableBtsnoopLogging

public static boolean disableBtsnoopLogging (ITestDevice device, 
                File sl4aApkFile)

Désactiver la journalisation btsnoop par appel sl4a

Paramètres
sl4aApkFile File : emplacement du fichier sl4a.apk, null s'il a été installé

Renvoie
boolean réussie ou non.

Génère
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

disableBtsnoopLogging

public static boolean disableBtsnoopLogging (ITestDevice device)

Désactiver la journalisation btsnoop par appel sl4a

Renvoie
boolean réussie ou non.

Génère
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

activer

public static boolean enable (ITestDevice device)

Active le Bluetooth sur l'appareil spécifié

Renvoie
boolean "True" si l'activation a réussi, "false" dans le cas contraire.

Génère
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

enableBtsnoopLogging

public static boolean enableBtsnoopLogging (ITestDevice device, 
                File sl4aApkFile)

Activer la journalisation btsnoop par appel sl4a

Paramètres
sl4aApkFile File : emplacement du fichier sl4a.apk, null s'il a été installé

Renvoie
boolean réussie ou non.

Génère
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

enableBtsnoopLogging

public static boolean enableBtsnoopLogging (ITestDevice device)

Activer la journalisation btsnoop par appel sl4a

Renvoie
boolean réussie ou non.

Génère
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getBluetoothMac

public static String getBluetoothMac (ITestDevice device)

Récupère l'adresse MAC Bluetooth de l'appareil donné.

Renvoie
String Adresse MAC Bluetooth ou null si elle est introuvable

Génère
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getBondedDevices

public static  getBondedDevices (ITestDevice device)

Renvoie les adresses MAC Bluetooth des appareils auxquels l'appareil donné est associé.

Renvoie
Adresses MAC Bluetooth

Génère
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getBtSnoopLogFilePath

public static String getBtSnoopLogFilePath (ITestDevice device)

Obtenir le chemin d'accès au fichier journal bt snoop à partir du fichier bt_stack.config

Renvoie
String Nom de fichier pour bt_snoop_log ou null s'il est introuvable

Génère
DeviceNotAvailableException

runBluetoothInstrumentation

public static String runBluetoothInstrumentation (ITestDevice device, 
                String command)

Méthode pratique pour exécuter la commande d'instrumentation BT et renvoyer le résultat

Paramètres
command String : chaîne de commande envoyée à l'instrumentation BT. Les commandes actuellement acceptées sont les suivantes : enable, disable, unpairAll, getName, getAddress, getBondedDevices. Pour en savoir plus, consultez la source AOSP.

Renvoie
String Sortie de BluetoothInstrumentation

Génère
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

runBluetoothInstrumentationWithRetry

public static boolean runBluetoothInstrumentationWithRetry (ITestDevice device, 
                String command)

Paramètres
device ITestDevice

command String

Renvoie
boolean

Génère
DeviceNotAvailableException

toggleBtsnoopLogging

public static boolean toggleBtsnoopLogging (Sl4aClient client, 
                boolean onOff)

Paramètres
client Sl4aClient

onOff boolean

Renvoie
boolean

Génère
DeviceNotAvailableException

unpairWithRetry

public static boolean unpairWithRetry (ITestDevice device)

Réessayer d'effacer l'association Bluetooth avec un intervalle linéaire entre les tentatives

Renvoie
boolean

Génère
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

uploadLogFiles

public static void uploadLogFiles (ITestInvocationListener listener, 
                ITestDevice device, 
                String type, 
                int iteration)

Importer le fichier journal snoop pour les résultats des tests

Paramètres
listener ITestInvocationListener

device ITestDevice

type String

iteration int

Génère
DeviceNotAvailableException