[−][src]Struct pelcodrs::Message
Single command message object type.
There are several way to build a message:
-
The main constructor Message::new() for "standard" messages.
-
Use the builder pattern with MessageBuilder.
-
Many convenient constructors are provided for "extended" commands.
-
Message::from_bytes() allows to manually specify the address and data words bytes, and will automatically fill the sync byte and checksum.
-
Full control of all the bytes values is possible with the trait implementaion From<[u8;7]>.
The bytes of a Message
can be accessed with Message::as_ref()
.
Message
objects can also be sent to the target device with
PelcoDPort::send_message().
Methods
impl Message
[src]
pub fn new(
address: u8,
cmd1: Command1,
cmd2: Command2,
data1: u8,
data2: u8
) -> Message
[src]
address: u8,
cmd1: Command1,
cmd2: Command2,
data1: u8,
data2: u8
) -> Message
New "standard" command message. This constructor cannot be used for "extended" commands, for which dedicated constructors or Message::from_bytes() should be used.
Example:
let msg = Message::new( 10, Command1::SENSE | Command1::CAMERA_ON_OFF, Command2::FOCUS_FAR | Command2::DOWN, 0x00, 0x40, ); assert_eq!(&[0xFF, 0x0A, 0x88, 0x90, 0x00, 0x40, 0x62], msg.as_ref());
pub fn from_bytes(address: u8, words: [u8; 4]) -> Message
[src]
Alternate constructor taking the raw words to insert in the message. The sync byte and checksum automatically inserted.
pub fn set_preset(address: u8, preset_id: u8) -> Result<Message>
[src]
Set Preset. An error is returned if preset_id
is 0, but special values
(like "flip 180") are not checked.
pub fn clear_preset(address: u8, preset_id: u8) -> Result<Message>
[src]
Clear Preet. An error is returned if preset_id
is 0.
pub fn go_to_preset(address: u8, preset_id: u8) -> Result<Message>
[src]
Call Preet. An error is returned if preset_id
is 0.
pub fn flip_180(address: u8) -> Result<Message>
[src]
Call the special preset "rotate 180 degrees".
pub fn go_to_zero_pan(address: u8) -> Result<Message>
[src]
Call the special preset "Go To Zero Pan".
pub fn set_auxiliary(address: u8, sub_opcode: u8, aux_id: u8) -> Result<Message>
[src]
Set Auxiliary. No particular check is done on the arguments.
pub fn clear_auxiliary(
address: u8,
sub_opcode: u8,
aux_id: u8
) -> Result<Message>
[src]
address: u8,
sub_opcode: u8,
aux_id: u8
) -> Result<Message>
Clear Auxiliary. No particular check is done on the arguments.
pub fn remote_reset(address: u8) -> Result<Message>
[src]
Reset.
pub fn set_zone_start(address: u8, zone_id: u8) -> Result<Message>
[src]
Set Zone Start.
pub fn set_zone_end(address: u8, zone_id: u8) -> Result<Message>
[src]
Set Zone End.
pub fn write_char_to_screen(
address: u8,
column: u8,
character: char
) -> Result<Message>
[src]
address: u8,
column: u8,
character: char
) -> Result<Message>
Write Character To Screen.
pub fn clear_screen(address: u8) -> Result<Message>
[src]
Clear Screen.
pub fn alarm_acknowledge(address: u8, alarm_no: u8) -> Result<Message>
[src]
Alarm Acknowledge.
pub fn zone_scan_on(address: u8) -> Result<Message>
[src]
Zone Scan On.
pub fn zone_scan_off(address: u8) -> Result<Message>
[src]
Zone Scan Off.
pub fn set_pattern_start(address: u8, pattern_id: u8) -> Result<Message>
[src]
Record Pattern Start.
pub fn set_pattern_stop(address: u8, pattern_id: u8) -> Result<Message>
[src]
Record Pattern End.
pub fn run_pattern(address: u8, pattern_id: u8) -> Result<Message>
[src]
Run Pattern.
pub fn set_zoom_speed(address: u8, speed: ZoomSpeed) -> Result<Message>
[src]
Set Zoom Speed.
pub fn set_focus_speed(address: u8, speed: FocusSpeed) -> Result<Message>
[src]
Set Focus Speed.
pub fn reset_camera_to_defaults(address: u8) -> Result<Message>
[src]
Reset Camera to Defaults.
pub fn auto_focus(address: u8, ctrl: AutoCtrl) -> Result<Message>
[src]
Auto Focus.
pub fn auto_iris(address: u8, cmd: AutoCtrl) -> Result<Message>
[src]
Auto Iris.
pub fn agc(address: u8, cmd: AutoCtrl) -> Result<Message>
[src]
AGC.
pub fn backlight_compensation(address: u8, ctrl: OnOff) -> Result<Message>
[src]
Backlight Compensation.
pub fn auto_white_balance(address: u8, ctrl: OnOff) -> Result<Message>
[src]
Auto White Balance.
pub fn enable_device_phase_delay_mode(address: u8) -> Result<Message>
[src]
Enable Device Phase Delay Mode.
pub fn set_shutter_speed(address: u8, ctrl: ShutterSpeed) -> Result<Message>
[src]
Set Shutter Speed.
pub fn adjust_line_lock_phase_delay(
address: u8,
ctrl: AdjustmentValue
) -> Result<Message>
[src]
address: u8,
ctrl: AdjustmentValue
) -> Result<Message>
Adjust Line Lock Phase Delay.
pub fn adjust_white_balance_rb(
address: u8,
ctrl: AdjustmentValue
) -> Result<Message>
[src]
address: u8,
ctrl: AdjustmentValue
) -> Result<Message>
Adjust White Balance (R-B)
pub fn adjust_white_balance_mg(
address: u8,
ctrl: AdjustmentValue
) -> Result<Message>
[src]
address: u8,
ctrl: AdjustmentValue
) -> Result<Message>
Adjust White Balance (M-G)
pub fn adjust_gain(address: u8, ctrl: AdjustmentValue) -> Result<Message>
[src]
Adjust Gain.
pub fn adjust_auto_iris_level(
address: u8,
ctrl: AdjustmentValue
) -> Result<Message>
[src]
address: u8,
ctrl: AdjustmentValue
) -> Result<Message>
Adjust Auto-Iris Level
pub fn adjust_auto_iris_peak(
address: u8,
ctrl: AdjustmentValue
) -> Result<Message>
[src]
address: u8,
ctrl: AdjustmentValue
) -> Result<Message>
Adjust Auto-Iris Peak Value.
pub fn query() -> Result<Message>
[src]
Query.
Trait Implementations
impl AsRef<[u8]> for Message
[src]
impl From<[u8; 7]> for Message
[src]
fn from(array: [u8; 7]) -> Self
[src]
Create a Message by specifying all the bytes manually:
let msg = Message::from([11, 22, 33, 44, 55, 66, 77]); assert_eq!(&[11, 22, 33, 44, 55, 66, 77], msg.as_ref());
impl From<MessageBuilder> for Message
[src]
fn from(draft: MessageBuilder) -> Self
[src]
impl Clone for Message
[src]
impl Copy for Message
[src]
impl PartialEq<Message> for Message
[src]
impl Debug for Message
[src]
impl<'_> TryFrom<&'_ [u8]> for Message
[src]
Auto Trait Implementations
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnwindSafe for Message
impl RefUnwindSafe for Message
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,