/// <summary> /// Queries the ADB server version. Only the minor version is returned. /// </summary> /// <returns></returns> public int QueryADBVersion() { using (var s = new AdbSocket(true, TransportType.any, null)) { s.SendService("host:version"); return(s.ReceiveData(true, true).FromHexToInt32()); } }
public void WaitForDevice(TransportType ttype, string serialNumber) { using (var s = new AdbSocket(true, ttype, serialNumber)) { s.SendService(string.Format(":wait-for-{0}", ttype)); s.ReadStatus().ThrowOnError(); // First OKAY for command received s.ReadStatus().ThrowOnError(); // Second OKAY for device connected this.UpdateDevices(); } }
public void Reboot(string rebootOption) { rebootOption = rebootOption.ToLower(); using (var s = new AdbSocket(true, TransportType.any, SerialNumber)) { if (rebootOption == "normal") { rebootOption = ""; } s.SendService(string.Format("reboot:{0}", rebootOption)); s.ReceiveData(true, false); } }
public static AdbSocket ConnectWithService(Device device, bool startServer, string service) { var s = new AdbSocket(startServer, TransportType.any, device == null ? null : device.SerialNumber); if (!s.Connect()) { if (startServer) { throw new Exception("Could not connect to the ADB server."); } else { return(null); } } s.SendService(service); return(s); }