Example #1
0
//--------------------------------------------------------------------------------------------------
static le_result_t StartPDPConnection
(
    uint32_t profileIndex    ///< [IN] The profile identifier
)
{
    char atcommand[ATCOMMAND_SIZE] ;
    atcmd_Ref_t atReqRef=NULL;
    atcmdsync_ResultRef_t  atresRef;
    const char* finalRespOkPtr[] = { "CONNECT" , NULL };
    const char* finalRespKoPtr[] = { "NO CARRIER", "TIMEOUT", NULL};

    atcmdsync_PrepareString(atcommand,ATCOMMAND_SIZE,"ATD*99***%d#",profileIndex);

    atReqRef = atcmdsync_PrepareStandardCommand(atcommand,
                                                    NULL,
                                                    finalRespOkPtr,
                                                    finalRespKoPtr,
                                                    30000);
    atresRef = atcmdsync_SendCommand(atports_GetInterface(ATPORT_PPP),atReqRef);
    le_result_t result = atcmdsync_CheckCommandResult(atresRef,finalRespOkPtr,finalRespKoPtr);

    le_mem_Release(atReqRef);
    le_mem_Release(atresRef);

    return result;
}
Example #2
0
//--------------------------------------------------------------------------------------------------
static le_result_t resetModem
(
    void
)
{
    atcmdsync_ResultRef_t  resRef=NULL;
    const char* finalRespOkPtr[] = {"+WIND: 4",NULL };
    const char* finalRespKoPtr[] = {"ERROR","+CME ERROR:","+CMS ERROR:","TIMEOUT",NULL};

    atcmd_Ref_t atReqRef = atcmd_Create();

    atcmd_AddCommand(atReqRef,"at+cfun=1",false);
    atcmd_AddData       (atReqRef,NULL,0);
    atcmd_SetTimer      (atReqRef,30000,atcmdsync_GetTimerExpiryHandler());
    atcmd_AddIntermediateResp    (atReqRef,atcmdsync_GetIntermediateEventId(),NULL);
    atcmd_AddFinalResp(atReqRef,atcmdsync_GetFinalEventId(),finalRespOkPtr);
    atcmd_AddFinalResp(atReqRef,atcmdsync_GetFinalEventId(),finalRespKoPtr);

    resRef = atcmdsync_SendCommand(atports_GetInterface(ATPORT_COMMAND),atReqRef);

    le_result_t result = atcmdsync_CheckCommandResult(resRef,finalRespOkPtr,finalRespKoPtr);

    le_mem_Release(atReqRef);   // Release e_atmgr_Object_CreateATCommand
    le_mem_Release(resRef);  // Release le_pa_at_SendSync

    return result;
}