use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum CentralState {
#[serde(rename = "absent")]
Absent,
#[serde(rename = "powered-off")]
PoweredOff,
#[serde(rename = "powered-on")]
PoweredOn,
#[serde(untagged)]
Unrecognized(String),
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum GattOperationType {
#[serde(rename = "connection")]
Connection,
#[serde(rename = "discovery")]
Discovery,
#[serde(untagged)]
Unrecognized(String),
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum CharacteristicWriteType {
#[serde(rename = "write-default-deprecated")]
WriteDefaultDeprecated,
#[serde(rename = "write-with-response")]
WriteWithResponse,
#[serde(rename = "write-without-response")]
WriteWithoutResponse,
#[serde(untagged)]
Unrecognized(String),
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum CharacteristicOperationType {
#[serde(rename = "read")]
Read,
#[serde(rename = "write")]
Write,
#[serde(rename = "subscribe-to-notifications")]
SubscribeToNotifications,
#[serde(rename = "unsubscribe-from-notifications")]
UnsubscribeFromNotifications,
#[serde(untagged)]
Unrecognized(String),
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum DescriptorOperationType {
#[serde(rename = "read")]
Read,
#[serde(rename = "write")]
Write,
#[serde(untagged)]
Unrecognized(String),
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ManufacturerData {
pub key: i64,
pub data: String,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ScanRecord {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub uuids: Option<Vec<String>>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub appearance: Option<i64>,
#[serde(rename = "txPower", default, skip_serializing_if = "Option::is_none")]
pub tx_power: Option<i64>,
#[serde(
rename = "manufacturerData",
default,
skip_serializing_if = "Option::is_none"
)]
pub manufacturer_data: Option<Vec<ManufacturerData>>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ScanEntry {
#[serde(rename = "deviceAddress")]
pub device_address: String,
pub rssi: i64,
#[serde(rename = "scanRecord")]
pub scan_record: ScanRecord,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct CharacteristicProperties {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub broadcast: Option<bool>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub read: Option<bool>,
#[serde(
rename = "writeWithoutResponse",
default,
skip_serializing_if = "Option::is_none"
)]
pub write_without_response: Option<bool>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub write: Option<bool>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub notify: Option<bool>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub indicate: Option<bool>,
#[serde(
rename = "authenticatedSignedWrites",
default,
skip_serializing_if = "Option::is_none"
)]
pub authenticated_signed_writes: Option<bool>,
#[serde(
rename = "extendedProperties",
default,
skip_serializing_if = "Option::is_none"
)]
pub extended_properties: Option<bool>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct EnableParams {
pub state: CentralState,
#[serde(rename = "leSupported")]
pub le_supported: bool,
}
impl crate::typed::Command for EnableParams {
const METHOD: &'static str = "BluetoothEmulation.enable";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SetSimulatedCentralStateParams {
pub state: CentralState,
}
impl crate::typed::Command for SetSimulatedCentralStateParams {
const METHOD: &'static str = "BluetoothEmulation.setSimulatedCentralState";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct DisableParams {}
impl crate::typed::Command for DisableParams {
const METHOD: &'static str = "BluetoothEmulation.disable";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SimulatePreconnectedPeripheralParams {
pub address: String,
pub name: String,
#[serde(rename = "manufacturerData")]
pub manufacturer_data: Vec<ManufacturerData>,
#[serde(rename = "knownServiceUuids")]
pub known_service_uuids: Vec<String>,
}
impl crate::typed::Command for SimulatePreconnectedPeripheralParams {
const METHOD: &'static str = "BluetoothEmulation.simulatePreconnectedPeripheral";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SimulateAdvertisementParams {
pub entry: ScanEntry,
}
impl crate::typed::Command for SimulateAdvertisementParams {
const METHOD: &'static str = "BluetoothEmulation.simulateAdvertisement";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SimulateGattOperationResponseParams {
pub address: String,
pub r#type: GattOperationType,
pub code: i64,
}
impl crate::typed::Command for SimulateGattOperationResponseParams {
const METHOD: &'static str = "BluetoothEmulation.simulateGATTOperationResponse";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SimulateCharacteristicOperationResponseParams {
#[serde(rename = "characteristicId")]
pub characteristic_id: String,
pub r#type: CharacteristicOperationType,
pub code: i64,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub data: Option<String>,
}
impl crate::typed::Command for SimulateCharacteristicOperationResponseParams {
const METHOD: &'static str = "BluetoothEmulation.simulateCharacteristicOperationResponse";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SimulateDescriptorOperationResponseParams {
#[serde(rename = "descriptorId")]
pub descriptor_id: String,
pub r#type: DescriptorOperationType,
pub code: i64,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub data: Option<String>,
}
impl crate::typed::Command for SimulateDescriptorOperationResponseParams {
const METHOD: &'static str = "BluetoothEmulation.simulateDescriptorOperationResponse";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct AddServiceParams {
pub address: String,
#[serde(rename = "serviceUuid")]
pub service_uuid: String,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct AddServiceReturns {
#[serde(rename = "serviceId")]
pub service_id: String,
}
impl crate::typed::Command for AddServiceParams {
const METHOD: &'static str = "BluetoothEmulation.addService";
type Returns = AddServiceReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct RemoveServiceParams {
#[serde(rename = "serviceId")]
pub service_id: String,
}
impl crate::typed::Command for RemoveServiceParams {
const METHOD: &'static str = "BluetoothEmulation.removeService";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct AddCharacteristicParams {
#[serde(rename = "serviceId")]
pub service_id: String,
#[serde(rename = "characteristicUuid")]
pub characteristic_uuid: String,
pub properties: CharacteristicProperties,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct AddCharacteristicReturns {
#[serde(rename = "characteristicId")]
pub characteristic_id: String,
}
impl crate::typed::Command for AddCharacteristicParams {
const METHOD: &'static str = "BluetoothEmulation.addCharacteristic";
type Returns = AddCharacteristicReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct RemoveCharacteristicParams {
#[serde(rename = "characteristicId")]
pub characteristic_id: String,
}
impl crate::typed::Command for RemoveCharacteristicParams {
const METHOD: &'static str = "BluetoothEmulation.removeCharacteristic";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct AddDescriptorParams {
#[serde(rename = "characteristicId")]
pub characteristic_id: String,
#[serde(rename = "descriptorUuid")]
pub descriptor_uuid: String,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct AddDescriptorReturns {
#[serde(rename = "descriptorId")]
pub descriptor_id: String,
}
impl crate::typed::Command for AddDescriptorParams {
const METHOD: &'static str = "BluetoothEmulation.addDescriptor";
type Returns = AddDescriptorReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct RemoveDescriptorParams {
#[serde(rename = "descriptorId")]
pub descriptor_id: String,
}
impl crate::typed::Command for RemoveDescriptorParams {
const METHOD: &'static str = "BluetoothEmulation.removeDescriptor";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SimulateGattDisconnectionParams {
pub address: String,
}
impl crate::typed::Command for SimulateGattDisconnectionParams {
const METHOD: &'static str = "BluetoothEmulation.simulateGATTDisconnection";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct GattOperationReceivedEvent {
pub address: String,
pub r#type: GattOperationType,
}
impl crate::typed::Event for GattOperationReceivedEvent {
const METHOD: &'static str = "BluetoothEmulation.gattOperationReceived";
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CharacteristicOperationReceivedEvent {
#[serde(rename = "characteristicId")]
pub characteristic_id: String,
pub r#type: CharacteristicOperationType,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub data: Option<String>,
#[serde(rename = "writeType", default, skip_serializing_if = "Option::is_none")]
pub write_type: Option<CharacteristicWriteType>,
}
impl crate::typed::Event for CharacteristicOperationReceivedEvent {
const METHOD: &'static str = "BluetoothEmulation.characteristicOperationReceived";
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DescriptorOperationReceivedEvent {
#[serde(rename = "descriptorId")]
pub descriptor_id: String,
pub r#type: DescriptorOperationType,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub data: Option<String>,
}
impl crate::typed::Event for DescriptorOperationReceivedEvent {
const METHOD: &'static str = "BluetoothEmulation.descriptorOperationReceived";
}