b5f816929378328384fac08a8c7251b83dac4810
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 changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c  15) // get serial settings from text
BlinkenLib/BlinkenOutputWin.c  16) static int serial_settings_parse(char *str)
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c             17) {
BlinkenOutputWin.c             18)   int baud, data, stop;
BlinkenOutputWin.c             19)   char parity;
BlinkenOutputWin.c             20) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c  21)   // split and parse settings string
BlinkenLib/BlinkenOutputWin.c  22)   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             23)     return 0;
BlinkenOutputWin.c             24) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c  25)   // baud rate
BlinkenLib/BlinkenOutputWin.c  26)   if (baud != 300 &&
BlinkenLib/BlinkenOutputWin.c  27)       baud != 600 &&
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c             28)       baud != 1200 &&
BlinkenOutputWin.c             29)       baud != 2400 &&
BlinkenOutputWin.c             30)       baud != 4800 &&
BlinkenOutputWin.c             31)       baud != 9600 &&
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c  32)       baud != 19200 && baud != 38400 && baud != 57600 && baud != 115200) {
BlinkenLib/BlinkenOutputWin.c  33)     printf("illegal baudrate: %d\n", baud);
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c  36)   // parity
BlinkenLib/BlinkenOutputWin.c  37)   if (parity != 'n' && parity != 'N' &&
BlinkenLib/BlinkenOutputWin.c  38)       parity != 'e' && parity != 'E' && parity != 'o' && parity != 'O') {
BlinkenLib/BlinkenOutputWin.c  39)     printf("invalid parity: %c\n", parity);
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c             40)     return 0;
BlinkenOutputWin.c             41)   }
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c  42)   // data bits
BlinkenLib/BlinkenOutputWin.c  43)   if (data != 5 && data != 6 && data != 7 && data != 8) {
BlinkenLib/BlinkenOutputWin.c  44)     printf("illegal number of data bits: %d\n", data);
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c             45)     return 0;
BlinkenOutputWin.c             46)   }
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c  47)   // stop bits
BlinkenLib/BlinkenOutputWin.c  48)   if (stop != 1 && stop == 2) {
BlinkenLib/BlinkenOutputWin.c  49)     printf("illegal number of stop bits: %d\n", stop);
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c             50)     return 0;
BlinkenOutputWin.c             51)   }
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

BlinkenOutputWin.c             53)   return 1;
BlinkenOutputWin.c             54) }
BlinkenOutputWin.c             55) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c  56) // set serial settings for fd
BlinkenLib/BlinkenOutputWin.c  57) static int serial_settings_set(HANDLE hDev, char *settings)
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c             58) {
BlinkenOutputWin.c             59)   DCB PortDcb;
BlinkenOutputWin.c             60)   COMMTIMEOUTS CommTimeouts;
BlinkenOutputWin.c             61) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

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

Stefan Schuermans authored 5 years ago

tools/BlinkenOutputWin.c       64)     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             65)     return 0;
BlinkenOutputWin.c             66)   }
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

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

Stefan Schuermans authored 5 years ago

tools/BlinkenOutputWin.c       68)     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             69)     return 0;
BlinkenOutputWin.c             70)   }
Stefan Schuermans fix Windows cross-build of...

Stefan Schuermans authored 5 years ago

tools/BlinkenOutputWin.c       71)   (void) settings; // TODO: set PortDcb fields
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

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

Stefan Schuermans authored 5 years ago

tools/BlinkenOutputWin.c       73)     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             74)     return 0;
BlinkenOutputWin.c             75)   }
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Stefan Schuermans authored 5 years ago

tools/BlinkenOutputWin.c       88)     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  89)            GetLastError());
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c             90)     return 0;
BlinkenOutputWin.c             91)   }
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

BlinkenOutputWin.c             93)   return 1;
BlinkenOutputWin.c             94) }
BlinkenOutputWin.c             95) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c  96) // receive frames from socket and output them
BlinkenLib/BlinkenOutputWin.c  97) // hDev may be INVALID_HANDLE_VALUE for not doing anything with device
BlinkenLib/BlinkenOutputWin.c  98) // returns error code (not for device-errors, 0 for success)
BlinkenLib/BlinkenOutputWin.c  99) static int recv_and_out(SOCKET udpSocket, HANDLE hDev,
BlinkenLib/BlinkenOutputWin.c 100)                         int *p_device_output_active,
BlinkenLib/BlinkenOutputWin.c 101)                         unsigned int format_change,
BlinkenLib/BlinkenOutputWin.c 102)                         unsigned int format_height, unsigned int format_width,
BlinkenLib/BlinkenOutputWin.c 103)                         unsigned int format_channels,
BlinkenLib/BlinkenOutputWin.c 104)                         unsigned int format_colors, etBlinkenProto proto,
BlinkenLib/BlinkenOutputWin.c 105)                         int use_msecs, unsigned int msecs,
BlinkenLib/BlinkenOutputWin.c 106)                         int is_serial_device)
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 109)   stBlinkenFrame *pFrame;
BlinkenLib/BlinkenOutputWin.c 110)   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      111)   int len;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            113)   DWORD DevWrLen, Err, start, end;
BlinkenOutputWin.c            114)   COMSTAT ComStat;
BlinkenOutputWin.c            115) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 116)   for (;;) {
BlinkenLib/BlinkenOutputWin.c 117)     // wait for next frame
BlinkenLib/BlinkenOutputWin.c 118)     FD_ZERO(&readFds);
BlinkenLib/BlinkenOutputWin.c 119)     FD_SET(udpSocket, &readFds);
BlinkenLib/BlinkenOutputWin.c 120)     FD_ZERO(&errFds);
BlinkenLib/BlinkenOutputWin.c 121)     FD_SET(udpSocket, &errFds);
BlinkenLib/BlinkenOutputWin.c 122)     if (use_msecs)      // timeout
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            125)       timeout.tv_sec = msecs / 1000;
BlinkenOutputWin.c            126)       timeout.tv_usec = msecs % 1000 * 1000;
BlinkenOutputWin.c            127)       p_timeout = &timeout;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 130)     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            131)     {
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 132)       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            133)       return -1;
BlinkenOutputWin.c            134)     }
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 140)     // received frame
BlinkenLib/BlinkenOutputWin.c 141)     if (FD_ISSET(udpSocket, &readFds)) {
BlinkenLib/BlinkenOutputWin.c 142)       // fetch data
BlinkenLib/BlinkenOutputWin.c 143)       len = recv(udpSocket, buffer, sizeof(buffer), 0);
BlinkenLib/BlinkenOutputWin.c 144)       if (len < 0) {
BlinkenLib/BlinkenOutputWin.c 145)         printf("could not read from socket\n");
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            149)         return -1;
BlinkenOutputWin.c            150) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 151)       // get frame from data
BlinkenLib/BlinkenOutputWin.c 152)       pFrame = BlinkenFrameFromNetwork(buffer, len, NULL);
BlinkenLib/BlinkenOutputWin.c 153)       if (pFrame != NULL) {
BlinkenLib/BlinkenOutputWin.c 154)         // change format
BlinkenLib/BlinkenOutputWin.c 155)         if (format_change)
BlinkenLib/BlinkenOutputWin.c 156)           BlinkenFrameResize(pFrame, format_height, format_width,
BlinkenLib/BlinkenOutputWin.c 157)                              format_channels, format_colors - 1);
BlinkenLib/BlinkenOutputWin.c 158) 
BlinkenLib/BlinkenOutputWin.c 159)         // create output data from frame
BlinkenLib/BlinkenOutputWin.c 160)         len = BlinkenFrameToNetwork(pFrame, proto, buffer, sizeof(buffer));
BlinkenLib/BlinkenOutputWin.c 161) 
BlinkenLib/BlinkenOutputWin.c 162)         // free frame
BlinkenLib/BlinkenOutputWin.c 163)         BlinkenFrameFree(pFrame);
BlinkenLib/BlinkenOutputWin.c 164) 
BlinkenLib/BlinkenOutputWin.c 165)         // output data to device
BlinkenLib/BlinkenOutputWin.c 166)         if (hDev != INVALID_HANDLE_VALUE && len > 0) {
BlinkenLib/BlinkenOutputWin.c 167)           if (!WriteFile(hDev, buffer, len, &DevWrLen, NULL)
BlinkenLib/BlinkenOutputWin.c 168)               || (int)DevWrLen != len) {
BlinkenLib/BlinkenOutputWin.c 169)             if (*p_device_output_active)
BlinkenLib/BlinkenOutputWin.c 170)               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            171)             break;
BlinkenOutputWin.c            172)           }
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            176)           *p_device_output_active = 1;
BlinkenOutputWin.c            177)         }
BlinkenOutputWin.c            178)       }
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 179)     }
BlinkenLib/BlinkenOutputWin.c 180)     // get state of serial device
BlinkenLib/BlinkenOutputWin.c 181)     if (hDev != INVALID_HANDLE_VALUE && is_serial_device) {
BlinkenLib/BlinkenOutputWin.c 182)       ClearCommError(hDev, &Err, &ComStat);
BlinkenLib/BlinkenOutputWin.c 183)       // reception error
BlinkenLib/BlinkenOutputWin.c 184)       if (Err & (CE_BREAK | CE_FRAME | CE_OVERRUN | CE_RXOVER | CE_RXPARITY)) {
BlinkenLib/BlinkenOutputWin.c 185)         if (*p_device_output_active)
Stefan Schuermans fix Windows cross-build of...

Stefan Schuermans authored 5 years ago

tools/BlinkenOutputWin.c      186)           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            187)         break;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            198)         break;
BlinkenOutputWin.c            199)       msecs -= msec;
BlinkenOutputWin.c            200)     }
BlinkenOutputWin.c            201) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            203) 
BlinkenOutputWin.c            204)   return 0;
BlinkenOutputWin.c            205) }
BlinkenOutputWin.c            206) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 207) // open device and output frames
BlinkenLib/BlinkenOutputWin.c 208) // returns error code (not for device-errors, 0 for success)
BlinkenLib/BlinkenOutputWin.c 209) static int open_and_output(SOCKET udpSocket, char *device,
BlinkenLib/BlinkenOutputWin.c 210)                            int *p_device_output_active,
BlinkenLib/BlinkenOutputWin.c 211)                            int serial_settings_change, char *serial_settings,
BlinkenLib/BlinkenOutputWin.c 212)                            unsigned int format_change,
BlinkenLib/BlinkenOutputWin.c 213)                            unsigned int format_height,
BlinkenLib/BlinkenOutputWin.c 214)                            unsigned int format_width,
BlinkenLib/BlinkenOutputWin.c 215)                            unsigned int format_channels,
BlinkenLib/BlinkenOutputWin.c 216)                            unsigned int format_colors, etBlinkenProto proto)
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            217) {
BlinkenOutputWin.c            218)   HANDLE hDev;
BlinkenOutputWin.c            219)   int err;
BlinkenOutputWin.c            220) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 221)   // open device
BlinkenLib/BlinkenOutputWin.c 222)   hDev =
BlinkenLib/BlinkenOutputWin.c 223)       CreateFile(device, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING,
BlinkenLib/BlinkenOutputWin.c 224)                  0, NULL);
BlinkenLib/BlinkenOutputWin.c 225)   if (hDev == INVALID_HANDLE_VALUE) {
BlinkenLib/BlinkenOutputWin.c 226)     if (*p_device_output_active)
Stefan Schuermans fix Windows cross-build of...

Stefan Schuermans authored 5 years ago

tools/BlinkenOutputWin.c      227)       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            228)     return 0;
BlinkenOutputWin.c            229)   }
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 230)   // setup serial port
BlinkenLib/BlinkenOutputWin.c 231)   if (serial_settings_change) {
BlinkenLib/BlinkenOutputWin.c 232)     if (!serial_settings_set(hDev, serial_settings)) {
BlinkenLib/BlinkenOutputWin.c 233)       if (*p_device_output_active)
BlinkenLib/BlinkenOutputWin.c 234)         printf("could not set serial port to \"%s\"\n", serial_settings);
BlinkenLib/BlinkenOutputWin.c 235)       CloseHandle(hDev);
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            236)       return 0;
BlinkenOutputWin.c            237)     }
BlinkenOutputWin.c            238)   }
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 239)   // receive frames and output to device
BlinkenLib/BlinkenOutputWin.c 240)   err = recv_and_out(udpSocket, hDev, p_device_output_active,
BlinkenLib/BlinkenOutputWin.c 241)                      format_change, format_height, format_width,
BlinkenLib/BlinkenOutputWin.c 242)                      format_channels, format_colors, proto, 0, 0,
BlinkenLib/BlinkenOutputWin.c 243)                      serial_settings_change);
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            247) 
BlinkenOutputWin.c            248)   return err;
BlinkenOutputWin.c            249) }
BlinkenOutputWin.c            250) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 251) // open device and output frames in a loop
BlinkenLib/BlinkenOutputWin.c 252) // returns error code (not for device-errors, 0 for success)
BlinkenLib/BlinkenOutputWin.c 253) static int open_and_output_loop(SOCKET udpSocket, char *device,
BlinkenLib/BlinkenOutputWin.c 254)                                 int serial_settings_change,
BlinkenLib/BlinkenOutputWin.c 255)                                 char *serial_settings, int reopen_device,
BlinkenLib/BlinkenOutputWin.c 256)                                 unsigned int reopen_device_ms,
BlinkenLib/BlinkenOutputWin.c 257)                                 unsigned int format_change,
BlinkenLib/BlinkenOutputWin.c 258)                                 unsigned int format_height,
BlinkenLib/BlinkenOutputWin.c 259)                                 unsigned int format_width,
BlinkenLib/BlinkenOutputWin.c 260)                                 unsigned int format_channels,
BlinkenLib/BlinkenOutputWin.c 261)                                 unsigned int format_colors,
BlinkenLib/BlinkenOutputWin.c 262)                                 etBlinkenProto proto)
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            263) {
BlinkenOutputWin.c            264)   int device_output_active, err;
BlinkenOutputWin.c            265) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 266)   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            267)   device_output_active = 1;
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) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 271)     // try to open device and output frames
BlinkenLib/BlinkenOutputWin.c 272)     err = open_and_output(udpSocket, device,
BlinkenLib/BlinkenOutputWin.c 273)                           &device_output_active,
BlinkenLib/BlinkenOutputWin.c 274)                           serial_settings_change, serial_settings,
BlinkenLib/BlinkenOutputWin.c 275)                           format_change, format_height, format_width,
BlinkenLib/BlinkenOutputWin.c 276)                           format_channels, format_colors, proto);
BlinkenLib/BlinkenOutputWin.c 277)     if (err != 0 || !reopen_device)
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            283)     device_output_active = 0;
BlinkenOutputWin.c            284) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 285)     // only fetch data from socket for a short time
BlinkenLib/BlinkenOutputWin.c 286)     err = recv_and_out(udpSocket, INVALID_HANDLE_VALUE, &device_output_active,
BlinkenLib/BlinkenOutputWin.c 287)                        format_change, format_height, format_width,
BlinkenLib/BlinkenOutputWin.c 288)                        format_channels, format_colors, proto, 1,
BlinkenLib/BlinkenOutputWin.c 289)                        reopen_device_ms, serial_settings_change);
BlinkenLib/BlinkenOutputWin.c 290)     if (err != 0)
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            291)       break;
BlinkenOutputWin.c            292) 
BlinkenOutputWin.c            293)   }
BlinkenOutputWin.c            294) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            298)   device_output_active = 0;
BlinkenOutputWin.c            299) 
BlinkenOutputWin.c            300)   return err;
BlinkenOutputWin.c            301) }
BlinkenOutputWin.c            302) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            304) {
BlinkenOutputWin.c            305)   WSADATA WsaData;
BlinkenOutputWin.c            306)   int i, bound;
BlinkenOutputWin.c            307)   SOCKET udpSocket;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 308)   char *serial_settings;
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            312)   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      313)   int serial_settings_change, reopen_device;
tools/BlinkenOutputWin.c      314)   unsigned long unblock;
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            315)   char txt[64];
BlinkenOutputWin.c            316)   unsigned short port;
BlinkenOutputWin.c            317)   struct sockaddr_in addr;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 318)   char *device;
BlinkenLib/BlinkenOutputWin.c 319) 
BlinkenLib/BlinkenOutputWin.c 320)   // print info
BlinkenLib/BlinkenOutputWin.c 321)   printf("BlinkenLib - BlinkenOutput\n"
Stefan Schuermans update email address of author

Stefan Schuermans authored 10 years ago

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

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 323)          "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 324)          "a blinkenarea.org project\n\n");
BlinkenLib/BlinkenOutputWin.c 325) 
BlinkenLib/BlinkenOutputWin.c 326)   // print syntax
BlinkenLib/BlinkenOutputWin.c 327)   if (argCnt <= 1) {
BlinkenLib/BlinkenOutputWin.c 328)     printf("syntax: %s <parameter> [...]\n\n"
BlinkenLib/BlinkenOutputWin.c 329)            "parameters:\n"
BlinkenLib/BlinkenOutputWin.c 330)            "  -l [<ip>:]<port>\n"
BlinkenLib/BlinkenOutputWin.c 331)            "     local address (defaults to 0.0.0.0:2323)\n"
BlinkenLib/BlinkenOutputWin.c 332)            "     must occur before -r, may only occur once\n"
BlinkenLib/BlinkenOutputWin.c 333)            "  -r <ip>[:<port>]\n"
BlinkenLib/BlinkenOutputWin.c 334)            "     remote addess (defaults to every remote address)\n"
BlinkenLib/BlinkenOutputWin.c 335)            "  -p [BLP|EBLP|MCUF]\n"
BlinkenLib/BlinkenOutputWin.c 336)            "     protocol to output frames in (defaults to MCUF)\n"
BlinkenLib/BlinkenOutputWin.c 337)            "  -f <width>x<height>-<channels>/<colors>\n"
BlinkenLib/BlinkenOutputWin.c 338)            "     format to output frames in (defaults to no change)\n"
BlinkenLib/BlinkenOutputWin.c 339)            "  -d <device>\n"
BlinkenLib/BlinkenOutputWin.c 340)            "     device to output frames to (defaults to \"NUL\")\n"
BlinkenLib/BlinkenOutputWin.c 341)            "  -s <baud-rate>,<parity>,<data-bits>,<stop-bits>\n"
BlinkenLib/BlinkenOutputWin.c 342)            "     settings to use for serial devices (defaults to no change)\n"
BlinkenLib/BlinkenOutputWin.c 343)            "  -o <milliseconds>\n"
BlinkenLib/BlinkenOutputWin.c 344)            "     reopen device after short time on error (defaults to not reopen)\n"
BlinkenLib/BlinkenOutputWin.c 345)            "\n", args[0]);
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            346)     return 0;
BlinkenOutputWin.c            347)   }
BlinkenOutputWin.c            348) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Stefan Schuermans authored 5 years ago

tools/BlinkenOutputWin.c      354)     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 355)     WSACleanup();
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            356)     return -1;
BlinkenOutputWin.c            357)   }
BlinkenOutputWin.c            358)   bound = 0;
BlinkenOutputWin.c            359) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Stefan Schuermans authored 5 years ago

tools/BlinkenOutputWin.c      363)     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 364)     closesocket(udpSocket);
BlinkenLib/BlinkenOutputWin.c 365)     WSACleanup();
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            369)   proto = BlinkenProtoMcuf;
BlinkenOutputWin.c            370)   format_change = 0;
BlinkenOutputWin.c            371)   format_height = 0;
BlinkenOutputWin.c            372)   format_width = 0;
BlinkenOutputWin.c            373)   format_channels = 0;
BlinkenOutputWin.c            374)   format_colors = 0;
BlinkenOutputWin.c            375)   device = "NUL";
BlinkenOutputWin.c            376)   serial_settings_change = 0;
BlinkenOutputWin.c            377)   reopen_device = 0;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 384)         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            385)           addr.sin_family = AF_INET;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 386)           addr.sin_port = htons(port);
BlinkenLib/BlinkenOutputWin.c 387)           addr.sin_addr.s_addr = inet_addr(txt);
BlinkenLib/BlinkenOutputWin.c 388)           if (bind(udpSocket, (struct sockaddr *)&addr, sizeof(addr)) != 0)
BlinkenLib/BlinkenOutputWin.c 389)             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            390)           else
BlinkenOutputWin.c            391)             bound = 1;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 392)         } 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            393)           addr.sin_family = AF_INET;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 394)           addr.sin_port = htons(port);
BlinkenLib/BlinkenOutputWin.c 395)           addr.sin_addr.s_addr = htonl(INADDR_ANY);
BlinkenLib/BlinkenOutputWin.c 396)           if (bind(udpSocket, (struct sockaddr *)&addr, sizeof(addr)) != 0)
BlinkenLib/BlinkenOutputWin.c 397)             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            398)           else
BlinkenOutputWin.c            399)             bound = 1;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 409)         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            410)           addr.sin_family = AF_INET;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 411)           addr.sin_port = htons(port);
BlinkenLib/BlinkenOutputWin.c 412)           addr.sin_addr.s_addr = inet_addr(txt);
BlinkenLib/BlinkenOutputWin.c 413)           if (connect(udpSocket, (struct sockaddr *)&addr, sizeof(addr)) != 0)
BlinkenLib/BlinkenOutputWin.c 414)             printf("could not set remote address to \"%s\"\n", args[i]);
BlinkenLib/BlinkenOutputWin.c 415)         } 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            416)           addr.sin_family = AF_INET;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 417)           addr.sin_port = htons(23230);
BlinkenLib/BlinkenOutputWin.c 418)           addr.sin_addr.s_addr = inet_addr(txt);
BlinkenLib/BlinkenOutputWin.c 419)           if (connect(udpSocket, (struct sockaddr *)&addr, sizeof(addr)) != 0)
BlinkenLib/BlinkenOutputWin.c 420)             printf("could not set remote address to \"%s\"\n", args[i]);
BlinkenLib/BlinkenOutputWin.c 421)         } else
BlinkenLib/BlinkenOutputWin.c 422)           printf("invalid remote address \"%s\"\n", args[i]);
BlinkenLib/BlinkenOutputWin.c 423)       } else
BlinkenLib/BlinkenOutputWin.c 424)         printf("missing remote address for \"-r\"\n");
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 445)         if (sscanf
BlinkenLib/BlinkenOutputWin.c 446)             (args[i], "%ux%u-%u/%u", &width, &height, &channels, &colors) == 4
BlinkenLib/BlinkenOutputWin.c 447)             && width > 0 && width < 1000 && height > 0 && height < 1000
BlinkenLib/BlinkenOutputWin.c 448)             && 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            449)           format_change = 1;
BlinkenOutputWin.c            450)           format_height = height;
BlinkenOutputWin.c            451)           format_width = width;
BlinkenOutputWin.c            452)           format_channels = channels;
BlinkenOutputWin.c            453)           format_colors = colors;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 471)         if (serial_settings_parse(args[i])) {
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 473)           serial_settings = args[i];
BlinkenLib/BlinkenOutputWin.c 474)         } else
BlinkenLib/BlinkenOutputWin.c 475)           printf("invalid serial settings \"%s\"\n", args[i]);
BlinkenLib/BlinkenOutputWin.c 476)       } else
BlinkenLib/BlinkenOutputWin.c 477)         printf("missing serial settings for \"-s\"\n");
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 499)   // try to bind if not bound
BlinkenLib/BlinkenOutputWin.c 500)   if (!bound) {
BlinkenLib/BlinkenOutputWin.c 501)     printf("no local address to receive frames on,\n"
BlinkenLib/BlinkenOutputWin.c 502)            "  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            503)     addr.sin_family = AF_INET;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 504)     addr.sin_port = htons(2323);
BlinkenLib/BlinkenOutputWin.c 505)     addr.sin_addr.s_addr = htonl(INADDR_ANY);
BlinkenLib/BlinkenOutputWin.c 506)     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            507)       bound = 1;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

BlinkenOutputWin.c            511)       return -1;
BlinkenOutputWin.c            512)     }
BlinkenOutputWin.c            513)   }
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 514)   // open device and output frames in a loop
BlinkenLib/BlinkenOutputWin.c 515)   open_and_output_loop(udpSocket, device,
BlinkenLib/BlinkenOutputWin.c 516)                        serial_settings_change, serial_settings,
BlinkenLib/BlinkenOutputWin.c 517)                        reopen_device, reopen_device_ms,
BlinkenLib/BlinkenOutputWin.c 518)                        format_change, format_height, format_width,
BlinkenLib/BlinkenOutputWin.c 519)                        format_channels, format_colors, proto);
Christian Heimke BlinkenLib v.0.5.2 (2006-05...

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Christian Heimke authored 13 years ago

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

Stefan Schuermans authored 13 years ago

BlinkenLib/BlinkenOutputWin.c 524)   WSACleanup();