Z3Cam-LX User Instructions
DOC-USR-0155-05
___________________________________________________________________________________________
Z3 Technology, LLC
♦
100 N 8
th
ST, STE 250
♦
Lincoln, NE 68508-1369 USA
♦
+1.402.323.0702
77
void help()
{
printf("The Following key combinations are supported:\n");
printf("\tI:\t Zoom In\n\tO:\t Zoom Out\n\tSpace:\t Stop Zoom\n\tV:\t Prints version
inquiry\n\tF:\t Sets picture to fliped\n\tN:\t Sets picture to normal.\n\tH:\t Prints
this message\n\tX:\t Exits\n");
}
void hex_dump(void *hex, int size)
{
int i;
char *hex_c = (char *)hex;
for (i = 0; i<size; i++)
{
printf("%02x ", hex_c[i] & 0xff);
if ((i+1 % 16) == 0 )
printf("\n");
}
printf("\n");
}
int visca_send(SOCKET soc, char *cmd)
{
send(soc, &cmd[1], (size_t)cmd[0],0);
}
int visca_receive(SOCKET soc, char* receive, int size, int do_dump)
{
int ret = -1;
while (ret == -1)
{
again:
ret = recv(soc, (void *)receive, size,0);
Sleep(1);
}
if (ret > 0 && do_dump) {
hex_dump(receive, ret);
}
if (ret > 2 &&
(receive[1] >= 0x40 && receive[1] <= 0x4f))
{
if (ret <= 3) //need another response
{
ret = -1;
goto again;
}
}
}
int main(int argc, char *argv[])
{
int res, i;
int ch = 0, chant = 0;
SOCKET s;
char buf[255];
unsigned char cmdVisca[6][10]=
{{0x06,0x81,0x01,0x04,0x07,0x02,0xFF,0x00,0x00,0x00},