#[derive(Debug, Clone, serde::Serialize)]
pub struct CharacteristicOperationReceivedParams {
#[serde(rename = "characteristicId")]
#[serde(deserialize_with = "ydp_core::binding_support::required")]
pub characteristic_id: String,
#[serde(rename = "type")]
#[serde(deserialize_with = "ydp_core::binding_support::required")]
pub r#type: crate::bluetooth_emulation::types::CharacteristicOperationType,
#[serde(rename = "data")]
#[serde(
default,
deserialize_with = "ydp_core::binding_support::presence",
skip_serializing_if = "Option::is_none"
)]
pub data: Option<String>,
#[serde(rename = "writeType")]
#[serde(
default,
deserialize_with = "ydp_core::binding_support::presence",
skip_serializing_if = "Option::is_none"
)]
pub write_type: Option<crate::bluetooth_emulation::types::CharacteristicWriteType>,
}
impl<'de> serde::Deserialize<'de> for CharacteristicOperationReceivedParams {
fn deserialize<D: serde::Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
struct Visitor;
impl<'de> serde::de::Visitor<'de> for Visitor {
type Value = CharacteristicOperationReceivedParams;
fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str("协议 object")
}
fn visit_map<A: serde::de::MapAccess<'de>>(
self,
a: A,
) -> Result<Self::Value, A::Error> {
#[derive(serde::Deserialize)]
struct Fields {
#[serde(rename = "characteristicId")]
#[serde(deserialize_with = "ydp_core::binding_support::required")]
pub characteristic_id: String,
#[serde(rename = "type")]
#[serde(deserialize_with = "ydp_core::binding_support::required")]
pub r#type: crate::bluetooth_emulation::types::CharacteristicOperationType,
#[serde(rename = "data")]
#[serde(
default,
deserialize_with = "ydp_core::binding_support::presence",
skip_serializing_if = "Option::is_none"
)]
pub data: Option<String>,
#[serde(rename = "writeType")]
#[serde(
default,
deserialize_with = "ydp_core::binding_support::presence",
skip_serializing_if = "Option::is_none"
)]
pub write_type:
Option<crate::bluetooth_emulation::types::CharacteristicWriteType>,
}
let fields = <Fields as serde::Deserialize>::deserialize(
serde::de::value::MapAccessDeserializer::new(a),
)?;
Ok(CharacteristicOperationReceivedParams {
characteristic_id: fields.characteristic_id,
r#type: fields.r#type,
data: fields.data,
write_type: fields.write_type,
})
}
}
d.deserialize_map(Visitor)
}
}
#[derive(Debug, Clone, Copy)]
pub struct CharacteristicOperationReceived;
impl ydp_core::Event for CharacteristicOperationReceived {
type Params = CharacteristicOperationReceivedParams;
const METHOD: &'static str = "BluetoothEmulation.characteristicOperationReceived";
}
#[derive(Debug, Clone, serde::Serialize)]
pub struct DescriptorOperationReceivedParams {
#[serde(rename = "descriptorId")]
#[serde(deserialize_with = "ydp_core::binding_support::required")]
pub descriptor_id: String,
#[serde(rename = "type")]
#[serde(deserialize_with = "ydp_core::binding_support::required")]
pub r#type: crate::bluetooth_emulation::types::DescriptorOperationType,
#[serde(rename = "data")]
#[serde(
default,
deserialize_with = "ydp_core::binding_support::presence",
skip_serializing_if = "Option::is_none"
)]
pub data: Option<String>,
}
impl<'de> serde::Deserialize<'de> for DescriptorOperationReceivedParams {
fn deserialize<D: serde::Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
struct Visitor;
impl<'de> serde::de::Visitor<'de> for Visitor {
type Value = DescriptorOperationReceivedParams;
fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str("协议 object")
}
fn visit_map<A: serde::de::MapAccess<'de>>(
self,
a: A,
) -> Result<Self::Value, A::Error> {
#[derive(serde::Deserialize)]
struct Fields {
#[serde(rename = "descriptorId")]
#[serde(deserialize_with = "ydp_core::binding_support::required")]
pub descriptor_id: String,
#[serde(rename = "type")]
#[serde(deserialize_with = "ydp_core::binding_support::required")]
pub r#type: crate::bluetooth_emulation::types::DescriptorOperationType,
#[serde(rename = "data")]
#[serde(
default,
deserialize_with = "ydp_core::binding_support::presence",
skip_serializing_if = "Option::is_none"
)]
pub data: Option<String>,
}
let fields = <Fields as serde::Deserialize>::deserialize(
serde::de::value::MapAccessDeserializer::new(a),
)?;
Ok(DescriptorOperationReceivedParams {
descriptor_id: fields.descriptor_id,
r#type: fields.r#type,
data: fields.data,
})
}
}
d.deserialize_map(Visitor)
}
}
#[derive(Debug, Clone, Copy)]
pub struct DescriptorOperationReceived;
impl ydp_core::Event for DescriptorOperationReceived {
type Params = DescriptorOperationReceivedParams;
const METHOD: &'static str = "BluetoothEmulation.descriptorOperationReceived";
}
#[derive(Debug, Clone, serde::Serialize)]
pub struct GattOperationReceivedParams {
#[serde(rename = "address")]
#[serde(deserialize_with = "ydp_core::binding_support::required")]
pub address: String,
#[serde(rename = "type")]
#[serde(deserialize_with = "ydp_core::binding_support::required")]
pub r#type: crate::bluetooth_emulation::types::GattOperationType,
}
impl<'de> serde::Deserialize<'de> for GattOperationReceivedParams {
fn deserialize<D: serde::Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
struct Visitor;
impl<'de> serde::de::Visitor<'de> for Visitor {
type Value = GattOperationReceivedParams;
fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str("协议 object")
}
fn visit_map<A: serde::de::MapAccess<'de>>(
self,
a: A,
) -> Result<Self::Value, A::Error> {
#[derive(serde::Deserialize)]
struct Fields {
#[serde(rename = "address")]
#[serde(deserialize_with = "ydp_core::binding_support::required")]
pub address: String,
#[serde(rename = "type")]
#[serde(deserialize_with = "ydp_core::binding_support::required")]
pub r#type: crate::bluetooth_emulation::types::GattOperationType,
}
let fields = <Fields as serde::Deserialize>::deserialize(
serde::de::value::MapAccessDeserializer::new(a),
)?;
Ok(GattOperationReceivedParams {
address: fields.address,
r#type: fields.r#type,
})
}
}
d.deserialize_map(Visitor)
}
}
#[derive(Debug, Clone, Copy)]
pub struct GattOperationReceived;
impl ydp_core::Event for GattOperationReceived {
type Params = GattOperationReceivedParams;
const METHOD: &'static str = "BluetoothEmulation.gattOperationReceived";
}