コード例 #1
0
ファイル: pa_mdc.c プロジェクト: H-H-bin/legato-af
//--------------------------------------------------------------------------------------------------
le_result_t pa_mdc_GetSessionState
(
    uint32_t profileIndex,                    ///< [IN] The profile to use
    le_mdc_ConState_t* sessionStatePtr        ///< [OUT] The data session state
)
{
    // All other profiles are always disconnected
    if ( profileIndex != GetCurrentDataSessionIndex() )
    {
        *sessionStatePtr = LE_MDC_DISCONNECTED;
    } else {
        *sessionStatePtr = LE_MDC_CONNECTED;
    }

    return LE_OK;
}
コード例 #2
0
ファイル: pa_mdc.c プロジェクト: andreasanna/legato-af
//--------------------------------------------------------------------------------------------------
le_result_t pa_mdc_StartSessionIPV4
(
    uint32_t profileIndex,        ///< [IN] The profile to use
    pa_mdc_CallRef_t* callRefPtr  ///< [OUT] Reference used for stopping the data session
)
{
    le_result_t result=LE_NOT_POSSIBLE;

    if ( GetCurrentDataSessionIndex() != INVALID_PROFILE_INDEX )
    {
        return LE_DUPLICATE;
    }

    // Always executed because:
    //   - if GPRS is already attached it doesn't do anything and then it returns OK
    //   - if GPRS is not attached it will attach it and then it returns OK on success
    if ( AttachGPRS(true) != LE_OK )
    {
        return LE_NOT_POSSIBLE;
    }

    // Always executed because:
    //   - if the context is already activated it doesn't do anything and then it returns OK
    //   - if the context is not activated it will attach it and then it returns OK on success
    if ( ActivateContext(profileIndex,true) != LE_OK )
    {
        return LE_NOT_POSSIBLE;
    }

    if ( (result = EstablishConnection(profileIndex)) != LE_OK )
    {
        return LE_NOT_POSSIBLE;
    }

    if (result==LE_OK) {
        SetCurrentDataSessionIndex(profileIndex);
        memcpy(callRefPtr, &profileIndex, sizeof(void*));
    } else {
        SetCurrentDataSessionIndex(INVALID_PROFILE_INDEX);
    }

    return result;
}
コード例 #3
0
ファイル: pa_mdc.c プロジェクト: H-H-bin/legato-af
//--------------------------------------------------------------------------------------------------
le_result_t pa_mdc_StopSession
(
    uint32_t profileIndex        ///< [IN] The profile to use
)
{
    if ( GetCurrentDataSessionIndex() == INVALID_PROFILE_INDEX )
    {
        return LE_FAULT;
    }

    // Stop the PDP connection on modem side
    if (StopPDPConnection() != LE_OK)
    {
        return LE_FAULT;
    }

    SetCurrentDataSessionIndex(INVALID_PROFILE_INDEX);

    return LE_OK;
}
コード例 #4
0
ファイル: pa_mdc.c プロジェクト: andreasanna/legato-af
//--------------------------------------------------------------------------------------------------
le_result_t pa_mdc_StopSession
(
    pa_mdc_CallRef_t callRef         ///< [IN] The call reference returned when starting the sessions
)
{
    if ( GetCurrentDataSessionIndex() == INVALID_PROFILE_INDEX )
    {
        return LE_NOT_POSSIBLE;
    }

    // Stop the PDP connection on modem side
    if (StopPDPConnection() != LE_OK)
    {
        return LE_NOT_POSSIBLE;
    }

    SetCurrentDataSessionIndex(INVALID_PROFILE_INDEX);

    return LE_OK;
}
コード例 #5
0
ファイル: pa_mdc.c プロジェクト: H-H-bin/legato-af
//--------------------------------------------------------------------------------------------------
le_result_t pa_mdc_StartSessionIPV4
(
    uint32_t profileIndex        ///< [IN] The profile to use
)
{
    le_result_t result=LE_FAULT;

    if ( GetCurrentDataSessionIndex() != INVALID_PROFILE_INDEX )
    {
        return LE_DUPLICATE;
    }

    // Always executed because:
    //   - if GPRS is already attached it doesn't do anything and then it returns OK
    //   - if GPRS is not attached it will attach it and then it returns OK on success
    if ( AttachGPRS(true) != LE_OK )
    {
        return LE_FAULT;
    }

    // Always executed because:
    //   - if the context is already activated it doesn't do anything and then it returns OK
    //   - if the context is not activated it will attach it and then it returns OK on success
    if ( ActivateContext(profileIndex,true) != LE_OK )
    {
        return LE_FAULT;
    }

    if ( (result = EstablishConnection(profileIndex)) != LE_OK )
    {
        SetCurrentDataSessionIndex(INVALID_PROFILE_INDEX);
        return LE_FAULT;
    }

    SetCurrentDataSessionIndex(profileIndex);

    return result;
}
コード例 #6
0
ファイル: pa_mdc.c プロジェクト: hakanernam/legato-af
//--------------------------------------------------------------------------------------------------
le_result_t pa_mdc_StopSession
(
    uint32_t callRef         ///< [IN] The call reference returned when starting the sessions
)
{
    le_result_t result=LE_NOT_POSSIBLE;

    if ( GetCurrentDataSessionIndex() == INVALID_PROFILE_INDEX )
    {
        return LE_DUPLICATE;
    }

    // Stop the PDP connection on modem side
    if ( (result = StopPDPConnection()) != LE_OK)
    {
        return LE_NOT_POSSIBLE;
    }

    if (result==LE_OK) {
        SetCurrentDataSessionIndex(INVALID_PROFILE_INDEX);
    }

    return result;
}