• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ LOGPRINTF函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了LOGPRINTF函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:TryndamereStark,项目名称:lirc,代码行数:31,代码来源:hw_mplay.c


示例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;
	}
}
开发者ID:TryndamereStark,项目名称:lirc,代码行数:25,代码来源:hw_uirt2_raw.c


示例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;
}
开发者ID:robfr,项目名称:pmm,代码行数:32,代码来源:pmm_interval.c


示例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);
}
开发者ID:aldebaran,项目名称:lirc,代码行数:31,代码来源:serial.c


示例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);
}
开发者ID:aldebaran,项目名称:lirc,代码行数:26,代码来源:serial.c


示例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();
        }
    }
}
开发者ID:luite,项目名称:zipbrowser,代码行数:32,代码来源:ipc.c


示例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;
}
开发者ID:TryndamereStark,项目名称:lirc,代码行数:32,代码来源:hw_bte.c


示例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;
}
开发者ID:zenwheel,项目名称:lirc,代码行数:28,代码来源:hw_uirt2_raw.c


示例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);
}
开发者ID:matzrh,项目名称:lirc,代码行数:25,代码来源:livedrive_common.c


示例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);
}
开发者ID:carriercomm,项目名称:ix,代码行数:30,代码来源:ib.c


示例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;
}
开发者ID:fullstory-morgue,项目名称:lirc,代码行数:33,代码来源:hw_creative_infracd.c


示例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;
}
开发者ID:Bruno17,项目名称:Irdroid,代码行数:28,代码来源:config_file.c


示例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);
}
开发者ID:carriercomm,项目名称:ix,代码行数:31,代码来源:ibv.c


示例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;
}
开发者ID:Albinoman887,项目名称:lirc,代码行数:26,代码来源:hw_hiddev.c


示例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;
}
开发者ID:hdezela,项目名称:utvideo,代码行数:8,代码来源:CodecBase.cpp


示例16: AfterAlignmentInit

void AfterAlignmentInit(ArgStruct *p)
{
  int bytesRead;

  /* Exchange buffer pointers and remote infiniband keys if doing rdma. Do
   * the exchange in this function because this will happen after any
   * memory alignment is done, which is important for getting the 
   * correct remote address.
  */
  if( p->prot.commtype == NP_COMM_RDMAWRITE || 
      p->prot.commtype == NP_COMM_RDMAWRITE_WITH_IMM ) {
     
     /* Send my receive buffer address
      */
     if(write(p->commfd, (void *)&p->r_buff, sizeof(void*)) < 0) {
        perror("NetPIPE: write of buffer address failed in AfterAlignmentInit");
        exit(-1);
     }
     
     LOGPRINTF("Sent buffer address: %p\n", p->r_buff);
     
     /* Send my remote key for accessing
      * my remote buffer via IB RDMA
      */
     if(write(p->commfd, (void *)&r_mr_out.r_key, sizeof(VAPI_rkey_t)) < 0) {
        perror("NetPIPE: write of remote key failed in AfterAlignmentInit");
        exit(-1);
     }
  
     LOGPRINTF("Sent remote key: %d\n", r_mr_out.r_key);
     
     /* Read the sent data
      */
     bytesRead = readFully(p->commfd, (void *)&remote_address, sizeof(void*));
     if (bytesRead < 0) {
        perror("NetPIPE: read of buffer address failed in AfterAlignmentInit");
        exit(-1);
     } else if (bytesRead != sizeof(void*)) {
        perror("NetPIPE: partial read of buffer address in AfterAlignmentInit");
        exit(-1);
     }
     
     LOGPRINTF("Received remote address from other node: %p\n", remote_address);
     
     bytesRead = readFully(p->commfd, (void *)&remote_key, sizeof(VAPI_rkey_t));
     if (bytesRead < 0) {
        perror("NetPIPE: read of remote key failed in AfterAlignmentInit");
        exit(-1);
     } else if (bytesRead != sizeof(VAPI_rkey_t)) {
        perror("NetPIPE: partial read of remote key in AfterAlignmentInit");
        exit(-1);
     }
     
     LOGPRINTF("Received remote key from other node: %d\n", remote_key);

  }
}
开发者ID:carriercomm,项目名称:ix,代码行数:57,代码来源:ib.c


示例17: tira_init

int tira_init(void)
{
	if (child_pid != -1) tira_deinit();

	LOGPRINTF (1, "Tira init");
	
	if(!tty_create_lock(hw.device))
	{
		logprintf(LOG_ERR,"could not create lock files");
		return 0;
	}
	if ( (hw.fd = open (hw.device, O_RDWR | O_NONBLOCK | O_NOCTTY)) < 0)
	{
		tty_delete_lock ();
		logprintf (LOG_ERR, "Could not open the '%s' device",
			   hw.device);
		return 0;
	}
	LOGPRINTF(1, "device '%s' opened", hw.device);

	/* We want 9600 8N1 with CTS/RTS handshaking, lets set that
	 * up. The specs state a baud rate of 100000, looking at the
	 * ftdi_sio driver it forces the issue so we can set to what
	 * we would like. And seeing as this is mapped to 9600 under
	 * windows should be a safe bet.
	 */

	/* Determine device type */
	device_type=0;
	if (check_tira()) device_type='t';else
	if (check_ira()) device_type='i';

#ifdef DEBUG
	const char *device_string;
	
	switch(device_type)
	{
	case 't':
		device_string = "Tira";
		break;
	case 'i':
		device_string = "Ira";
		break;
	default:
		device_string = "unknown";
	}
	LOGPRINTF(1, "device type %s", device_string);
#endif

	if (device_type == 0)
	{
		tira_deinit();
		return 0;
	}  

	return 1;
}
开发者ID:zenwheel,项目名称:lirc,代码行数:57,代码来源:hw_tira.c


示例18: is_my_device

int is_my_device(int fd,char *name)
{
	sg_io_hdr_t io_hdr;
	int k;
	unsigned char inqCmdBlk [SCSI_INQ_CMD_LEN] = 
		{INQUIRY, 0, 0, 0, MAX_SCSI_REPLY_LEN, 0};
	unsigned char Buff[MAX_SCSI_REPLY_LEN];
	unsigned char sense_buffer[32];

	/* Just to be safe, check we have a sg device wigh version > 3 */
	if ((ioctl(fd, SG_GET_VERSION_NUM, &k) < 0) || (k < 30000)) {
		LOGPRINTF(LOG_ERR, "%s isn't sg device version > 3",name);
		return 0;
	} else {
		usleep(10);
		LOGPRINTF(1,"%s is valid sg device - checking what it is",
			  name);
	}

	/* Prepare INQUIRY command */
	memset(&io_hdr, 0, sizeof(sg_io_hdr_t));
	io_hdr.interface_id = 'S';
	io_hdr.cmd_len = sizeof(inqCmdBlk);
	io_hdr.mx_sb_len = sizeof(sense_buffer);
	io_hdr.dxfer_direction = SG_DXFER_FROM_DEV;
	io_hdr.dxfer_len = MAX_SCSI_REPLY_LEN;
	io_hdr.dxferp = Buff;
	io_hdr.cmdp = inqCmdBlk;
	io_hdr.sbp = sense_buffer;
	io_hdr.timeout = 2000;

	if (ioctl(fd, SG_IO, &io_hdr) < 0) {
		LOGPRINTF(LOG_ERR, "INQUIRY SG_IO ioctl error");
		return 0;
	} else {
		usleep(10);
	}
	if ( (io_hdr.info & SG_INFO_OK_MASK) != SG_INFO_OK) {
		LOGPRINTF(LOG_ERR,
			  "INQUIRY: SCSI status=0x%x host_status=0x%x "
			  "driver_status=0x%x",io_hdr.status,
			  io_hdr.host_status,io_hdr.driver_status);
		return 0;
	}
	/* check INQUIRY returned string */
	if ( strncmp(Buff+8,"CREATIVE",8) > 0 ) {
		LOGPRINTF(LOG_ERR, "%s is %s (vendor isn't Creative)",
			  name,Buff+8);
	}

	/* now run sense_mode_10 for page 0 to see if this is really it */
	if ( test_device_command(fd) < 0 ) {
		return 0;
	}
	return 1;
}
开发者ID:fullstory-morgue,项目名称:lirc,代码行数:56,代码来源:hw_creative_infracd.c


示例19: parseFlags

int parseFlags(char *val)
{
        struct flaglist *flaglptr;
	int flags=0;
	char *flag,*help;

	flag=help=val;
	while(flag!=NULL)
	{
		while(*help!='|' && *help!=0) help++;
		if(*help=='|')
		{
			*help=0;help++;
		}
		else
		{
			help=NULL;
		}

		flaglptr=all_flags;
		while(flaglptr->name!=NULL){
			if(strcasecmp(flaglptr->name,flag)==0){
				if(flaglptr->flag&IR_PROTOCOL_MASK &&
				   flags&IR_PROTOCOL_MASK)
				{
					logprintf(LOG_ERR, "error in "
						  "configfile line %d:",
						  line);
					logprintf(LOG_ERR, "multiple "
						  "protocols given in flags: "
						  "\"%s\"",flag);
					parse_error=1;
					return(0);
				}
				flags=flags|flaglptr->flag;
				LOGPRINTF(3,"flag %s recognized",
					  flaglptr->name);
				break;
			}
			flaglptr++;
		}
		if(flaglptr->name==NULL)
		{
			logprintf(LOG_ERR,"error in configfile line %d:",
				  line);
			logprintf(LOG_ERR,"unknown flag: \"%s\"",flag);
			parse_error=1;
			return(0);
		}
		flag=help;
	}
	LOGPRINTF(2,"flags value: %d",flags);

        return(flags);
}
开发者ID:Bruno17,项目名称:Irdroid,代码行数:55,代码来源:config_file.c


示例20: LOGPRINTF

struct ir_ncode *defineCode(char *key, char *val, struct ir_ncode *code)
{
        code->name=s_strdup(key);
        code->code=s_strtocode(val);
#       ifdef LONG_IR_CODE
        LOGPRINTF(3,"      %-20s 0x%016llX",code->name, code->code);
#       else
        LOGPRINTF(3,"      %-20s 0x%016lX",code->name, code->code);
#       endif
        return(code);
}
开发者ID:BackupTheBerlios,项目名称:wl530g-svn,代码行数:11,代码来源:config_file.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ LOGSTRING函数代码示例发布时间:2022-05-30
下一篇:
C++ LOGP函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap