selenium-webdriver
Version:
The official WebDriver JavaScript bindings from the Selenium project
224 lines (223 loc) • 9.19 kB
TypeScript
export type BluetoothBluetoothUuid = string;
export interface BluetoothBluetoothManufacturerData {
key: number;
data: string;
}
export interface BluetoothCharacteristicProperties {
broadcast?: boolean;
read?: boolean;
writeWithoutResponse?: boolean;
write?: boolean;
notify?: boolean;
indicate?: boolean;
authenticatedSignedWrites?: boolean;
extendedProperties?: boolean;
}
export type BluetoothRequestDevice = string;
export interface BluetoothRequestDeviceInfo {
id: BluetoothRequestDevice;
name: string | null;
}
export type BluetoothRequestDevicePrompt = string;
export interface BluetoothScanRecord {
name?: string;
uuids?: BluetoothBluetoothUuid[];
appearance?: Number;
manufacturerData?: BluetoothBluetoothManufacturerData[];
}
export type BluetoothCommand = BluetoothHandleRequestDevicePrompt | BluetoothSimulateAdapter | BluetoothDisableSimulation | BluetoothSimulatePreconnectedPeripheral | BluetoothSimulateAdvertisement | BluetoothSimulateGattConnectionResponse | BluetoothSimulateGattDisconnection | BluetoothSimulateService | BluetoothSimulateCharacteristic | BluetoothSimulateCharacteristicResponse | BluetoothSimulateDescriptor | BluetoothSimulateDescriptorResponse;
export interface BluetoothHandleRequestDevicePrompt {
method: "bluetooth.handleRequestDevicePrompt";
params: BluetoothHandleRequestDevicePromptParameters;
}
export type BluetoothHandleRequestDevicePromptParameters = (BluetoothHandleRequestDevicePromptAcceptParameters | BluetoothHandleRequestDevicePromptCancelParameters) & {
context: string;
prompt: BluetoothRequestDevicePrompt;
};
export interface BluetoothHandleRequestDevicePromptAcceptParameters {
accept: true;
device: BluetoothRequestDevice;
}
export interface BluetoothHandleRequestDevicePromptCancelParameters {
accept: false;
}
export interface BluetoothSimulateAdapter {
method: "bluetooth.simulateAdapter";
params: BluetoothSimulateAdapterParameters;
}
export interface BluetoothSimulateAdapterParameters {
context: string;
leSupported?: boolean;
state: "absent" | "powered-off" | "powered-on";
}
export interface BluetoothDisableSimulation {
method: "bluetooth.disableSimulation";
params: BluetoothDisableSimulationParameters;
}
export interface BluetoothDisableSimulationParameters {
context: string;
}
export interface BluetoothSimulatePreconnectedPeripheral {
method: "bluetooth.simulatePreconnectedPeripheral";
params: BluetoothSimulatePreconnectedPeripheralParameters;
}
export interface BluetoothSimulatePreconnectedPeripheralParameters {
context: string;
address: string;
name: string;
manufacturerData: BluetoothBluetoothManufacturerData[];
knownServiceUuids: BluetoothBluetoothUuid[];
}
export interface BluetoothSimulateAdvertisement {
method: "bluetooth.simulateAdvertisement";
params: BluetoothSimulateAdvertisementParameters;
}
export interface BluetoothSimulateAdvertisementParameters {
context: string;
scanEntry: BluetoothSimulateAdvertisementScanEntryParameters;
}
export interface BluetoothSimulateAdvertisementScanEntryParameters {
deviceAddress: string;
rssi: Number;
scanRecord: BluetoothScanRecord;
}
export interface BluetoothSimulateGattConnectionResponse {
method: "bluetooth.simulateGattConnectionResponse";
params: BluetoothSimulateGattConnectionResponseParameters;
}
export interface BluetoothSimulateGattConnectionResponseParameters {
context: string;
address: string;
code: number;
}
export interface BluetoothSimulateGattDisconnection {
method: "bluetooth.simulateGattDisconnection";
params: BluetoothSimulateGattDisconnectionParameters;
}
export interface BluetoothSimulateGattDisconnectionParameters {
context: string;
address: string;
}
export interface BluetoothSimulateService {
method: "bluetooth.simulateService";
params: BluetoothSimulateServiceParameters;
}
export interface BluetoothSimulateServiceParameters {
context: string;
address: string;
uuid: BluetoothBluetoothUuid;
type: "add" | "remove";
}
export interface BluetoothSimulateCharacteristic {
method: "bluetooth.simulateCharacteristic";
params: BluetoothSimulateCharacteristicParameters;
}
export interface BluetoothSimulateCharacteristicParameters {
context: string;
address: string;
serviceUuid: BluetoothBluetoothUuid;
characteristicUuid: BluetoothBluetoothUuid;
characteristicProperties?: BluetoothCharacteristicProperties;
type: "add" | "remove";
}
export interface BluetoothSimulateCharacteristicResponse {
method: "bluetooth.simulateCharacteristicResponse";
params: BluetoothSimulateCharacteristicResponseParameters;
}
export interface BluetoothSimulateCharacteristicResponseParameters {
context: string;
address: string;
serviceUuid: BluetoothBluetoothUuid;
characteristicUuid: BluetoothBluetoothUuid;
type: "read" | "write" | "subscribe-to-notifications" | "unsubscribe-from-notifications";
code: number;
data?: number[];
}
export interface BluetoothSimulateDescriptor {
method: "bluetooth.simulateDescriptor";
params: BluetoothSimulateDescriptorParameters;
}
export interface BluetoothSimulateDescriptorParameters {
context: string;
address: string;
serviceUuid: BluetoothBluetoothUuid;
characteristicUuid: BluetoothBluetoothUuid;
descriptorUuid: BluetoothBluetoothUuid;
type: "add" | "remove";
}
export interface BluetoothSimulateDescriptorResponse {
method: "bluetooth.simulateDescriptorResponse";
params: BluetoothSimulateDescriptorResponseParameters;
}
export interface BluetoothSimulateDescriptorResponseParameters {
context: string;
address: string;
serviceUuid: BluetoothBluetoothUuid;
characteristicUuid: BluetoothBluetoothUuid;
descriptorUuid: BluetoothBluetoothUuid;
type: "read" | "write";
code: number;
data?: number[];
}
export type BluetoothEvent = BluetoothRequestDevicePromptUpdated | BluetoothGattConnectionAttempted;
export interface BluetoothRequestDevicePromptUpdated {
method: "bluetooth.requestDevicePromptUpdated";
params: BluetoothRequestDevicePromptUpdatedParameters;
}
export interface BluetoothRequestDevicePromptUpdatedParameters {
context: string;
prompt: BluetoothRequestDevicePrompt;
devices: BluetoothRequestDeviceInfo[];
}
export interface BluetoothGattConnectionAttempted {
method: "bluetooth.gattConnectionAttempted";
params: BluetoothGattConnectionAttemptedParameters;
}
export interface BluetoothGattConnectionAttemptedParameters {
context: string;
address: string;
}
export interface BluetoothCharacteristicEventGenerated {
method: "bluetooth.characteristicEventGenerated";
params: BluetoothCharacteristicEventGeneratedParameters;
}
export interface BluetoothCharacteristicEventGeneratedParameters {
context: string;
address: string;
serviceUuid: BluetoothBluetoothUuid;
characteristicUuid: BluetoothBluetoothUuid;
type: "read" | "write-with-response" | "write-without-response" | "subscribe-to-notifications" | "unsubscribe-from-notifications";
data?: number[];
}
export interface BluetoothDescriptorEventGenerated {
method: "bluetooth.descriptorEventGenerated";
params: BluetoothDescriptorEventGeneratedParameters;
}
export interface BluetoothDescriptorEventGeneratedParameters {
context: string;
address: string;
serviceUuid: BluetoothBluetoothUuid;
characteristicUuid: BluetoothBluetoothUuid;
descriptorUuid: BluetoothBluetoothUuid;
type: "read" | "write";
data?: number[];
}
export declare class Bluetooth {
private readonly bidi;
private constructor();
static create(driver: unknown): Promise<Bluetooth>;
handleRequestDevicePrompt(params: BluetoothHandleRequestDevicePromptParameters): Promise<void>;
simulateAdapter(params: BluetoothSimulateAdapterParameters): Promise<void>;
disableSimulation(params: BluetoothDisableSimulationParameters): Promise<void>;
simulatePreconnectedPeripheral(params: BluetoothSimulatePreconnectedPeripheralParameters): Promise<void>;
simulateAdvertisement(params: BluetoothSimulateAdvertisementParameters): Promise<void>;
simulateGattConnectionResponse(params: BluetoothSimulateGattConnectionResponseParameters): Promise<void>;
simulateGattDisconnection(params: BluetoothSimulateGattDisconnectionParameters): Promise<void>;
simulateService(params: BluetoothSimulateServiceParameters): Promise<void>;
simulateCharacteristic(params: BluetoothSimulateCharacteristicParameters): Promise<void>;
simulateCharacteristicResponse(params: BluetoothSimulateCharacteristicResponseParameters): Promise<void>;
simulateDescriptor(params: BluetoothSimulateDescriptorParameters): Promise<void>;
simulateDescriptorResponse(params: BluetoothSimulateDescriptorResponseParameters): Promise<void>;
onRequestDevicePromptUpdated(callback: (params: BluetoothRequestDevicePromptUpdatedParameters) => void): Promise<void>;
onGattConnectionAttempted(callback: (params: BluetoothGattConnectionAttemptedParameters) => void): Promise<void>;
}