pub struct DevEncoded {
pub format: Scalar<str>,
pub data: Spectrum<u8>,
}Expand description
A value of an encoded attribute or command: octets, and the name of the format they are in, which is how a device sends what Tango has no type for, a compressed image above all. Both share the message they were decoded out of.
Tango only has such a value as a scalar, an attribute of it being neither a spectrum nor an image.
Fields§
§format: Scalar<str>The name of the format the octets are in, such as JPEG_RGB, which is only a
convention between the device and its clients.
data: Spectrum<u8>The octets themselves.
Implementations§
Source§impl DevEncoded
impl DevEncoded
Source§impl DevEncoded
impl DevEncoded
Sourcepub const JPEG_RGB: &'static str = "JPEG_RGB"
pub const JPEG_RGB: &'static str = "JPEG_RGB"
The format of a JPEG image in color, see [Self::to_image].
Sourcepub const JPEG_GRAY8: &'static str = "JPEG_GRAY8"
pub const JPEG_GRAY8: &'static str = "JPEG_GRAY8"
The format of a JPEG image in shades of gray, see [Self::to_image].
Sourcepub const GRAY8: &'static str = "GRAY8"
pub const GRAY8: &'static str = "GRAY8"
The format of raw 8 bits gray pixels, see EncodedPixels::Gray8.
Sourcepub const GRAY16: &'static str = "GRAY16"
pub const GRAY16: &'static str = "GRAY16"
The format of raw 16 bits gray pixels, see EncodedPixels::Gray16.
Sourcepub const RGB24: &'static str = "RGB24"
pub const RGB24: &'static str = "RGB24"
The format of raw 24 bits color pixels, see EncodedPixels::Rgb24.
Source§impl DevEncoded
impl DevEncoded
Sourcepub fn to_pixels(&self) -> Result<EncodedPixels, Error>
pub fn to_pixels(&self) -> Result<EncodedPixels, Error>
The pixels of an image in one of the raw formats, failing for any other format,
JPEG included, see [Self::to_image] for that one.
Sourcepub fn from_pixels(pixels: &EncodedPixels) -> Result<Self, Error>
pub fn from_pixels(pixels: &EncodedPixels) -> Result<Self, Error>
Encode these pixels in their raw format, failing for an image wider or higher than the 65535 pixels its dimensions have room for.