本文整理汇总了C++中android::sp::DispatchMsg方法的典型用法代码示例。如果您正苦于以下问题:C++ sp::DispatchMsg方法的具体用法?C++ sp::DispatchMsg怎么用?C++ sp::DispatchMsg使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android::sp
的用法示例。
在下文中一共展示了sp::DispatchMsg方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tf_write
int TestFrameworkClient::tf_write(const char *buf)
{
int ret = 0, status = 0;
bool send = false;
status = tf_logging_status();
switch(status) {
case TF_LOGCAT:
__android_log_write(ANDROID_LOG_ERROR, LOG_TAG, buf);
break;
case TF_TESTFRAMEWORK:
case TF_ALL:
send = true;
break;
case TF_DISABLE:
break;
}
if (send) {
#ifdef TF_FEATURE_MSGS_THROUGH_BINDER
mTfDispacther->DispatchMsg(buf);
#else
ret = TfWrite(buf);
#endif
}
return ret;
}
示例2: tf_print
int TestFrameworkClient::tf_print(int eventtype, const char *eventgrp,
const char *eventid, const char *fmt, va_list ap) {
char evarg[TF_LOG_BUF_SIZE];
int ret = 0, idx=0, status = TF_DISABLE;
bool send = false;
status = tf_logging_status();
if (TF_DISABLE == status ||
!(mEventType & eventtype) ||
!TfSearchFilterInTable(eventgrp, eventid) ||
!IsTraceGatesOpen()) {
return 0;
}
switch(status) {
case TF_LOGCAT: {
__android_log_vprint(ANDROID_LOG_ERROR, eventgrp, fmt, ap);
}
break;
case TF_LOGCAT_FTRACE:
break;
case TF_TESTFRAMEWORK: {
char modifiedEventID[TF_EVENT_ID_SIZE_MAX];
if (!TfIsValid()) {
TfTracersInit();
}
//add pid to eve
snprintf(modifiedEventID, TF_EVENT_ID_SIZE_MAX, "%s-%d", eventid, getpid());
snprintf(evarg, TF_LOG_BUF_SIZE, "name=%s [class=%s, info=", modifiedEventID, eventgrp);
idx = strlen(evarg);
vsnprintf (evarg+idx, TF_LOG_BUF_SIZE-idx, fmt, ap);
idx = strlen(evarg);
snprintf (evarg+idx, TF_LOG_BUF_SIZE-idx, " {%s}", tf_get_str_eventtype(eventtype));
idx = strlen(evarg);
if (idx < TF_LOG_BUF_SIZE-2) {
strlcpy(evarg+idx, "]\n", TF_LOG_BUF_SIZE-idx);
}
send = true;
}
break;
case TF_ALL: {
char modifiedEventID[TF_EVENT_ID_SIZE_MAX];
if (!TfIsValid()) {
TfTracersInit();
}
//add pid to events
snprintf(modifiedEventID, TF_EVENT_ID_SIZE_MAX, "%s-%d", eventid, getpid());
__android_log_vprint(ANDROID_LOG_ERROR, eventgrp, fmt, ap);
snprintf(evarg, TF_LOG_BUF_SIZE, "name=%s [class=%s, info=", modifiedEventID, eventgrp);
idx = strlen(evarg);
vsnprintf (evarg+idx, TF_LOG_BUF_SIZE-idx, fmt, ap);
idx = strlen(evarg);
snprintf (evarg+idx, TF_LOG_BUF_SIZE-idx, " {%s}", tf_get_str_eventtype(eventtype));
idx = strlen(evarg);
if (idx < TF_LOG_BUF_SIZE-2) {
strlcpy(evarg+idx, "]\n", TF_LOG_BUF_SIZE-idx);
}
send = true;
}
break;
case TF_DISABLE:
default:
break;
}
if (send) {
#ifdef TF_FEATURE_MSGS_THROUGH_BINDER
if (mTfDispacther != 0) {
mTfDispacther->DispatchMsg(eventtype, evarg);
}
#else
ret = TfWrite(eventtype, evarg);
#endif
}
return ret;
}