pub struct AgentClient { /* private fields */ }Expand description
Agent client for remote custom component execution.
Connects to an AgentServer to delegate custom recognition and action execution to a separate process.
Implementations§
Source§impl AgentClient
impl AgentClient
Sourcepub fn new(identifier: Option<&str>) -> MaaResult<Self>
pub fn new(identifier: Option<&str>) -> MaaResult<Self>
Create a new agent client.
§Arguments
identifier- Optional connection identifier for matching specific AgentServer
Sourcepub fn identifier(&self) -> Option<String>
pub fn identifier(&self) -> Option<String>
Get the connection identifier.
Sourcepub fn bind(&mut self, resource: Resource) -> MaaResult<()>
pub fn bind(&mut self, resource: Resource) -> MaaResult<()>
Bind a resource to receive custom recognitions and actions from AgentServer.
Takes ownership of the Resource to ensure it stays alive while bound.
Sourcepub fn register_resource_sink(&mut self, resource: Resource) -> MaaResult<()>
pub fn register_resource_sink(&mut self, resource: Resource) -> MaaResult<()>
Register resource event sink to forward events to AgentServer.
Sourcepub fn register_controller_sink(
&mut self,
controller: Controller,
) -> MaaResult<()>
pub fn register_controller_sink( &mut self, controller: Controller, ) -> MaaResult<()>
Register controller event sink to forward events to AgentServer.
Sourcepub fn register_tasker_sink(&mut self, tasker: Tasker) -> MaaResult<()>
pub fn register_tasker_sink(&mut self, tasker: Tasker) -> MaaResult<()>
Register tasker event sink to forward events to AgentServer.
Sourcepub fn register_sinks(
&mut self,
resource: Resource,
controller: Controller,
tasker: Tasker,
) -> MaaResult<()>
pub fn register_sinks( &mut self, resource: Resource, controller: Controller, tasker: Tasker, ) -> MaaResult<()>
Register all event sinks (resource, controller, tasker) at once.
Sourcepub fn disconnect(&self) -> MaaResult<()>
pub fn disconnect(&self) -> MaaResult<()>
Disconnect from the AgentServer.
Sourcepub fn set_timeout(&self, milliseconds: i64) -> MaaResult<()>
pub fn set_timeout(&self, milliseconds: i64) -> MaaResult<()>
Sourcepub fn custom_recognition_list(&self) -> MaaResult<Vec<String>>
pub fn custom_recognition_list(&self) -> MaaResult<Vec<String>>
Get the list of custom recognitions available on the AgentServer.
Sourcepub fn custom_action_list(&self) -> MaaResult<Vec<String>>
pub fn custom_action_list(&self) -> MaaResult<Vec<String>>
Get the list of custom actions available on the AgentServer.
Sourcepub fn raw(&self) -> *mut MaaAgentClient
pub fn raw(&self) -> *mut MaaAgentClient
Get the raw handle pointer.