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