void pff_pause_disconnect_test::is_av_started()
{
    int error = 0;
    if (check_audio_started() && check_video_started())
    {
        if (iUsePlayFileBeforeAddSource)
        {
            OSCL_TRY(error, terminal->StartPlayL());
            if (error)
            {
                test_is_true(false);
                disconnect();
            }
        }
        else
        {
            OSCL_TRY(error, terminal->UsePlayFileAsSourceL(true));
            if (error)
            {
                test_is_true(false);
                disconnect();
            }
        }
    }

    return;
}
bool pff_pause_disconnect_test::start_async_test()
{
    int error = 0;

    OSCL_TRY(error, terminal = CPV2WayEngineFactory::CreateTerminalL(PV_324M,
                               (MPVCmnCmdStatusObserver *) this,
                               (MPVCmnInfoEventObserver *) this,
                               (MPVCmnErrorEventObserver *) this));

    if (error)
    {
        test_is_true(false);
        return false;
    }

    create_sink_source();

    OSCL_TRY(error, terminal->InitL(iSdkInitInfo, iCommServer));
    if (error)
    {
        test_is_true(false);
        CPV2WayEngineFactory::DeleteTerminal(terminal);
        terminal = NULL;
        return false;
    }

    return true;
}
void connect_test::InitSucceeded()
{
    i324mConfigInterface = iH324MConfig;
    //OSCL_TRY(error, i324mIFCommandId = terminal->QueryInterface(h324mUuid, i324mConfigInterface,NULL));
    if (i324mConfigInterface == NULL)
    {
        test_is_true(false);
        reset();
        return;

    }
    // set some timers via the interface
    H324MConfigInterface * i324Interface = (H324MConfigInterface *)i324mConfigInterface;
    if (iRunTimerTest)
    {
        i324Interface->SetTimerCounter(EH324Timer, 1, 1, 10, NULL);
        i324Interface->SetTimerCounter(EH324Counter, 4, 1, 10, NULL);
    }
    i324Interface->removeRef();
    iStackIFSet = true;
    int error;
    PVUuid mp4h263EncUuid = PVMp4H263EncExtensionUUID;
    OSCL_TRY(error, iEncoderIFCommandId = terminal->QueryInterface(mp4h263EncUuid, iMP4H263EncoderInterface, NULL));
    if (error)
    {
        test_is_true(false);
        reset();
    }
}
void receive_data_test::TimeoutOccurred(int32 timerID, int32 timeoutInfo)
{
    if (timerID == iTimerConnectionID)
    {
        //PV2WayUtil::OutputInfo("\n-------- Basic lipsync test stats--------\n");
        //PV2WayUtil::OutputInfo("\n------------------------------------------\n");
        //timer->Request(iTimerRender, iTimeoutInfoRender, RENDER_DURATION);
        PV2WayUtil::OutputInfo("\nReceived: Audio %d Video %d\n",
                               iReceivedAudio, iReceivedVideo);
        if (iReceivedAudio > 0 &&
                iReceivedVideo > 0)
        {
            test_is_true(true);
        }
        else
        {
            test_is_true(false);
        }
        DisconnectSourceSinks();
    }
    else if (timerID == iTimerTestTimeoutID)
    {
        timer->Cancel(iTimerConnectionID);
        test_is_true(false);
        // cleanup because we are unsuccessful
        DisconnectSourceSinks();
    }
}
 virtual void test(void)
 {
     int_point first_equal_point(1, 9);
     int_point second_equal_point(9, 2);
     test_is_true(top_left_point != first_equal_point);
     test_is_true(top_left_point != second_equal_point);
     test_is_true(top_left_point != bottom_right_point);
 }
void pff_eos_test::check_eos()
{
    int error = 0;

    if (iStopPlayLCalled) return;

    if (iWaitForAudioEOS)
    {
        if (!iAudioEOSRecv) return;
    }

    if (iWaitForVideoEOS)
    {
        if (!iVideoEOSRecv) return;
    }

    OSCL_TRY(error, terminal->StopPlayL());
    if (error)
    {
        test_is_true(false);
        disconnect();
    }
    else
    {
        iStopPlayLCalled = true;
    }

    return;
}
bool test_base::Init()
{
    int32 error = 0;
    OSCL_FastString aStr;

    /*!

      Step 7: Initialize terminal
      @param PV2Way324InitInfo
      Initialize the terminal using PV2Way324InitInfo structure to set
      the formats that the application supports
    */
    OSCL_TRY(error, iInitCmdId = terminal->Init(iSdkInitInfo));
    if (error)
    {
        printf("\n*************** Test FAILED: could not initialize terminal *************** \n");
        test_is_true(false);

        if (iUseProxy)
        {
            CPV2WayProxyFactory::DeleteTerminal(terminal);
        }
        else
        {
            CPV2WayEngineFactory::DeleteTerminal(terminal);
        }

        terminal = NULL;
        return false;
    }
    return true;
}
bool init_play_test::start_async_test()
{
    int error = 0;

    if (iUseProxy)
    {
        OSCL_TRY(error, terminal = CPV2WayProxyFactory::CreateTerminalL(PV_324M,
                                   (MPVCmnCmdStatusObserver *) this,
                                   (MPVCmnInfoEventObserver *) this,
                                   (MPVCmnErrorEventObserver *) this));
    }
    else
    {
        OSCL_TRY(error, terminal = CPV2WayEngineFactory::CreateTerminalL(PV_324M,
                                   (MPVCmnCmdStatusObserver *) this,
                                   (MPVCmnInfoEventObserver *) this,
                                   (MPVCmnErrorEventObserver *) this));
    }

    if (error)
    {
        test_is_true(false);
        return false;
    }

    create_sink_source();

    OSCL_TRY(error, terminal->InitL(iSdkInitInfo, iCommServer));
    if (error)
    {
        test_is_true(false);

        if (iUseProxy)
        {
            CPV2WayProxyFactory::DeleteTerminal(terminal);
        }
        else
        {
            CPV2WayEngineFactory::DeleteTerminal(terminal);
        }

        terminal = NULL;
        return false;
    }

    return true;
}
void init_test::InitSucceeded()
{
    iRstCmdId = 0;
    int error;
    cleanup();
    OSCL_TRY(error, iRstCmdId =  terminal->Reset());
    if (error)
    {
        test_is_true(false);
        RunIfNotReady();
    }
    else
    {
        if (iCurrentRun >= (iMaxRuns - 1))
        {
            test_is_true(true);
        }
    }
}
void user_input_test::ConnectSucceeeded()
{
    if (iH324MConfig == NULL)
    {
        test_is_true(false);
        disconnect();
    }
    H324MConfigInterface * t324Interface = (H324MConfigInterface *)iH324MConfig;
    t324Interface->SetObserver(this);
    iUserInputId = t324Interface->SendUserInput(iUserInput);
}
void video_preview_disconnect_test::HandleInformationalEventL(const CPVCmnAsyncInfoEvent& aEvent)
{
    int error = 0;

    switch (aEvent.GetEventType())
    {
        case PVT_INDICATION_INCOMING_TRACK:
            TPVChannelId id;

            if (((CPVCmnAsyncEvent&)aEvent).GetLocalBuffer()[0] == PV_VIDEO)
            {
                OSCL_TRY(error, iVideoAddSinkId = terminal->AddDataSinkL(*iVideoSink, id));
                if (error)
                {
                    test_is_true(false);
                    disconnect();
                }
            }
            break;

        case PVT_INDICATION_DISCONNECT:
            iAudioSourceAdded = false;
            iVideoSourceAdded = false;
            iAudioSinkAdded = false;
            iVideoSinkAdded = false;
            break;

        case PVT_INDICATION_CLOSE_TRACK:
            if (((CPVCmnAsyncEvent&)aEvent).GetLocalBuffer()[0] == PV_VIDEO)
            {
                if (((CPVCmnAsyncEvent&)aEvent).GetLocalBuffer()[1] == INCOMING)
                {
                    iVideoSinkAdded = false;
                }
                else
                {
                    iVideoSourceAdded = false;
                }

                if (check_video_stopped())
                {
                    disconnect();
                }
            }
            break;

        case PVT_INDICATION_INTERNAL_ERROR:
            break;

        default:
            break;
    }
}
void init_cancel_test::QueryInterfaceSucceeded()
{
    test_base::QueryInterfaceSucceeded();

    int error = 0;
    OSCL_TRY(error, iCnclCmdId = terminal->CancelAllCommands());
    if (error)
    {
        test_is_true(false);
    }

}
void test_base::VideoRemoveSourceCompleted()
{
    int error = 0;
    iVideoSourceAdded = false;
    OSCL_TRY(error, iVideoRemoveSinkId = iSourceAndSinks->RemoveVideoSink());
    if (error)
    {
        printf("\n*************** Test FAILED: error removing video sink *************** \n");
        test_is_true(false);
        disconnect();
    }
}
void connect_test::DisCmdFailed()
{
    test_is_true(false);
    reset();
    // yep- this is how the code was.
    if (++iCurrentRun < iMaxRuns)
    {
        connect();
    }
    else
    {
        reset();
    }
    destroy_sink_source();
}
bool user_input_test::start_async_test()
{
    if (iIsDTMF)
    {
        iUserInput = OSCL_NEW(CPVUserInputDtmf,
                              (DTMF_TEST_INPUT, DTMF_TEST_UPDATE, DTMF_TEST_DURATION));
    }
    else
    {
        iUserInput = OSCL_NEW(CPVUserInputAlphanumeric,
                              (alphanumericTestString, ALPHANUMERIC_STRING_LENGTH));
    }

    if (iUserInput == NULL)
    {
        test_is_true(false);
        return false;
    }


    return test_base::start_async_test();;
}
void test_base::ConnectFailed()
{
    printf("\n*************** Test FAILED: connect failed *************** \n");
    test_is_true(false);
    reset();
}
void init_cancel_test::InitFailed()
{
    test_is_true(false);
    RunIfNotReady();
}
void init_cancel_test::InitSucceeded()
{
    test_is_true(true);
    reset();
}
void pff_pause_disconnect_test::CommandCompletedL(const CPVCmnCmdResp& aResponse)
{
    int error = 0;
    switch (aResponse.GetCmdType())
    {
        case PVT_COMMAND_INIT:
            if (aResponse.GetCmdStatus() == PVMFSuccess)
            {
                OSCL_TRY(error, terminal->InitPlayFileL(iFilename));
                if (error)
                {
                    test_is_true(false);
                    reset();
                }
            }
            else
            {
                test_is_true(false);
                RunIfNotReady();
            }
            break;

        case PVT_COMMAND_RESET:
            RunIfNotReady();
            break;

        case PVT_COMMAND_ADD_DATA_SOURCE:
            if (aResponse.GetCmdId() == iAudioAddSourceId)
            {
                if (aResponse.GetCmdStatus() == PVMFSuccess)
                {
                    iAudioSourceAdded = true;
                    is_av_started();
                }
                else
                {
                    test_is_true(false);
                    disconnect();
                }
                iAudioAddSourceId = 0;
            }
            else if (aResponse.GetCmdId() == iVideoAddSourceId)
            {
                if (aResponse.GetCmdStatus() == PVMFSuccess)
                {
                    iVideoSourceAdded = true;
                    is_av_started();
                }
                else
                {
                    test_is_true(false);
                    disconnect();
                }
                iVideoAddSourceId = 0;
            }
            break;

        case PVT_COMMAND_REMOVE_DATA_SOURCE:
            if (aResponse.GetCmdId() == iAudioRemoveSourceId)
            {
                iAudioRemoveSourceId = 0;
                iAudioSourceAdded = false;
            }
            else if (aResponse.GetCmdId() == iVideoRemoveSourceId)
            {
                iVideoRemoveSourceId = 0;
                iVideoSourceAdded = false;
            }
            break;

        case PVT_COMMAND_ADD_DATA_SINK:
            if (aResponse.GetCmdId() == iAudioAddSinkId)
            {
                if (aResponse.GetCmdStatus() == PVMFSuccess)
                {
                    iAudioSinkAdded = true;
                    is_av_started();
                }
                else
                {
                    test_is_true(false);
                    disconnect();
                }
                iAudioAddSinkId = 0;
            }
            else if (aResponse.GetCmdId() == iVideoAddSinkId)
            {
                if (aResponse.GetCmdStatus() == PVMFSuccess)
                {
                    iVideoSinkAdded = true;
                    is_av_started();
                }
                else
                {
                    test_is_true(false);
                    disconnect();
                }
                iVideoAddSinkId = 0;
            }
            break;

        case PVT_COMMAND_REMOVE_DATA_SINK:
            if (aResponse.GetCmdId() == iAudioRemoveSinkId)
            {
                iAudioRemoveSinkId = 0;
                iAudioSinkAdded = false;
            }
            else if (aResponse.GetCmdId() == iVideoRemoveSinkId)
            {
                iVideoRemoveSinkId  = 0;
                iVideoSinkAdded = false;
            }
            break;

        case PVT_COMMAND_CONNECT:
            if (aResponse.GetCmdStatus() == PVMFSuccess)
            {
                OSCL_TRY(error, iAudioAddSourceId = terminal->AddDataSourceL(*iAudioSource));
                if (error)
                {
                    test_is_true(false);
                    disconnect();
                }

                OSCL_TRY(error, iVideoAddSourceId = terminal->AddDataSourceL(*iVideoSource));
                if (error)
                {
                    test_is_true(false);
                    disconnect();
                }
            }
            else
            {
                test_is_true(false);
                reset();
            }
            break;

        case PVT_COMMAND_DISCONNECT:
            iAudioSourceAdded = false;
            iVideoSourceAdded = false;
            iAudioSinkAdded = false;
            iVideoSinkAdded = false;

            if (aResponse.GetCmdStatus() == PVMFSuccess)
            {
                test_is_true(true);
            }

            OSCL_TRY(error, terminal->ResetPlayFileL());
            if (error)
            {
                reset();
            }
            break;

        case PVT_COMMAND_INIT_PLAY_FILE:
            if (aResponse.GetCmdStatus() == PVMFSuccess)
            {
                if (iUsePlayFileBeforeAddSource)
                {
                    OSCL_TRY(error, terminal->UsePlayFileAsSourceL(true));
                    if (error)
                    {
                        test_is_true(false);
                        reset();
                    }
                }
                else
                {
                    OSCL_TRY(error, terminal->ConnectL(iConnectOptions));
                    if (error)
                    {
                        test_is_true(false);
                        reset();
                    }
                }
            }
            else
            {
                test_is_true(false);
                reset();
            }
            break;

        case PVT_COMMAND_RESET_PLAY_FILE:
            reset();
            break;

        case PVT_COMMAND_USE_PLAY_FILE:
            if (aResponse.GetCmdStatus() == PVMFSuccess)
            {
                if (iUsePlayFileBeforeAddSource)
                {
                    OSCL_TRY(error, terminal->ConnectL(iConnectOptions));
                    if (error)
                    {
                        test_is_true(false);
                        reset();
                    }
                }
                else
                {
                    OSCL_TRY(error, terminal->StartPlayL());
                    if (error)
                    {
                        test_is_true(false);
                        disconnect();
                    }
                }
            }
            else
            {
                test_is_true(false);
                if (iUsePlayFileBeforeAddSource)
                {
                    reset();
                }
                else
                {
                    disconnect();
                }
            }
            break;

        case PVT_COMMAND_START_PLAY:
            if (aResponse.GetCmdStatus() == PVMFSuccess)
            {
                OSCL_TRY(error, terminal->PausePlayL());
                if (error)
                {
                    test_is_true(false);
                    disconnect();
                }
            }
            else
            {
                test_is_true(false);
                disconnect();
            }
            break;

        case PVT_COMMAND_PAUSE_PLAY:
            if (aResponse.GetCmdStatus() == PVMFSuccess)
            {
                TPVPostDisconnectOption option;
                OSCL_TRY(error, terminal->DisconnectL(option));
                if (error)
                {
                    test_is_true(false);
                    reset();
                }
            }
            else
            {
                test_is_true(false);
                disconnect();
            }
            break;
    }
}
void connect_test::InitFailed()
{
    test_is_true(false);
    test_base::InitFailed();
}
void video_preview_disconnect_test::CommandCompletedL(const CPVCmnCmdResp& aResponse)
{
    int error = 0;
    switch (aResponse.GetCmdType())
    {
        case PVT_COMMAND_INIT:
            if (aResponse.GetCmdStatus() == PVMFSuccess)
            {
                OSCL_TRY(error, terminal->ConnectL(iConnectOptions));
                if (error)
                {
                    test_is_true(false);
                    reset();
                }
                else
                {
                }
            }
            else
            {
                test_is_true(false);
                RunIfNotReady();
            }
            break;

        case PVT_COMMAND_RESET:
            RunIfNotReady();
            break;

        case PVT_COMMAND_ADD_DATA_SOURCE:
            if (aResponse.GetCmdId() == iVideoAddSourceId)
            {
                if (aResponse.GetCmdStatus() == PVMFSuccess)
                {
                    iVideoSourceAdded = true;

                    if (check_video_started())
                    {
                        OSCL_TRY(error, terminal->AddPreviewSinkL(*iVideoSource, *iVideoPreview));
                        if (error)
                        {
                            test_is_true(false);
                            disconnect();
                        }
                    }
                }
                else
                {
                    test_is_true(false);
                    disconnect();
                }
                iVideoAddSourceId = 0;
            }
            break;

        case PVT_COMMAND_REMOVE_DATA_SOURCE:
            if (aResponse.GetCmdId() == iVideoRemoveSourceId)
            {
                iVideoRemoveSourceId = 0;
                iVideoSourceAdded = false;

                if (check_video_stopped())
                {
                    disconnect();
                }
            }
            break;

        case PVT_COMMAND_ADD_DATA_SINK:
            if (aResponse.GetCmdId() == iVideoAddSinkId)
            {
                if (aResponse.GetCmdStatus() == PVMFSuccess)
                {
                    iVideoSinkAdded = true;

                    if (check_video_started())
                    {
                        OSCL_TRY(error, terminal->AddPreviewSinkL(*iVideoSource, *iVideoPreview));
                        if (error)
                        {
                            test_is_true(false);
                            disconnect();
                        }
                    }
                }
                else
                {
                    test_is_true(false);
                    disconnect();
                }
                iVideoAddSinkId = 0;
            }
            break;

        case PVT_COMMAND_REMOVE_DATA_SINK:
            if (aResponse.GetCmdId() == iVideoRemoveSinkId)
            {
                iVideoRemoveSinkId = 0;
                iVideoSinkAdded = false;

                if (check_video_stopped())
                {
                    disconnect();
                }
            }
            break;

        case PVT_COMMAND_CONNECT:
            if (aResponse.GetCmdStatus() == PVMFSuccess)
            {
                OSCL_TRY(error, iVideoAddSourceId = terminal->AddDataSourceL(*iVideoSource));
                if (error)
                {
                    test_is_true(false);
                    disconnect();
                }
            }
            else
            {
                test_is_true(false);
                reset();
            }
            break;

        case PVT_COMMAND_DISCONNECT:
            iAudioSourceAdded = false;
            iVideoSourceAdded = false;
            iAudioSinkAdded = false;
            iVideoSinkAdded = false;

            if (aResponse.GetCmdStatus() == PVMFSuccess)
            {
                test_is_true(true);
            }
            else
            {
                test_is_true(false);
            }

            reset();
            break;


        case PVT_COMMAND_ADD_PREVIEW_SINK:
            if (aResponse.GetCmdStatus() == PVMFSuccess)
            {
                TPVPostDisconnectOption option;
                OSCL_TRY(error, terminal->DisconnectL(option));
                if (error)
                {
                    test_is_true(false);
                    reset();
                }
            }
            else
            {
                test_is_true(false);
                disconnect();
            }
            break;

        case PVT_COMMAND_REMOVE_PREVIEW_SINK:
            test_is_true(false);
            break;
    }
}
void av_pause_rec_disconnect_test::CommandCompletedL(const CPVCmnCmdResp& aResponse)
{
    int error = 0;
    switch (aResponse.GetCmdType())
    {
        case PVT_COMMAND_INIT:
            if (aResponse.GetCmdStatus() == PVMFSuccess)
            {
                OSCL_wHeapString<OsclMemAllocator> filename(RECORDED_CALL_FILENAME);
                OSCL_TRY(error, terminal->InitRecordFileL(filename));
                if (error)
                {
                    test_is_true(false);
                    reset();
                }
            }
            else
            {
                test_is_true(false);
                RunIfNotReady();
            }
            break;

        case PVT_COMMAND_RESET:
            RunIfNotReady();
            break;

        case PVT_COMMAND_ADD_DATA_SOURCE:
            if (aResponse.GetCmdId() == iAudioAddSourceId)
            {
                if (aResponse.GetCmdStatus() == PVMFSuccess)
                {
                    iAudioSourceAdded = true;

                    if (check_audio_started() && check_video_started())
                    {
                        OSCL_TRY(error, iAudioStartRecId = terminal->StartRecordL(*iAudioSink));
                        if (error)
                        {
                            test_is_true(false);
                            disconnect();
                        }

                        OSCL_TRY(error, iVideoStartRecId = terminal->StartRecordL(*iVideoSink));
                        if (error)
                        {
                            test_is_true(false);
                            disconnect();
                        }
                    }
                }
                else
                {
                    test_is_true(false);
                    disconnect();
                }
                iAudioAddSourceId = 0;
            }
            else if (aResponse.GetCmdId() == iVideoAddSourceId)
            {
                if (aResponse.GetCmdStatus() == PVMFSuccess)
                {
                    iVideoSourceAdded = true;

                    if (check_audio_started() && check_video_started())
                    {
                        OSCL_TRY(error, iAudioStartRecId = terminal->StartRecordL(*iAudioSink));
                        if (error)
                        {
                            test_is_true(false);
                            disconnect();
                        }

                        OSCL_TRY(error, iVideoStartRecId = terminal->StartRecordL(*iVideoSink));
                        if (error)
                        {
                            test_is_true(false);
                            disconnect();
                        }
                    }
                }
                else
                {
                    test_is_true(false);
                    disconnect();
                }
                iVideoAddSourceId = 0;
            }
            break;

        case PVT_COMMAND_REMOVE_DATA_SOURCE:
            if (aResponse.GetCmdId() == iAudioRemoveSourceId)
            {
                iAudioRemoveSourceId = 0;
                iAudioSourceAdded = false;
            }
            else if (aResponse.GetCmdId() == iVideoRemoveSourceId)
            {
                iVideoRemoveSourceId = 0;
                iVideoSourceAdded = false;
            }
            break;

        case PVT_COMMAND_ADD_DATA_SINK:
            if (aResponse.GetCmdId() == iAudioAddSinkId)
            {
                if (aResponse.GetCmdStatus() == PVMFSuccess)
                {
                    iAudioSinkAdded = true;

                    if (check_audio_started() && check_video_started())
                    {
                        OSCL_TRY(error, iAudioStartRecId = terminal->StartRecordL(*iAudioSink));
                        if (error)
                        {
                            test_is_true(false);
                            disconnect();
                        }

                        OSCL_TRY(error, iVideoStartRecId = terminal->StartRecordL(*iVideoSink));
                        if (error)
                        {
                            test_is_true(false);
                            disconnect();
                        }
                    }
                }
                else
                {
                    test_is_true(false);
                    disconnect();
                }
                iAudioAddSinkId = 0;
            }
            else if (aResponse.GetCmdId() == iVideoAddSinkId)
            {
                if (aResponse.GetCmdStatus() == PVMFSuccess)
                {
                    iVideoSinkAdded = true;

                    if (check_audio_started() && check_video_started())
                    {
                        OSCL_TRY(error, iAudioStartRecId = terminal->StartRecordL(*iAudioSink));
                        if (error)
                        {
                            test_is_true(false);
                            disconnect();
                        }

                        OSCL_TRY(error, iVideoStartRecId = terminal->StartRecordL(*iVideoSink));
                        if (error)
                        {
                            test_is_true(false);
                            disconnect();
                        }
                    }
                }
                else
                {
                    test_is_true(false);
                    disconnect();
                }
                iVideoAddSinkId = 0;
            }
            break;

        case PVT_COMMAND_REMOVE_DATA_SINK:
            if (aResponse.GetCmdId() == iAudioRemoveSinkId)
            {
                iAudioRemoveSinkId = 0;
                iAudioSinkAdded = false;
            }
            else if (aResponse.GetCmdId() == iVideoRemoveSinkId)
            {
                iVideoRemoveSinkId  = 0;
                iVideoSinkAdded = false;
            }
            break;

        case PVT_COMMAND_CONNECT:
            if (aResponse.GetCmdStatus() == PVMFSuccess)
            {
                OSCL_TRY(error, iAudioAddSourceId = terminal->AddDataSourceL(*iAudioSource));
                if (error)
                {
                    test_is_true(false);
                    disconnect();
                }

                OSCL_TRY(error, iVideoAddSourceId = terminal->AddDataSourceL(*iVideoSource));
                if (error)
                {
                    test_is_true(false);
                    disconnect();
                }
            }
            else
            {
                test_is_true(false);
                reset();
            }
            break;

        case PVT_COMMAND_DISCONNECT:
            iAudioSourceAdded = false;
            iVideoSourceAdded = false;
            iAudioSinkAdded = false;
            iVideoSinkAdded = false;

            test_is_true(true);

            OSCL_TRY(error, terminal->ResetRecordFileL());
            if (error)
            {
                reset();
            }
            break;

        case PVT_COMMAND_INIT_RECORD_FILE:
            if (aResponse.GetCmdStatus() == PVMFSuccess)
            {
                OSCL_TRY(error, terminal->ConnectL(iConnectOptions));
                if (error)
                {
                    test_is_true(false);
                    reset();
                }
            }
            else
            {
                test_is_true(false);
                reset();
            }
            break;

        case PVT_COMMAND_RESET_RECORD_FILE:
            reset();
            break;

        case PVT_COMMAND_START_RECORD:
            if (aResponse.GetCmdId() == iAudioStartRecId)
            {
                if (aResponse.GetCmdStatus() == PVMFSuccess)
                {
                    OSCL_TRY(error, iAudioPauseRecId = terminal->PauseRecordL(*iAudioSink));
                    if (error)
                    {
                        test_is_true(false);
                        disconnect();
                    }
                }
                else
                {
                    test_is_true(false);
                    disconnect();
                }
                iAudioStartRecId = 0;
            }
            else if (aResponse.GetCmdId() == iVideoStartRecId)
            {
                if (aResponse.GetCmdStatus() == PVMFSuccess)
                {
                    OSCL_TRY(error, iVideoPauseRecId = terminal->PauseRecordL(*iVideoSink));
                    if (error)
                    {
                        test_is_true(false);
                        disconnect();
                    }
                }
                else
                {
                    test_is_true(false);
                    disconnect();
                }
                iVideoStartRecId = 0;
            }
            break;

        case PVT_COMMAND_PAUSE_RECORD:
            if (aResponse.GetCmdId() == iAudioPauseRecId)
            {
                if (aResponse.GetCmdStatus() == PVMFSuccess)
                {
                    iAudioRecPaused = true;

                    if (check_rec_paused())
                    {
                        disconnect();
                    }
                }
                else
                {
                    test_is_true(false);
                    disconnect();
                }
                iAudioPauseRecId = 0;
            }
            else if (aResponse.GetCmdId() == iVideoPauseRecId)
            {
                if (aResponse.GetCmdStatus() == PVMFSuccess)
                {
                    iVideoRecPaused = true;

                    if (check_rec_paused())
                    {
                        disconnect();
                    }
                }
                else
                {
                    test_is_true(false);
                    disconnect();
                }
                iVideoPauseRecId = 0;
            }
            break;
    }
}
 virtual void test(void)
 {
     int_point test_equal_point(1, 2);
     test_is_true(top_left_point == top_left_point);
     test_is_true(top_left_point == test_equal_point);
 }
void init_play_test::CommandCompletedL(const CPVCmnCmdResp& aResponse)
{
    int error = 0;
    switch (aResponse.GetCmdType())
    {
        case PVT_COMMAND_INIT:
            if (aResponse.GetCmdStatus() == PVMFSuccess)
            {
                OSCL_TRY(error, terminal->InitPlayFileL(iFilename));
                if (error)
                {
                    test_is_true(false);
                    reset();
                }
                else
                {
                }
            }
            else
            {
                test_is_true(false);
                reset();
            }
            break;

        case PVT_COMMAND_RESET:
            RunIfNotReady();
            break;

        case PVT_COMMAND_INIT_PLAY_FILE:
            if (aResponse.GetCmdStatus() == PVMFSuccess)
            {
                OSCL_TRY(error, terminal->ResetPlayFileL());
                if (error)
                {
                    test_is_true(false);
                    reset();
                }
                else
                {
                }
            }
            else
            {
                test_is_true(false);
                reset();
            }
            break;

        case PVT_COMMAND_RESET_PLAY_FILE:
            if (aResponse.GetCmdStatus() == PVMFSuccess)
            {
                iCurrentRun++;
                if (iCurrentRun < iMaxRuns)
                {
                    OSCL_TRY(error, terminal->InitPlayFileL(iFilename));
                    if (error)
                    {
                        test_is_true(false);
                        reset();
                    }
                }
                else
                {
                    test_is_true(true);

                    OSCL_TRY(error, terminal->ResetL());
                    if (error)
                    {
                        test_is_true(false);
                        RunIfNotReady();
                    }
                    else
                    {
                    }
                }
            }
            else
            {
                test_is_true(false);
                RunIfNotReady();
            }
            break;
    }
}
void user_input_test::InitFailed()
{
    test_is_true(false);
    RunIfNotReady();
}
void test_base::CancelCmdCompleted()
{
    test_is_true(true);
    RunIfNotReady();
}
void pff_eos_test::CommandCompletedL(const CPVCmnCmdResp& aResponse)
{
    int error = 0;
    switch (aResponse.GetCmdType())
    {
        case PVT_COMMAND_INIT:
            if (aResponse.GetCmdStatus() == PVMFSuccess)
            {
                OSCL_TRY(error, terminal->InitPlayFileL(iFilename));
                if (error)
                {
                    test_is_true(false);
                    reset();
                }
            }
            else
            {
                test_is_true(false);
                RunIfNotReady();
            }
            break;

        case PVT_COMMAND_RESET:
            RunIfNotReady();
            break;

        case PVT_COMMAND_ADD_DATA_SOURCE:
            if (aResponse.GetCmdId() == iAudioAddSourceId)
            {
                if (aResponse.GetCmdStatus() == PVMFSuccess)
                {
                    iAudioSourceAdded = true;

                    if (check_audio_started() && check_video_started())
                    {
                        OSCL_TRY(error, terminal->StartPlayL());
                        if (error)
                        {
                            test_is_true(false);
                            disconnect();
                        }
                    }
                }
                else
                {
                    test_is_true(false);
                    disconnect();
                }
                iAudioAddSourceId = 0;
            }
            else if (aResponse.GetCmdId() == iVideoAddSourceId)
            {
                if (aResponse.GetCmdStatus() == PVMFSuccess)
                {
                    iVideoSourceAdded = true;

                    if (check_audio_started() && check_video_started())
                    {
                        OSCL_TRY(error, terminal->StartPlayL());
                        if (error)
                        {
                            test_is_true(false);
                            disconnect();
                        }
                    }
                }
                else
                {
                    test_is_true(false);
                    disconnect();
                }
                iVideoAddSourceId = 0;
            }
            break;

        case PVT_COMMAND_REMOVE_DATA_SOURCE:
            if (aResponse.GetCmdId() == iAudioRemoveSourceId)
            {
                iAudioRemoveSourceId = 0;
                iAudioSourceAdded = false;
            }
            else if (aResponse.GetCmdId() == iVideoRemoveSourceId)
            {
                iVideoRemoveSourceId = 0;
                iVideoSourceAdded = false;
            }
            break;

        case PVT_COMMAND_ADD_DATA_SINK:
            if (aResponse.GetCmdId() == iAudioAddSinkId)
            {
                if (aResponse.GetCmdStatus() == PVMFSuccess)
                {
                    iAudioSinkAdded = true;

                    if (check_audio_started() && check_video_started())
                    {
                        OSCL_TRY(error, terminal->StartPlayL());
                        if (error)
                        {
                            test_is_true(false);
                            disconnect();
                        }
                    }
                }
                else
                {
                    test_is_true(false);
                    disconnect();
                }
                iAudioAddSinkId = 0;
            }
            else if (aResponse.GetCmdId() == iVideoAddSinkId)
            {
                if (aResponse.GetCmdStatus() == PVMFSuccess)
                {
                    iVideoSinkAdded = true;

                    if (check_audio_started() && check_video_started())
                    {
                        OSCL_TRY(error, terminal->StartPlayL());
                        if (error)
                        {
                            test_is_true(false);
                            disconnect();
                        }
                    }
                }
                else
                {
                    test_is_true(false);
                    disconnect();
                }
                iVideoAddSinkId = 0;
            }
            break;

        case PVT_COMMAND_REMOVE_DATA_SINK:
            if (aResponse.GetCmdId() == iAudioRemoveSinkId)
            {
                iAudioRemoveSinkId = 0;
                iAudioSinkAdded = false;
            }
            else if (aResponse.GetCmdId() == iVideoRemoveSinkId)
            {
                iVideoRemoveSinkId  = 0;
                iVideoSinkAdded = false;
            }
            break;

        case PVT_COMMAND_CONNECT:
            if (aResponse.GetCmdStatus() == PVMFSuccess)
            {
                OSCL_TRY(error, iAudioAddSourceId = terminal->AddDataSourceL(*iAudioSource));
                if (error)
                {
                    test_is_true(false);
                    disconnect();
                }

                OSCL_TRY(error, iVideoAddSourceId = terminal->AddDataSourceL(*iVideoSource));
                if (error)
                {
                    test_is_true(false);
                    disconnect();
                }
            }
            else
            {
                test_is_true(false);
                reset();
            }
            break;

        case PVT_COMMAND_DISCONNECT:
            iAudioSourceAdded = false;
            iVideoSourceAdded = false;
            iAudioSinkAdded = false;
            iVideoSinkAdded = false;

            OSCL_TRY(error, terminal->ResetPlayFileL());
            if (error)
            {
                reset();
            }
            break;

        case PVT_COMMAND_INIT_PLAY_FILE:
            if (aResponse.GetCmdStatus() == PVMFSuccess)
            {
                OSCL_TRY(error, terminal->ConnectL(iConnectOptions));
                if (error)
                {
                    test_is_true(false);
                    reset();
                }
            }
            else
            {
                test_is_true(false);
                reset();
            }
            break;

        case PVT_COMMAND_RESET_PLAY_FILE:
            reset();
            break;

        case PVT_COMMAND_START_PLAY:
            if (aResponse.GetCmdStatus() == PVMFSuccess)
            {
                //Wait for EOS
            }
            else
            {
                test_is_true(false);
                disconnect();
            }
            break;

        case PVT_COMMAND_STOP_PLAY:
            iStopPlayLCalled = false;
            if (aResponse.GetCmdStatus() == PVMFSuccess)
            {
                iAudioEOSRecv = false;
                iVideoEOSRecv = false;
                iCurrentRun++;
                if (iCurrentRun < iMaxRuns)
                {
                    OSCL_TRY(error, terminal->StartPlayL());
                    if (error)
                    {
                        test_is_true(false);
                        disconnect();
                    }
                }
                else
                {
                    test_is_true(true);
                    disconnect();
                }
            }
            else
            {
                test_is_true(false);
                disconnect();
            }
            break;
    }
}
void test_base::AudioAddSourceFailed()
{
    printf("\n****** Test FAILED: add audio source failed \n");
    test_is_true(false);
    disconnect();
}
void pff_eos_test::HandleInformationalEventL(const CPVCmnAsyncInfoEvent& aEvent)
{
    int error = 0;

    switch (aEvent.GetEventType())
    {
        case PVT_INDICATION_INCOMING_TRACK:
            TPVChannelId id;

            if (((CPVCmnAsyncEvent&)aEvent).GetLocalBuffer()[0] == PV_VIDEO)
            {
                OSCL_TRY(error, iVideoAddSinkId = terminal->AddDataSinkL(*iVideoSink, id));
                if (error)
                {
                    test_is_true(false);
                    disconnect();
                }
            }

            if (((CPVCmnAsyncEvent&)aEvent).GetLocalBuffer()[0] == PV_AUDIO)
            {
                OSCL_TRY(error, iAudioAddSinkId = terminal->AddDataSinkL(*iAudioSink, id));
                if (error)
                {
                    test_is_true(false);
                    disconnect();
                }
            }
            break;

        case PVT_INDICATION_DISCONNECT:
            iAudioSourceAdded = false;
            iVideoSourceAdded = false;
            iAudioSinkAdded = false;
            iVideoSinkAdded = false;
            break;

        case PVT_INDICATION_CLOSE_TRACK:
            if (((CPVCmnAsyncEvent&)aEvent).GetLocalBuffer()[0] == PV_VIDEO)
            {
                if (((CPVCmnAsyncEvent&)aEvent).GetLocalBuffer()[1] == INCOMING)
                {
                    iVideoSinkAdded = false;
                }
                else
                {
                    iVideoSourceAdded = false;
                }
            }
            else if (((CPVCmnAsyncEvent&)aEvent).GetLocalBuffer()[0] == PV_AUDIO)
            {
                if (((CPVCmnAsyncEvent&)aEvent).GetLocalBuffer()[1] == INCOMING)
                {
                    iAudioSinkAdded = false;
                }
                else
                {
                    iAudioSourceAdded = false;
                }
            }
            break;

        case PVT_INDICATION_PLAY_EOS:
            if (((CPVCmnAsyncEvent&)aEvent).GetLocalBuffer()[0] == PV_VIDEO)
            {
                iVideoEOSRecv = true;
                if (iWaitForVideoEOS) check_eos();
            }
            else if (((CPVCmnAsyncEvent&)aEvent).GetLocalBuffer()[0] == PV_AUDIO)
            {
                iAudioEOSRecv = true;
                if (iWaitForAudioEOS) check_eos();
            }

            break;

        default:
            break;
    }
}
void test_base::VideoAddSinkFailed()
{
    printf("\n***** Test FAILED: add video sink failed  \n");
    test_is_true(false);
    disconnect();
}