#include #include // Simply place the completed tuning interface DLL into the tuner directory. PVS will automatically // enumerate and list the interface on a restart of the application. // Use any or all of the following info to tune the device. // dwChanne: Channel number // dwBroadcastType: 0 = Antenna, 1 = Cable // dwFrequency = The frequency to tune to, in Hz typedef struct { DWORD dwVersionSpec; // The current version of the tuning DLL spec is 2. DWORD dwVersion; // You may put your own internal version number here. char szName[MAX_PATH]; // Name of the device(s) being tuned char szDescription[MAX_PATH]; // Description of the tuning DLL char szFilename[MAX_PATH]; // Don't pass back or modify this field } TTUNER; /* This function is called by the PVS to obtain information about this tuning interface */ int TunerGetProperties( TTUNER *pTuner ) { pTuner->dwVersionSpec = 2; pTuner->dwVersion = 1; strcpy( pTuner->szName, "New RCA DSS tuner" ); strcpy( pTuner->szDescription, "For Receivers using the new serial commands." ); return TRUE; } BOOL SetTunerFrequency(DWORD dwChannel, DWORD dwBroadcastType, DWORD dwFrequency) { // Do your tuning here! HANDLE h; DCB dcb; char chWrite[10] = ""; DWORD dwWrite; memset(&dcb, 0, sizeof(dcb)); dcb.DCBlength = sizeof(dcb); dcb.BaudRate = 9600; dcb.fBinary = 1; dcb.fOutxCtsFlow = 0; dcb.XoffChar = 0; dcb.fOutxDsrFlow = 0; dcb.fDtrControl = 0; dcb.fRtsControl = 0; dcb.Parity = NOPARITY; dcb.StopBits = ONESTOPBIT; dcb.ByteSize = 8; dcb.fNull = 0; h = CreateFile("COM1", GENERIC_READ|GENERIC_WRITE,0,0, OPEN_EXISTING,0,NULL); SetCommState(h,&dcb); chWrite[0] = 0xFA; //Header Command chWrite[1] = 0x82; //Power On Command WriteFile(h, &chWrite, 2, &dwWrite, NULL); chWrite[0] = 0xFA; //Header Command chWrite[1] = 0xA6; //Set Channel Command chWrite[2] = dwChannel >> 8; //high byte of dwChannel chWrite[3] = dwChannel; //low byte of dwChannel chWrite[4] = 0xff; //Subchannel chWrite[5] = 0xff; //Subchannel Sleep(500); WriteFile(h, &chWrite, 6, &dwWrite, NULL); CloseHandle(h); return TRUE; }