private static IAndroidLogcatTaskResult QueryDevicesAsync(IAndroidLogcatTaskInput input)
        {
            var adb = ((AndroidLogcatRetrieveDeviceIdsInput)input).adb;

            if (adb == null)
                throw new NullReferenceException("ADB interface has to be valid");

            var result = new AndroidLogcatRetrieveDeviceIdsResult();
            result.notifyListeners = ((AndroidLogcatRetrieveDeviceIdsInput)input).notifyListeners;

            AndroidLogcatInternalLog.Log("{0} devices", adb.GetADBPath());
            try
            {
                var adbOutput = adb.Run(new[] { "devices" }, "Unable to list connected devices. ");
                foreach (var line in adbOutput.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries).Select(line => line.Trim()))
                {
                    AndroidLogcatInternalLog.Log(" " + line);
                    AndroidLogcatRetrieveDeviceIdsResult.DeviceInfo info;
                    if (ParseDeviceInfo(line, out info.id, out info.state))
                        result.deviceInfo.Add(info);
                }
            }
            catch (Exception ex)
            {
                AndroidLogcatInternalLog.Log(ex.Message);
                result.deviceInfo = new List<AndroidLogcatRetrieveDeviceIdsResult.DeviceInfo>();
            }

            return result;
        }
        internal static IAndroidLogcatTaskResult Execute(IAndroidLogcatTaskInput input)
        {
            var adb = ((AndroidLogcatRetrieveDeviceIdsInput)input).adb;

            if (adb == null)
            {
                throw new NullReferenceException("ADB interface has to be valid");
            }

            var result = new AndroidLogcatRetrieveDeviceIdsResult();

            AndroidLogcatInternalLog.Log("{0} devices", adb.GetADBPath());
            var adbOutput = adb.Run(new[] { "devices" }, "Unable to list connected devices. ");

            foreach (var line in adbOutput.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries).Select(line => line.Trim()))
            {
                AndroidLogcatInternalLog.Log(" " + line);
                if (line.EndsWith("device"))
                {
                    var deviceId = line.Split(new[] { '\t', ' ' })[0];
                    result.deviceIds.Add(deviceId);
                }
            }

            return(result);
        }