//////////////////////////////////////////////////////////////////////////////// // christie_serial.cpp - send command to the christie projector // // djzielin 11-22-2005 //////////////////////////////////////////////////////////////////////////////// // precompiled header include MUST appear as the first non-comment line #include "arPrecompiled.h" #include "arMasterSlaveFramework.h" #include #include #include #include char *command_string; int send_serial_command(char *port,char *command) { HANDLE hSerial; hSerial=CreateFile(port,GENERIC_WRITE,0,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0); if(hSerial==INVALID_HANDLE_VALUE) { printf("error, could not open serial port\n"); return 1; } else printf("opened serial port successfully\n"); DCB dcbSerialParams={0}; if(!GetCommState(hSerial,&dcbSerialParams)) { printf("error getting serial port state.\n"); return 1; } dcbSerialParams.BaudRate=CBR_19200; dcbSerialParams.ByteSize=8; dcbSerialParams.StopBits=ONESTOPBIT; dcbSerialParams.Parity=NOPARITY; if(!SetCommState(hSerial, &dcbSerialParams)) { printf("error setting serial port state\n"); CloseHandle(hSerial); return 1; } else printf("set serial port settings sucessfully\n"); DWORD bytesWritten; printf("length of command: %d\n",strlen(command)); if(!WriteFile(hSerial,command,strlen(command),&bytesWritten,NULL)) { printf("error could not write commands!\n"); } else printf("wrote commands: %s\n",command); CloseHandle(hSerial); return 0; } bool init( arMasterSlaveFramework& fw, arSZGClient& SZGClient ) { send_serial_command("COM1",command_string); send_serial_command("COM2",command_string); printf("send serial command here...\n"); return false; } void process_args(int argc, char** argv) { printf("examining command line args...\n"); for(int i=1;i