Пример #1
0
//--------------------------------------------------------------------------------------------------
void comp1_Foo(void)
{
    LE_DEBUG("comp1 %d msg", LE_LOG_DEBUG);
    LE_INFO("comp1 %d msg", LE_LOG_INFO);
    LE_WARN("comp1 %d msg", LE_LOG_WARN);
    LE_ERROR("comp1 %d msg", LE_LOG_ERR);
    LE_CRIT("comp1 %d msg", LE_LOG_CRIT);
    LE_EMERG("comp1 %d msg", LE_LOG_EMERG);

    le_log_TraceRef_t trace1 = le_log_GetTraceRef("key 1");
    le_log_TraceRef_t trace2 = le_log_GetTraceRef("key 2");

    LE_TRACE(trace1, "Trace msg in %s", STRINGIZE(LE_COMPONENT_NAME));
    LE_TRACE(trace2, "Trace msg in %s", STRINGIZE(LE_COMPONENT_NAME));
}
Пример #2
0
//--------------------------------------------------------------------------------------------------
static void InitPool
(
    le_mem_PoolRef_t    pool,       ///< [IN] The pool to initialize.
    const char*      componentName, ///< [IN] Name of the component.
    const char*         name,       ///< [IN] Name of the pool inside the component.
    size_t              objSize     ///< [IN] The size of the individual objects to be allocated
                                    ///       from this pool in bytes.
)
{
    // Construct the component-scoped pool name.
    size_t nameSize = snprintf(pool->name, sizeof(pool->name), "%s.%s", componentName, name);
    if (nameSize >= sizeof(pool->name))
    {
        LE_WARN("Memory pool name '%s.%s' is truncated to '%s'", componentName, name, pool->name);
    }

    // Compute the total block size.
    size_t blockSize = sizeof(MemBlock_t) + objSize;

    #ifdef USE_GUARD_BAND
    {
        // Add guard bands around the user data in every block.
        blockSize += (GUARD_BAND_SIZE * 2);
    }
    #endif

    // Round up the block size to the nearest multiple of the processor word size.
    size_t remainder = blockSize % sizeof(void*);
    if (remainder != 0)
    {
        blockSize += (sizeof(void*) - remainder);
    }

    pool->poolLink = LE_DLS_LINK_INIT;

    #ifndef LE_MEM_VALGRIND
        pool->freeList = LE_SLS_LIST_INIT;
    #endif

    pool->userDataSize = objSize;
    pool->blockSize = blockSize;
    pool->destructor = NULL;
    pool->superPoolPtr = NULL;
    pool->numAllocations = 0;
    pool->numOverflows = 0;
    pool->totalBlocks = 0;
    pool->numBlocksInUse = 0;
    pool->maxNumBlocksUsed = 0;
    pool->numBlocksToForce = DEFAULT_NUM_BLOCKS_TO_FORCE;

    #ifdef LE_MEM_TRACE
        pool->memTrace = NULL;

        if (LE_LOG_SESSION != NULL)
        {
            pool->memTrace = le_log_GetTraceRef(pool->name);
            LE_DEBUG("Tracing enabled for pool '%s'.", pool->name);
        }
    #endif
}
Пример #3
0
//--------------------------------------------------------------------------------------------------
int main
(
    int argc,
    char *argv[]
)
{
    LE_LOG_SESSION = log_RegComponent( "sms", &LE_LOG_LEVEL_FILTER_PTR);

    arg_SetArgs(argc,argv);

    le_log_TraceRef_t traceRef = le_log_GetTraceRef( "smsPdu" );

    le_log_SetFilterLevel(LE_LOG_DEBUG);
    le_log_EnableTrace(traceRef);

    // Init the test case / test suite data structures
    smsPdu_Initialize();

    // Init pa simu
    pa_simSimu_Init();

    // Init le_sim
    le_sim_Init();

    pa_simSimu_SetPin("0000");
    pa_sms_SetSmsc("+33123456789");

    // Init the sms PA Simu
    sms_simu_Init();

    //EnterPin Code
    pa_sim_EnterPIN(PA_SIM_PIN, "0000");

    LE_INFO("======== Start UnitTest of SMS API ========");

    LE_INFO("======== CDMA PDU Test ========");
    testle_sms_CdmaPduTest();

    LE_INFO("======== SMS PDU Test ========");
    testle_sms_SmsPduTest();

    LE_INFO("======== SMS API Unit Test ========");
    testle_sms_SmsApiUnitTest();

    LE_INFO("======== UnitTest of SMS API ends with SUCCESS ========");

    return 0;
}
Пример #4
0
//--------------------------------------------------------------------------------------------------
void fdMon_Init
(
    void
)
//--------------------------------------------------------------------------------------------------
{
    // Create the FD Monitor Pool from which FD Monitor objects are to be allocated.
    /// @todo Make this configurable.
    FdMonitorPool = le_mem_CreatePool("FdMonitor", sizeof(FdMonitor_t));
    le_mem_ExpandPool(FdMonitorPool, DEFAULT_FD_MONITOR_POOL_SIZE);

    // Create the Safe Reference Maps.
    /// @todo Make this configurable.
    FdMonitorRefMap = le_ref_CreateMap("FdMonitors", DEFAULT_FD_MONITOR_POOL_SIZE);
    HandlerRefMap = le_ref_CreateMap("FdEventHandlers",
                                     DEFAULT_FD_MONITOR_POOL_SIZE * LE_EVENT_NUM_FD_EVENT_TYPES);

    // Get a reference to the trace keyword that is used to control tracing in this module.
    TraceRef = le_log_GetTraceRef("fdMonitor");
}
Пример #5
0
//--------------------------------------------------------------------------------------------------
void fdMon_Init
(
    void
)
//--------------------------------------------------------------------------------------------------
{
    // Create the FD Monitor Pool from which FD Monitor objects are to be allocated.
    /// @todo Make this configurable.
    FdMonitorPool = le_mem_CreatePool("FdMonitor", sizeof(FdMonitor_t));
    le_mem_ExpandPool(FdMonitorPool, DEFAULT_FD_MONITOR_POOL_SIZE);

    // Create the Safe Reference Map.
    /// @todo Make this configurable.
    FdMonitorRefMap = le_ref_CreateMap("FdMonitors", DEFAULT_FD_MONITOR_POOL_SIZE);

    // Get a reference to the trace keyword that is used to control tracing in this module.
    TraceRef = le_log_GetTraceRef("fdMonitor");

    // Create the thread-specific data key for the FD Monitor Ptr of the current running handler.
    LE_ASSERT(pthread_key_create(&FDMonitorPtrKey, NULL) == 0);
}