本文整理汇总了C++中LE_DEBUG函数的典型用法代码示例。如果您正苦于以下问题:C++ LE_DEBUG函数的具体用法?C++ LE_DEBUG怎么用?C++ LE_DEBUG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LE_DEBUG函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: LE_PRINT_VALUE
static void HandleTestA
(
int32_t x,
void* contextPtr
)
{
static int count=0;
count++;
LE_PRINT_VALUE("%i", x);
if ( contextPtr == ClientMessage )
{
LE_DEBUG("HandleTestA: context pointer works");
LE_PRINT_VALUE( "'%s'", (char *)contextPtr );
}
else
{
LE_DEBUG("HandleTestA: context pointer fails");
}
// Re-do the test again for the given number of times.
if ( count < 2 )
{
banner("Test 2 again");
LE_PRINT_VALUE("%i", count);
HandlerRef = AddTestAHandler(HandleTestA, (void*)ClientMessage);
LE_PRINT_VALUE("%p", HandlerRef);
LE_DEBUG("Triggering TestA yet again for count=%i\n", count);
TriggerTestA();
}
}
开发者ID:H-H-bin,项目名称:legato-af,代码行数:34,代码来源:multiClientMain.c
示例2: fprintf
// -------------------------------------------------------------------------------------------------
static void NetRegStateHandler
(
le_mrc_NetRegState_t state, ///< [IN] The new state of the modem.
void* contextPtr
)
{
// Record the change of state to the chat log.
if (OutputFilePtr)
{
fprintf(OutputFilePtr, "## %s ##\n", GetNetStateString(state));
fflush(OutputFilePtr);
}
// For traceablity, make sure that this event is recorded.
LE_DEBUG("%s", GetNetStateString(state));
// If we are going back on net, and have been configured to do so, send our "on network" message
// now.
if (((state == LE_MRC_REG_HOME)
|| (state == LE_MRC_REG_ROAMING))
&& (DestNumValid))
{
LE_DEBUG("Sending On Network Message.");
SendMessage(DestNum, "Getting back on network.");
}
}
开发者ID:mbaglin,项目名称:legato-af,代码行数:27,代码来源:demo.c
示例3: LE_ASSERT
//--------------------------------------------------------------------------------------------------
static void FieldActionHandler
(
assetData_InstanceDataRef_t instanceRef,
int fieldId,
assetData_ActionTypes_t action,
void* contextPtr
)
{
// Get the handler data from the contextPtr
LE_ASSERT( contextPtr != NULL );
FieldEventData_t* handlerDataPtr = contextPtr;
// Ensure the action happens on the desired instance. This could happen since we register
// against the asset, rather than an instance of the asset.
// NOTE: Don't need to check for fieldId, since they should always match.
if ( handlerDataPtr->instRef != instanceRef )
{
LE_DEBUG("Action %i not expected for this instance, so ignore it", action);
return;
}
LE_DEBUG("Got action=%i, for field='%s'", action, handlerDataPtr->fieldName);
// Call the user supplied handler
handlerDataPtr->handlerPtr(handlerDataPtr->safeRef,
handlerDataPtr->fieldName,
handlerDataPtr->contextPtr);
}
开发者ID:legatoproject,项目名称:legato-af,代码行数:29,代码来源:avData.c
示例4: TestGetDir
static void TestGetDir(void)
{
int i;
char dirname[100];
// Test the standard strings.
for (i = 0; i < NUM_TEST_STRS; i++)
{
LE_TEST( (le_path_GetDir(PathNames[i], "/", dirname, 100) == LE_OK) &&
(strcmp(dirname, DirNames[i]) == 0) );
LE_DEBUG("Dir: '%s'", dirname);
}
// Test with multibyte separators.
for (i = 0; i < NUM_TEST_STRS; i++)
{
LE_TEST( (le_path_GetDir(SepPathNames[i], "**", dirname, 100) == LE_OK) &&
(strcmp(dirname, SepDirNames[i]) == 0) );
LE_DEBUG("Dir: '%s'", dirname);
}
// Test an overflow condition.
LE_TEST( (le_path_GetDir(PathNames[1], "/", dirname, 21) == LE_OVERFLOW) &&
(strcmp(dirname, "/long/path/with/trai") == 0) );
LE_DEBUG("Dir: '%s'", dirname);
}
开发者ID:andreasanna,项目名称:legato-af,代码行数:26,代码来源:pathTest.c
示例5: test3
void test3(void)
{
banner("Test 3");
// Test what happens if an event is triggered, then the handler is removed. The registered
// handler should not be called, even if there is a pending event, because the handler has
// been removed.
TestAHandlerRef_t handlerRef = AddTestAHandler(NewHandleTestA, NULL);
LE_PRINT_VALUE("%p", handlerRef);
LE_DEBUG("Triggering New TestA\n");
TriggerTestA();
RemoveTestAHandler(handlerRef);
// Test function callback parameters.
int result;
// This is not used in the test; this parameter was added to test a code generation bug fix.
uint8_t dataArray[] = { 1, 2 };
result = TestCallback(10, dataArray, 2, CallbackTestHandler, NULL);
LE_PRINT_VALUE("%d", result);
LE_DEBUG("Triggering CallbackTest");
TriggerCallbackTest(100);
// Need to allow the event loop to process the trigger.
// The rest of the test will be continued in the handler.
}
开发者ID:H-H-bin,项目名称:legato-af,代码行数:31,代码来源:clientMain.c
示例6: LE_PRINT_VALUE
static void HandleTestA
(
int32_t x,
void* contextPtr
)
{
LE_PRINT_VALUE("%i", x);
if ( contextPtr == &SomeData )
{
LE_DEBUG("HandleTestA: context pointer works");
LE_PRINT_VALUE( "%u", *((uint32_t*)contextPtr) );
}
else
{
LE_DEBUG("HandleTestA: context pointer fails");
}
// continue the rest of the test
LE_DEBUG("Removing TestA");
RemoveTestAHandler(HandlerRef);
LE_DEBUG("Triggering TestA again");
TriggerTestA();
// Continue with next test
test3();
}
开发者ID:H-H-bin,项目名称:legato-af,代码行数:28,代码来源:clientMain.c
示例7: mqttClient_connectUser
int mqttClient_connectUser(mqttClient_t* clientData, const char* password)
{
int32_t rc = LE_OK;
LE_ASSERT(clientData);
LE_ASSERT(password);
if (!clientData->session.isConnected)
{
LE_DEBUG("pw('%s')", password);
strcpy(clientData->session.secret, password);
if (!clientData->dataConnectionState)
{
clientData->dataConnectionState = le_data_AddConnectionStateHandler(mqttClient_dataConnectionStateHandler, clientData);
}
LE_DEBUG("initiated data connection");
rc = mqttClient_connectData(clientData);
if (rc)
{
LE_ERROR("mqttClient_connectData() failed(%d)", rc);
goto cleanup;
}
}
else
{
LE_KILL_CLIENT("The MQTT client is already connected");
}
cleanup:
return rc;
}
开发者ID:CoRfr,项目名称:mangOH-MqttClient,代码行数:33,代码来源:mqttClient.c
示例8: LE_DEBUG
//--------------------------------------------------------------------------------------------------
void le_sup_ctrl_RestartLegato
(
le_sup_ctrl_ServerCmdRef_t cmdRef,
bool manualRestart
)
{
LE_DEBUG("Received request to restart Legato.");
if (State == STATE_NORMAL)
{
// Save the command reference to use in the response later.
AsyncApiCmdRef = cmdRef;
if (manualRestart)
{
State = STATE_RESTARTING_MANUAL;
}
else
{
State = STATE_RESTARTING;
}
// Start the process of shutting down the framework.
BeginShutdown();
}
else
{
LE_DEBUG("Ignoring request to restart Legato in state %d.", State);
le_sup_ctrl_RestartLegatoRespond(cmdRef, LE_DUPLICATE);
}
}
开发者ID:ekral85,项目名称:legato-af,代码行数:33,代码来源:supervisor.c
示例9: main
int main(int argc, char* argv[])
{
arg_SetArgs((size_t)argc, (char**)argv);
LE_DEBUG("== Starting Executable '%s' ==", STRINGIZE(LE_EXECUTABLE_NAME));
LE_LOG_SESSION = log_RegComponent( STRINGIZE(LE_COMPONENT_NAME), &LE_LOG_LEVEL_FILTER_PTR);
// Connect to the Log Control Daemon.
// The sooner we can connect to the Log Control Daemon, the better, because that is when
// we obtain any non-default log settings that have been set using the interactive log
// control tool. However, we can't do that until we have a working IPC messaging system.
// However, the Log Control Daemon shouldn't try to connect to itself.
// Also, the Service Directory shouldn't try to use the messaging system, so it can't
// connect to the Log Control Daemon either. Besides, the Service Directory starts before
// the Log Control Daemon starts.
#ifndef NO_LOG_CONTROL
log_ConnectToControlDaemon();
#endif
//@todo: Block all signals that the user intends to handle with signal events.
// Queue up all the component initialization functions to be called by the Event Loop after
// it processes any messages that were received from the Log Control Daemon.
event_QueueComponentInit(_le_event_InitializeComponent);
LE_DEBUG("== Starting Event Processing Loop ==");
le_event_RunLoop();
LE_FATAL("SHOULDN'T GET HERE!");
}
开发者ID:andreasanna,项目名称:legato-af,代码行数:33,代码来源:_le_main.c
示例10: LE_DEBUG
//--------------------------------------------------------------------------------------------------
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);
}
}
}
开发者ID:H-H-bin,项目名称:legato-af,代码行数:34,代码来源:pa_mdc.c
示例11: mangoh_bridge_air_vantage_pushString
static int mangoh_bridge_air_vantage_pushString(void* param, const unsigned char* data, uint32_t size)
{
mangoh_bridge_air_vantage_t* airVantage = (mangoh_bridge_air_vantage_t*)param;
int32_t res = LE_OK;
LE_ASSERT(airVantage);
LE_ASSERT(data);
LE_DEBUG("---> PUSH STRING");
uint8_t* ptr = (uint8_t*)data;
uint8_t len = 0;
memcpy(&len, ptr, sizeof(len));
LE_DEBUG("len(%u)", len);
ptr += sizeof(len);
char fieldName[MANGOH_BRIDGE_AIR_VANTAGE_FIELD_NAME_MAX_LEN] = {0};
memcpy(fieldName, ptr, len);
LE_DEBUG("field('%s')", fieldName);
ptr += len;
char val[MANGOH_BRIDGE_AIR_VANTAGE_VALUE_MAX_LEN] = {0};
memcpy(val, ptr, size - len - sizeof(len));
LE_DEBUG("value('%s')", val);
dataRouter_WriteString(fieldName, val, time(NULL));
dataRouter_DataUpdateHandlerRef_t dataUpdateHandlerRef = le_hashmap_Get(airVantage->dataUpdateHandlers, fieldName);
if (!dataUpdateHandlerRef)
{
LE_DEBUG("add data update handler('%s')", fieldName);
dataUpdateHandlerRef = dataRouter_AddDataUpdateHandler(fieldName, mangoh_bridge_air_vantage_dataUpdateHdlr, airVantage);
if (!dataUpdateHandlerRef)
{
LE_ERROR("ERROR dataRouter_AddDataUpdateHandler() failed");
res = LE_FAULT;
goto cleanup;
}
if (le_hashmap_Put(airVantage->dataUpdateHandlers, fieldName, dataUpdateHandlerRef))
{
LE_ERROR("ERROR le_hashmap_Put() failed");
res = LE_FAULT;
goto cleanup;
}
}
res = mangoh_bridge_sendResult(airVantage->bridge, 0);
if (res != LE_OK)
{
LE_ERROR("ERROR mangoh_bridge_sendResult() failed(%d)", res);
goto cleanup;
}
cleanup:
return res;
}
开发者ID:mangOH,项目名称:ArduinoBridge,代码行数:57,代码来源:airVantage.c
示例12: LE_DEBUG
//--------------------------------------------------------------------------------------------------
int32_t le_hex_StringToBinary
(
const char *stringPtr, ///< [IN] string to convert
uint32_t stringLength, ///< [IN] string length
uint8_t *binaryPtr, ///< [OUT] binary result
uint32_t binarySize ///< [IN] size of the binary table. Must be >= stringLength / 2
)
{
uint32_t idxString;
uint32_t idxBinary;
char* refStrPtr = "0123456789ABCDEF";
if (stringLength > strlen(stringPtr))
{
LE_DEBUG("The stringLength (%" PRIu32 ") is more than size of stringPtr (%s)",
stringLength, stringPtr);
return -1;
}
if (stringLength % 2 != 0)
{
LE_DEBUG("The input stringLength=%" PRIu32 " is not a multiple of 2", stringLength);
return -1;
}
if (stringLength / 2 > binarySize)
{
LE_DEBUG(
"The stringLength (%" PRIu32 ") is too long to convert"
" into a byte array of length (%" PRIu32 ")",
stringLength,
binarySize);
return -1;
}
for (idxString=0,idxBinary=0 ; idxString<stringLength ; idxString+=2,idxBinary++)
{
char* ch1Ptr;
char* ch2Ptr;
if ( ((ch1Ptr = strchr(refStrPtr, toupper((int)stringPtr[idxString]))) && *ch1Ptr) &&
((ch2Ptr = strchr(refStrPtr, toupper((int)stringPtr[idxString+1]))) && *ch2Ptr) )
{
binaryPtr[idxBinary] = ((ch2Ptr - refStrPtr) & 0x0F) |
(((ch1Ptr - refStrPtr)<<4) & 0xF0);
}
else
{
LE_DEBUG("Invalid string to convert (%s)", stringPtr);
return -1;
}
}
return idxBinary;
}
开发者ID:legatoproject,项目名称:legato-af,代码行数:56,代码来源:hex.c
示例13: LE_DEBUG
//--------------------------------------------------------------------------------------------------
static void CleanupClientData
(
le_msg_SessionRef_t sessionRef,
void *contextPtr
)
{
LE_DEBUG("Client %p is closed !!!", sessionRef);
// Iterate over the server data reference map and remove anything that matches
// the client session.
_LOCK
le_ref_IterRef_t iterRef = le_ref_GetIterator(_HandlerRefMap);
le_result_t result = le_ref_NextNode(iterRef);
_ServerData_t const* serverDataPtr;
while ( result == LE_OK )
{
serverDataPtr = le_ref_GetValue(iterRef);
if ( sessionRef != serverDataPtr->clientSessionRef )
{
LE_DEBUG("Found session ref %p; does not match",
serverDataPtr->clientSessionRef);
}
else
{
LE_DEBUG("Found session ref %p; match found, so needs cleanup",
serverDataPtr->clientSessionRef);
// Remove the handler, if the Remove handler functions exists.
if ( serverDataPtr->removeHandlerFunc != NULL )
{
serverDataPtr->removeHandlerFunc( serverDataPtr->handlerRef );
}
// Release the server data block
le_mem_Release((void*)serverDataPtr);
// Delete the associated safeRef
le_ref_DeleteRef( _HandlerRefMap, (void*)le_ref_GetSafeRef(iterRef) );
// Since the reference map was modified, the iterator is no longer valid and
// so has to be re-initalized. This means that some values may get revisited,
// but eventually this will iterate over the whole reference map.
// todo: Is there an easier way?
iterRef = le_ref_GetIterator(_HandlerRefMap);
}
// Get the next value in the reference mpa
result = le_ref_NextNode(iterRef);
}
_UNLOCK
}
开发者ID:mbarazzouq,项目名称:legato-af,代码行数:56,代码来源:server.c
示例14: tp_GetTreeName
//--------------------------------------------------------------------------------------------------
tdb_TreeRef_t tu_GetRequestedTree
(
tu_UserRef_t userRef, ///< [IN] Get a tree for this user.
tu_TreePermission_t permission, ///< [IN] Try to get a tree with this permission.
const char* pathPtr ///< [IN] The path to check.
)
//--------------------------------------------------------------------------------------------------
{
char treeName[MAX_TREE_NAME_BYTES] = "";
// If the path has the tree name embedded, extract it now. Otherwise, check to see if the user
// is trying to write to the default tree. If it is we extract the tree name for checking
// permission just like if they explicitly specifed the tree name. If the user is simply trying
// to read from their default tree, then we grant it without resorting to an ACL lookup.
if (tp_PathHasTreeSpecifier(pathPtr) == true)
{
tp_GetTreeName(treeName, pathPtr);
LE_DEBUG("** Specific tree requested, '%s'.", treeName);
// Make sure that this isn't the user's didn't just specify their own default tree. If they
// did and they're looking for read access, then just go ahead and grant it.
if ( (permission == TU_TREE_READ)
&& (strcmp(treeName, userRef->treeName) == 0))
{
return tdb_GetTree(userRef->treeName);
}
}
else if (permission == TU_TREE_WRITE)
{
LE_DEBUG("** Attempting write access on the default tree, '%s'.", userRef->treeName);
strcpy(treeName, userRef->treeName);
}
else
{
LE_DEBUG("** Opening the default tree, '%s' with read only access.", userRef->treeName);
return tdb_GetTree(userRef->treeName);
}
// If we got this far, it's because we have a tree that we need to do an ACL lookup on. So do
// so now, if that check fails, we simply bail.
if ( (ic_CheckTreePermission(permission, userRef->userName, treeName) == false)
&& (userRef->userId != 0))
{
LE_ERROR("The user, '%s', id: %d, does not have %s permission on the tree '%s'.",
userRef->userName,
userRef->userId,
PermissionStr(permission),
treeName);
return NULL;
}
// Looks like the user has permission, so grab the tree.
return tdb_GetTree(treeName);
}
开发者ID:andreasanna,项目名称:legato-af,代码行数:56,代码来源:treeUser.c
示例15: LE_DEBUG
//--------------------------------------------------------------------------------------------------
static void LoadECallSettings
(
int32_t* hMinAccuracyPtr,
int32_t* dirMinAccuracyPtr
)
{
char psapStr[LE_MDMDEFS_PHONE_NUM_MAX_BYTES] = {0};
LE_DEBUG("Start reading eCall app settings in Configuration Tree");
le_cfg_IteratorRef_t eCallCfgRef = le_cfg_CreateReadTxn(CFG_ECALL_APP_PATH);
// Get PSAP
if (le_cfg_NodeExists(eCallCfgRef, CFG_NODE_PSAP))
{
if ( le_cfg_GetString(eCallCfgRef, CFG_NODE_PSAP, psapStr, sizeof(psapStr), "") != LE_OK )
{
LE_FATAL("No node value set for '%s', exit the app!", CFG_NODE_PSAP);
}
LE_DEBUG("eCall settings, PSAP number is %s", psapStr);
if (le_ecall_SetPsapNumber(psapStr) != LE_OK)
{
LE_FATAL("Cannot set PSAP number, exit the app!");
}
}
else
{
LE_FATAL("No value set for '%s', restart the app!", CFG_NODE_PSAP);
}
// Get minimum horizontal accuracy
if (le_cfg_NodeExists(eCallCfgRef, CFG_NODE_H_MIN_ACCURACY))
{
*hMinAccuracyPtr = le_cfg_GetInt(eCallCfgRef, CFG_NODE_H_MIN_ACCURACY, DEFAULT_H_ACCURACY);
LE_DEBUG("eCall app settings, horizontal accuracy is %d meter(s)", *hMinAccuracyPtr);
}
else
{
*hMinAccuracyPtr = DEFAULT_H_ACCURACY;
}
// Get minimum direction accuracy
if (le_cfg_NodeExists(eCallCfgRef, CFG_NODE_DIR_MIN_ACCURACY))
{
*dirMinAccuracyPtr = le_cfg_GetInt(eCallCfgRef, CFG_NODE_DIR_MIN_ACCURACY, DEFAULT_DIR_ACCURACY);
LE_DEBUG("eCall app settings, direction accuracy is %d degree(s)", *dirMinAccuracyPtr);
}
else
{
*dirMinAccuracyPtr = DEFAULT_DIR_ACCURACY;
}
le_cfg_CancelTxn(eCallCfgRef);
}
开发者ID:H-H-bin,项目名称:legato-af,代码行数:55,代码来源:eCallApp.c
示例16: LE_DEBUG
// -------------------------------------------------------------------------------------------------
void le_cfgAdmin_ExportTree
(
le_cfgAdmin_ServerCmdRef_t commandRef, ///< [IN] Reference used to generate a reply for this
///< request.
le_cfg_IteratorRef_t externalRef, ///< [IN] Write iterator that is being used for the
///< export.
const char* filePathPtr, ///< [IN] Export the tree data to the this file.
const char* nodePathPtr ///< [IN] Where in the tree should this export happen?
///< Leave as an empty string to use the iterator's
///< current node.
)
// -------------------------------------------------------------------------------------------------
{
LE_DEBUG("** Exporting a tree from node '%s' into file '%s', using iterator, '%p'.",
nodePathPtr, filePathPtr, externalRef);
ni_IteratorRef_t iteratorRef = GetIteratorFromRef(externalRef);
if (iteratorRef == NULL)
{
le_cfgAdmin_ExportTreeRespond(commandRef, LE_OK);
return;
}
LE_DEBUG("Opening file '%s'.", filePathPtr);
FILE* filePtr = NULL;
filePtr = fopen(filePathPtr, "w+");
if (!filePtr)
{
LE_ERROR("File '%s' could not be opened.", filePathPtr);
le_cfgAdmin_ExportTreeRespond(commandRef, LE_IO_ERROR);
return;
}
LE_DEBUG("Exporting config data.");
le_result_t result = LE_OK;
if (tdb_WriteTreeNode(ni_GetNode(iteratorRef, nodePathPtr), filePtr) != LE_OK)
{
result = LE_FAULT;
}
fclose(filePtr);
le_cfgAdmin_ExportTreeRespond(commandRef, result);
}
开发者ID:legatoproject,项目名称:legato-af,代码行数:53,代码来源:configTreeAdminApi.c
示例17: mqttClient_processPublish
static int mqttClient_processPublish(mqttClient_t* clientData)
{
MQTTString topicName;
mqttClient_msg_t msg;
int len = 0;
int32_t rc = LE_OK;
LE_DEBUG("---> PUBLISH");
LE_ASSERT(clientData);
if (MQTTDeserialize_publish((unsigned char*)&msg.dup, (int*)&msg.qos, (unsigned char*)&msg.retained, (unsigned short*)&msg.id, &topicName,
(unsigned char**)&msg.payload, (int*)&msg.payloadLen, clientData->session.rx.buf, sizeof(clientData->session.rx.buf)) != 1)
{
LE_ERROR("MQTTDeserialize_publish() failed");
rc = LE_BAD_PARAMETER;
goto cleanup;
}
if (msg.qos != MQTT_CLIENT_QOS0)
{
if (msg.qos == MQTT_CLIENT_QOS1)
len = MQTTSerialize_ack(clientData->session.tx.buf, sizeof(clientData->session.tx.buf), PUBACK, 0, msg.id);
else if (msg.qos == MQTT_CLIENT_QOS2)
len = MQTTSerialize_ack(clientData->session.tx.buf, sizeof(clientData->session.tx.buf), PUBREC, 0, msg.id);
if (len <= 0)
{
LE_ERROR("MQTTSerialize_ack() failed(%d)", len);
rc = LE_BAD_PARAMETER;
goto cleanup;
}
LE_DEBUG("<--- PUBACK");
rc = mqttClient_write(clientData, len);
if (rc)
{
LE_ERROR("mqttClient_write() failed(%d)", rc);
goto cleanup;
}
}
rc = mqttClient_deliverMsg(clientData, &topicName, &msg);
if (rc)
{
LE_ERROR("mqttClient_deliverMsg() failed(%d)", rc);
goto cleanup;
}
cleanup:
return rc;
}
开发者ID:CoRfr,项目名称:mangOH-MqttClient,代码行数:51,代码来源:mqttClient.c
示例18: mqttClient_processConnAck
static int mqttClient_processConnAck(mqttClient_t* clientData)
{
int32_t rc = LE_OK;
uint8_t sessionPresent = 0;
uint8_t connack_rc = 0;
LE_DEBUG("---> CONNACK");
LE_ASSERT(clientData);
rc = le_timer_Stop(clientData->session.cmdTimer);
if (rc)
{
LE_ERROR("le_timer_Stop() failed(%d)", rc);
goto cleanup;
}
rc = MQTTDeserialize_connack((unsigned char*)&sessionPresent, &connack_rc, clientData->session.rx.buf, sizeof(clientData->session.rx.buf));
if (rc != 1)
{
LE_ERROR("MQTTDeserialize_connack() failed(%d)", rc);
rc = LE_BAD_PARAMETER;
goto cleanup;
}
LE_DEBUG("session present(%u) connection ACK(%u)", sessionPresent, connack_rc);
clientData->session.isConnected = (connack_rc == MQTT_CLIENT_CONNECT_SUCCESS);
if (clientData->session.isConnected)
{
mqttClient_SendConnStateEvent(true, 0, rc);
LE_INFO("subscribe('%s')", clientData->subscribeTopic);
rc = mqttClient_subscribe(clientData, clientData->subscribeTopic, 0, mqttClient_onIncomingMessage);
if (rc)
{
LE_ERROR("mqttClient_subscribe() failed(%d)", rc);
goto cleanup;
}
}
else
{
LE_ERROR("response('%s')", mqttClient_connectionRsp(connack_rc));
rc = LE_BAD_PARAMETER;
goto cleanup;
}
cleanup:
return rc;
}
开发者ID:CoRfr,项目名称:mangOH-MqttClient,代码行数:50,代码来源:mqttClient.c
示例19: l_processEvents
static int l_processEvents(lua_State *L)
{
le_result_t res = LE_WOULD_BLOCK;
L_eventloop = L;
do {
LE_DEBUG("=> serviceLoop");
res = le_event_ServiceLoop();
LE_DEBUG("<= serviceLoop, res = %d", res);
} while(res == LE_OK);
lua_pushstring(L, "ok");
return 1;
}
开发者ID:hakanernam,项目名称:legato-af,代码行数:14,代码来源:agent_platform_core_event.c
示例20: quality
//--------------------------------------------------------------------------------------------------
le_result_t le_mrc_GetSignalQual
(
uint32_t* qualityPtr ///< [OUT] The received signal strength quality (0 = no signal strength,
/// 5 = very good signal strength).
)
{
le_result_t res;
int32_t rssi; // The received signal strength (in dBm).
int32_t thresholds[] = {-113, -100, -90, -80, -65}; // TODO: Verify thresholds !
uint32_t i=0;
size_t thresholdsCount = NUM_ARRAY_MEMBERS(thresholds);
if (qualityPtr == NULL)
{
LE_KILL_CLIENT("qualityPtr is NULL !");
return LE_FAULT;
}
if ((res=pa_mrc_GetSignalQuality(&rssi)) == LE_OK)
{
for (i=0; i<thresholdsCount; i++)
{
if (rssi <= thresholds[i])
{
*qualityPtr = i;
break;
}
}
if (i == thresholdsCount)
{
*qualityPtr = i;
}
LE_DEBUG("pa_mrc_GetSignalQuality has returned rssi=%ddBm", rssi);
return LE_OK;
}
else if (res == LE_OUT_OF_RANGE)
{
LE_DEBUG("pa_mrc_GetSignalQuality has returned LE_OUT_OF_RANGE");
*qualityPtr = 0;
return LE_OK;
}
else
{
LE_ERROR("pa_mrc_GetSignalQuality has returned %d", res);
*qualityPtr = 0;
return LE_NOT_POSSIBLE;
}
}
开发者ID:hakanernam,项目名称:legato-af,代码行数:50,代码来源:le_mrc.c
注:本文中的LE_DEBUG函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论