public void RunLogService(string logname, LogReceiver receiver) { AdbHelper.Instance.RunLogService(AndroidDebugBridge.AdbServerSocketAddress, this, logname, receiver); }
public void RunLogService(IPEndPoint address, Device device, string logName, LogReceiver rcvr) { using (Socket socket = ExecuteRawSocketCommand(address, device, "log:{0}".With(logName))) { byte[] data = new byte[16384]; using (MemoryStream ms = new MemoryStream(data)) { int offset = 0; while (true) { int count; if (rcvr != null && rcvr.IsCancelled) { break; } byte[] buffer = new byte[4*1024]; count = socket.Receive(buffer); if (count < 0) { break; } else if (count == 0) { try { Thread.Sleep(WAIT_TIME*5); } catch (ThreadInterruptedException) { } } else { ms.Write(buffer, offset, count); offset += count; if (rcvr != null) { byte[] d = ms.ToArray(); rcvr.ParseNewData(d, 0, d.Length); } } } } } }
public void RunEventLogService(LogReceiver receiver) { AdbHelper.Instance.RunEventLogService(AndroidDebugBridge.AdbServerSocketAddress, this, receiver); }
public void RunEventLogService(IPEndPoint address, Device device, LogReceiver rcvr) { RunLogService(address, device, "events", rcvr); }