本文整理汇总了C++中LSErrorPrint函数的典型用法代码示例。如果您正苦于以下问题:C++ LSErrorPrint函数的具体用法?C++ LSErrorPrint怎么用?C++ LSErrorPrint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LSErrorPrint函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getMessages_method
bool getMessages_method(LSHandle* lshandle, LSMessage *message, void *ctx) {
LSError lserror;
LSErrorInit(&lserror);
char filename[MAXLINLEN];
strcpy(filename, "/var/log/messages");
return read_file(lshandle, message, filename, true);
error:
LSErrorPrint(&lserror, stderr);
LSErrorFree(&lserror);
end:
return false;
}
示例2: SignalCancel
static void
SignalCancel(CBH *helper)
{
bool retVal;
LSError lserror;
LSErrorInit(&lserror);
retVal = LSCallCancel(gServiceHandle, helper->token, &lserror);
if (!retVal)
{
LSErrorPrint(&lserror, stderr);
LSErrorFree(&lserror);
}
helper->token = 0;
}
示例3: luna_service_check_for_subscription_and_process
bool luna_service_check_for_subscription_and_process(LSHandle *handle, LSMessage *message)
{
LSError lserror;
bool subscribed = false;
LSErrorInit(&lserror);
if (LSMessageIsSubscription(message)) {
if (!LSSubscriptionProcess(handle, message, &subscribed, &lserror)) {
LSErrorPrint(&lserror, stderr);
LSErrorFree(&lserror);
}
}
return subscribed;
}
示例4: listContacts
// callback
static bool
listContacts(LSHandle *sh, LSMessage *message, void *categoryContext)
{
bool retVal;
LSError lserror;
LSErrorInit(&lserror);
retVal = LSMessageReply(sh, message, "{ JSON REPLY PAYLOAD }", &lserror);
if (!retVal)
{
LSErrorPrint(&lserror, stderr);
LSErrorFree(&lserror);
}
return retVal;
}
示例5: clearMessages_method
bool clearMessages_method(LSHandle* lshandle, LSMessage *message, void *ctx) {
LSError lserror;
LSErrorInit(&lserror);
char command[MAXLINLEN];
sprintf(command, "rm -rf /var/log/messages 2>&1");
return simple_command(lshandle, message, command);
error:
LSErrorPrint(&lserror, stderr);
LSErrorFree(&lserror);
end:
return false;
}
示例6: send_shutdown_services
static void
send_shutdown_services()
{
bool retVal;
LSError lserror;
LSErrorInit(&lserror);
retVal = LSSignalSend(GetLunaServiceHandle(),
"luna://com.palm.sleep/shutdown/shutdownServices",
"{}", &lserror);
if (!retVal)
{
g_critical("%s Could not send shutdown applications", __FUNCTION__);
LSErrorPrint(&lserror, stderr);
LSErrorFree(&lserror);
}
}
示例7: dummy_method
//
// A dummy method, useful for unimplemented functions or as a status function.
// Called directly from webOS, and returns directly to webOS.
//
bool dummy_method(LSHandle* lshandle, LSMessage *message, void *ctx)
{
log("dummy_method");
LSError lserror;
LSErrorInit(&lserror);
if (!LSMessageReply(lshandle, message, "{\"returnValue\": true}", &lserror))
{
LSErrorPrint(&lserror, stderr);
LSErrorFree(&lserror);
return false;
}
return true;
}
示例8: alarm_queue_add
/**
* @brief Add a new alarm to the queue.
*
* @param id
* @param calendar_time
* @param expiry
* @param serviceName
* @param applicationName
*
* @retval
*/
static bool
alarm_queue_add(uint32_t id, const char *key, bool calendar_time,
time_t expiry, const char *serviceName,
const char *applicationName,
bool subscribe, LSMessage *message)
{
_Alarm *alarm = g_new0(_Alarm, 1);
alarm->key = g_strdup(key);
alarm->id = id;
alarm->calendar = calendar_time;
alarm->expiry = expiry;
alarm->serviceName = g_strdup(serviceName);
alarm->applicationName = g_strdup(applicationName);
if (subscribe)
{
LSError lserror;
LSErrorInit(&lserror);
bool retVal = LSSubscriptionAdd(
GetLunaServiceHandle(), "alarm", message, &lserror);
if (!retVal) {
LSErrorPrint(&lserror, stderr);
LSErrorFree(&lserror);
goto error;
}
LSMessageRef(message);
alarm->message = message;
}
alarm_print(alarm);
if (alarm->id >= gAlarmQueue->seq_id)
{
gAlarmQueue->seq_id = alarm->id+1;
}
g_sequence_insert_sorted(gAlarmQueue->alarms,
alarm, (GCompareDataFunc)alarm_cmp_func,
NULL);
update_alarms();
return true;
error:
return false;
}
示例9: LSErrorInit
void WindowServerLuna::slotFullEraseDevice()
{
LSHandle* handle = SystemService::instance()->serviceHandle();
LSError err;
LSErrorInit(&err);
luna_assert(handle != 0);
LSCall(handle, "palm://com.palm.storage/erase/EraseAll", "{}", &WindowServerLuna::cbFullEraseCallback, this, NULL, &err);
if (LSErrorIsSet(&err)) {
LSErrorPrint(&err, stderr);
LSErrorFree(&err);
}
else {
m_fullErasePending = true;
}
}
示例10: luna_service_message_reply_custom_error
void luna_service_message_reply_custom_error(LSHandle *handle, LSMessage *message, const char *error_text)
{
bool ret;
LSError lserror;
char *payload;
LSErrorInit(&lserror);
payload = g_strdup_printf("{\"returnValue\":false, \"errorText\":\"%s\"}", error_text);
ret = LSMessageReply(handle, message, payload, &lserror);
if (!ret) {
LSErrorPrint(&lserror, stderr);
LSErrorFree(&lserror);
}
g_free(payload);
}
示例11: LSErrorInit
void HostArmPixie::getInitialSwitchStates()
{
LSError err;
LSErrorInit(&err);
if (!LSCall(m_service, HIDD_RINGER_URI, HIDD_GET_STATE, HostArm::switchStateCallback, (void*)SW_RINGER, NULL, &err))
goto Error;
if (!LSCall(m_service, HIDD_HEADSET_URI, HIDD_GET_STATE, HostArm::switchStateCallback, (void*)SW_HEADPHONE_INSERT, NULL, &err))
goto Error;
Error:
if (LSErrorIsSet(&err)) {
LSErrorPrint(&err, stderr);
LSErrorFree(&err);
}
}
示例12: getLogging_method
//
// Run command to get Logging context level.
//
bool getLogging_method(LSHandle* lshandle, LSMessage *message, void *ctx) {
LSError lserror;
LSErrorInit(&lserror);
// Local buffer to store the update command
char command[MAXLINLEN];
// Store the command, so it can be used in the error report if necessary
sprintf(command, "PmLogCtl show 2>&1");
return simple_command(lshandle, message, command);
error:
LSErrorPrint(&lserror, stderr);
LSErrorFree(&lserror);
end:
return false;
}
示例13: shutdown_init
static int
shutdown_init(void)
{
LSError lserror;
LSErrorInit(&lserror);
if (!LSRegisterCategory(GetLunaServiceHandle(),
"/shutdown", shutdown_methods, NULL, NULL, &lserror))
{
goto error;
}
return 0;
error:
LSErrorPrint(&lserror, stderr);
LSErrorFree(&lserror);
return -1;
}
示例14: listConnections_method
bool listConnections_method(LSHandle* lshandle, LSMessage *message, void *ctx) {
LSError lserror;
LSErrorInit(&lserror);
if (access_denied(message)) return true;
// Local buffer to store the command
char command[MAXLINLEN];
sprintf(command, "cat /proc/net/nf_conntrack 2>&1");
return simple_command(message, command);
error:
LSErrorPrint(&lserror, stderr);
LSErrorFree(&lserror);
end:
return false;
}
示例15: listFilecacheTypes_method
bool listFilecacheTypes_method(LSHandle* lshandle, LSMessage *message, void *ctx) {
LSError lserror;
LSErrorInit(&lserror);
if (access_denied(message)) return true;
// Local buffer to store the command
char command[MAXLINLEN];
sprintf(command, "/bin/ls -1 /etc/palm/filecache_types/ 2>&1");
return simple_command(message, command);
error:
LSErrorPrint(&lserror, stderr);
LSErrorFree(&lserror);
end:
return false;
}