2 Copyright 2004-2005 Chris Tallon
4 This file is part of VOMP.
6 VOMP is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 VOMP is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with VOMP; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "remotewin.h"
22 #include "vompreswin.h"
25 RemoteWin::RemoteWin()
32 RemoteWin::~RemoteWin()
36 int RemoteWin::init(char* devName)
38 if (initted) return 0;
40 event = CreateEvent(NULL,/*FALSE*/TRUE,FALSE,NULL);
46 int RemoteWin::shutdown()
48 if (!initted) return 0;
54 UCHAR RemoteWin::getButtonPress(int waitType)
57 how = 1 - start new wait
58 how = 2 - continue wait
63 if (curevent!=NA_NONE) {
73 } else { //We do not distingish between 2 and 3
77 WaitForSingleObject(event,wait);
79 if (curevent==NA_NONE) {
82 return NA_SIGNAL; //Since we have no signals on windows, we simulate this
93 void RemoteWin::clearBuffer()
97 int RemoteWin::ReceiveButtonVK(UINT button) {
99 //should we use a translation table ? No APPCOMMAND iS DWORD!
100 switch (button) { //Processing VK_Messages
144 case 'J'://j for JUMP TO instead of go to
162 }; //All other commands are process via APPCOMMAND_MESSAGES
163 if (pb==NA_NONE) return 0;
170 int RemoteWin::ReceiveButtonAP(UINT button) {
172 //should we use a translation table ? No APPCOMMAND iS DWORD!
173 switch (button) { //Processing VK_Messages
174 case APPCOMMAND_BROWSER_BACKWARD:
176 case APPCOMMAND_MEDIA_CHANNEL_DOWN:
177 pb=CHANNELDOWN;break;
178 case APPCOMMAND_MEDIA_CHANNEL_UP:
180 case APPCOMMAND_MEDIA_FAST_FORWARD:
182 case APPCOMMAND_VOLUME_MUTE:
184 case APPCOMMAND_MEDIA_PAUSE:
186 case APPCOMMAND_MEDIA_PLAY:
188 case APPCOMMAND_MEDIA_RECORD:
190 case APPCOMMAND_MEDIA_PREVIOUSTRACK:
192 case APPCOMMAND_MEDIA_REWIND:
194 case APPCOMMAND_MEDIA_NEXTTRACK:
195 pb=SKIPFORWARD;break;
196 case APPCOMMAND_MEDIA_STOP:
198 case APPCOMMAND_VOLUME_DOWN:
200 case APPCOMMAND_VOLUME_UP:
223 if (pb==NA_NONE) return 0;
230 int RemoteWin::ReceiveButtonRI(UINT button) {
233 /* Note Codes above 0x29c are not listed in the specs on usb.org
234 therefore they are used by try, they might be device dependent
235 thus please supply codes of your remote control */
236 switch (button) { //Processing VK_Messages
245 case 0x30d: //MCE Button, used for Menu
247 case 0x348: //Record Television
249 case 0x28d: //Attach File Mmh, how should we assign this
251 case 0x325: //Playback Televison
253 case 0x324: //Playback DVD
255 case 0x209: //Properties
256 case 0x35a: //Teletext?
261 if (pb==NA_NONE) return 0;
268 void RemoteWin::Signal() {
274 void RemoteWin::SendPower()