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"
24 RemoteWin::RemoteWin()
31 RemoteWin::~RemoteWin()
35 int RemoteWin::init(char* devName)
37 if (initted) return 0;
39 event = CreateEvent(NULL,/*FALSE*/TRUE,FALSE,NULL);
45 int RemoteWin::shutdown()
47 if (!initted) return 0;
53 UCHAR RemoteWin::getButtonPress(int waitType)
56 how = 1 - start new wait
57 how = 2 - continue wait
62 if (curevent!=NA_NONE) {
72 } else { //We do not distingish between 2 and 3
76 WaitForSingleObject(event,wait);
78 if (curevent==NA_NONE) {
81 return NA_SIGNAL; //Since we have no signals on windows, we simulate this
92 void RemoteWin::clearBuffer()
96 int RemoteWin::ReceiveButtonVK(UINT button) {
98 //should we use a translation table ? No APPCOMMAND iS DWORD!
99 switch (button) { //Processing VK_Messages
143 case 'J'://j for JUMP TO instead of go to
161 }; //All other commands are process via APPCOMMAND_MESSAGES
162 if (pb==NA_NONE) return 0;
169 int RemoteWin::ReceiveButtonAP(UINT button) {
171 //should we use a translation table ? No APPCOMMAND iS DWORD!
172 switch (button) { //Processing VK_Messages
173 case APPCOMMAND_MEDIA_CHANNEL_DOWN:
174 pb=CHANNELDOWN;break;
175 case APPCOMMAND_MEDIA_CHANNEL_UP:
177 case APPCOMMAND_MEDIA_FAST_FORWARD:
179 case APPCOMMAND_VOLUME_MUTE:
181 case APPCOMMAND_MEDIA_PAUSE:
183 case APPCOMMAND_MEDIA_PLAY:
185 case APPCOMMAND_MEDIA_RECORD:
187 case APPCOMMAND_MEDIA_PREVIOUSTRACK:
189 case APPCOMMAND_MEDIA_REWIND:
191 case APPCOMMAND_MEDIA_NEXTTRACK:
192 pb=SKIPFORWARD;break;
193 case APPCOMMAND_MEDIA_STOP:
195 case APPCOMMAND_VOLUME_DOWN:
197 case APPCOMMAND_VOLUME_UP:
200 if (pb==NA_NONE) return 0;
207 void RemoteWin::Signal() {