233959b88f950867243897ad0908c4969e3bbb72
Stefan Schuermans cleanup file headers after...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c   1) /* BlinkenLib
Stefan Schuermans update email address of author

Stefan Schuermans authored 10 years ago

BlinkenLib/BlinkenOutputWin.c   2)    Copyright 2004-2014 Stefan Schuermans <stefan@schuermans.info>
Stefan Schuermans cleanup file headers after...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c   3)    Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html
BlinkenLib/BlinkenOutputWin.c   4)    a blinkenarea.org project */
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c              5) 
BlinkenOutputWin.c              6) #include <fcntl.h>
BlinkenOutputWin.c              7) #include <stdlib.h>
BlinkenOutputWin.c              8) #include <stdio.h>
BlinkenOutputWin.c              9) #include <string.h>
BlinkenOutputWin.c             10) #include <winsock2.h>
BlinkenOutputWin.c             11) #include <windows.h>
BlinkenOutputWin.c             12) 
Christian Heimke BlinkenLib v.0.5.5 (2008-03...

Christian Heimke authored 13 years ago

BlinkenLib/BlinkenOutputWin.c  13) #include <BlinkenLib/BlinkenLib.h>
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c             14) 
Stefan Schuermans implement serial port confi...

Stefan Schuermans authored 5 years ago

tools/BlinkenOutputWin.c       15) struct s_serial_settings {
tools/BlinkenOutputWin.c       16)   char *str; // pointer into argv[]
tools/BlinkenOutputWin.c       17)   DWORD BaudRate;
tools/BlinkenOutputWin.c       18)   DWORD fParity : 1;
tools/BlinkenOutputWin.c       19)   BYTE ByteSize;
tools/BlinkenOutputWin.c       20)   BYTE Parity;
tools/BlinkenOutputWin.c       21)   BYTE StopBits;
tools/BlinkenOutputWin.c       22) };
tools/BlinkenOutputWin.c       23) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c  24) // get serial settings from text
Stefan Schuermans implement serial port confi...

Stefan Schuermans authored 5 years ago

tools/BlinkenOutputWin.c       25) static int serial_settings_parse(char *str,
tools/BlinkenOutputWin.c       26)                                  struct s_serial_settings *serial_settings)
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c             27) {
BlinkenOutputWin.c             28)   int baud, data, stop;
BlinkenOutputWin.c             29)   char parity;
BlinkenOutputWin.c             30) 
Stefan Schuermans implement serial port confi...

Stefan Schuermans authored 5 years ago

tools/BlinkenOutputWin.c       31)   serial_settings->str = str;
tools/BlinkenOutputWin.c       32) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c  33)   // split and parse settings string
BlinkenLib/BlinkenOutputWin.c  34)   if (sscanf(str, "%i,%c,%i,%i", &baud, &parity, &data, &stop) != 4)
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c             35)     return 0;
BlinkenOutputWin.c             36) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c  37)   // baud rate
Stefan Schuermans implement serial port confi...

Stefan Schuermans authored 5 years ago

tools/BlinkenOutputWin.c       38)   switch (baud) {
tools/BlinkenOutputWin.c       39)     case 300:
tools/BlinkenOutputWin.c       40)       serial_settings->BaudRate = CBR_300;
tools/BlinkenOutputWin.c       41)       break;
tools/BlinkenOutputWin.c       42)     case 600:
tools/BlinkenOutputWin.c       43)       serial_settings->BaudRate = CBR_600;
tools/BlinkenOutputWin.c       44)       break;
tools/BlinkenOutputWin.c       45)     case 1200:
tools/BlinkenOutputWin.c       46)       serial_settings->BaudRate = CBR_1200;
tools/BlinkenOutputWin.c       47)       break;
tools/BlinkenOutputWin.c       48)     case 2400:
tools/BlinkenOutputWin.c       49)       serial_settings->BaudRate = CBR_2400;
tools/BlinkenOutputWin.c       50)       break;
tools/BlinkenOutputWin.c       51)     case 4800:
tools/BlinkenOutputWin.c       52)       serial_settings->BaudRate = CBR_4800;
tools/BlinkenOutputWin.c       53)       break;
tools/BlinkenOutputWin.c       54)     case 9600:
tools/BlinkenOutputWin.c       55)       serial_settings->BaudRate = CBR_9600;
tools/BlinkenOutputWin.c       56)       break;
tools/BlinkenOutputWin.c       57)     case 19200:
tools/BlinkenOutputWin.c       58)       serial_settings->BaudRate = CBR_19200;
tools/BlinkenOutputWin.c       59)       break;
tools/BlinkenOutputWin.c       60)     case 57600:
tools/BlinkenOutputWin.c       61)       serial_settings->BaudRate = CBR_57600;
tools/BlinkenOutputWin.c       62)       break;
tools/BlinkenOutputWin.c       63)     case 115200:
tools/BlinkenOutputWin.c       64)       serial_settings->BaudRate = CBR_115200;
tools/BlinkenOutputWin.c       65)       break;
tools/BlinkenOutputWin.c       66)     default:
tools/BlinkenOutputWin.c       67)       printf("illegal baudrate: %d\n", baud);
tools/BlinkenOutputWin.c       68)       return 0;
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c             69)   }
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c  70)   // parity
Stefan Schuermans implement serial port confi...

Stefan Schuermans authored 5 years ago

tools/BlinkenOutputWin.c       71)   switch (parity) {
tools/BlinkenOutputWin.c       72)     case 'n':
tools/BlinkenOutputWin.c       73)     case 'N':
tools/BlinkenOutputWin.c       74)       serial_settings->fParity = 0;
tools/BlinkenOutputWin.c       75)       serial_settings->Parity = NOPARITY;
tools/BlinkenOutputWin.c       76)       break;
tools/BlinkenOutputWin.c       77)     case 'e':
tools/BlinkenOutputWin.c       78)     case 'E':
tools/BlinkenOutputWin.c       79)       serial_settings->fParity = 1;
tools/BlinkenOutputWin.c       80)       serial_settings->Parity = EVENPARITY;
tools/BlinkenOutputWin.c       81)       break;
tools/BlinkenOutputWin.c       82)     case 'o':
tools/BlinkenOutputWin.c       83)     case 'O':
tools/BlinkenOutputWin.c       84)       serial_settings->fParity = 1;
tools/BlinkenOutputWin.c       85)       serial_settings->Parity = ODDPARITY;
tools/BlinkenOutputWin.c       86)       break;
tools/BlinkenOutputWin.c       87)     default:
tools/BlinkenOutputWin.c       88)       printf("invalid parity: %c\n", parity);
tools/BlinkenOutputWin.c       89)       return 0;
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c             90)   }
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c  91)   // data bits
Stefan Schuermans implement serial port confi...

Stefan Schuermans authored 5 years ago

tools/BlinkenOutputWin.c       92)   switch (data) {
tools/BlinkenOutputWin.c       93)     case 5:
tools/BlinkenOutputWin.c       94)     case 6:
tools/BlinkenOutputWin.c       95)     case 7:
tools/BlinkenOutputWin.c       96)     case 8:
tools/BlinkenOutputWin.c       97)       serial_settings->ByteSize = data;
tools/BlinkenOutputWin.c       98)       break;
tools/BlinkenOutputWin.c       99)     default:
tools/BlinkenOutputWin.c      100)       printf("illegal number of data bits: %d\n", data);
tools/BlinkenOutputWin.c      101)       return 0;
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            102)   }
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 103)   // stop bits
Stefan Schuermans implement serial port confi...

Stefan Schuermans authored 5 years ago

tools/BlinkenOutputWin.c      104)   switch (stop) {
tools/BlinkenOutputWin.c      105)     case 1:
tools/BlinkenOutputWin.c      106)       serial_settings->StopBits = ONESTOPBIT;
tools/BlinkenOutputWin.c      107)       break;
tools/BlinkenOutputWin.c      108)     case 2:
tools/BlinkenOutputWin.c      109)       serial_settings->StopBits = TWOSTOPBITS;
tools/BlinkenOutputWin.c      110)       break;
tools/BlinkenOutputWin.c      111)     default:
tools/BlinkenOutputWin.c      112)       printf("illegal number of stop bits: %d\n", stop);
tools/BlinkenOutputWin.c      113)       return 0;
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            114)   }
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 115)   // success
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            116)   return 1;
BlinkenOutputWin.c            117) }
BlinkenOutputWin.c            118) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 119) // set serial settings for fd
Stefan Schuermans implement serial port confi...

Stefan Schuermans authored 5 years ago

tools/BlinkenOutputWin.c      120) static int serial_settings_set(HANDLE hDev, struct s_serial_settings *settings)
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            121) {
BlinkenOutputWin.c            122)   DCB PortDcb;
BlinkenOutputWin.c            123)   COMMTIMEOUTS CommTimeouts;
BlinkenOutputWin.c            124) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 125)   // set serial parameters
BlinkenLib/BlinkenOutputWin.c 126)   if (!GetCommState(hDev, &PortDcb)) {
Stefan Schuermans fix Windows cross-build of...

Stefan Schuermans authored 5 years ago

tools/BlinkenOutputWin.c      127)     printf("error getting device comm state: error %lu\n", GetLastError());
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            128)     return 0;
BlinkenOutputWin.c            129)   }
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 130)   if (!BuildCommDCB(hDev, &PortDcb)) {
Stefan Schuermans fix Windows cross-build of...

Stefan Schuermans authored 5 years ago

tools/BlinkenOutputWin.c      131)     printf("error building comm state: error %lu\n", GetLastError());
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            132)     return 0;
BlinkenOutputWin.c            133)   }
Stefan Schuermans implement serial port confi...

Stefan Schuermans authored 5 years ago

tools/BlinkenOutputWin.c      134)   PortDcb.BaudRate = settings->BaudRate;
tools/BlinkenOutputWin.c      135)   PortDcb.fParity = settings->fParity;
tools/BlinkenOutputWin.c      136)   PortDcb.ByteSize = settings->ByteSize;
tools/BlinkenOutputWin.c      137)   PortDcb.Parity = settings->Parity;
tools/BlinkenOutputWin.c      138)   PortDcb.StopBits = settings->StopBits;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 139)   if (!SetCommState(hDev, &PortDcb)) {
Stefan Schuermans fix Windows cross-build of...

Stefan Schuermans authored 5 years ago

tools/BlinkenOutputWin.c      140)     printf("error setting device comm state: error %lu\n", GetLastError());
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            141)     return 0;
BlinkenOutputWin.c            142)   }
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 143)   // set timeout parameters
BlinkenLib/BlinkenOutputWin.c 144)   // maximum time between arrival of two characters: 10 ms
BlinkenLib/BlinkenOutputWin.c 145)   // if this time elapses, read command will return even if buffer is not
BlinkenLib/BlinkenOutputWin.c 146)   // filled completely
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            147)   CommTimeouts.ReadIntervalTimeout = 10;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 148)   // disable read timeouts
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            149)   CommTimeouts.ReadTotalTimeoutConstant = 0;
BlinkenOutputWin.c            150)   CommTimeouts.ReadTotalTimeoutMultiplier = 0;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 151)   // disable write timeouts
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            152)   CommTimeouts.WriteTotalTimeoutConstant = 0;
BlinkenOutputWin.c            153)   CommTimeouts.WriteTotalTimeoutMultiplier = 0;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 154)   if (!SetCommTimeouts(hDev, &CommTimeouts)) {
Stefan Schuermans fix Windows cross-build of...

Stefan Schuermans authored 5 years ago

tools/BlinkenOutputWin.c      155)     printf("error setting device timeout parameters: error %lu\n",
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 156)            GetLastError());
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            157)     return 0;
BlinkenOutputWin.c            158)   }
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 159)   // success
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            160)   return 1;
BlinkenOutputWin.c            161) }
BlinkenOutputWin.c            162) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 163) // receive frames from socket and output them
BlinkenLib/BlinkenOutputWin.c 164) // hDev may be INVALID_HANDLE_VALUE for not doing anything with device
BlinkenLib/BlinkenOutputWin.c 165) // returns error code (not for device-errors, 0 for success)
BlinkenLib/BlinkenOutputWin.c 166) static int recv_and_out(SOCKET udpSocket, HANDLE hDev,
BlinkenLib/BlinkenOutputWin.c 167)                         int *p_device_output_active,
BlinkenLib/BlinkenOutputWin.c 168)                         unsigned int format_change,
BlinkenLib/BlinkenOutputWin.c 169)                         unsigned int format_height, unsigned int format_width,
BlinkenLib/BlinkenOutputWin.c 170)                         unsigned int format_channels,
BlinkenLib/BlinkenOutputWin.c 171)                         unsigned int format_colors, etBlinkenProto proto,
BlinkenLib/BlinkenOutputWin.c 172)                         int use_msecs, unsigned int msecs,
BlinkenLib/BlinkenOutputWin.c 173)                         int is_serial_device)
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            174) {
BlinkenOutputWin.c            175)   fd_set readFds, errFds;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 176)   stBlinkenFrame *pFrame;
BlinkenLib/BlinkenOutputWin.c 177)   char buffer[65536];   // 64kB is more than maximum UDP size
Stefan Schuermans fix Windows cross-build of...

Stefan Schuermans authored 5 years ago

tools/BlinkenOutputWin.c      178)   int len;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 179)   struct timeval timeout, *p_timeout;
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            180)   DWORD DevWrLen, Err, start, end;
BlinkenOutputWin.c            181)   COMSTAT ComStat;
BlinkenOutputWin.c            182) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 183)   for (;;) {
BlinkenLib/BlinkenOutputWin.c 184)     // wait for next frame
BlinkenLib/BlinkenOutputWin.c 185)     FD_ZERO(&readFds);
BlinkenLib/BlinkenOutputWin.c 186)     FD_SET(udpSocket, &readFds);
BlinkenLib/BlinkenOutputWin.c 187)     FD_ZERO(&errFds);
BlinkenLib/BlinkenOutputWin.c 188)     FD_SET(udpSocket, &errFds);
BlinkenLib/BlinkenOutputWin.c 189)     if (use_msecs)      // timeout
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            190)     {
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 191)       start = GetTickCount();
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            192)       timeout.tv_sec = msecs / 1000;
BlinkenOutputWin.c            193)       timeout.tv_usec = msecs % 1000 * 1000;
BlinkenOutputWin.c            194)       p_timeout = &timeout;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 195)     } else
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            196)       p_timeout = NULL;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 197)     if (select(0, &readFds, NULL, &errFds, p_timeout) < 0)      // error
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            198)     {
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 199)       printf("error during select: %s\n", strerror(errno));
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            200)       return -1;
BlinkenOutputWin.c            201)     }
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 202)     // error on socket
BlinkenLib/BlinkenOutputWin.c 203)     if (FD_ISSET(udpSocket, &errFds)) {
BlinkenLib/BlinkenOutputWin.c 204)       printf("error on socket\n");
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            205)       return -1;
BlinkenOutputWin.c            206)     }
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 207)     // received frame
BlinkenLib/BlinkenOutputWin.c 208)     if (FD_ISSET(udpSocket, &readFds)) {
BlinkenLib/BlinkenOutputWin.c 209)       // fetch data
BlinkenLib/BlinkenOutputWin.c 210)       len = recv(udpSocket, buffer, sizeof(buffer), 0);
BlinkenLib/BlinkenOutputWin.c 211)       if (len < 0) {
BlinkenLib/BlinkenOutputWin.c 212)         printf("could not read from socket\n");
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            213)         return -1;
BlinkenOutputWin.c            214)       }
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 215)       if (len == 0)
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            216)         return -1;
BlinkenOutputWin.c            217) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 218)       // get frame from data
BlinkenLib/BlinkenOutputWin.c 219)       pFrame = BlinkenFrameFromNetwork(buffer, len, NULL);
BlinkenLib/BlinkenOutputWin.c 220)       if (pFrame != NULL) {
BlinkenLib/BlinkenOutputWin.c 221)         // change format
BlinkenLib/BlinkenOutputWin.c 222)         if (format_change)
BlinkenLib/BlinkenOutputWin.c 223)           BlinkenFrameResize(pFrame, format_height, format_width,
BlinkenLib/BlinkenOutputWin.c 224)                              format_channels, format_colors - 1);
BlinkenLib/BlinkenOutputWin.c 225) 
BlinkenLib/BlinkenOutputWin.c 226)         // create output data from frame
BlinkenLib/BlinkenOutputWin.c 227)         len = BlinkenFrameToNetwork(pFrame, proto, buffer, sizeof(buffer));
BlinkenLib/BlinkenOutputWin.c 228) 
BlinkenLib/BlinkenOutputWin.c 229)         // free frame
BlinkenLib/BlinkenOutputWin.c 230)         BlinkenFrameFree(pFrame);
BlinkenLib/BlinkenOutputWin.c 231) 
BlinkenLib/BlinkenOutputWin.c 232)         // output data to device
BlinkenLib/BlinkenOutputWin.c 233)         if (hDev != INVALID_HANDLE_VALUE && len > 0) {
BlinkenLib/BlinkenOutputWin.c 234)           if (!WriteFile(hDev, buffer, len, &DevWrLen, NULL)
BlinkenLib/BlinkenOutputWin.c 235)               || (int)DevWrLen != len) {
BlinkenLib/BlinkenOutputWin.c 236)             if (*p_device_output_active)
BlinkenLib/BlinkenOutputWin.c 237)               printf("error writing to device: error %lu\n", GetLastError());
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            238)             break;
BlinkenOutputWin.c            239)           }
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 240)           // message: output to device was restarted
BlinkenLib/BlinkenOutputWin.c 241)           if (!*p_device_output_active)
BlinkenLib/BlinkenOutputWin.c 242)             printf("restarted output to device...\n");
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            243)           *p_device_output_active = 1;
BlinkenOutputWin.c            244)         }
BlinkenOutputWin.c            245)       }
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 246)     }
BlinkenLib/BlinkenOutputWin.c 247)     // get state of serial device
BlinkenLib/BlinkenOutputWin.c 248)     if (hDev != INVALID_HANDLE_VALUE && is_serial_device) {
BlinkenLib/BlinkenOutputWin.c 249)       ClearCommError(hDev, &Err, &ComStat);
BlinkenLib/BlinkenOutputWin.c 250)       // reception error
BlinkenLib/BlinkenOutputWin.c 251)       if (Err & (CE_BREAK | CE_FRAME | CE_OVERRUN | CE_RXOVER | CE_RXPARITY)) {
BlinkenLib/BlinkenOutputWin.c 252)         if (*p_device_output_active)
Stefan Schuermans fix Windows cross-build of...

Stefan Schuermans authored 5 years ago

tools/BlinkenOutputWin.c      253)           printf("error reading from device (comm err=%lX)\n", Err);
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            254)         break;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 255)       }
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            256)     }
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 257)     // using time limit
BlinkenLib/BlinkenOutputWin.c 258)     if (use_msecs) {
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            259)       unsigned int msec;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 260)       // get time elapsed
BlinkenLib/BlinkenOutputWin.c 261)       end = GetTickCount();
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            262)       msec = end - start;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 263)       // more than rest of timeout (or exact match)
BlinkenLib/BlinkenOutputWin.c 264)       if (msec >= msecs)
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            265)         break;
BlinkenOutputWin.c            266)       msecs -= msec;
BlinkenOutputWin.c            267)     }
BlinkenOutputWin.c            268) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 269)   }     // for( ; ; )
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            270) 
BlinkenOutputWin.c            271)   return 0;
BlinkenOutputWin.c            272) }
BlinkenOutputWin.c            273) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 274) // open device and output frames
BlinkenLib/BlinkenOutputWin.c 275) // returns error code (not for device-errors, 0 for success)
BlinkenLib/BlinkenOutputWin.c 276) static int open_and_output(SOCKET udpSocket, char *device,
BlinkenLib/BlinkenOutputWin.c 277)                            int *p_device_output_active,
Stefan Schuermans implement serial port confi...

Stefan Schuermans authored 5 years ago

tools/BlinkenOutputWin.c      278)                            int serial_settings_change,
tools/BlinkenOutputWin.c      279)                            struct s_serial_settings *serial_settings,
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 280)                            unsigned int format_change,
BlinkenLib/BlinkenOutputWin.c 281)                            unsigned int format_height,
BlinkenLib/BlinkenOutputWin.c 282)                            unsigned int format_width,
BlinkenLib/BlinkenOutputWin.c 283)                            unsigned int format_channels,
BlinkenLib/BlinkenOutputWin.c 284)                            unsigned int format_colors, etBlinkenProto proto)
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            285) {
BlinkenOutputWin.c            286)   HANDLE hDev;
BlinkenOutputWin.c            287)   int err;
BlinkenOutputWin.c            288) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 289)   // open device
BlinkenLib/BlinkenOutputWin.c 290)   hDev =
BlinkenLib/BlinkenOutputWin.c 291)       CreateFile(device, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING,
BlinkenLib/BlinkenOutputWin.c 292)                  0, NULL);
BlinkenLib/BlinkenOutputWin.c 293)   if (hDev == INVALID_HANDLE_VALUE) {
BlinkenLib/BlinkenOutputWin.c 294)     if (*p_device_output_active)
Stefan Schuermans fix Windows cross-build of...

Stefan Schuermans authored 5 years ago

tools/BlinkenOutputWin.c      295)       printf("could not open \"%s\": error %lu\n", device, GetLastError());
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            296)     return 0;
BlinkenOutputWin.c            297)   }
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 298)   // setup serial port
BlinkenLib/BlinkenOutputWin.c 299)   if (serial_settings_change) {
BlinkenLib/BlinkenOutputWin.c 300)     if (!serial_settings_set(hDev, serial_settings)) {
BlinkenLib/BlinkenOutputWin.c 301)       if (*p_device_output_active)
Stefan Schuermans implement serial port confi...

Stefan Schuermans authored 5 years ago

tools/BlinkenOutputWin.c      302)         printf("could not set serial port to \"%s\"\n", serial_settings->str);
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 303)       CloseHandle(hDev);
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            304)       return 0;
BlinkenOutputWin.c            305)     }
BlinkenOutputWin.c            306)   }
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 307)   // receive frames and output to device
BlinkenLib/BlinkenOutputWin.c 308)   err = recv_and_out(udpSocket, hDev, p_device_output_active,
BlinkenLib/BlinkenOutputWin.c 309)                      format_change, format_height, format_width,
BlinkenLib/BlinkenOutputWin.c 310)                      format_channels, format_colors, proto, 0, 0,
BlinkenLib/BlinkenOutputWin.c 311)                      serial_settings_change);
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            312) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 313)   // close device
BlinkenLib/BlinkenOutputWin.c 314)   CloseHandle(hDev);
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            315) 
BlinkenOutputWin.c            316)   return err;
BlinkenOutputWin.c            317) }
BlinkenOutputWin.c            318) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 319) // open device and output frames in a loop
BlinkenLib/BlinkenOutputWin.c 320) // returns error code (not for device-errors, 0 for success)
BlinkenLib/BlinkenOutputWin.c 321) static int open_and_output_loop(SOCKET udpSocket, char *device,
BlinkenLib/BlinkenOutputWin.c 322)                                 int serial_settings_change,
Stefan Schuermans implement serial port confi...

Stefan Schuermans authored 5 years ago

tools/BlinkenOutputWin.c      323)                                 struct s_serial_settings *serial_settings,
tools/BlinkenOutputWin.c      324)                                 int reopen_device,
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 325)                                 unsigned int reopen_device_ms,
BlinkenLib/BlinkenOutputWin.c 326)                                 unsigned int format_change,
BlinkenLib/BlinkenOutputWin.c 327)                                 unsigned int format_height,
BlinkenLib/BlinkenOutputWin.c 328)                                 unsigned int format_width,
BlinkenLib/BlinkenOutputWin.c 329)                                 unsigned int format_channels,
BlinkenLib/BlinkenOutputWin.c 330)                                 unsigned int format_colors,
BlinkenLib/BlinkenOutputWin.c 331)                                 etBlinkenProto proto)
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            332) {
BlinkenOutputWin.c            333)   int device_output_active, err;
BlinkenOutputWin.c            334) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 335)   printf("receiving frames and outputting them to \"%s\"...\n", device);
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            336)   device_output_active = 1;
BlinkenOutputWin.c            337) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 338)   for (;;) {
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            339) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 340)     // try to open device and output frames
BlinkenLib/BlinkenOutputWin.c 341)     err = open_and_output(udpSocket, device,
BlinkenLib/BlinkenOutputWin.c 342)                           &device_output_active,
BlinkenLib/BlinkenOutputWin.c 343)                           serial_settings_change, serial_settings,
BlinkenLib/BlinkenOutputWin.c 344)                           format_change, format_height, format_width,
BlinkenLib/BlinkenOutputWin.c 345)                           format_channels, format_colors, proto);
BlinkenLib/BlinkenOutputWin.c 346)     if (err != 0 || !reopen_device)
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            347)       break;
BlinkenOutputWin.c            348) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 349)     // output to device stopped
BlinkenLib/BlinkenOutputWin.c 350)     if (device_output_active)
BlinkenLib/BlinkenOutputWin.c 351)       printf("output to device stopped...\n");
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            352)     device_output_active = 0;
BlinkenOutputWin.c            353) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 354)     // only fetch data from socket for a short time
BlinkenLib/BlinkenOutputWin.c 355)     err = recv_and_out(udpSocket, INVALID_HANDLE_VALUE, &device_output_active,
BlinkenLib/BlinkenOutputWin.c 356)                        format_change, format_height, format_width,
BlinkenLib/BlinkenOutputWin.c 357)                        format_channels, format_colors, proto, 1,
BlinkenLib/BlinkenOutputWin.c 358)                        reopen_device_ms, serial_settings_change);
BlinkenLib/BlinkenOutputWin.c 359)     if (err != 0)
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            360)       break;
BlinkenOutputWin.c            361) 
BlinkenOutputWin.c            362)   }
BlinkenOutputWin.c            363) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 364)   // output to device finshed
BlinkenLib/BlinkenOutputWin.c 365)   if (device_output_active)
BlinkenLib/BlinkenOutputWin.c 366)     printf("output to device finished...\n");
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            367)   device_output_active = 0;
BlinkenOutputWin.c            368) 
BlinkenOutputWin.c            369)   return err;
BlinkenOutputWin.c            370) }
BlinkenOutputWin.c            371) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 372) int main(int argCnt, char **args)
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            373) {
BlinkenOutputWin.c            374)   WSADATA WsaData;
BlinkenOutputWin.c            375)   int i, bound;
BlinkenOutputWin.c            376)   SOCKET udpSocket;
Stefan Schuermans implement serial port confi...

Stefan Schuermans authored 5 years ago

tools/BlinkenOutputWin.c      377)   struct s_serial_settings serial_settings = {};
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            378)   etBlinkenProto proto;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 379)   unsigned int format_change, format_height, format_width, format_channels,
BlinkenLib/BlinkenOutputWin.c 380)       format_colors;
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            381)   unsigned int height, width, channels, colors, reopen_device_ms;
Stefan Schuermans fix Windows cross-build of...

Stefan Schuermans authored 5 years ago

tools/BlinkenOutputWin.c      382)   int serial_settings_change, reopen_device;
tools/BlinkenOutputWin.c      383)   unsigned long unblock;
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            384)   char txt[64];
BlinkenOutputWin.c            385)   unsigned short port;
BlinkenOutputWin.c            386)   struct sockaddr_in addr;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 387)   char *device;
BlinkenLib/BlinkenOutputWin.c 388) 
BlinkenLib/BlinkenOutputWin.c 389)   // print info
BlinkenLib/BlinkenOutputWin.c 390)   printf("BlinkenLib - BlinkenOutput\n"
Stefan Schuermans update email address of author

Stefan Schuermans authored 10 years ago

BlinkenLib/BlinkenOutputWin.c 391)          "Copyright 2004-2014 Stefan Schuermans <stefan@schuermans.info>\n"
Stefan Schuermans cleanup file headers after...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 392)          "Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html\n"
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 393)          "a blinkenarea.org project\n\n");
BlinkenLib/BlinkenOutputWin.c 394) 
BlinkenLib/BlinkenOutputWin.c 395)   // print syntax
BlinkenLib/BlinkenOutputWin.c 396)   if (argCnt <= 1) {
BlinkenLib/BlinkenOutputWin.c 397)     printf("syntax: %s <parameter> [...]\n\n"
BlinkenLib/BlinkenOutputWin.c 398)            "parameters:\n"
BlinkenLib/BlinkenOutputWin.c 399)            "  -l [<ip>:]<port>\n"
BlinkenLib/BlinkenOutputWin.c 400)            "     local address (defaults to 0.0.0.0:2323)\n"
BlinkenLib/BlinkenOutputWin.c 401)            "     must occur before -r, may only occur once\n"
BlinkenLib/BlinkenOutputWin.c 402)            "  -r <ip>[:<port>]\n"
BlinkenLib/BlinkenOutputWin.c 403)            "     remote addess (defaults to every remote address)\n"
BlinkenLib/BlinkenOutputWin.c 404)            "  -p [BLP|EBLP|MCUF]\n"
BlinkenLib/BlinkenOutputWin.c 405)            "     protocol to output frames in (defaults to MCUF)\n"
BlinkenLib/BlinkenOutputWin.c 406)            "  -f <width>x<height>-<channels>/<colors>\n"
BlinkenLib/BlinkenOutputWin.c 407)            "     format to output frames in (defaults to no change)\n"
BlinkenLib/BlinkenOutputWin.c 408)            "  -d <device>\n"
BlinkenLib/BlinkenOutputWin.c 409)            "     device to output frames to (defaults to \"NUL\")\n"
BlinkenLib/BlinkenOutputWin.c 410)            "  -s <baud-rate>,<parity>,<data-bits>,<stop-bits>\n"
BlinkenLib/BlinkenOutputWin.c 411)            "     settings to use for serial devices (defaults to no change)\n"
BlinkenLib/BlinkenOutputWin.c 412)            "  -o <milliseconds>\n"
BlinkenLib/BlinkenOutputWin.c 413)            "     reopen device after short time on error (defaults to not reopen)\n"
BlinkenLib/BlinkenOutputWin.c 414)            "\n", args[0]);
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            415)     return 0;
BlinkenOutputWin.c            416)   }
BlinkenOutputWin.c            417) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 418)   WSAStartup(0x0101, &WsaData);
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            419) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 420)   // create udp socket
BlinkenLib/BlinkenOutputWin.c 421)   udpSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
BlinkenLib/BlinkenOutputWin.c 422)   if (udpSocket == INVALID_SOCKET) {
Stefan Schuermans fix Windows cross-build of...

Stefan Schuermans authored 5 years ago

tools/BlinkenOutputWin.c      423)     printf("cannot create UDP socket: error %u\n", WSAGetLastError());
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 424)     WSACleanup();
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            425)     return -1;
BlinkenOutputWin.c            426)   }
BlinkenOutputWin.c            427)   bound = 0;
BlinkenOutputWin.c            428) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 429)   // unblock udp socket
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            430)   unblock = 1;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 431)   if (ioctlsocket(udpSocket, FIONBIO, &unblock) == SOCKET_ERROR) {
Stefan Schuermans fix Windows cross-build of...

Stefan Schuermans authored 5 years ago

tools/BlinkenOutputWin.c      432)     printf("cannot unblock UDP socket: error %u\n", WSAGetLastError());
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 433)     closesocket(udpSocket);
BlinkenLib/BlinkenOutputWin.c 434)     WSACleanup();
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            435)     return -1;
BlinkenOutputWin.c            436)   }
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 437)   // process parameters
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            438)   proto = BlinkenProtoMcuf;
BlinkenOutputWin.c            439)   format_change = 0;
BlinkenOutputWin.c            440)   format_height = 0;
BlinkenOutputWin.c            441)   format_width = 0;
BlinkenOutputWin.c            442)   format_channels = 0;
BlinkenOutputWin.c            443)   format_colors = 0;
BlinkenOutputWin.c            444)   device = "NUL";
BlinkenOutputWin.c            445)   serial_settings_change = 0;
BlinkenOutputWin.c            446)   reopen_device = 0;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 447)   for (i = 1; i < argCnt; i++) {
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            448) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 449)     // local address
BlinkenLib/BlinkenOutputWin.c 450)     if (strcmp(args[i], "-l") == 0) {
BlinkenLib/BlinkenOutputWin.c 451)       if (i + 1 < argCnt) {
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            452)         i++;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 453)         if (sscanf(args[i], "%32[0-9.]:%hu", txt, &port) == 2) {
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            454)           addr.sin_family = AF_INET;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 455)           addr.sin_port = htons(port);
BlinkenLib/BlinkenOutputWin.c 456)           addr.sin_addr.s_addr = inet_addr(txt);
BlinkenLib/BlinkenOutputWin.c 457)           if (bind(udpSocket, (struct sockaddr *)&addr, sizeof(addr)) != 0)
BlinkenLib/BlinkenOutputWin.c 458)             printf("could not set local address to \"%s\"\n", args[i]);
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            459)           else
BlinkenOutputWin.c            460)             bound = 1;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 461)         } else if (sscanf(args[i], "%hu", &port) == 1) {
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            462)           addr.sin_family = AF_INET;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 463)           addr.sin_port = htons(port);
BlinkenLib/BlinkenOutputWin.c 464)           addr.sin_addr.s_addr = htonl(INADDR_ANY);
BlinkenLib/BlinkenOutputWin.c 465)           if (bind(udpSocket, (struct sockaddr *)&addr, sizeof(addr)) != 0)
BlinkenLib/BlinkenOutputWin.c 466)             printf("could not set local address to \"%s\"\n", args[i]);
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            467)           else
BlinkenOutputWin.c            468)             bound = 1;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 469)         } else
BlinkenLib/BlinkenOutputWin.c 470)           printf("invalid local address \"%s\"\n", args[i]);
BlinkenLib/BlinkenOutputWin.c 471)       } else
BlinkenLib/BlinkenOutputWin.c 472)         printf("missing local address for \"-l\"\n");
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            473)     }
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 474)     // remote address
BlinkenLib/BlinkenOutputWin.c 475)     else if (strcmp(args[i], "-r") == 0) {
BlinkenLib/BlinkenOutputWin.c 476)       if (i + 1 < argCnt) {
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            477)         i++;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 478)         if (sscanf(args[i], "%32[0-9.]:%hu", txt, &port) == 2) {
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            479)           addr.sin_family = AF_INET;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 480)           addr.sin_port = htons(port);
BlinkenLib/BlinkenOutputWin.c 481)           addr.sin_addr.s_addr = inet_addr(txt);
BlinkenLib/BlinkenOutputWin.c 482)           if (connect(udpSocket, (struct sockaddr *)&addr, sizeof(addr)) != 0)
BlinkenLib/BlinkenOutputWin.c 483)             printf("could not set remote address to \"%s\"\n", args[i]);
BlinkenLib/BlinkenOutputWin.c 484)         } else if (sscanf(args[i], "%32[0-9.]", txt) == 1) {
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            485)           addr.sin_family = AF_INET;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 486)           addr.sin_port = htons(23230);
BlinkenLib/BlinkenOutputWin.c 487)           addr.sin_addr.s_addr = inet_addr(txt);
BlinkenLib/BlinkenOutputWin.c 488)           if (connect(udpSocket, (struct sockaddr *)&addr, sizeof(addr)) != 0)
BlinkenLib/BlinkenOutputWin.c 489)             printf("could not set remote address to \"%s\"\n", args[i]);
BlinkenLib/BlinkenOutputWin.c 490)         } else
BlinkenLib/BlinkenOutputWin.c 491)           printf("invalid remote address \"%s\"\n", args[i]);
BlinkenLib/BlinkenOutputWin.c 492)       } else
BlinkenLib/BlinkenOutputWin.c 493)         printf("missing remote address for \"-r\"\n");
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            494)     }
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 495)     // protocol to output frames in
BlinkenLib/BlinkenOutputWin.c 496)     else if (strcmp(args[i], "-p") == 0) {
BlinkenLib/BlinkenOutputWin.c 497)       if (i + 1 < argCnt) {
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            498)         i++;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 499)         if (stricmp(args[i], "BLP") == 0)
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            500)           proto = BlinkenProtoBlp;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 501)         else if (stricmp(args[i], "EBLP") == 0)
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            502)           proto = BlinkenProtoEblp;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 503)         else if (stricmp(args[i], "MCUF") == 0)
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            504)           proto = BlinkenProtoMcuf;
BlinkenOutputWin.c            505)         else
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 506)           printf("unknown protocol \"%s\"\n", args[i]);
BlinkenLib/BlinkenOutputWin.c 507)       } else
BlinkenLib/BlinkenOutputWin.c 508)         printf("missing protocol for \"-p\"\n");
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            509)     }
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 510)     // format to output frames in
BlinkenLib/BlinkenOutputWin.c 511)     else if (strcmp(args[i], "-f") == 0) {
BlinkenLib/BlinkenOutputWin.c 512)       if (i + 1 < argCnt) {
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            513)         i++;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 514)         if (sscanf
BlinkenLib/BlinkenOutputWin.c 515)             (args[i], "%ux%u-%u/%u", &width, &height, &channels, &colors) == 4
BlinkenLib/BlinkenOutputWin.c 516)             && width > 0 && width < 1000 && height > 0 && height < 1000
BlinkenLib/BlinkenOutputWin.c 517)             && channels > 0 && channels < 20 && colors > 1 && colors <= 256) {
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            518)           format_change = 1;
BlinkenOutputWin.c            519)           format_height = height;
BlinkenOutputWin.c            520)           format_width = width;
BlinkenOutputWin.c            521)           format_channels = channels;
BlinkenOutputWin.c            522)           format_colors = colors;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 523)         } else
BlinkenLib/BlinkenOutputWin.c 524)           printf("invalid frame format \"%s\"\n", args[i]);
BlinkenLib/BlinkenOutputWin.c 525)       } else
BlinkenLib/BlinkenOutputWin.c 526)         printf("missing frame format for \"-r\"\n");
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            527)     }
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 528)     // device to output frames to
BlinkenLib/BlinkenOutputWin.c 529)     else if (strcmp(args[i], "-d") == 0) {
BlinkenLib/BlinkenOutputWin.c 530)       if (i + 1 < argCnt) {
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            531)         i++;
BlinkenOutputWin.c            532)         device = args[i];
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 533)       } else
BlinkenLib/BlinkenOutputWin.c 534)         printf("missing device name for \"-d\"\n");
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            535)     }
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 536)     // settings for serial output devices
BlinkenLib/BlinkenOutputWin.c 537)     else if (strcmp(args[i], "-s") == 0) {
BlinkenLib/BlinkenOutputWin.c 538)       if (i + 1 < argCnt) {
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            539)         i++;
Stefan Schuermans implement serial port confi...

Stefan Schuermans authored 5 years ago

tools/BlinkenOutputWin.c      540)         if (serial_settings_parse(args[i], &serial_settings)) {
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            541)           serial_settings_change = 1;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 542)         } else
BlinkenLib/BlinkenOutputWin.c 543)           printf("invalid serial settings \"%s\"\n", args[i]);
BlinkenLib/BlinkenOutputWin.c 544)       } else
BlinkenLib/BlinkenOutputWin.c 545)         printf("missing serial settings for \"-s\"\n");
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            546)     }
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 547)     // reopen device on error after some time
BlinkenLib/BlinkenOutputWin.c 548)     else if (strcmp(args[i], "-o") == 0) {
BlinkenLib/BlinkenOutputWin.c 549)       if (i + 1 < argCnt) {
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            550)         i++;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 551)         if (sscanf(args[i], "%u", &reopen_device_ms) == 1
BlinkenLib/BlinkenOutputWin.c 552)             && reopen_device_ms >= 1)
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            553)           reopen_device = 1;
BlinkenOutputWin.c            554)         else
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 555)           printf("invalid number of milliseconds \"%s\"\n", args[i]);
BlinkenLib/BlinkenOutputWin.c 556)       } else
BlinkenLib/BlinkenOutputWin.c 557)         printf("missing time for \"-o\"\n");
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            558)     }
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 559)     // unknown parameter
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            560)     else
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 561)       printf
BlinkenLib/BlinkenOutputWin.c 562)           ("unknown parameter \"%s\", call without parameters to get help\n",
BlinkenLib/BlinkenOutputWin.c 563)            args[i]);
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            564) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 565)   }     // for( i ...
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            566) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 567)   // try to bind if not bound
BlinkenLib/BlinkenOutputWin.c 568)   if (!bound) {
BlinkenLib/BlinkenOutputWin.c 569)     printf("no local address to receive frames on,\n"
BlinkenLib/BlinkenOutputWin.c 570)            "  using default local address \"0.0.0.0:2323\"\n");
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            571)     addr.sin_family = AF_INET;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 572)     addr.sin_port = htons(2323);
BlinkenLib/BlinkenOutputWin.c 573)     addr.sin_addr.s_addr = htonl(INADDR_ANY);
BlinkenLib/BlinkenOutputWin.c 574)     if (bind(udpSocket, (struct sockaddr *)&addr, sizeof(addr)) == 0)
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            575)       bound = 1;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 576)     else {
BlinkenLib/BlinkenOutputWin.c 577)       printf("could not set local address to \"0.0.0.0:2323\"\n");
BlinkenLib/BlinkenOutputWin.c 578)       closesocket(udpSocket);
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            579)       return -1;
BlinkenOutputWin.c            580)     }
BlinkenOutputWin.c            581)   }
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 582)   // open device and output frames in a loop
BlinkenLib/BlinkenOutputWin.c 583)   open_and_output_loop(udpSocket, device,
Stefan Schuermans implement serial port confi...

Stefan Schuermans authored 5 years ago

tools/BlinkenOutputWin.c      584)                        serial_settings_change, &serial_settings,
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 585)                        reopen_device, reopen_device_ms,
BlinkenLib/BlinkenOutputWin.c 586)                        format_change, format_height, format_width,
BlinkenLib/BlinkenOutputWin.c 587)                        format_channels, format_colors, proto);
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            588) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 589)   // close socket
BlinkenLib/BlinkenOutputWin.c 590)   closesocket(udpSocket);
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            591) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 592)   WSACleanup();