Exemplo n.º 1
0
//--------------------------------------------------------------------------------------------------
static void ConnectAudio
(
    void
)
{
    // Redirect audio to the in-built Microphone and Speaker.
    FeOutRef = le_audio_OpenSpeaker();
    LE_ERROR_IF((FeOutRef==NULL), "OpenSpeaker returns NULL!");
    FeInRef = le_audio_OpenMic();
    LE_ERROR_IF((FeInRef==NULL), "OpenMic returns NULL!");

    AudioInputConnectorRef = le_audio_CreateConnector();
    LE_ERROR_IF((AudioInputConnectorRef==NULL), "AudioInputConnectorRef is NULL!");
    AudioOutputConnectorRef = le_audio_CreateConnector();
    LE_ERROR_IF((AudioOutputConnectorRef==NULL), "AudioOutputConnectorRef is NULL!");

    LE_ERROR_IF((le_audio_Connect(AudioInputConnectorRef, FeInRef)!=LE_OK),
                "Failed to connect Mic on Input connector!");
    LE_ERROR_IF((le_audio_Connect(AudioOutputConnectorRef, FeOutRef)!=LE_OK),
                "Failed to connect Speaker on Output connector!");

    MdmRxAudioRef = le_audio_OpenModemVoiceRx();
    LE_ERROR_IF((MdmRxAudioRef==NULL), "GetRxAudioStream returns NULL!");
    MdmTxAudioRef = le_audio_OpenModemVoiceTx();
    LE_ERROR_IF((MdmTxAudioRef==NULL), "GetTxAudioStream returns NULL!");

    // Play local on output connector.
    PlayerRef = le_audio_OpenPlayer();
    LE_ERROR_IF((PlayerRef==NULL), "OpenFilePlayback returns NULL!");
    LE_ERROR_IF((le_audio_Connect(AudioOutputConnectorRef, PlayerRef) != LE_OK),
                "Failed to connect FilePlayback on output connector!");

    MediaHandlerRef = le_audio_AddMediaHandler(PlayerRef, MyMediaEventHandler, NULL);
    LE_ERROR_IF((MediaHandlerRef==NULL), "AddMediaHandler returns NULL!");

    // Set gains
    LE_ERROR_IF((le_audio_SetGain(PlayerRef, 1) != LE_OK), "Cannot set multimedia gain");

    LE_ERROR_IF((le_audio_SetGain(FeInRef, 1) != LE_OK), "Cannot set microphone gain");
    LE_ERROR_IF((le_audio_SetGain(MdmRxAudioRef, 12) != LE_OK), "Cannot set MdmRxAudioRef gain");
    LE_ERROR_IF((le_audio_SetGain(MdmTxAudioRef, 12) != LE_OK), "Cannot set MdmTxAudioRef gain");

    // Set specific gains for AR7/AR8 (won't work on other platforms)
    LE_ERROR_IF((le_audio_SetPlatformSpecificGain("D_AFE_GAIN_RX", 0x2000) != LE_OK),
                "Cannot set \"D_AFE_GAIN_RX\" gain");
    LE_ERROR_IF((le_audio_SetPlatformSpecificGain("D_AFE_GAIN_TX", 0x2000) != LE_OK),
                "Cannot set \"D_AFE_GAIN_TX\" gain");
}
Exemplo n.º 2
0
//--------------------------------------------------------------------------------------------------
static void StartTestECall
(
    void
)
{
    le_ecall_State_t                   state = LE_ECALL_STATE_UNKNOWN;
    le_ecall_StateChangeHandlerRef_t   stateChangeHandlerRef = 0x00;

    LE_INFO("Start StartTestECall");

    LE_ASSERT((stateChangeHandlerRef = le_ecall_AddStateChangeHandler(MyECallEventHandler, NULL)) != NULL);

    LE_ASSERT(le_ecall_SetPsapNumber(PsapNumber) == LE_OK);

    LE_ASSERT(le_ecall_SetMsdTxMode(LE_ECALL_TX_MODE_PUSH) == LE_OK);

    LE_ASSERT((LastTestECallRef=le_ecall_Create()) != NULL);

    LE_ASSERT(le_ecall_SetMsdPosition(LastTestECallRef, true, +48898064, +2218092, 0) == LE_OK);

    LE_ASSERT(le_ecall_SetMsdPassengersCount(LastTestECallRef, 3) == LE_OK);

    ConnectAudio();
    // Set a default gain for my test
    le_audio_SetGain(FeOutRef, 50);

    LE_ASSERT(le_ecall_StartTest(LastTestECallRef) == LE_OK);

    state=le_ecall_GetState(LastTestECallRef);
    LE_ASSERT(((state>=LE_ECALL_STATE_STARTED) && (state<=LE_ECALL_STATE_FAILED)));
}