GenericLogcatEventParser

public class GenericLogcatEventParser
extends Object

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 في حال بلوغ مهلة الانتظار