pub struct Command { /* private fields */ }Expand description
Main command payload structure.
Implementations§
Source§impl Command
impl Command
Sourcepub fn new_control() -> Command
pub fn new_control() -> Command
Create a new, empty control packet.
Sourcepub fn new_cancellation() -> Command
pub fn new_cancellation() -> Command
Create a new, empty cancellation packet.
Sourcepub fn new_validation_ack() -> Command
pub fn new_validation_ack() -> Command
Create a new, empty validation ACK packet.
Sourcepub fn new_exec_ack() -> Command
pub fn new_exec_ack() -> Command
Create a new, empty execution ACK packet.
Sourcepub fn new_query_ack() -> Command
pub fn new_query_ack() -> Command
Create a new, empty query ACK packet.
Sourcepub fn message_id(&self) -> u32
pub fn message_id(&self) -> u32
Get the packet message ID.
Sourcepub fn set_message_id(&mut self, message_id: u32)
pub fn set_message_id(&mut self, message_id: u32)
Set the packet message ID.
Sourcepub fn cam(&self) -> ControlAckMode
pub fn cam(&self) -> ControlAckMode
Get the packet’s Control Ack Mode (CAM)
Sourcepub fn set_cam(&mut self, mode: ControlAckMode)
pub fn set_cam(&mut self, mode: ControlAckMode)
Set the packet’s Control Ack Mode (CAM)
§Example
use vita49::{prelude::*, ControlAckMode, ActionMode};
let mut packet = Vrt::new_control_packet();
let command_mut = packet.payload_mut().command_mut().unwrap();
let mut cam = ControlAckMode::default();
cam.set_action_mode(ActionMode::Execute);
command_mut.set_cam(cam);
assert_eq!(command_mut.cam().action_mode(), ActionMode::Execute);Sourcepub fn controllee_id(&self) -> Option<u32>
pub fn controllee_id(&self) -> Option<u32>
Get the controllee identifier.
Sourcepub fn set_controllee_id(&mut self, id: Option<u32>) -> Result<(), VitaError>
pub fn set_controllee_id(&mut self, id: Option<u32>) -> Result<(), VitaError>
Sets the controllee identifier. If None is passed, the field
will be unset.
§Errors
If this function is called while the controllee_uuid field is set,
an error will be returned as these fields are mutually exclusive.
Sourcepub fn controller_id(&self) -> Option<u32>
pub fn controller_id(&self) -> Option<u32>
Get the controller identifier.
Sourcepub fn set_controller_id(&mut self, id: Option<u32>) -> Result<(), VitaError>
pub fn set_controller_id(&mut self, id: Option<u32>) -> Result<(), VitaError>
Sets the controller identifier. If None is passed, the field
will be unset.
§Errors
If this function is called while the controller_uuid field is set,
an error will be returned as these fields are mutually exclusive.
Sourcepub fn controllee_uuid(&self) -> Option<u128>
pub fn controllee_uuid(&self) -> Option<u128>
Get the controllee UUID.
Sourcepub fn set_controllee_uuid(
&mut self,
uuid: Option<u128>,
) -> Result<(), VitaError>
pub fn set_controllee_uuid( &mut self, uuid: Option<u128>, ) -> Result<(), VitaError>
Sets the controllee UUID. If None is passed, the field
will be unset.
§Errors
If this function is called while the controllee_id field is set,
an error will be returned as these fields are mutually exclusive.
Sourcepub fn controller_uuid(&self) -> Option<u128>
pub fn controller_uuid(&self) -> Option<u128>
Get the controller UUID.
Sourcepub fn set_controller_uuid(
&mut self,
uuid: Option<u128>,
) -> Result<(), VitaError>
pub fn set_controller_uuid( &mut self, uuid: Option<u128>, ) -> Result<(), VitaError>
Sets the controller UUID. If None is passed, the field
will be unset.
§Errors
If this function is called while the controller_id field is set,
an error will be returned as these fields are mutually exclusive.
Sourcepub fn payload(&self) -> &CommandPayload
pub fn payload(&self) -> &CommandPayload
Get a reference to the underlying command payload enumeration.
Sourcepub fn payload_mut(&mut self) -> &mut CommandPayload
pub fn payload_mut(&mut self) -> &mut CommandPayload
Get a mutable reference to the underlying command payload enumeration.
Sourcepub fn size_words(&self) -> u16
pub fn size_words(&self) -> u16
Get the size of the command packet (in 32-bit words).