예제 #1
0
//--------------------------------------------------------------------------------------------------
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;
}
예제 #2
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;
}