예제 #1
0
파일: b.c 프로젝트: thatking/hi3516c
int SetPanTiltFLen(short FLen)
{
    FLenCtrlCode f;
    int ret;
    f.head = htonl(0x87010447);
    f.FLen = htonl(NumToContlCode(FLen));
    f.tail = 0xFF;
    //printf("FLen=%x\n",f.FLen);
    ret = writeTTY(&f, sizeof(f));
    return ret;
}
예제 #2
0
파일: ttyqr.c 프로젝트: oskar456/ttyqr
static void qrencode(const char *intext, const char *outfile)
{
	QRcode *qrcode;
	
	qrcode = encode(intext);
	if(qrcode == NULL) {
		perror("Failed to encode the input data:");
		exit(EXIT_FAILURE);
	}
	writeTTY(qrcode, outfile);
	QRcode_free(qrcode);
}
예제 #3
0
파일: b.c 프로젝트: thatking/hi3516c
int SetPanTiltPoi(unsigned char YSpeed, unsigned char ZSpeed,
                  unsigned short YPoi, unsigned short ZPoi)
{
	PoiCtrlCode c;
	int ret;
	memset(&c, 0, sizeof(c));
	c.head = htonl(0x87010602);
	c.YSpeed = YSpeed;
	c.ZSpeed = ZSpeed;
	c.YPoi = htonl(NumToContlCode(YPoi));
	c.ZPoi = htonl(NumToContlCode(ZPoi));
	c.tail = 0xFF;
	ret = writeTTY(&c, sizeof(c));
	return ret;
}
예제 #4
0
파일: ttyqr.c 프로젝트: oskar456/ttyqr
static void qrencodeStructured(const char *intext, const char *outfile)
{
	QRcode_List *qrlist, *p;
	char filename[FILENAME_MAX];
	char *base, *q, *suffix = NULL;
	int i = 1;

	base = strdup(outfile);
	if(base == NULL) {
		fprintf(stderr, "Failed to allocate memory.\n");
		exit(EXIT_FAILURE);
	}
	if(strlen(base) > 4) {
		q = base + strlen(base) - 4;
		if(strcasecmp(".txt", q) == 0) {
			suffix = strdup(q);
			*q = '\0';
		}
	}
	
	qrlist = encodeStructured(intext);
	if(qrlist == NULL) {
		perror("Failed to encode the input data:");
		exit(EXIT_FAILURE);
	}

	for(p = qrlist; p != NULL; p = p->next) {
		if(p->code == NULL) {
			fprintf(stderr, "Failed to encode the input data.\n");
			exit(EXIT_FAILURE);
		}
		if(suffix) {
			snprintf(filename, FILENAME_MAX, "%s-%02d%s", base, i, suffix);
		} else {
			snprintf(filename, FILENAME_MAX, "%s-%02d", base, i);
		}
		writeTTY(p->code, filename);
		i++;
	}

	free(base);
	if(suffix) {
		free(suffix);
	}

	QRcode_List_free(qrlist);
}