/// <summary> /// Gets the currently connected devices. /// </summary> public static IEnumerable <AndroidDevice> GetDevices(int timeout) { try { using (var socket = new AdbDevicesRequest(EndPoint)) { return(socket.Devices()); } } catch (Exception ex) { throw new AdbException(string.Format("Failed to list devices because: {0}", ex.Message)); } }
/// <summary> /// Perform the monitor loop /// </summary> private void Run() { var initialLoopCounter = loopCounter; while (initialLoopCounter == loopCounter) { try { if (errorCount > 0) { // Ensure Adb is started new Adb().StartServer(Adb.Timeout.StartServer); errorCount = 0; Thread.Sleep(500); } else { // Start tracking try { using (request = new AdbDevicesRequest(endPoint)) { request.TrackDevices(CallBack); } } finally { request = null; } } } catch { errorCount++; } } }
/// <summary> /// Gets the currently connected devices. /// </summary> public static IEnumerable<AndroidDevice> GetDevices(int timeout) { try { using (var socket = new AdbDevicesRequest(EndPoint)) { return socket.Devices(); } } catch (Exception ex) { throw new AdbException(string.Format("Failed to list devices because: {0}", ex.Message)); } }