本文整理汇总了C++中AutoPtr::AddConnection方法的典型用法代码示例。如果您正苦于以下问题:C++ AutoPtr::AddConnection方法的具体用法?C++ AutoPtr::AddConnection怎么用?C++ AutoPtr::AddConnection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AutoPtr
的用法示例。
在下文中一共展示了AutoPtr::AddConnection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ExecuteMessage
ECode CAccessibilityServiceClientWrapper::ExecuteMessage(
/* [in] */ IMessage* message)
{
Int32 what, arg1;
message->GetWhat(&what);
message->GetArg1(&arg1);
switch (what) {
case DO_ON_ACCESSIBILITY_EVENT : {
AutoPtr<IInterface> obj;
message->GetObj((IInterface**)&obj);
IAccessibilityEvent* event = IAccessibilityEvent::Probe(obj);
if (event != NULL) {
AutoPtr<IAccessibilityInteractionClientHelper> helper;
CAccessibilityInteractionClientHelper::AcquireSingleton((IAccessibilityInteractionClientHelper**)&helper);
AutoPtr<IAccessibilityInteractionClient> client;
helper->GetInstance((IAccessibilityInteractionClient**)&client);
client->OnAccessibilityEvent(event);
mCallback->OnAccessibilityEvent(event);
event->Recycle();
}
return NOERROR;
}
case DO_ON_INTERRUPT :
mCallback->OnInterrupt();
return NOERROR;
case DO_SET_SET_CONNECTION : {
AutoPtr<IAccessibilityInteractionClientHelper> helper;
CAccessibilityInteractionClientHelper::AcquireSingleton((IAccessibilityInteractionClientHelper**)&helper);
AutoPtr<IAccessibilityInteractionClient> client;
helper->GetInstance((IAccessibilityInteractionClient**)&client);
const Int32 connectionId = arg1;
AutoPtr<IInterface> obj;
message->GetObj((IInterface**)&obj);
IIAccessibilityServiceConnection* connection = IIAccessibilityServiceConnection::Probe(obj);
if (connection != NULL) {
client->AddConnection(connectionId, connection);
mCallback->OnSetConnectionId(connectionId);
mCallback->OnServiceConnected();
}
else {
client->RemoveConnection(connectionId);
mCallback->OnSetConnectionId(IAccessibilityInteractionClient::NO_ID);
}
return NOERROR;
}
case DO_ON_GESTURE : {
Boolean result;
mCallback->OnGesture(arg1, &result);
return NOERROR;
}
default :
// Logger::W(LOG_TAG, "Unknown message type %d", what);
break;
}
return NOERROR;
}
示例2: ExecuteMessage
ECode IAccessibilityServiceClientWrapper::ExecuteMessage(
/* [in] */ IMessage* message)
{
Int32 what, arg1;
message->GetWhat(&what);
message->GetArg1(&arg1);
switch (what) {
case DO_ON_ACCESSIBILITY_EVENT : {
AutoPtr<IInterface> obj;
message->GetObj((IInterface**)&obj);
IAccessibilityEvent* event = IAccessibilityEvent::Probe(obj);
if (event != NULL) {
AutoPtr<IAccessibilityInteractionClient> client = CAccessibilityInteractionClient::GetInstance();
client->OnAccessibilityEvent(event);
mCallback->OnAccessibilityEvent(event);
// Make sure the event is recycled.
// try {
IAccessibilityRecord::Probe(event)->Recycle();
// } catch (IllegalStateException ise) {
// /* ignore - best effort */
// }
}
return NOERROR;
}
case DO_ON_INTERRUPT :
mCallback->OnInterrupt();
return NOERROR;
case DO_SET_SET_CONNECTION : {
AutoPtr<IAccessibilityInteractionClient> client = CAccessibilityInteractionClient::GetInstance();
mConnectionId = arg1;
AutoPtr<IInterface> obj;
message->GetObj((IInterface**)&obj);
IIAccessibilityServiceConnection* connection = IIAccessibilityServiceConnection::Probe(obj);
if (connection != NULL) {
client->AddConnection(mConnectionId, connection);
mCallback->OnSetConnectionId(mConnectionId);
mCallback->OnServiceConnected();
}
else {
client->RemoveConnection(mConnectionId);
client->ClearCache();
mCallback->OnSetConnectionId(IAccessibilityInteractionClient::NO_ID);
}
return NOERROR;
}
case DO_ON_GESTURE : {
Boolean result;
mCallback->OnGesture(arg1, &result);
break;
}
case DO_CLEAR_ACCESSIBILITY_CACHE : {
AutoPtr<IAccessibilityInteractionClient> client = CAccessibilityInteractionClient::GetInstance();
client->ClearCache();
return NOERROR;
}
case DO_ON_KEY_EVENT : {
AutoPtr<IInterface> obj;
message->GetObj((IInterface**)&obj);
AutoPtr<IKeyEvent> event = IKeyEvent::Probe(obj);
// try {
AutoPtr<IAccessibilityInteractionClient> client = CAccessibilityInteractionClient::GetInstance();
AutoPtr<IIAccessibilityServiceConnection> connection;
client->GetConnection(mConnectionId, (IIAccessibilityServiceConnection**)&connection);
if (connection != NULL) {
Boolean result;
mCallback->OnKeyEvent(event, &result);
Int32 sequence = arg1;
// try {
connection->SetOnKeyEventResult(result, sequence);
// } catch (RemoteException re) {
/* ignore */
// }
}
// } finally {
// Make sure the event is recycled.
// try {
IAccessibilityRecord::Probe(event)->Recycle();
// } catch (IllegalStateException ise) {
/* ignore - best effort */
// // }
// }
return NOERROR;
}
default :
Logger::W("IAccessibilityServiceClientWrapper", "Unknown message type %d", what);
return NOERROR;
}
return NOERROR;
}