-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: update adb_client README.md * chore(internal): add assert_command() method on ADBTransportMessage * chore: minor internal changes * chore: add server-only models
- Loading branch information
Showing
46 changed files
with
173 additions
and
228 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,14 @@ | ||
use crate::{ | ||
device::{adb_message_device::ADBMessageDevice, MessageCommand}, | ||
ADBMessageTransport, RebootType, Result, RustADBError, | ||
ADBMessageTransport, RebootType, Result, | ||
}; | ||
|
||
impl<T: ADBMessageTransport> ADBMessageDevice<T> { | ||
pub(crate) fn reboot(&mut self, reboot_type: RebootType) -> Result<()> { | ||
self.open_session(format!("reboot:{}\0", reboot_type).as_bytes())?; | ||
|
||
let message = self.get_transport_mut().read_message()?; | ||
|
||
if message.header().command() != MessageCommand::Okay { | ||
return Err(RustADBError::ADBShellNotSupported); | ||
} | ||
|
||
Ok(()) | ||
self.get_transport_mut() | ||
.read_message() | ||
.and_then(|message| message.assert_command(MessageCommand::Okay)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
use crate::{models::ADBEmulatorCommand, ADBEmulatorDevice, Result}; | ||
use crate::{emulator_device::ADBEmulatorCommand, ADBEmulatorDevice, Result}; | ||
|
||
impl ADBEmulatorDevice { | ||
/// Send a SMS to this emulator with given content with given phone number | ||
pub fn rotate(&mut self) -> Result<()> { | ||
let transport = self.connect()?; | ||
transport.send_command(ADBEmulatorCommand::Rotate)?; | ||
Ok(()) | ||
self.connect()?.send_command(ADBEmulatorCommand::Rotate) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,11 @@ | ||
use crate::{models::ADBEmulatorCommand, ADBEmulatorDevice, Result}; | ||
use crate::{emulator_device::ADBEmulatorCommand, ADBEmulatorDevice, Result}; | ||
|
||
impl ADBEmulatorDevice { | ||
/// Send a SMS to this emulator with given content with given phone number | ||
pub fn send_sms(&mut self, phone_number: &str, content: &str) -> Result<()> { | ||
let transport = self.connect()?; | ||
transport.send_command(ADBEmulatorCommand::Sms( | ||
self.connect()?.send_command(ADBEmulatorCommand::Sms( | ||
phone_number.to_string(), | ||
content.to_string(), | ||
))?; | ||
Ok(()) | ||
)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
mod adb_emulator_device; | ||
mod commands; | ||
mod models; | ||
pub use adb_emulator_device::ADBEmulatorDevice; | ||
pub(crate) use models::ADBEmulatorCommand; |
2 changes: 1 addition & 1 deletion
2
...client/src/models/adb_emulator_command.rs → ...tor_device/models/adb_emulator_command.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
mod adb_emulator_command; | ||
pub use adb_emulator_command::ADBEmulatorCommand; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.