Exemple #1
0
 public void RunLogService(string logname, LogReceiver receiver)
 {
     AdbHelper.Instance.RunLogService(AndroidDebugBridge.AdbServerSocketAddress, this, logname, receiver);
 }
Exemple #2
0
        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);
                                }
                            }
                        }
                    }
                }
            }
Exemple #3
0
 public void RunEventLogService(LogReceiver receiver)
 {
     AdbHelper.Instance.RunEventLogService(AndroidDebugBridge.AdbServerSocketAddress, this, receiver);
 }
Exemple #4
0
 public void RunEventLogService(IPEndPoint address, Device device, LogReceiver rcvr)
     {
     RunLogService(address, device, "events", rcvr);
     }