pub enum Advertisement<'a> {
CompleteLocalName(&'a str),
ServiceData16BitUuid(u16, &'a [u8]),
ServiceData32BitUuid(u32, &'a [u8]),
ServiceData128BitUuid(u128, &'a [u8]),
ManufacturerSpecificData(u16, &'a [u8]),
}
Expand description
LE Advertisement Type
Variants§
CompleteLocalName(&'a str)
Complete local name of the device.
ServiceData16BitUuid(u16, &'a [u8])
Service data with 16-bit UUID.
The first parameter is the UUID, the second parameter is the payload.
The payload may be up to 27 bytes for legacy advertising mode.
ServiceData32BitUuid(u32, &'a [u8])
Service data with 32-bit UUID
The first parameter is the UUID, the second parameter is the payload.
The payload may be up to 25 bytes for legacy advertising mode.
ServiceData128BitUuid(u128, &'a [u8])
Service data with 128-bit UUID
The first parameter is the UUID, the second parameter is the payload.
The payload may be up to 13 bytes for legacy advertising mode.
ManufacturerSpecificData(u16, &'a [u8])
Manufacturer-specific data
The first parameter is the manufacturer ID, the second parameter is the payload.
The payload may be up to 27 bytes for legacy advertising mode.
Implementations§
Source§impl Advertisement<'_>
impl Advertisement<'_>
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Gets the length of the advertisement payload, in bytes.
This includes the length byte itself.
Sourcepub fn copy_into_slice(&self, bytes: &mut [u8]) -> usize
pub fn copy_into_slice(&self, bytes: &mut [u8]) -> usize
Serialize the advertisement into the given buffer, and return the number of bytes written.
The maximum length of advertisements in legacy mode is 31 bytes.
bytes
must be at least Self::len() bytes.