当前位置: 首页>>代码示例>>C++>>正文


C++ LE_ASSERT函数代码示例

本文整理汇总了C++中LE_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ LE_ASSERT函数的具体用法?C++ LE_ASSERT怎么用?C++ LE_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了LE_ASSERT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: mqttClient_processUnSubAck

static int mqttClient_processUnSubAck(mqttClient_t* clientData)
{
  int32_t rc = LE_OK;
  uint16_t packetId;

  LE_DEBUG("---> UNSUBACK");
  LE_ASSERT(clientData);

  rc = le_timer_Stop(clientData->session.cmdTimer);
  if (rc)
  {
    LE_ERROR("le_timer_Stop() failed(%d)", rc);
    goto cleanup;
  }

  rc = MQTTDeserialize_unsuback(&packetId, clientData->session.rx.buf, sizeof(clientData->session.rx.buf));
  if (rc != 1)
  {
    LE_ERROR("MQTTDeserialize_unsuback() failed");
    rc = LE_BAD_PARAMETER;
    goto cleanup;
  }
  else if (clientData->session.nextPacketId != packetId)
  {
    LE_ERROR("invalid packet ID(%u != %u)", clientData->session.nextPacketId, packetId);
    rc = LE_BAD_PARAMETER;
    goto cleanup;
  }

cleanup:
  return rc;
}
开发者ID:CoRfr,项目名称:mangOH-MqttClient,代码行数:32,代码来源:mqttClient.c

示例2: mqttClient_connExpiryHndlr

static void mqttClient_connExpiryHndlr(le_timer_Ref_t timer)
{
  mqttClient_t* clientData = le_timer_GetContextPtr(timer);
  int32_t rc = LE_OK;

  LE_ASSERT(clientData);

  rc = mqttClient_close(clientData);
  if (rc)
  {
    LE_ERROR("mqttClient_close() failed(%d)", rc);
    goto cleanup;
  }

  LE_DEBUG("<--- reconnect");
  rc = mqttClient_connect(clientData);
  if (rc)
  {
    LE_ERROR("mqttClient_connect() failed(%d)", rc);
    goto cleanup;
  }

cleanup:
  return;
}
开发者ID:CoRfr,项目名称:mangOH-MqttClient,代码行数:25,代码来源:mqttClient.c

示例3: mqttClient_pingExpiryHndlr

static void mqttClient_pingExpiryHndlr(le_timer_Ref_t timer)
{
  mqttClient_t* clientData = le_timer_GetContextPtr(timer);
  int32_t rc = LE_OK;

  LE_ASSERT(clientData);

  int len = MQTTSerialize_pingreq(clientData->session.tx.buf, sizeof(clientData->session.tx.buf));
  if (len < 0)
  {
    LE_ERROR("MQTTSerialize_pingreq() failed(%d)", len);
    goto cleanup;
  }

  LE_DEBUG("<--- PING");
  rc = mqttClient_write(clientData, len);
  if (rc)
  {
    LE_ERROR("mqttClient_write() failed(%d)", rc);
    goto cleanup;
  }

cleanup:
  return;
}
开发者ID:CoRfr,项目名称:mangOH-MqttClient,代码行数:25,代码来源:mqttClient.c

示例4: le_event_QueueFunctionToThread

//--------------------------------------------------------------------------------------------------
static void Testle_Temp_RemoveHandlers
(
    void
)
{
    int i;

    // Remove handlers: add le_temp_RemoveThresholdEventHandler to the eventLoop of tasks
    for (i=0; i<NB_CLIENT; i++)
    {
        le_event_QueueFunctionToThread( AppCtx[i].appThreadRef,
                                        RemoveHandler,
                                        &AppCtx[i],
                                        NULL );
    }

    // Wait for the tasks
    SynchTest();

    // trigger an event report
    ExpectedStatus = 0;
    pa_tempSimu_TriggerEventReport(ExpectedStatus);

    // Wait for the semaphore timeout to check that handlers are not called
    LE_ASSERT( le_sem_WaitWithTimeOut(ThreadSemaphore, TimeToWait) == LE_TIMEOUT );
}
开发者ID:H-H-bin,项目名称:legato-af,代码行数:27,代码来源:main.c

示例5: mqttClient_close

static int mqttClient_close(mqttClient_t* clientData)
{
  int rc = LE_OK;

  LE_ASSERT(clientData);

  if (clientData->session.sock != MQTT_CLIENT_INVALID_SOCKET)
  {
    le_fdMonitor_Delete(clientData->session.sockFdMonitor);

    rc = close(clientData->session.sock);
    if (rc == -1)
    {
      LE_ERROR("close() failed(%d)", errno);
      rc = LE_FAULT;
      goto cleanup;
    }

    clientData->session.sock = MQTT_CLIENT_INVALID_SOCKET;
  }
  else
  {
    LE_WARN("socket already closed");
  }

cleanup:
  return rc;
}
开发者ID:CoRfr,项目名称:mangOH-MqttClient,代码行数:28,代码来源:mqttClient.c

示例6: LE_ASSERT

//--------------------------------------------------------------------------------------------------
void ni_Release
(
    ni_IteratorRef_t iteratorRef  ///< [IN] Free the resources used by this iterator.
)
//--------------------------------------------------------------------------------------------------
{
    LE_ASSERT(iteratorRef != NULL);

    // Make sure that the transaction timer isn't still running.
    if (iteratorRef->timerRef != NULL)
    {
        if (le_timer_GetExpiryCount(iteratorRef->timerRef) == 0)
        {
            le_timer_Stop(iteratorRef->timerRef);
        }

        le_timer_Delete(iteratorRef->timerRef);
        iteratorRef->timerRef = NULL;
    }

    // Release the rest of the iterator's resources.
    LE_DEBUG("Releasing iterator, <%p> with a lifetime of %d seconds.",
             iteratorRef,
             (uint32_t)(le_clk_GetRelativeTime().sec - iteratorRef->creationTime.sec));

    ni_Close(iteratorRef);
    tdb_UnregisterIterator(iteratorRef->treeRef, iteratorRef);

    le_pathIter_Delete(iteratorRef->pathIterRef);

    tdb_ReleaseTree(iteratorRef->treeRef);
    le_mem_Release(iteratorRef);
}
开发者ID:andreasanna,项目名称:legato-af,代码行数:34,代码来源:nodeIterator.c

示例7: tdb_GetNodeParent

//--------------------------------------------------------------------------------------------------
le_result_t ni_GoToParent
(
    ni_IteratorRef_t iteratorRef  ///< [IN] The iterator object to access.
)
//--------------------------------------------------------------------------------------------------
{
    // Update our path.
    if (le_pathIter_Append(iteratorRef->pathIterRef, "..") == LE_UNDERFLOW)
    {
        // Looks like there are no more parents in the chain.
        return LE_NOT_FOUND;
    }

    // Now, if we have a current node, just get it's parent node.  Otherwise make an attempt to see
    // if the requested parent node exists.
    if (iteratorRef->currentNodeRef != NULL)
    {
        iteratorRef->currentNodeRef = tdb_GetNodeParent(iteratorRef->currentNodeRef);
        LE_ASSERT(iteratorRef->currentNodeRef != NULL);
    }
    else
    {
        // Make an attempt to get the new current node.
        iteratorRef->currentNodeRef = ni_GetNode(iteratorRef, "");
    }

    return LE_OK;
}
开发者ID:andreasanna,项目名称:legato-af,代码行数:29,代码来源:nodeIterator.c

示例8: to

//--------------------------------------------------------------------------------------------------
static void ResetClientWatchdog
(
    int32_t timeout ///< [IN] The timeout to reset the watchdog timer to (in milliseconds).
)
{
    le_clk_Time_t timeoutValue;
    WatchdogObj_t* watchDogPtr = GetClientWatchdogPtr();
    if (watchDogPtr != NULL)
    {
        le_timer_Stop(watchDogPtr->timer);
        if (timeout == TIMEOUT_KICK)
        {
            timeoutValue = watchDogPtr->kickTimeoutInterval;
        }
        else
        {
            timeoutValue = MakeTimerInterval(timeout);
        }

        if (timeout != LE_WDOG_TIMEOUT_NEVER)
        {
            // timer should be stopped here so this should never fail
            // testing
            LE_ASSERT(LE_OK == le_timer_SetInterval(watchDogPtr->timer, timeoutValue));
            le_timer_Start(watchDogPtr->timer);
        }
        else
        {
            LE_DEBUG("Timeout set to NEVER!");
        }
    }
}
开发者ID:tegoo,项目名称:legato-af,代码行数:33,代码来源:watchdog.c

示例9: string

//--------------------------------------------------------------------------------------------------
le_result_t le_utf8_Append
(
    char* destStr,          ///< [IN] The destination string.
    const char* srcStr,     ///< [IN] The UTF-8 source string.
    const size_t destSize,  ///< [IN] Size of the destination buffer in bytes.
    size_t* destStrLenPtr   ///< [OUT] The number of bytes in the resultant destination string (not
                            ///        including the NULL-terminator).  This parameter can be set to
                            ///        NULL if the destination string size is not needed.
)
{
    // Check parameters.
    LE_ASSERT( (destStr != NULL) && (srcStr != NULL) && (destSize > 0) );

    size_t destStrSize = strlen(destStr);
    le_result_t result = le_utf8_Copy(&(destStr[destStrSize]),
                                      srcStr,
                                      destSize - destStrSize,
                                      destStrLenPtr);

    if (destStrLenPtr)
    {
        *destStrLenPtr += destStrSize;
    }

    return result;
}
开发者ID:mbarazzouq,项目名称:legato-af,代码行数:27,代码来源:utf8.c

示例10: LE_KILL_CLIENT

//--------------------------------------------------------------------------------------------------
le_avdata_AssetInstanceRef_t le_avdata_Create
(
    const char* assetName
        ///< [IN]
)
{
    // Get the client's credentials.
    pid_t pid;
    uid_t uid;

    if (le_msg_GetClientUserCreds(le_avdata_GetClientSessionRef(), &uid, &pid) != LE_OK)
    {
        LE_KILL_CLIENT("Could not get credentials for the client.");
        return NULL;
    }


    // Look up the process's application name.
    char appName[LE_LIMIT_APP_NAME_LEN+1];

    le_result_t result = le_appInfo_GetName(pid, appName, sizeof(appName));
    LE_FATAL_IF(result == LE_OVERFLOW, "Buffer too small to contain the application name.");

    // TODO: Should this be LE_KILL_CLIENT instead?
    LE_FATAL_IF(result != LE_OK, "Could not get app name");


    // Create an instance of the asset
    assetData_InstanceDataRef_t instRef;
    int instanceId;

    LE_ASSERT( assetData_CreateInstanceByName(appName, assetName, -1, &instRef) == LE_OK );
    LE_ASSERT( instRef != NULL );
    LE_ASSERT( assetData_GetInstanceId(instRef, &instanceId) == LE_OK );
    LE_PRINT_VALUE("%i", instanceId);

    // Return a safe reference for the instance
    InstanceRefData_t* instRefDataPtr = le_mem_ForceAlloc(InstanceRefDataPoolRef);

    instRefDataPtr->clientSessionRef = le_avdata_GetClientSessionRef();
    instRefDataPtr->instRef = instRef;

    instRef = le_ref_CreateRef(InstanceRefMap, instRefDataPtr);

    return instRef;
}
开发者ID:legatoproject,项目名称:legato-af,代码行数:47,代码来源:avData.c

示例11: LE_ASSERT

//--------------------------------------------------------------------------------------------------
static void AddWatchdog
(
    WatchdogObj_t* newDogPtr   ///< A pointer to the watchdog that is to be added to our container
)
{
    // The procId is the unique identifier for this watchdog. There shouldn't already be one.
    LE_ASSERT(NULL == le_hashmap_Put(WatchdogRefsContainer, &(newDogPtr->procId), newDogPtr));
}
开发者ID:mbaglin,项目名称:legato-af,代码行数:9,代码来源:watchdog.c

示例12: le_sem_Create

//--------------------------------------------------------------------------------------------------
void TestSim_Stk
(
    void
)
{
    // Stk handler semaphore
    StkHandlerSem = (le_sem_Ref_t) le_sem_Create("StkHandlerSem",1);

    // each thread subscribes to state handler using le_sim_AddSimToolkitEventHandler
    // This API has to be called by threads
    int i=0;
    for (; i<NB_CLIENT; i++)
    {
        le_event_QueueFunctionToThread( AppCtx[i].appThreadRef,
                                        AddStkHandler,
                                        &AppCtx[i],
                                        NULL );
    }

    // Wait for the tasks
    SynchTest();

    StkEvent = LE_SIM_REFRESH;

    // Invoke Stk event
    pa_simSimu_ReportStkEvent(StkEvent);

    // Wait for the call of the handlers
    SynchTest();

    // Check the result
    for (i=0; i<NB_CLIENT; i++)
    {
        LE_ASSERT(AppCtx[i].stkEvent == StkEvent);
        AppCtx[i].stkEvent = 0;
    }

    // Test le_sim_AcceptSimToolkitCommand and le_sim_RejectSimToolkitCommand
    pa_simSimu_SetExpectedStkConfirmationCommand(true);
    LE_ASSERT( le_sim_AcceptSimToolkitCommand(CurrentSimId) == LE_OK );
    pa_simSimu_SetExpectedStkConfirmationCommand(false);
    LE_ASSERT( le_sim_RejectSimToolkitCommand(CurrentSimId) == LE_OK );

    // Check that all handlers have been called as expected
    LE_ASSERT( le_sem_GetValue(ThreadSemaphore) == 0 );
}
开发者ID:tegoo,项目名称:legato-af,代码行数:47,代码来源:main.c

示例13: LE_ASSERT

//--------------------------------------------------------------------------------------------------
le_result_t pa_audio_GetGain
(
    pa_audio_If_t interface,    ///< [IN] audio interface
    uint32_t     *gainPtr       ///< [OUT] gain value [0..100] (0 means 'muted', 100 is the
                                ///        maximum gain value)
)
{
    LE_ASSERT(gainPtr);

    LE_DEBUG("Get gain for [%d]",interface);
    switch (interface)
    {
        case PA_AUDIO_IF_CODEC_MIC:
        {
            unsigned value;
            GetMixerParameter("ADC1 Volume",&value);
            if (value == 3)
            {
                *gainPtr = 100;
            }
            else if (value == 2)
            {
                *gainPtr = 66;
            }
            else if (value == 1)
            {
                *gainPtr = 33;
            }
            else
            {
                *gainPtr = 0;
            }
            return LE_OK;
        }
        case PA_AUDIO_IF_CODEC_SPEAKER:
        {
            unsigned value;
            GetMixerParameter("RX1 Digital Volume",&value);
            *gainPtr = (100*value)/124;
            return LE_OK;
        }
        case PA_AUDIO_IF_DSP_FRONTEND_USB_RX:
        case PA_AUDIO_IF_DSP_FRONTEND_USB_TX:
        case PA_AUDIO_IF_DSP_BACKEND_MODEM_VOICE_RX:
        case PA_AUDIO_IF_DSP_BACKEND_MODEM_VOICE_TX:
        case PA_AUDIO_IF_DSP_FRONTEND_PCM_RX:
        case PA_AUDIO_IF_DSP_FRONTEND_PCM_TX:
        case PA_AUDIO_IF_FILE_PLAYING:
        case PA_AUDIO_IF_DSP_FRONTEND_I2S_RX:
        case PA_AUDIO_IF_DSP_FRONTEND_I2S_TX:
        case PA_AUDIO_IF_END:
        {
            break;
        }
    }
    LE_ERROR("This interface (%d) is not supported",interface);
    return LE_FAULT;
}
开发者ID:hakanernam,项目名称:legato-af,代码行数:59,代码来源:pa_audio_ar7.c

示例14: LE_ASSERT

//--------------------------------------------------------------------------------------------------
static void DisconnectedProfile
(
    le_mdc_ProfileRef_t profileRef
)
{
    char ipAddrStr[IP_STR_SIZE];
    char dns1AddrStr[IP_STR_SIZE];
    char dns2AddrStr[IP_STR_SIZE];
    char gatewayAddrStr[IP_STR_SIZE];
    char interfaceName[10];

    /* Expected value: LE_FAULT as the frofile is supposed to be disconnected */

    LE_ASSERT(le_mdc_GetInterfaceName(profileRef, interfaceName, sizeof(interfaceName))
                                                                                    == LE_FAULT);
    LE_ASSERT(le_mdc_GetIPv4Address(profileRef, ipAddrStr, IP_STR_SIZE) == LE_FAULT);
    LE_ASSERT(le_mdc_GetIPv6Address(profileRef, ipAddrStr, IP_STR_SIZE) == LE_FAULT);
    LE_ASSERT(le_mdc_GetIPv4DNSAddresses(   profileRef,
                                            dns1AddrStr,
                                            IP_STR_SIZE,
                                            dns2AddrStr,
                                            IP_STR_SIZE) == LE_FAULT);
    LE_ASSERT(le_mdc_GetIPv6DNSAddresses(   profileRef,
                                            dns1AddrStr,
                                            IP_STR_SIZE,
                                            dns2AddrStr,
                                            IP_STR_SIZE) == LE_OVERFLOW);
    LE_ASSERT(le_mdc_GetIPv4GatewayAddress( profileRef, gatewayAddrStr, IP_STR_SIZE )
                                                                                    == LE_FAULT);
    LE_ASSERT(le_mdc_GetIPv6GatewayAddress( profileRef, gatewayAddrStr, IP_STR_SIZE )
                                                                                    == LE_FAULT);

}
开发者ID:legatoproject,项目名称:legato-af,代码行数:34,代码来源:main.c

示例15: pa_mdcSimu_SetDataFlowStatistics

//--------------------------------------------------------------------------------------------------
void TestMdc_Stat
(
    void
)
{
    pa_mdc_PktStatistics_t dataStatistics;
    dataStatistics.transmittedBytesCount = 123456789;
    dataStatistics.receivedBytesCount = 369258147;

    /* Set the statistics value to the pa */
    pa_mdcSimu_SetDataFlowStatistics(&dataStatistics);

    uint64_t rxBytes;
    uint64_t txBytes;

    /* Get the statistics and check the values */
    le_result_t res = le_mdc_GetBytesCounters(&rxBytes, &txBytes);
    LE_ASSERT(res == LE_OK);
    LE_ASSERT(rxBytes == dataStatistics.receivedBytesCount);
    LE_ASSERT(txBytes == dataStatistics.transmittedBytesCount);

    /* Reset counter, check again statistics (0 values expected) */
    res = le_mdc_ResetBytesCounter();
    LE_ASSERT(res == LE_OK);

    res = le_mdc_GetBytesCounters(&rxBytes, &txBytes);
    LE_ASSERT(res == LE_OK);
    LE_ASSERT(rxBytes == 0);
    LE_ASSERT(txBytes == 0);
}
开发者ID:tegoo,项目名称:legato-af,代码行数:31,代码来源:main.c


注:本文中的LE_ASSERT函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。