当前位置: 首页>>代码示例>>C++>>正文


C++ AutoPtr::AddConnection方法代码示例

本文整理汇总了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;
}
开发者ID:TheTypoMaster,项目名称:ElastosRDK5_0,代码行数:64,代码来源:CAccessibilityServiceClientWrapper.cpp

示例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;
}
开发者ID:elastos,项目名称:Elastos5,代码行数:97,代码来源:AccessibilityService.cpp


注:本文中的AutoPtr::AddConnection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。