#include "SerialPort.h"
HANDLE hComm;
//SYSTEMTIME etime;
bool openPort(TCHAR *gszPort) {
printf("try to open the port %s \n", gszPort);
hComm = CreateFile(gszPort, // pointer to name of the file
GENERIC_READ | GENERIC_WRITE,// access (read-write) mode
0, // share mode
0, // pointer to security attributes
OPEN_EXISTING,// how to create
0, // file attributes
0);// handle to file with attributes to copy
if (hComm == INVALID_HANDLE_VALUE) {
printf("failed to open serial port %s \n", gszPort);
return 0;
} else {
printf("serial port %s opened \n", gszPort);
return 1;
}
}
bool setupPort() {
printf("try to set up the port \n");
DCB dcb;
//printf("setting up DCB\n")