예제 #1
0
파일: pa_mdc.c 프로젝트: H-H-bin/legato-af
//--------------------------------------------------------------------------------------------------
static void CGEVUnsolHandler
(
    void* reportPtr
)
{
    atmgr_UnsolResponse_t* unsolPtr = reportPtr;
    uint32_t  numParam=0;
    pa_mdc_SessionStateData_t *sessionStatePtr=NULL;

    LE_DEBUG("Handler received -%s-",unsolPtr->line);

    if ( ( FIND_STRING("+CGEV: NW DEACT", unsolPtr->line) )
        ||
         ( FIND_STRING("+CGEV: ME DEACT", unsolPtr->line) )
       )
    {
        numParam = atcmd_CountLineParameter(unsolPtr->line);

        if (numParam == 4) {
            sessionStatePtr = le_mem_ForceAlloc(NewSessionStatePool);
            sessionStatePtr->profileIndex = atoi(atcmd_GetLineParameter(unsolPtr->line,4));
            sessionStatePtr->newState = LE_MDC_DISCONNECTED;

            SetCurrentDataSessionIndex(INVALID_PROFILE_INDEX);

            LE_DEBUG("Send Event for %d with state %d",
                        sessionStatePtr->profileIndex,sessionStatePtr->newState);
            le_event_ReportWithRefCounting(NewSessionStateEvent,sessionStatePtr);
        } else {
            LE_WARN("this Response pattern is not expected -%s-",unsolPtr->line);
        }
    }
}
예제 #2
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;
}
예제 #3
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;
}
예제 #4
0
파일: pa_mdc.c 프로젝트: H-H-bin/legato-af
//--------------------------------------------------------------------------------------------------
static void MDCInternalHandler
(
    void* reportPtr
)
{
    atmgr_UnsolResponse_t* unsolPtr = reportPtr;

    LE_DEBUG("Handler received -%s-",unsolPtr->line);

    if ( FIND_STRING("NO CARRIER", unsolPtr->line) )
    {
        SetCurrentDataSessionIndex(INVALID_PROFILE_INDEX);
        atmgr_UnSubscribeUnsolReq(atports_GetInterface(ATPORT_COMMAND),InternalEventCall,"NO CARRIER");
    }
}
예제 #5
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;
}
예제 #6
0
//--------------------------------------------------------------------------------------------------
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;
}
예제 #7
0
//--------------------------------------------------------------------------------------------------
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;
}