Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support extra connection #329

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions maa-sys/src/binding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ link! {
config: *const ::std::os::raw::c_char,
block: AsstBool,
) -> AsstAsyncCallId;

pub fn AsstSetConnectionExtras(
handle: AsstHandle,
name: *const ::std::os::raw::c_char,
extras: *const ::std::os::raw::c_char,
) -> AsstBool;

pub fn AsstAsyncClick(handle: AsstHandle, x: i32, y: i32, block: AsstBool) -> AsstAsyncCallId;
pub fn AsstAsyncScreencap(handle: AsstHandle, block: AsstBool) -> AsstAsyncCallId;

Expand Down
15 changes: 15 additions & 0 deletions maa-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,21 @@
})
}

/// Set the connection extras of the assistant
pub fn set_connection_extras(

Check warning on line 221 in maa-sys/src/lib.rs

View check run for this annotation

Codecov / codecov/patch

maa-sys/src/lib.rs#L221

Added line #L221 was not covered by tests
&self,
name: impl ToCString,
extras: impl ToCString,
) -> Result<()> {
handle_asst(unsafe {
binding::AsstSetConnectionExtras(
self.handle,
name.to_cstring()?.as_ptr(),
extras.to_cstring()?.as_ptr(),

Check warning on line 230 in maa-sys/src/lib.rs

View check run for this annotation

Codecov / codecov/patch

maa-sys/src/lib.rs#L226-L230

Added lines #L226 - L230 were not covered by tests
)
})
}

/// Click the screen at the given position
pub fn async_click(&self, x: i32, y: i32, block: bool) -> Result<AsstAsyncCallId> {
Ok(unsafe { binding::AsstAsyncClick(self.handle, x, y, block.into()) })
Expand Down