(
&self,
udid: &str,
button: &str,
pressed: bool,
usage_page: Option<u32>,
usage: Option<u32>,
)
| 708 | } |
| 709 | |
| 710 | pub fn send_button( |
| 711 | &self, |
| 712 | udid: &str, |
| 713 | button: &str, |
| 714 | pressed: bool, |
| 715 | usage_page: Option<u32>, |
| 716 | usage: Option<u32>, |
| 717 | ) -> Result<(), AppError> { |
| 718 | let udid = CString::new(udid).map_err(|e| AppError::bad_request(e.to_string()))?; |
| 719 | let button = CString::new(button).map_err(|e| AppError::bad_request(e.to_string()))?; |
| 720 | let has_usage = usage_page.is_some() && usage.is_some(); |
| 721 | unsafe { |
| 722 | let mut error = ptr::null_mut(); |
| 723 | bool_result( |
| 724 | ffi::xcw_native_send_button( |
| 725 | udid.as_ptr(), |
| 726 | button.as_ptr(), |
| 727 | pressed, |
| 728 | has_usage, |
| 729 | usage_page.unwrap_or(0), |
| 730 | usage.unwrap_or(0), |
| 731 | &mut error, |
| 732 | ), |
| 733 | error, |
| 734 | ) |
| 735 | } |
| 736 | } |
| 737 | |
| 738 | pub fn rotate_crown(&self, udid: &str, delta: f64) -> Result<(), AppError> { |
| 739 | if !delta.is_finite() { |
no test coverage detected