⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rod_test_binary.c

📁 rod4 扫描仪协议分析代码
💻 C
字号:
#include <termios.h>#include <unistd.h>#include <stdio.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include "librod2.h"#include "debug.h"#include "type.h"int main(int argc , char *argv[]){	int fd;	//int i;	struct timeval tv;	fd_set fds;	int totallen = 0;	printf("%s %d\n", __FILE__, __LINE__);	if(argc !=2)	{		printf("%s %d\n", __FILE__, __LINE__);		fd = librod2_init("192.168.240.3");	}	else	{		printf("%s %d\n", __FILE__, __LINE__);		fd = librod2_init(argv[1]);	}	if(fd < 0)	{		printf("error init\n");		return 0;	}	printf("init succeed\n");	while(1)	{		int n = 4;		tv.tv_sec = 5;		tv.tv_usec = 0;		FD_ZERO(&fds);		FD_SET(fd, &fds);		n = select(n , &fds, NULL, NULL,&tv);		if(n < 0)		{			perror("select failed\n");		}		else if(n)		{			if(FD_ISSET(fd, &fds))			{				struct _data_type data[1024];				int size;				if(librod2_parse_cmd(fd, (void *)data, &size) == LASER_DATA_READY)				{					printf("ret %d\n", size);				}			}		}		else		{			printf("time out , reinit\n");		}	}	close(fd);	return 1;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -