示例#1
0
//--------------------------------------------------------------------------------------------------
le_result_t pa_mdc_Init
(
    void
)
{
    if (atports_GetInterface(ATPORT_COMMAND)==NULL) {
        LE_WARN("DATA Module is not initialize in this session");
        return LE_FAULT;
    }

    if (atports_GetInterface(ATPORT_PPP)==false) {
        LE_WARN("PPP Module is not initialize in this session");
        return LE_FAULT;
    }

    NewSessionStateEvent = le_event_CreateIdWithRefCounting("NewSessionStateEvent");
    UnsolicitedEvent     = le_event_CreateId("SessionUnsolicitedEvent",sizeof(atmgr_UnsolResponse_t));
    NewSessionStatePool  = le_mem_CreatePool("NewSessionStatePool", sizeof(pa_mdc_SessionStateData_t));

    InternalEventCall = le_event_CreateId("MDCInternalEventCall",sizeof(atmgr_UnsolResponse_t));
    le_event_AddHandler("MDCUnsolHandler",InternalEventCall  ,MDCInternalHandler);

    // set unsolicited +CGEV to Register our own handler.
    SetIndicationHandler(2);

    le_event_AddHandler("MDCUnsolHandler",UnsolicitedEvent  ,CGEVUnsolHandler);

    return LE_OK;
}
示例#2
0
//--------------------------------------------------------------------------------------------------
le_event_HandlerRef_t pa_mdc_AddSessionStateHandler
(
    pa_mdc_SessionStateHandler_t handlerRef, ///< [IN] The session state handler function.
    void*                        contextPtr  ///< [IN] The context to be given to the handler.
)
{
    // Check if the old handler is replaced or deleted.
    if ( (NewSessionStateHandlerRef != NULL) || (handlerRef == NULL) )
    {
        LE_INFO("Clearing old handler");
        le_event_RemoveHandler(NewSessionStateHandlerRef);
        NewSessionStateHandlerRef = NULL;
    }

    // Check if new handler is being added
    if ( handlerRef != NULL )
    {
        NewSessionStateHandlerRef = le_event_AddHandler(
                                            "NewSessionStateHandler",
                                            NewSessionStateEvent,
                                            (le_event_HandlerFunc_t) handlerRef);
    }

    return NewSessionStateHandlerRef;
}
示例#3
0
//--------------------------------------------------------------------------------------------------
static void* CellNetThread
(
    void* contextPtr
)
{
    // Connect to the services required by this thread
    le_cfg_ConnectService();
    le_mrc_ConnectService();
    le_sim_ConnectService();

    LE_INFO("CellNet Thread Started");

    // Register for command events
    le_event_AddHandler("ProcessCommand",
                        CommandEvent,
                        ProcessCommand);


    // Register for SIM state changes
    le_sim_AddNewStateHandler(SimStateHandler, NULL);

    // Register for MRC Network Registration state changes
    le_mrc_AddNetRegStateEventHandler(MrcNetRegHandler, NULL);


    // Run the event loop
    le_event_RunLoop();
    return NULL;
}
//--------------------------------------------------------------------------------------------------
le_event_HandlerRef_t pa_lpt_AddEDrxParamsChangeHandler
(
    pa_lpt_EDrxParamsChangeIndHandlerFunc_t handlerFuncPtr  ///< [IN] The handler function.
)
{
    LE_ASSERT(handlerFuncPtr);

    return le_event_AddHandler("EDrxParamsChange",
                               EDrxParamsChangeEventId,
                               (le_event_HandlerFunc_t) handlerFuncPtr);
}
示例#5
0
//--------------------------------------------------------------------------------------------------
le_event_HandlerRef_t pa_mrc_SetRatChangeHandler
(
    pa_mrc_RatChangeHdlrFunc_t handlerFuncPtr ///< [IN] The handler function.
)
{
    LE_ASSERT(handlerFuncPtr != NULL);

    return le_event_AddHandler(
                "RatChangeHandler",
                RatChangeEvent,
                (le_event_HandlerFunc_t) handlerFuncPtr);
}
示例#6
0
//--------------------------------------------------------------------------------------------------
le_event_HandlerRef_t pa_mrc_AddNetworkRegHandler
(
    pa_mrc_NetworkRegHdlrFunc_t regStateHandler ///< [IN] The handler function to handle the
                                                ///        Network registration state.
)
{
    LE_ASSERT(regStateHandler != NULL);

    return le_event_AddHandler(
                "NewRegStateHandler",
                NewRegStateEvent,
                (le_event_HandlerFunc_t) regStateHandler);
}
//--------------------------------------------------------------------------------------------------
le_event_HandlerRef_t pa_gnss_AddNmeaHandler
(
    pa_gnss_NmeaHandlerFunc_t handler ///< [IN] The handler function.
)
{
    LE_FATAL_IF((handler==NULL),"gnss module cannot set handler");

    le_event_HandlerRef_t newHandlerPtr = le_event_AddHandler(
                                                            "gnssNmeaHandler",
                                                            NmeaEventId,
                                                            (le_event_HandlerFunc_t) handler);
    return newHandlerPtr;
}
//--------------------------------------------------------------------------------------------------
le_event_HandlerRef_t pa_gnss_AddPositionDataHandler
(
    pa_gnss_PositionDataHandlerFunc_t handler ///< [IN] The handler function.
)
{
    LE_FATAL_IF((handler==NULL),"gnss module cannot set handler");

    le_event_HandlerRef_t newHandlerPtr = le_event_AddHandler(
                                                            "gpsInformationHandler",
                                                            GnssEventId,
                                                            (le_event_HandlerFunc_t) handler);

    return newHandlerPtr;
}
示例#9
0
//--------------------------------------------------------------------------------------------------
le_event_HandlerRef_t pa_sim_AddNewStateHandler
(
    pa_sim_NewStateHdlrFunc_t handler ///< [IN] The handler function.
)
{
    LE_DEBUG("Set new SIM State handler");

    if (handler==NULL) {
        LE_FATAL("new SIM State handler is NULL");
    }

    return (le_event_AddHandler("NewSIMStateHandler",
                               EventNewSimStateId,
                               (le_event_HandlerFunc_t) handler));
}
示例#10
0
static void* Thread1(void* context)
{
    delEvent = le_event_CreateId("DeleteSigs", 0);
    le_event_AddHandler("DelSigHandler", delEvent, DeleteSigs);

    le_sig_SetEventHandler(SIGUSR1, SigUser1Handler);

    // Start the test procedure by sending a SIGUSR1 signal to our own process.
    checkCount++;
    LE_ASSERT(kill(getpid(), SIGUSR1) == 0);

    le_event_RunLoop();

    return NULL;
}
示例#11
0
//--------------------------------------------------------------------------------------------------
le_event_HandlerRef_t pa_mrc_AddNetworkRegHandler
(
    pa_mrc_NetworkRegHdlrFunc_t regStateHandler ///< [IN] The handler function to handle the
                                                 ///       Network registration state.
)
{
    LE_DEBUG("Set new Radio Control handler");

    if (regStateHandler==NULL)
    {
        LE_FATAL("new Radio Control handler is NULL");
    }

    return (le_event_AddHandler("NewRegStateHandler",
                                EventNewRcStatusId,
                                (le_event_HandlerFunc_t) regStateHandler));
}
//--------------------------------------------------------------------------------------------------
le_event_HandlerRef_t* pa_ips_AddVoltageEventHandler
(
    pa_ips_ThresholdInd_HandlerFunc_t   msgHandler
)
{
    le_event_HandlerRef_t  handlerRef = NULL;

    if ( msgHandler != NULL )
    {
        handlerRef = le_event_AddHandler( "VoltThresholdStatushandler",
            VoltageThresholdEventId,
            (le_event_HandlerFunc_t) msgHandler);
    }
    else
    {
        LE_ERROR("Null handler given in parameter");
    }

    return (le_event_HandlerRef_t*) handlerRef;
}
示例#13
0
//--------------------------------------------------------------------------------------------------
le_result_t pa_sim_Init
(
    void
)
{
    if (atports_GetInterface(ATPORT_COMMAND)==NULL) {
        LE_DEBUG("SIM Module is not initialize in this session");
        return LE_NOT_POSSIBLE;
    }

    SimEventPoolRef = le_mem_CreatePool("SimEventPool", sizeof(pa_sim_Event_t));
    SimEventPoolRef = le_mem_ExpandPool(SimEventPoolRef,DEFAULT_SIMEVENT_POOL_SIZE);

    EventUnsolicitedId    = le_event_CreateId("SIMEventIdUnsol",sizeof(atmgr_UnsolResponse_t));
    EventNewSimStateId    = le_event_CreateIdWithRefCounting("SIMEventIdNewState");
    le_event_AddHandler("SIMUnsolHandler",EventUnsolicitedId  ,SIMUnsolHandler);

    LE_DEBUG_IF(SetIndicator()!=LE_OK,"cannot set sim +WIND indicator");

    return LE_OK;
}
示例#14
0
//--------------------------------------------------------------------------------------------------
void pa_mdc_SetSessionStateHandler
(
    pa_mdc_SessionStateHandler_t handlerRef ///< [IN] The session state handler function.
)
{
    // Check if the old handler is replaced or deleted.
    if ( (NewSessionStateHandlerRef != NULL) || (handlerRef == NULL) )
    {
        LE_INFO("Clearing old handler");
        le_event_RemoveHandler(NewSessionStateHandlerRef);
        NewSessionStateHandlerRef = NULL;
    }

    // Check if new handler is being added
    if ( handlerRef != NULL )
    {
        NewSessionStateHandlerRef = le_event_AddHandler(
                                            "NewSessionStateHandler",
                                            NewSessionStateEvent,
                                            (le_event_HandlerFunc_t) handlerRef);
    }
}
示例#15
0
//--------------------------------------------------------------------------------------------------
le_result_t pa_mrc_Init
(
    void
)
{
    if (atports_GetInterface(ATPORT_COMMAND)==NULL) {
        LE_WARN("radio control Module is not initialize in this session");
        return LE_NOT_POSSIBLE;
    }

    EventUnsolicitedId    = le_event_CreateId("RCEventIdUnsol",sizeof(atmgr_UnsolResponse_t));
    EventNewRcStatusId    = le_event_CreateIdWithRefCounting("EventNewRcStatus");

    le_event_AddHandler("RCUnsolHandler",EventUnsolicitedId  ,CREGUnsolHandler);

    RegStatePoolRef = le_mem_CreatePool("regStatePool",sizeof(le_mrc_NetRegState_t));
    RegStatePoolRef = le_mem_ExpandPool(RegStatePoolRef,DEFAULT_REGSTATE_POOL_SIZE);

    SubscribeUnsolCREG(PA_MRC_ENABLE_REG_LOC_NOTIFICATION);

    pa_mrc_GetNetworkRegConfig(&ThisMode);

    return LE_OK;
}