本文整理汇总了C++中LE_DEBUG函数的典型用法代码示例。如果您正苦于以下问题:C++ LE_DEBUG函数的具体用法?C++ LE_DEBUG怎么用?C++ LE_DEBUG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LE_DEBUG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
}
示例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.");
}
}
示例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);
}
示例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);
}
示例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.
}
示例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();
}
示例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;
}
示例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);
}
}
示例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!");
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例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
}
示例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);
}
示例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);
}