本文整理汇总了C++中LOGPRINTF函数的典型用法代码示例。如果您正苦于以下问题:C++ LOGPRINTF函数的具体用法?C++ LOGPRINTF怎么用?C++ LOGPRINTF使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LOGPRINTF函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mplay_init
/**************************************************************************
* Lock and initialize the serial port.
* This function is called by the LIRC daemon when the first client
* registers itself.
* Return 1 on success, 0 on error.
**************************************************************************/
int mplay_init(void)
{
int result = 1;
LOGPRINTF(1, "Entering mplay_init()");
/* Creation of a lock file for the port */
if (!tty_create_lock(hw.device)) {
logprintf(LOG_ERR, "Could not create the lock file");
LOGPRINTF(1, "Could not create the lock file");
result = 0;
}
/* Try to open serial port */
else if ((hw.fd = open(hw.device, O_RDWR | O_NONBLOCK | O_NOCTTY)) < 0) {
logprintf(LOG_ERR, "Could not open the serial port");
LOGPRINTF(1, "Could not open the serial port");
mplay_deinit();
result = 0;
}
/* Serial port configuration */
else if (!tty_reset(hw.fd) || !tty_setbaud(hw.fd, MPLAY_BAUD_RATE)) {
logprintf(LOG_ERR, "could not configure the serial port for '%s'", hw.device);
LOGPRINTF(1, "could not configure the serial port for '%s'", hw.device);
mplay_deinit();
}
return result;
}
示例2: LOGPRINTF
static char *uirt2_raw_rec(struct ir_remote *remotes)
{
LOGPRINTF(1, "uirt2_raw_rec");
LOGPRINTF(1, "uirt2_raw_rec: %p", remotes);
if (!clear_rec_buffer())
return (NULL);
if (remotes) {
char *res;
res = decode_all(remotes);
return res;
} else {
lirc_t data;
queue_clear();
data = uirt2_read_raw(dev, 1);
if (data) {
queue_put(data);
}
return NULL;
}
}
示例3: remove_interval
//TODO failure? return 0 on success
int
remove_interval(struct pmm_interval_list *l, struct pmm_interval *i)
{
LOGPRINTF("removing interval with type: %d\n", i->type);
//if interval is at top or bottom, rewire top/bottom pointers
if(l->top == i) {
l->top = i->previous;
}
if(l->bottom == i) {
l->bottom = i->next;
}
//rewire intervals that were previous/next intervals of the remove-ee
if(i->next != NULL) {
i->next->previous = i->previous;
}
if(i->previous != NULL) {
i->previous->next = i->next;
}
//free interval
free_interval(&i);
l->size -= 1;
LOGPRINTF("size: %d\n", l->size);
return 1;
}
示例4: tty_read
int tty_read(int fd,char *byte)
{
fd_set fds;
int ret;
struct timeval tv;
FD_ZERO(&fds);
FD_SET(fd,&fds);
tv.tv_sec=1; /* timeout after 1 sec */
tv.tv_usec=0;
ret=select(fd+1,&fds,NULL,NULL,&tv);
if(ret==0)
{
logprintf(LOG_ERR,"tty_read(): timeout");
return(-1); /* received nothing, bad */
}
else if(ret!=1)
{
LOGPRINTF(1,"tty_read(): select() failed");
LOGPERROR(1,"tty_read()");
return(-1);
}
if(read(fd,byte,1)!=1)
{
LOGPRINTF(1,"tty_read(): read() failed");
LOGPERROR(1,"tty_read()");
return(-1);
}
return(1);
}
示例5: tty_setrtscts
int tty_setrtscts(int fd,int enable)
{
struct termios options;
if(tcgetattr(fd,&options)==-1)
{
LOGPRINTF(1,"%s: tcgetattr() failed", __FUNCTION__);
LOGPERROR(1, __FUNCTION__);
return(0);
}
if(enable)
{
options.c_cflag|=CRTSCTS;
}
else
{
options.c_cflag&=~CRTSCTS;
}
if(tcsetattr(fd,TCSAFLUSH,&options)==-1)
{
LOGPRINTF(1,"%s: tcsetattr() failed", __FUNCTION__);
LOGPERROR(1, __FUNCTION__);
return(0);
}
return(1);
}
示例6: on_connection_status
/* @brief Called after network connection state was requested, or the state has changed
*
*/
static void on_connection_status ( eripc_context_t *context,
const eripc_event_info_t *info,
void *user_data )
{
LOGPRINTF("entry");
const eripc_arg_t *arg_array = info->args;
if ((arg_array[0].type == ERIPC_TYPE_BOOL) &&
(arg_array[1].type == ERIPC_TYPE_STRING) &&
(arg_array[2].type == ERIPC_TYPE_STRING) &&
(arg_array[3].type == ERIPC_TYPE_STRING))
{
gboolean is_connected = arg_array[0].value.b;
//const gchar *medium = arg_array[1].value.s;
//const gchar *profile = arg_array[2].value.s;
//const gchar *reason = arg_array[3].value.s;
if (is_connected)
{
LOGPRINTF("Network connection established");
g_connect_cb();
}
else
{
LOGPRINTF("Network connection terminated - reason [%s]", arg_array[3].value.s);
g_disconnect_cb();
}
}
}
示例7: LOGPRINTF
char *bte_readline()
{
static char msg[PACKET_SIZE + 1];
char c;
static int n = 0;
int ok = 1;
LOGPRINTF(6, "bte_readline called");
if (io_failed && !bte_connect()) // try to reestablish connection
return (NULL);
if ((ok = read(hw.fd, &c, 1)) <= 0) {
io_failed = 1;
logprintf(LOG_ERR, "bte_readline: read failed - %d: %s", errno, strerror(errno));
return (NULL);
}
if (ok == 0 || c == '\r')
return NULL;
if (c == '\n') {
if (n == 0)
return NULL;
msg[n] = 0;
n = 0;
LOGPRINTF(1, "bte_readline: %s", msg);
return (msg);
}
msg[n++] = c;
if (n >= PACKET_SIZE - 1)
msg[--n] = '!';
return NULL;
}
示例8: calc_data_bit
static int calc_data_bit(struct ir_remote *remote,
int table[], int table_len, int signal, int tUnit)
{
int i;
for (i = 0; i < table_len; i++)
{
if (table[i] == 0)
{
table[i] = signal / tUnit;
LOGPRINTF(2, "table[%d] = %d\n", i, table[i]);
return i;
}
if (expect(remote, signal, table[i] * tUnit))
{
LOGPRINTF(2, "expect %d, table[%d] = %d\n",
signal / tUnit, i, table[i]);
return i;
}
}
LOGPRINTF(2, "Couldn't find %d\n", signal/tUnit);
return -1;
}
示例9: livedrive_decode
int livedrive_decode(struct ir_remote *remote, ir_code * prep, ir_code * codep, ir_code * postp, int *repeat_flagp,
lirc_t * min_remaining_gapp, lirc_t * max_remaining_gapp)
{
lirc_t gap;
if (!map_code(remote, prep, codep, postp, 16, pre, 16, code, 0, 0))
return (0);
gap = 0;
if (start.tv_sec - last.tv_sec >= 2)
*repeat_flagp = 0;
else {
gap = time_elapsed(&last, &start);
if (gap < 300000)
*repeat_flagp = 1;
else
*repeat_flagp = 0;
}
LOGPRINTF(1, "repeat_flag: %d", *repeat_flagp);
LOGPRINTF(1, "gap: %lu", (__u32) gap);
return (1);
}
示例10: FreeBuff
void FreeBuff(char *buff1, char *buff2)
{
VAPI_ret_t ret;
if(s_mr_hndl != VAPI_INVAL_HNDL) {
LOGPRINTF("Deregistering send buffer\n");
ret = VAPI_deregister_mr(hca_hndl, s_mr_hndl);
if(ret != VAPI_OK) {
fprintf(stderr, "Error deregistering send mr: %s\n", VAPI_strerror(ret));
} else {
s_mr_hndl = VAPI_INVAL_HNDL;
}
}
if(r_mr_hndl != VAPI_INVAL_HNDL) {
LOGPRINTF("Deregistering recv buffer\n");
ret = VAPI_deregister_mr(hca_hndl, r_mr_hndl);
if(ret != VAPI_OK) {
fprintf(stderr, "Error deregistering recv mr: %s\n", VAPI_strerror(ret));
} else {
r_mr_hndl = VAPI_INVAL_HNDL;
}
}
if(buff1 != NULL)
free(buff1);
if(buff2 != NULL)
free(buff2);
}
示例11: init_device
int init_device()
{
char c;
int fd;
/* user overriding autoprobing */
if ( hw.device ) {
fd = open(hw.device,O_RDWR);
if ( fd < 0 ) {
LOGPRINTF(1, "Init: open of %s failed", hw.device);
return 0;
}
/* open ok, test device */
if ( is_my_device(fd,hw.device) ) {
return fd;
}
return 0;
}
for(c = 'a';c < 'z';c++) {
sprintf(dev_name,"/dev/sg%c",c);
fd = open(dev_name,O_RDWR);
if ( fd < 0 ) {
LOGPRINTF(1, "Probing: open of %s failed", dev_name);
continue;
}
/* open ok, test device */
if ( is_my_device(fd,dev_name) ) {
hw.device = dev_name;
return fd;
}
}
return 0;
}
示例12: LOGPRINTF
struct ir_code_node *defineNode(struct ir_ncode *code, const char *val)
{
struct ir_code_node *node;
node=s_malloc(sizeof(*node));
if(node==NULL) return NULL;
node->code=s_strtocode(val);
node->next=NULL;
# ifdef LONG_IR_CODE
LOGPRINTF(3," 0x%016llX", node->code);
# else
LOGPRINTF(3," 0x%016lX", node->code);
# endif
if(code->current==NULL)
{
code->next=node;
code->current=node;
}
else
{
code->current->next=node;
code->current=node;
}
return node;
}
示例13: FreeBuff
/* De_register the allocated memory regions before exiting */
void FreeBuff(char *buff1, char *buff2)
{
int ret;
if(s_mr_hndl) {
LOGPRINTF(("Deregistering send buffer"));
ret = ibv_dereg_mr(s_mr_hndl);
if(ret) {
fprintf(stderr, "Error deregistering send mr\n");
} else {
s_mr_hndl = NULL;
}
}
if(r_mr_hndl) {
LOGPRINTF(("Deregistering recv buffer"));
ret = ibv_dereg_mr(r_mr_hndl);
if(ret) {
fprintf(stderr, "Error deregistering recv mr\n");
} else {
r_mr_hndl = NULL;
}
}
if(buff1 != NULL)
free(buff1);
if(buff2 != NULL)
free(buff2);
}
示例14: hiddev_decode
int hiddev_decode(struct ir_remote *remote, ir_code * prep, ir_code * codep, ir_code * postp, int *repeat_flagp,
lirc_t * min_remaining_gapp, lirc_t * max_remaining_gapp)
{
LOGPRINTF(1, "hiddev_decode");
if (!map_code(remote, prep, codep, postp, pre_code_length, pre_code, main_code_length, main_code, 0, 0)) {
return (0);
}
LOGPRINTF(1, "lirc code: 0x%X", *codep);
map_gap(remote, &start, &last, 0, repeat_flagp, min_remaining_gapp, max_remaining_gapp);
/* override repeat */
switch (repeat_state) {
case RPT_NO:
*repeat_flagp = 0;
break;
case RPT_YES:
*repeat_flagp = 1;
break;
default:
break;
}
return 1;
}
示例15: LOGPRINTF
int CCodecBase::EncodeBegin(utvf_t infmt, unsigned int width, unsigned int height, size_t cbGrossWidth)
{
LOGPRINTF("%p CCodecBase::EncodeBegin(infmt=%08X, width=%u, height=%u, cbGrossWidth=%" PRIdSZT ")", this, infmt, width, height, cbGrossWidth);
int ret = InternalEncodeBegin(infmt, width, height, cbGrossWidth);
LOGPRINTF("%p CCodecBase::EncodeBegin return %d", this, ret);
return ret;
}