7#define MAX_PORTNAME_LEN 20
8#define APP_VERSION_STR "0.01"
29 sprintf(szPortName,
_T(
"COM%d"), nPortNum);
32 printf(
"Attempting to open serial port %d - %s\n", nPortNum, szPortName);
42 printf(
"ERROR: CreateFile() failed with result: %lx\n", (
DWORD)hPort);
45 printf(
"CreateFile() returned: %lx\n", (
DWORD)hPort);
47 printf(
"Fiddling with DTR and RTS control lines...\n");
48 for (
i = 0;
i < 100;
i++) {
51 printf(
"WARNING: EscapeCommFunction(SETDTR) failed: %lx\n", (
DWORD)bResult);
55 printf(
"WARNING: EscapeCommFunction(SETRTS) failed: %lx\n", (
DWORD)bResult);
70 printf(
"WARNING: EscapeCommFunction(CLRDTR) failed: %lx\n", (
DWORD)bResult);
74 printf(
"WARNING: EscapeCommFunction(CLRRTS) failed: %lx\n", (
DWORD)bResult);
77 printf(
"Getting the default line characteristics...\n");
78 dcb.DCBlength =
sizeof(
DCB);
83 printf(
"Setting the line characteristics to 9600,8,N,1\n");
84 dcb.BaudRate = dwBaud;
91 printf(
"ERROR: failed to set the comm state: %lx\n", (
DWORD)bResult);
100 printf(
"Writing transmit buffer to the serial port\n");
103 printf(
"ERROR: failed to write to the serial port: %lx\n", (
DWORD)bResult);
106 printf(
"WriteFile() returned: %lx, byteswritten: %lx\n", (
DWORD)bResult, dwNumWritten);
108 printf(
"Attempting to read %d bytes from the serial port\n",
BUFSIZE);
111 printf(
"ERROR: failed to read from the serial port: %lx\n", (
DWORD)bResult);
114 printf(
"ReadFile() returned: %lx, bytesread: %lx\n", (
DWORD)bResult, dwNumRead);
119 printf(
"Attempting to close the serial port\n");
121 printf(
"ClearCommError returned: %lx, dwErrors: %lx\n", (
DWORD)bResult, dwErrors);
124 printf(
"ERROR: failed to close the serial port: %lx\n", (
DWORD)bResult);
#define ReadFile(a, b, c, d, e)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
BOOL WINAPI SetCommState(HANDLE handle, LPDCB lpdcb)
BOOL WINAPI GetCommState(HANDLE handle, LPDCB lpdcb)
BOOL WINAPI EscapeCommFunction(HANDLE handle, DWORD func)
BOOL WINAPI ClearCommError(HANDLE handle, LPDWORD errors, LPCOMSTAT lpStat)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
_Check_return_ _CRTIMP int __cdecl sscanf(_In_z_ const char *_Src, _In_z_ _Scanf_format_string_ const char *_Format,...)
#define sprintf(buf, format,...)
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
DWORD WINAPI GetLastError(void)