pub struct AgentServer;Expand description
Static functions for AgentServer management.
AgentServer hosts custom recognitions and actions that can be accessed remotely by AgentClient instances.
Implementations§
Source§impl AgentServer
impl AgentServer
Sourcepub fn register_custom_recognition(
name: &str,
reco: Box<dyn CustomRecognition>,
) -> MaaResult<()>
pub fn register_custom_recognition( name: &str, reco: Box<dyn CustomRecognition>, ) -> MaaResult<()>
Register a custom recognition with the AgentServer.
The recognition will be available to connected AgentClients.
The framework rejects an empty name and any name already taken by a custom
recognition or action on this server; Err(MaaError::InvalidArgument) is returned.
Sourcepub fn register_custom_action(
name: &str,
action: Box<dyn CustomAction>,
) -> MaaResult<()>
pub fn register_custom_action( name: &str, action: Box<dyn CustomAction>, ) -> MaaResult<()>
Register a custom action with the AgentServer.
The action will be available to connected AgentClients.
The framework rejects an empty name and any name already taken by a custom
recognition or action on this server; Err(MaaError::InvalidArgument) is returned.
Sourcepub fn add_resource_sink<F>(callback: F) -> MaaResult<MaaSinkId>
pub fn add_resource_sink<F>(callback: F) -> MaaResult<MaaSinkId>
Add a resource event sink.
Sourcepub fn add_controller_sink<F>(callback: F) -> MaaResult<MaaSinkId>
pub fn add_controller_sink<F>(callback: F) -> MaaResult<MaaSinkId>
Add a controller event sink.
Sourcepub fn add_tasker_sink<F>(callback: F) -> MaaResult<MaaSinkId>
pub fn add_tasker_sink<F>(callback: F) -> MaaResult<MaaSinkId>
Add a tasker event sink.
Sourcepub fn add_context_sink<F>(callback: F) -> MaaResult<MaaSinkId>
pub fn add_context_sink<F>(callback: F) -> MaaResult<MaaSinkId>
Add a context event sink.