GenericLogcatEventParser

public class GenericLogcatEventParser
extends Object implements Closeable

java.lang.Object
   ↳ com.android.tradefed.util.GenericLogcatEventParser<LogcatEventType>


تحليل إدخال logcat للأحداث

يفسّر هذا الصف رسائل logcat ويمكنه إبلاغ أداة معالجة الحدث بالأحداث بطريقتَي الحظر والاستقصاء.

ملخّص

الصفوف المتداخلة

class GenericLogcatEventParser.LogcatEvent

بنية لتخزين حدث logcat مع نوع الحدث ورسالة logcat التي تؤدي إلى تشغيله 

طُرق وضع التصميم العامة

GenericLogcatEventParser(ITestDevice device)

إنشاء مثيل جديد لفئة LogcatEventParser

الإجراءات العامة

void close()

أوقِف الاستماع إلى Logcat.

void parseEvents(String[] lines)

تحليل أسطر أداة Logcat وإضافة أي أحداث تم التقاطها (تم تسجيلها باستخدام registerEventTrigger(String,String,LogcatEventType)) إلى صفّ الأحداث

GenericLogcatEventParser.LogcatEvent pollForEvent()

يستطلع قائمة انتظار الأحداث.

void registerEventTrigger(String tag, String msg, LogcatEventType response)

تسجيل حدث لعلامة logcat ورسالة معيّنتَين مع الردّ المطلوب

void registerEventTrigger(Log.LogLevel logLevel, String tag, String msg, LogcatEventType response)

تسجيل حدث بمستوى logcat وعلامة ورسالة محدّدة مع الردّ المطلوب

void start()

ابدأ الاستماع إلى logcat وتحليل الأحداث.

GenericLogcatEventParser.LogcatEvent waitForEvent(long timeoutMs)

يتم الحظر إلى أن يتم تلقّي حدث.

طُرق وضع التصميم العامة

GenericLogcatEventParser

public GenericLogcatEventParser (ITestDevice device)

إنشاء مثيل جديد لفئة LogcatEventParser

المعلَمات
device ITestDevice: لقراءة سجلّ logcat من

الإجراءات العامة

إغلاق

public void close ()

أوقِف الاستماع إلى Logcat.

parseEvents

public void parseEvents (String[] lines)

تحليل أسطر أداة Logcat وإضافة أي أحداث تم التقاطها (تم تسجيلها باستخدام registerEventTrigger(String,String,LogcatEventType)) إلى صفّ الأحداث

المعلَمات
lines String

pollForEvent

public GenericLogcatEventParser.LogcatEvent pollForEvent ()

يستطلع قائمة انتظار الأحداث. يتم عرض النتيجة على الفور.

المرتجعات
GenericLogcatEventParser.LogcatEvent الحدث أو null إذا لم يتم العثور على حدث مطابق

registerEventTrigger

public void registerEventTrigger (String tag, 
                String msg, 
                LogcatEventType response)

تسجيل حدث لعلامة logcat ورسالة معيّنتَين مع الردّ المطلوب قد تكون الرسالة جزئية.

المعلَمات
tag String

msg String

response LogcatEventType

registerEventTrigger

public void registerEventTrigger (Log.LogLevel logLevel, 
                String tag, 
                String msg, 
                LogcatEventType response)

تسجيل حدث بمستوى logcat وعلامة ورسالة محدّدة مع الردّ المطلوب قد تكون الرسالة جزئية.

المعلَمات
logLevel Log.LogLevel

tag String

msg String

response LogcatEventType

البدء

public void start ()

ابدأ الاستماع إلى logcat وتحليل الأحداث.

waitForEvent

public GenericLogcatEventParser.LogcatEvent waitForEvent (long timeoutMs)

يتم الحظر إلى أن يتم تلقّي حدث.

المعلَمات
timeoutMs long: مدة الانتظار بالملّي ثانية

المرتجعات
GenericLogcatEventParser.LogcatEvent الحدث أو null في حال انتهاء المهلة

عمليات الطرح
InterruptedException