#include "command.h"
#ifdef WIN32
-#include "inputManwin.h"
+#include "inputwin.h"
#endif
#ifdef __ANDROID__
-#include "inputManandroid.h"
+#include "inputandroid.h"
#endif
#include "led.h"
inputMan->start();
- // Start method 2 of getting commands in... // FIXME move this inside input
- udp.run(this);
-
while(irun)
{
messageQueueCond.wait(lockWrapper, [&] { return !irun || !messages.empty(); });
{
case Message::SHUTDOWN:
{
- udp.shutdown();
irun = false;
break;
}
handleCommand(m->parameter);
break;
}
- case Message::UDP_BUTTON:
- {
- handleCommand(m->parameter);
- break;
- }
case Message::CHANGE_LANGUAGE:
{
boxstack->removeAllExceptWallpaper();
#include "defines.h"
#include "messagequeue.h"
-#include "udp.h"
class VConnect;
class Message;
ASLPrefList langcodes;
int subdefault;
- UDP udp;
-
void processMessage(Message* m);
};
#define RemoteStartDev ""//No devices passed
+// FIXME - check C++ - I think some of these are in std:: now ?
#define SNPRINTF _snprintf
#define VSNPRINTF _vsnprintf
#define STRCASECMP _stricmp
#include "dsock.h"
DatagramSocket::DatagramSocket(short port)
+: myPort(port)
{
- iterate_ip = 0;
- myPort = port;
addrlen = sizeof(struct sockaddr);
- initted = false;
}
DatagramSocket::~DatagramSocket()
initted = false;
}
-unsigned char DatagramSocket::waitforMessage(unsigned char how)
+unsigned char DatagramSocket::waitforMessage(unsigned char how, int quitPipe)
{
if (!initted) return 0;
/* how = 0 - block
how = 1 - start new wait
how = 2 - continue wait
+ how = 3 - block, return on byte from quitPipe
*/
+ FD_ZERO(&readfds);
+ FD_SET(socketnum, &readfds);
+
struct timeval* passToSelect = NULL;
+ int sockMaxP1 = socketnum + 1;
- if (how == 0)
- {
- passToSelect = NULL;
- }
- else if (how == 1)
+ if (how == 1)
{
tv.tv_sec = 1;
tv.tv_usec = 500000;
}
passToSelect = &tv;
}
- FD_ZERO(&readfds);
- FD_SET(socketnum, &readfds);
+ else if (how == 3)
+ {
+ FD_SET(quitPipe, &readfds);
+ if (quitPipe > socketnum) sockMaxP1 = quitPipe + 1;
+ }
+
- if (select(socketnum + 1, &readfds, NULL, NULL, passToSelect) <= 0)
+ if (select(sockMaxP1, &readfds, NULL, NULL, passToSelect) <= 0)
{ return 1; }
+ if ((how == 3) && FD_ISSET(quitPipe, &readfds)) return 3;
+
if ((mlength = recvfrom(socketnum, buf, MAXBUFLEN, 0,
reinterpret_cast<struct sockaddr *>(&theirAddr), &addrlen)) == -1)
{ perror("recvfrom"); return 0; }
~DatagramSocket();
int init();
void shutdown();
- unsigned char waitforMessage(unsigned char); // int =0-block =1-new wait =2-continue wait
+ unsigned char waitforMessage(unsigned char, int quitPipe = 0); // uchar =0-block =1-new wait =2-continue wait
UINT getDataLength() const;
const void* getData() const; // returns a pointer to the data
const char* getFromIPA() const; // returns a pointer to from IP address
void send(const char *, short, char *, int); // send wants: IP Address ddn style, port, data, length of data
private:
- bool initted;
+ bool initted{};
ULONG getIPNumber(ULONG num);
- ULONG iterate_ip;
+ ULONG iterate_ip{};
const static char DSOCKDEBUG = 0;
int socketnum; // Socket descriptor
short myPort; // My port number
#include "log.h"
#include "vdr.h"
#include "wtabbar.h"
+#include "message.h"
+#include "messagequeue.h"
+#include "command.h" // FIXME - get rid after predefined message targets
#include "inputman.h"
#include "input.h"
void Input::EnterLearningMode(UCHAR command)
{
- learnmode = command; //Armed
+ learnmode = command; //Armed
}
void Input::ResetToDefault()
InitHWCListwithDefaults();
}
-/*
-UCHAR Input::TranslateHWCFixed(ULLONG code)
-{
- switch (code)
- {
- case DOWN:
- return DOWN;
- case UP:
- return UP;
- case LEFT:
- return LEFT;
- case RIGHT:
- return RIGHT;
- case MENU:
- return MENU;
- case BACK:
- return BACK;
- case OK:
- return OK;
- default:
- return NA_UNKNOWN;
- }
-}
-*/
-
-const char* Input::HardcodedTranslateStr(UCHAR command)
-{
- switch (command)
- {
- case DOWN:
- return tr("Down");
- case UP:
- return tr("Up");
- case LEFT:
- return tr("Left");
- case RIGHT:
- return tr("Right");
- case MENU:
- return tr("Menu");
- case BACK:
- return tr("Back");
- case OK:
- return tr("Ok");
- default:
- return NULL;
- }
-}
-
UCHAR Input::TranslateHWCList(int code)
{
if (learnmode != NOLEARNMODE)
VDR::getInstance()->configSave("General","RemoteKeyNum",buffer);
}
-char* Input::HCWDesc(ULLONG hcw)
-{
- char *dest;
- const char* temp = InputMan::CommandDesc((UCHAR)hcw);
- if (temp != NULL)
- {
- dest=new char[strlen(temp)+1];
- strcpy(dest,temp);
- }
- else
- {
- dest=new char[20];
- sprintf(dest,"C:%lX",(ULONG)hcw);
- }
- return dest;
-}
-
-char* Input::CommandTranslateStr(UCHAR command)
-{
- char* desc;
- int length = 5; //:+\t+0
-
- const char* commanddesc = InputMan::CommandDesc(command);
- if (commanddesc != NULL) length += strlen(commanddesc);
-
- const char* preassigneddesc = HardcodedTranslateStr(command);
- if (preassigneddesc != NULL) length += strlen(preassigneddesc);
-
- char* keydesc[10];
- int keys = 0; // max 10
- RemoteTranslationList::const_iterator it;
- for (it = translist.begin(); it != translist.end(); it++)
- {
- if (it->second == command)
- {
- keydesc[keys] = HCWDesc(it->first);
- length += strlen(keydesc[keys])+2;
- keys++;
- if (keys == 10) break;
- }
- }
-
- desc = new char[length];
- char* current = desc;
- if (commanddesc != NULL)
- {
- current += sprintf(current, "%s:\t ", commanddesc);
- }
- else
- {
- current += sprintf(current,":\t ");
- }
-
- if (preassigneddesc != NULL)
- {
- current += sprintf(current, "%s\t", preassigneddesc);
- }
- else
- {
- current+=sprintf(current,"\t");
- }
-
- for (int i = 0; i < keys; i++)
- {
- current += sprintf(current, "%s, ", keydesc[i]);
- delete[] keydesc[i];
- }
-
- return desc;
-}
// bool Input::addOptionPagesToWTB(WTabBar *wtb)
// {
bool Input::saveOptionstoServer()
{
- SaveKeysConfig();
- return true;
+ SaveKeysConfig();
+ return true;
+}
+
+void Input::sendInputKey(int key)
+{
+ Message* m = new Message();
+ m->message = Message::INPUT_EVENT;
+ m->to = Command::getInstance();
+ m->from = this;
+ m->parameter = TranslateHWC(key);
+ MessageQueue::getInstance()->postMessage(m);
+}
+
+std::string Input::getAllHardwareKeyNamesAssignedToVompKey(UCHAR vompKey)
+{
+ std::string keyNames;
+ keyNames.reserve(50);
+ int keys = 0; // max 10
+ RemoteTranslationList::const_iterator it;
+ bool first = true;
+ for (it = translist.begin(); it != translist.end(); it++)
+ {
+ if (it->second == vompKey)
+ {
+ if (!first) keyNames += ", ";
+ first = false;
+
+ keyNames += getHardwareKeyName(it->first);
+ keys++;
+ if (keys == 10) break;
+ }
+ }
+ return keyNames;
}
#ifndef INPUT_H
#define INPUT_H
-#include <stdio.h>
+#include <string>
#include <map>
-#include <thread>
-#include <mutex>
#include "defines.h"
#include "abstractoption.h"
// FIXME make common base class sendKey function
+class VDR;
typedef std::map<ULLONG, UCHAR> RemoteTranslationList;
void SaveKeysConfig();
void EnterLearningMode(UCHAR command);
- virtual int init()=0;
+ virtual bool init()=0;
virtual void shutdown()=0;
virtual bool handlesVolume() {return false;};
virtual void changePowerState(bool /* poweron */) {}; //informs the remote control, that about vomp's power state, this is important e.g. for cec
virtual void InitHWCListwithDefaults()=0;
- virtual char* HCWDesc(ULLONG hcw);
+ std::string getAllHardwareKeyNamesAssignedToVompKey(UCHAR vompKey);
char* CommandTranslateStr(UCHAR command);
- static const char* HardcodedTranslateStr(UCHAR command);
void EnterLearnMode(UCHAR command);
void ResetToDefault();
+ virtual std::string getHardwareKeyName(int hardwareKey)=0;
const static ULONG NOLEARNMODE = 256;
ULONG learnmode;
RemoteTranslationList translist;
+
+ void sendInputKey(int key);
};
#endif
#include <bcm_host.h>
#include "log.h"
-#include "message.h"
-#include "messagequeue.h"
#include "vdr.h"
#include "woptionpane.h"
#include "inputcec.h"
InputCEC* InputCEC::instance = NULL;
-int InputCEC::init()
+bool InputCEC::init()
{
InitHWCListwithDefaults();
InitKeymap();
if (!cec_adap)
{
Log::getInstance()->log("InputCEC", Log::ERR, "Init LibCEC failed");
- return 1;
+ return false;
}
cec_adap->InitVideoStandalone();
if (adap_num < 0)
{
Log::getInstance()->log("InputCEC", Log::ERR, "CEC:Failed to find adapter");
- return 1;
+ return false;
}
if (adap_num == 0)
{
Log::getInstance()->log("InputCEC", Log::NOTICE, "CEC: No adapter found");
- return 1;
+ return false;
}
if (!cec_adap->Open(cec_adapter_descriptors[0].strComName))
{
Log::getInstance()->log("InputCEC", Log::ERR, "CEC:Failed to open adapter");
- return 1;
+ return false;
}
if (!cec_adap->SetActiveSource(cec_config.deviceTypes[0]))
{
Log::getInstance()->log("InputCEC", Log::ERR, "CEC:Failed set active source");
- return 1;
+ return false;
}
- return 1;
+ return true;
}
void InputCEC::shutdown()
}
}
-void InputCEC::incomingCECkey(int keys)
+void InputCEC::incomingCECkey(int key)
{
- // Send INPUT message
- Message* m = new Message();
- m->message = Message::INPUT_EVENT;
- m->to = Command::getInstance();
- m->from = this;
- m->parameter = TranslateHWC(keys);
- MessageQueue::getInstance()->postMessage(m);
+ sendInputKey(TranslateHWC(key));
}
void InputCEC::incomingPowerkey(UCHAR key)
{
- // Send INPUT message
- Message* m = new Message();
- m->message = Message::INPUT_EVENT;
- m->to = Command::getInstance();
- m->from = this;
- m->parameter = key;
- MessageQueue::getInstance()->postMessage(m);
+ sendInputKey(key);
}
void InputCEC::volumeUp()
NAMETRICK2(CEC_USER_CONTROL_CODE_,AN_CHANNELS_LIST );
NAMETRICK2(CEC_USER_CONTROL_CODE_,MAX );
}
+
+const char* InputCEC::getHardCodedHardwareKeyNamesForVompKey(UCHAR vompKey)
+{
+ return ""; // FIXME
+}
+
+std::string InputCEC::getHardwareKeyName(int hardwareKey)
+{
+ const char* desc = cec_keymap[hardwareKey];
+
+ std::string retval;
+
+ if (desc)
+ {
+ retval = desc;
+ }
+ else
+ {
+ char* rt = new char[10];
+ sprintf(rt, "0x%x", hardwareKey);
+ retval = rt;
+ }
+
+ return retval;
+}
+
class InputCEC : public Input
{
public:
- int init();
+ bool init();
void shutdown();
bool handlesVolume() { return cechandlesvolume; };
bool addOptionsToPanes(int panenumber,Options *options,WOptionPane* pane);
bool handleOptionChanges(Option* option);
+ std::string getHardwareKeyName(int hardwareKey);
+ const char* getHardCodedHardwareKeyNamesForVompKey(UCHAR vompKey);
+
private:
void InitKeymap();
void InitHWCListwithDefaults();
along with VOMP. If not, see <https://www.gnu.org/licenses/>.
*/
+#include <stdio.h>
#include <linux/input.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "i18n.h"
#include "vdr.h"
#include "woptionpane.h"
-#include "message.h"
-#include "messagequeue.h"
-#include "command.h" // FIXME - get rid after predefined message targets
#include "inputlinux.h"
#define test_bit(input,b) ((1 << ((b) % 8))&(input)[b / 8] )
-int InputLinux::init()
+bool InputLinux::init()
{
- if (initted) return 0;
+ if (initted) return false;
initted = 1;
InitHWCListwithDefaults();
}
}
}
- return 1;
+ return true;
}
void InputLinux::shutdown()
NAMETRICK(KEY_,NUMERIC_POUND);
}
-char* InputLinux::HCWDesc(unsigned long long hcw)
+const char* InputLinux::getHardCodedHardwareKeyNamesForVompKey(UCHAR vompKey)
+{
+ switch (vompKey)
+ {
+ case DOWN:
+ return tr("Down");
+ case UP:
+ return tr("Up");
+ case LEFT:
+ return tr("Left");
+ case RIGHT:
+ return tr("Right");
+ case MENU:
+ return tr("M");
+ case BACK:
+ return tr("Backspace, Back");
+ case OK:
+ return tr("Return, Space");
+ default:
+ return "";
+ }
+}
+
+std::string InputLinux::getHardwareKeyName(int hardwareKey)
{
- unsigned int vk = static_cast<ULONG>(hcw); // FIXME
- char* rt = new char[10];
- const char* desc = linux_keymap[vk];
+ const char* desc = linux_keymap[hardwareKey];
+
+ std::string retval;
+
if (desc)
- strncpy(rt, desc, 9);
+ {
+ retval = desc;
+ }
else
- sprintf(rt, "0x%x", vk);
+ {
+ char* rt = new char[10];
+ sprintf(rt, "0x%x", hardwareKey);
+ retval = rt;
+ }
- return rt;
+ return retval;
}
bool InputLinux::start()
{
if (ev.type == EV_KEY && ev.value == 1)
{
- // Send INPUT message
- Message* m = new Message();
- m->message = Message::INPUT_EVENT;
- m->to = Command::getInstance();
- m->from = this;
-// m->parameter = static_cast<UCHAR>(TranslateHWC_KC(ev.code));
- m->parameter = TranslateHWC(ev.code);
- MessageQueue::getInstance()->postMessage(m);
+ sendInputKey(TranslateHWC(ev.code));
}
}
}
#ifndef INPUTLINUX_H
#define INPUTLINUX_H
-#include <stdio.h>
+#include <string>
#include <vector>
+#include <thread>
+#include <mutex>
#include "defines.h"
#include "input.h"
class InputLinux : public Input
{
public:
- int init();
+ bool init();
void shutdown();
- char* HCWDesc(ULLONG hcw);
+ std::string getHardwareKeyName(int hardwareKey);
+ const char* getHardCodedHardwareKeyNamesForVompKey(UCHAR vompKey);
bool start();
void stop();
void InitHWCListwithDefaults();
UCHAR TranslateHWCFixed(int code);
+
std::vector<int> devices;
std::thread listenThread;
};
#endif
+
+// FIXME remove all ULLONG for hwc
#include "wtabbar.h"
#include "inputlinux.h"
#include "inputcec.h"
+#include "inputudp.h"
#include "i18n.h"
#include "input.h"
bool InputMan::init()
{
- bool i1{}, i2{};
+ bool i1{}, i2{}, i3{};
#ifdef VOMP_PLATFORM_RASPBERRY
inputLinux = new InputLinux();
// if (!i2) { delete inputCEC; inputCEC = NULL; }
#endif
- if (!i1 && !i2)
+ inputUDP = new InputUDP();
+ i3 = inputUDP->init();
+ if (!i3) { delete inputUDP; inputUDP = NULL; }
+
+
+ if (!i1 && !i2 && !i3)
{
Log::getInstance()->log("InputMan", Log::CRIT, "InputMan could not init any input module");
return false;
bool InputMan::start()
{
- bool i1{};
+ Log::getInstance()->log("InputMan", Log::DEBUG, "Start");
+
+ bool i1{}, i3{};
if (inputLinux)
{
i1 = inputLinux->start();
}
+ if (inputUDP)
+ {
+ i3 = inputUDP->start();
+ }
+
return i1;
}
void InputMan::stop()
{
if (inputLinux) inputLinux->stop();
+ if (inputUDP) inputUDP->stop();
}
void InputMan::shutdown()
inputCEC = NULL;
}
+ if (inputUDP)
+ {
+ Log::getInstance()->log("InputMan", Log::DEBUG, "Shutdown start - UDP");
+ inputUDP->stop();
+ inputUDP->shutdown();
+ delete inputUDP;
+ inputUDP = NULL;
+ }
+
initted = false;
}
return true; // FIXME
}
-const char* InputMan::CommandDesc(UCHAR number)
+const char* InputMan::getVompKeyName(UCHAR number)
{
switch (number)
{
return NULL;
}
}
+
+std::string InputMan::getHardCodedHardwareKeyNamesForVompKey(UCHAR vompKey)
+{
+ // Go through each active Input class and get the hardware key name for vompKey
+
+ // which doesn't make any sense
+
+ std::string keyNames;
+
+ if (inputLinux)
+ {
+ std::string k = inputLinux->getHardCodedHardwareKeyNamesForVompKey(vompKey);
+ if (k.size()) keyNames += k;
+ }
+
+ if (inputCEC)
+ {
+ std::string k = inputCEC->getHardCodedHardwareKeyNamesForVompKey(vompKey);
+ if (k.size()) { keyNames += ", "; keyNames += k; }
+ }
+
+ if (inputUDP)
+ {
+ std::string k = inputUDP->getHardCodedHardwareKeyNamesForVompKey(vompKey);
+ if (k.size()) { keyNames += ", "; keyNames += k; }
+ }
+
+ return keyNames;
+}
+
+std::string InputMan::getAllHardwareKeyNamesAssignedToVompKey(UCHAR vompKey)
+{
+ std::string keyNames;
+
+ if (inputLinux)
+ {
+ std::string k = inputLinux->getAllHardwareKeyNamesAssignedToVompKey(vompKey);
+ if (k.size()) keyNames += k;
+ }
+
+ if (inputCEC)
+ {
+ std::string k = inputCEC->getAllHardwareKeyNamesAssignedToVompKey(vompKey);
+ if (k.size()) { keyNames += ", "; keyNames += k; }
+ }
+
+ if (inputUDP)
+ {
+ std::string k = inputUDP->getAllHardwareKeyNamesAssignedToVompKey(vompKey);
+ if (k.size()) { keyNames += ", "; keyNames += k; }
+ }
+
+ return keyNames;
+}
*/
+#include <string>
+
#include "defines.h"
#include "abstractoption.h"
bool addOptionsToPanes(int panenumber, Options* options, WOptionPane* pane);
bool saveOptionstoServer();
- static const char* CommandDesc(UCHAR number);
+ static const char* getVompKeyName(UCHAR vompKey);
+
+ std::string getHardCodedHardwareKeyNamesForVompKey(UCHAR vompKey);
+ std::string getAllHardwareKeyNamesAssignedToVompKey(UCHAR vompKey);
private:
static InputMan* instance;
--- /dev/null
+/*
+ Copyright 2006-2020 Chris Tallon
+
+ This file is part of VOMP.
+
+ VOMP is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ VOMP is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with VOMP. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+#include <fcntl.h>
+#include <unistd.h>
+
+#include "dsock.h"
+#include "log.h"
+
+#include "inputudp.h"
+
+bool InputUDP::init()
+{
+ if (initted) return false;
+ initted = true;
+ log = Log::getInstance();
+ log->log("InputUDP", Log::DEBUG, "Starting InputUDP command server");
+
+ ds = new DatagramSocket(2000);
+ if (!ds->init())
+ {
+ log->log("InputUDP", Log::DEBUG, "DSock init error");
+ delete ds;
+ initted = false;
+ return false;
+ }
+
+ if (pipe2(pfds, O_NONBLOCK) == -1)
+ {
+ Log::getInstance()->log("InputUDP", Log::ERR, "pipe2() fail");
+ ds->shutdown();
+ delete ds;
+ initted = false;
+ return false;
+ }
+
+ return true;
+}
+
+void InputUDP::shutdown()
+{
+ ds->shutdown();
+ delete ds;
+
+ close(pfds[1]);
+ close(pfds[0]);
+
+ initted = false;
+}
+
+bool InputUDP::start()
+{
+ threadStartProtect.lock(); // Make sure listenThread is fully initted before start returns
+ listenThread = std::thread( [this]
+ {
+ threadStartProtect.lock();
+ threadStartProtect.unlock();
+ listenLoop();
+ });
+ threadStartProtect.unlock();
+
+ log->log("InputUDP", Log::DEBUG, "InputUDP command server started");
+ return true;
+}
+
+void InputUDP::stop()
+{
+ std::lock_guard<std::mutex> lg(threadStartProtect); // Also use it to protect against starting while stopping
+
+ if (!initted) return;
+
+ if (listenThread.joinable())
+ {
+ write(pfds[1], "1", 1); // break the select in listenLoop
+ listenThread.join();
+ }
+}
+
+void InputUDP::listenLoop()
+{
+ int retval;
+ while(1)
+ {
+ retval = ds->waitforMessage(3, pfds[0]);
+
+ if (retval == 2)
+ {
+ processRequest(ds->getData(), ds->getDataLength());
+ }
+ else if (retval == 3) // quit
+ {
+ break;
+ }
+ else
+ {
+ log->log("InputUDP", Log::CRIT, "Wait for packet error");
+ return;
+ }
+ }
+}
+
+void InputUDP::processRequest(const void* data, UINT length)
+{
+ log->log("InputUDP", Log::DEBUG, "Got request");
+
+ char* temp = new char[length + 1];
+ memcpy(temp, data, length);
+ temp[length] = '\0';
+ UINT command = static_cast<UINT>(atoi(temp));
+ delete[] temp;
+
+ log->log("InputUDP", Log::DEBUG, "Command %i recieved", command);
+ sendInputKey(command);
+}
+
+const char* InputUDP::getHardCodedHardwareKeyNamesForVompKey(UCHAR vompKey)
+{
+ return "";
+}
+
+std::string InputUDP::getHardwareKeyName(int hardwareKey)
+{
+ std::string retval;
+ return retval;
+}
+
+
+
+
+
+
+/*
+
+//void dump(unsigned char* data, USHORT size);
+//unsigned char dcc(UCHAR c);
+
+void dump(unsigned char* data, USHORT size)
+{
+ printf("Size = %u\n", size);
+
+ USHORT c = 0;
+ while(c < size)
+ {
+ if ((size - c) > 15)
+ {
+ printf(" %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\n",
+ data[c], data[c+1], data[c+2], data[c+3], data[c+4], data[c+5], data[c+6], data[c+7],
+ data[c+8], data[c+9], data[c+10], data[c+11], data[c+12], data[c+13], data[c+14], data[c+15],
+ dcc(data[c]), dcc(data[c+1]), dcc(data[c+2]), dcc(data[c+3]), dcc(data[c+4]), dcc(data[c+5]), dcc(data[c+6]), dcc(data[c+7]),
+ dcc(data[c+8]), dcc(data[c+9]), dcc(data[c+10]), dcc(data[c+11]), dcc(data[c+12]), dcc(data[c+13]), dcc(data[c+14]), dcc(data[c+15]));
+ c += 16;
+ }
+ else
+ {
+ switch (size - c)
+ {
+ case 15:
+ printf(" %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\n",
+ data[c], data[c+1], data[c+2], data[c+3], data[c+4], data[c+5], data[c+6], data[c+7],
+ data[c+8], data[c+9], data[c+10], data[c+11], data[c+12], data[c+13], data[c+14],
+ dcc(data[c]), dcc(data[c+1]), dcc(data[c+2]), dcc(data[c+3]), dcc(data[c+4]), dcc(data[c+5]), dcc(data[c+6]), dcc(data[c+7]),
+ dcc(data[c+8]), dcc(data[c+9]), dcc(data[c+10]), dcc(data[c+11]), dcc(data[c+12]), dcc(data[c+13]), dcc(data[c+14]));
+ c += 15;
+ break;
+ case 14:
+ printf(" %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %c%c%c%c%c%c%c%c%c%c%c%c%c%c\n",
+ data[c], data[c+1], data[c+2], data[c+3], data[c+4], data[c+5], data[c+6], data[c+7],
+ data[c+8], data[c+9], data[c+10], data[c+11], data[c+12], data[c+13],
+ dcc(data[c]), dcc(data[c+1]), dcc(data[c+2]), dcc(data[c+3]), dcc(data[c+4]), dcc(data[c+5]), dcc(data[c+6]), dcc(data[c+7]),
+ dcc(data[c+8]), dcc(data[c+9]), dcc(data[c+10]), dcc(data[c+11]), dcc(data[c+12]), dcc(data[c+13]));
+ c += 14;
+ break;
+ case 13:
+ printf(" %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %c%c%c%c%c%c%c%c%c%c%c%c%c\n",
+ data[c], data[c+1], data[c+2], data[c+3], data[c+4], data[c+5], data[c+6], data[c+7],
+ data[c+8], data[c+9], data[c+10], data[c+11], data[c+12],
+ dcc(data[c]), dcc(data[c+1]), dcc(data[c+2]), dcc(data[c+3]), dcc(data[c+4]), dcc(data[c+5]), dcc(data[c+6]), dcc(data[c+7]),
+ dcc(data[c+8]), dcc(data[c+9]), dcc(data[c+10]), dcc(data[c+11]), dcc(data[c+12]));
+ c += 13;
+ break;
+ case 12:
+ printf(" %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %c%c%c%c%c%c%c%c%c%c%c%c\n",
+ data[c], data[c+1], data[c+2], data[c+3], data[c+4], data[c+5], data[c+6], data[c+7],
+ data[c+8], data[c+9], data[c+10], data[c+11],
+ dcc(data[c]), dcc(data[c+1]), dcc(data[c+2]), dcc(data[c+3]), dcc(data[c+4]), dcc(data[c+5]), dcc(data[c+6]), dcc(data[c+7]),
+ dcc(data[c+8]), dcc(data[c+9]), dcc(data[c+10]), dcc(data[c+11]));
+ c += 12;
+ break;
+ case 11:
+ printf(" %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %c%c%c%c%c%c%c%c%c%c%c\n",
+ data[c], data[c+1], data[c+2], data[c+3], data[c+4], data[c+5], data[c+6], data[c+7],
+ data[c+8], data[c+9], data[c+10],
+ dcc(data[c]), dcc(data[c+1]), dcc(data[c+2]), dcc(data[c+3]), dcc(data[c+4]), dcc(data[c+5]), dcc(data[c+6]), dcc(data[c+7]),
+ dcc(data[c+8]), dcc(data[c+9]), dcc(data[c+10]));
+ c += 11;
+ break;
+ case 10:
+ printf(" %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %c%c%c%c%c%c%c%c%c%c\n",
+ data[c], data[c+1], data[c+2], data[c+3], data[c+4], data[c+5], data[c+6], data[c+7],
+ data[c+8], data[c+9],
+ dcc(data[c]), dcc(data[c+1]), dcc(data[c+2]), dcc(data[c+3]), dcc(data[c+4]), dcc(data[c+5]), dcc(data[c+6]), dcc(data[c+7]),
+ dcc(data[c+8]), dcc(data[c+9]));
+ c += 10;
+ break;
+ case 9:
+ printf(" %02X %02X %02X %02X %02X %02X %02X %02X %02X %c%c%c%c%c%c%c%c%c\n",
+ data[c], data[c+1], data[c+2], data[c+3], data[c+4], data[c+5], data[c+6], data[c+7],
+ data[c+8],
+ dcc(data[c]), dcc(data[c+1]), dcc(data[c+2]), dcc(data[c+3]), dcc(data[c+4]), dcc(data[c+5]), dcc(data[c+6]), dcc(data[c+7]),
+ dcc(data[c+8]));
+ c += 9;
+ break;
+ case 8:
+ printf(" %02X %02X %02X %02X %02X %02X %02X %02X %c%c%c%c%c%c%c%c\n",
+ data[c], data[c+1], data[c+2], data[c+3], data[c+4], data[c+5], data[c+6], data[c+7],
+ dcc(data[c]), dcc(data[c+1]), dcc(data[c+2]), dcc(data[c+3]), dcc(data[c+4]), dcc(data[c+5]), dcc(data[c+6]), dcc(data[c+7]));
+ c += 8;
+ break;
+ case 7:
+ printf(" %02X %02X %02X %02X %02X %02X %02X %c%c%c%c%c%c%c\n",
+ data[c], data[c+1], data[c+2], data[c+3], data[c+4], data[c+5], data[c+6],
+ dcc(data[c]), dcc(data[c+1]), dcc(data[c+2]), dcc(data[c+3]), dcc(data[c+4]), dcc(data[c+5]), dcc(data[c+6]));
+ c += 7;
+ break;
+ case 6:
+ printf(" %02X %02X %02X %02X %02X %02X %c%c%c%c%c%c\n",
+ data[c], data[c+1], data[c+2], data[c+3], data[c+4], data[c+5],
+ dcc(data[c]), dcc(data[c+1]), dcc(data[c+2]), dcc(data[c+3]), dcc(data[c+4]), dcc(data[c+5]));
+ c += 6;
+ break;
+ case 5:
+ printf(" %02X %02X %02X %02X %02X %c%c%c%c%c\n",
+ data[c], data[c+1], data[c+2], data[c+3], data[c+4],
+ dcc(data[c]), dcc(data[c+1]), dcc(data[c+2]), dcc(data[c+3]), dcc(data[c+4]));
+ c += 5;
+ break;
+ case 4:
+ printf(" %02X %02X %02X %02X %c%c%c%c\n",
+ data[c], data[c+1], data[c+2], data[c+3],
+ dcc(data[c]), dcc(data[c+1]), dcc(data[c+2]), dcc(data[c+3]));
+ c += 4;
+ break;
+ case 3:
+ printf(" %02X %02X %02X %c%c%c\n",
+ data[c], data[c+1], data[c+2],
+ dcc(data[c]), dcc(data[c+1]), dcc(data[c+2]));
+ c += 3;
+ break;
+ case 2:
+ printf(" %02X %02X %c%c\n",
+ data[c], data[c+1],
+ dcc(data[c]), dcc(data[c+1]));
+ c += 2;
+ break;
+ case 1:
+ printf(" %02X %c\n",
+ data[c],
+ dcc(data[c]));
+ c += 1;
+ break;
+ }
+ }
+ }
+}
+
+unsigned char dcc(UCHAR c)
+{
+ if (isspace(c)) return ' ';
+ if (isprint(c)) return c;
+ return '.';
+}
+*/
--- /dev/null
+/*
+ Copyright 2006 Chris Tallon
+
+ This file is part of VOMP.
+
+ VOMP is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ VOMP is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with VOMP. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+#ifndef INPUTUDP_H
+#define INPUTUDP_H
+
+#include <string>
+#include <thread>
+#include <mutex>
+
+#include "defines.h"
+#include "input.h"
+
+class DatagramSocket;
+class Log;
+
+class InputUDP : public Input
+{
+ public:
+ bool init();
+ void shutdown();
+
+ bool start();
+ void stop();
+
+ // FIXME these 2..
+ void InitHWCListwithDefaults() {};
+ UCHAR TranslateHWCFixed(int code) { return code; };
+ const char* getHardCodedHardwareKeyNamesForVompKey(UCHAR vompKey);
+ std::string getHardwareKeyName(int hardwareKey);
+
+
+ private:
+ bool initted{};
+ DatagramSocket* ds{};
+ Log* log{};
+
+ std::thread listenThread;
+ std::mutex threadStartProtect;
+ void listenLoop();
+ bool listenLoopStop{};
+ int pfds[2];
+
+ void processRequest(const void* data, UINT length);
+};
+
+#endif
const static ULONG CHANGED_OPTIONS = 18;
const static ULONG CONNECTION_LOST = 19;
const static ULONG MOVE_RECORDING = 20;
- const static ULONG UDP_BUTTON = 21;
const static ULONG PLAYER_EVENT = 22;
const static ULONG AUDIO_CHANGE_CHANNEL = 23;
const static ULONG CHILD_CLOSE = 24;
OBJ_COMMON = command.o tcp.o dsock.o thread.o timers.o i18n.o vdp6.o \
- message.o messagequeue.o udp.o wol.o audio.o video.o log.o mutex.o \
+ message.o messagequeue.o wol.o audio.o video.o log.o mutex.o \
vdr.o recman.o recording.o recinfo.o channel.o rectimer.o event.o \
directory.o mark.o option.o player.o playerradio.o vfeed.o afeed.o \
- demuxer.o demuxervdr.o demuxerts.o stream.o inputman.o \
+ demuxer.o demuxervdr.o demuxerts.o stream.o osd.o surface.o \
region.o colour.o boxstack.o boxx.o tbboxx.o vrecording.o \
vinfo.o vquestion.o vrecordinglist.o vrecordinglistclassic.o \
vrecordinglistadvanced.o vepgsummary.o vepglistadvanced.o \
vradiorec.o vaudioselector.o vscreensaver.o vopts.o \
wselectlist.o wjpeg.o wsymbol.o wbutton.o wtextbox.o \
woptionpane.o woptionbox.o wremoteconfig.o wtabbar.o led.o \
- input.o osd.o surface.o vpicturebanner.o abstractoption.o \
+ inputman.o input.o inputudp.o vpicturebanner.o abstractoption.o \
eventdispatcher.o vdrrequestpacket.o vdrresponsepacket.o \
vvideolivetv.o vsleeptimer.o playerlivetv.o playerliveradio.o \
wprogressbar.o bitmap.o dvbsubtitles.o tfeed.o vteletextview.o \
ledraspberry.o videoomx.o audioomx.o imageomx.o \
wjpegsimple.o inputlinux.o inputcec.o signal.o
-OBJ_WINDOWS = winmain.o threadwin.o remotewin.o ledwin.o videowin.o \
+OBJ_WINDOWS = winmain.o threadwin.o inputwin.o ledwin.o videowin.o \
audiowin.o windowsosd.o dsallocator.o dssourcefilter.o dssourcepin.o \
wwinvideofilter.o wwinvideoh264filter.o wwinaudiofilter.o \
wwinmp3audiofilter.o wjpegsimple.o
+++ /dev/null
-/*
- Copyright 2006 Chris Tallon
-
- This file is part of VOMP.
-
- VOMP is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- VOMP is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with VOMP. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-#include "udp.h"
-
-#include "dsock.h"
-#include "messagequeue.h"
-#include "message.h"
-#include "log.h"
-#include "command.h"
-
-//void dump(unsigned char* data, USHORT size);
-//unsigned char dcc(UCHAR c);
-
-UDP::UDP()
-{
- log = Log::getInstance();
- initted = 0;
-}
-
-UDP::~UDP()
-{
- shutdown();
-}
-
-int UDP::shutdown()
-{
- if (!initted) return 1;
- if (threadIsActive()) threadCancel();
- ds->shutdown();
- delete ds;
-
- initted = 0;
- return 1;
-}
-
-int UDP::run(MessageQueue* tMessageQueue)
-{
- if (threadIsActive()) return 1;
- log->log("UDP", Log::DEBUG, "Starting UDP command server");
-
- initted = 1;
-
- messageQueue = tMessageQueue;
- ds = new DatagramSocket(2000);
-
- if (!ds->init())
- {
- log->log("UDP", Log::DEBUG, "DSock init error");
- shutdown();
- return 0;
- }
-
- if (!threadStart())
- {
- log->log("UDP", Log::DEBUG, "Thread start error");
- shutdown();
- return 0;
- }
-
- log->log("UDP", Log::DEBUG, "UDP command server started");
- return 1;
-}
-
-void UDP::threadMethod()
-{
- threadSetKillable();
-
- int retval;
- while(1)
- {
- retval = ds->waitforMessage(1);
-
- if (retval == 0)
- {
- log->log("UDP", Log::CRIT, "Wait for packet error");
- return;
- }
- else if (retval == 1)
- {
- threadCheckExit();
- continue;
- }
- else
- {
- processRequest(ds->getData(), ds->getDataLength());
- }
- threadCheckExit();
- }
-}
-
-void UDP::processRequest(const void* data, UINT length)
-{
- log->log("UDP", Log::DEBUG, "Got request");
-
- char* temp = new char[length + 1];
- memcpy(temp, data, length);
- temp[length] = '\0';
- UINT command = static_cast<UINT>(atoi(temp));
- delete[] temp;
-
- log->log("UDP", Log::DEBUG, "Command %i recieved", command);
-
-
- Message *m = new Message();
- m->to = Command::getInstance();
- m->message = Message::UDP_BUTTON;
- m->parameter = command;
- messageQueue->postMessage(m);
-}
-
-/*
-void dump(unsigned char* data, USHORT size)
-{
- printf("Size = %u\n", size);
-
- USHORT c = 0;
- while(c < size)
- {
- if ((size - c) > 15)
- {
- printf(" %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\n",
- data[c], data[c+1], data[c+2], data[c+3], data[c+4], data[c+5], data[c+6], data[c+7],
- data[c+8], data[c+9], data[c+10], data[c+11], data[c+12], data[c+13], data[c+14], data[c+15],
- dcc(data[c]), dcc(data[c+1]), dcc(data[c+2]), dcc(data[c+3]), dcc(data[c+4]), dcc(data[c+5]), dcc(data[c+6]), dcc(data[c+7]),
- dcc(data[c+8]), dcc(data[c+9]), dcc(data[c+10]), dcc(data[c+11]), dcc(data[c+12]), dcc(data[c+13]), dcc(data[c+14]), dcc(data[c+15]));
- c += 16;
- }
- else
- {
- switch (size - c)
- {
- case 15:
- printf(" %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\n",
- data[c], data[c+1], data[c+2], data[c+3], data[c+4], data[c+5], data[c+6], data[c+7],
- data[c+8], data[c+9], data[c+10], data[c+11], data[c+12], data[c+13], data[c+14],
- dcc(data[c]), dcc(data[c+1]), dcc(data[c+2]), dcc(data[c+3]), dcc(data[c+4]), dcc(data[c+5]), dcc(data[c+6]), dcc(data[c+7]),
- dcc(data[c+8]), dcc(data[c+9]), dcc(data[c+10]), dcc(data[c+11]), dcc(data[c+12]), dcc(data[c+13]), dcc(data[c+14]));
- c += 15;
- break;
- case 14:
- printf(" %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %c%c%c%c%c%c%c%c%c%c%c%c%c%c\n",
- data[c], data[c+1], data[c+2], data[c+3], data[c+4], data[c+5], data[c+6], data[c+7],
- data[c+8], data[c+9], data[c+10], data[c+11], data[c+12], data[c+13],
- dcc(data[c]), dcc(data[c+1]), dcc(data[c+2]), dcc(data[c+3]), dcc(data[c+4]), dcc(data[c+5]), dcc(data[c+6]), dcc(data[c+7]),
- dcc(data[c+8]), dcc(data[c+9]), dcc(data[c+10]), dcc(data[c+11]), dcc(data[c+12]), dcc(data[c+13]));
- c += 14;
- break;
- case 13:
- printf(" %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %c%c%c%c%c%c%c%c%c%c%c%c%c\n",
- data[c], data[c+1], data[c+2], data[c+3], data[c+4], data[c+5], data[c+6], data[c+7],
- data[c+8], data[c+9], data[c+10], data[c+11], data[c+12],
- dcc(data[c]), dcc(data[c+1]), dcc(data[c+2]), dcc(data[c+3]), dcc(data[c+4]), dcc(data[c+5]), dcc(data[c+6]), dcc(data[c+7]),
- dcc(data[c+8]), dcc(data[c+9]), dcc(data[c+10]), dcc(data[c+11]), dcc(data[c+12]));
- c += 13;
- break;
- case 12:
- printf(" %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %c%c%c%c%c%c%c%c%c%c%c%c\n",
- data[c], data[c+1], data[c+2], data[c+3], data[c+4], data[c+5], data[c+6], data[c+7],
- data[c+8], data[c+9], data[c+10], data[c+11],
- dcc(data[c]), dcc(data[c+1]), dcc(data[c+2]), dcc(data[c+3]), dcc(data[c+4]), dcc(data[c+5]), dcc(data[c+6]), dcc(data[c+7]),
- dcc(data[c+8]), dcc(data[c+9]), dcc(data[c+10]), dcc(data[c+11]));
- c += 12;
- break;
- case 11:
- printf(" %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %c%c%c%c%c%c%c%c%c%c%c\n",
- data[c], data[c+1], data[c+2], data[c+3], data[c+4], data[c+5], data[c+6], data[c+7],
- data[c+8], data[c+9], data[c+10],
- dcc(data[c]), dcc(data[c+1]), dcc(data[c+2]), dcc(data[c+3]), dcc(data[c+4]), dcc(data[c+5]), dcc(data[c+6]), dcc(data[c+7]),
- dcc(data[c+8]), dcc(data[c+9]), dcc(data[c+10]));
- c += 11;
- break;
- case 10:
- printf(" %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %c%c%c%c%c%c%c%c%c%c\n",
- data[c], data[c+1], data[c+2], data[c+3], data[c+4], data[c+5], data[c+6], data[c+7],
- data[c+8], data[c+9],
- dcc(data[c]), dcc(data[c+1]), dcc(data[c+2]), dcc(data[c+3]), dcc(data[c+4]), dcc(data[c+5]), dcc(data[c+6]), dcc(data[c+7]),
- dcc(data[c+8]), dcc(data[c+9]));
- c += 10;
- break;
- case 9:
- printf(" %02X %02X %02X %02X %02X %02X %02X %02X %02X %c%c%c%c%c%c%c%c%c\n",
- data[c], data[c+1], data[c+2], data[c+3], data[c+4], data[c+5], data[c+6], data[c+7],
- data[c+8],
- dcc(data[c]), dcc(data[c+1]), dcc(data[c+2]), dcc(data[c+3]), dcc(data[c+4]), dcc(data[c+5]), dcc(data[c+6]), dcc(data[c+7]),
- dcc(data[c+8]));
- c += 9;
- break;
- case 8:
- printf(" %02X %02X %02X %02X %02X %02X %02X %02X %c%c%c%c%c%c%c%c\n",
- data[c], data[c+1], data[c+2], data[c+3], data[c+4], data[c+5], data[c+6], data[c+7],
- dcc(data[c]), dcc(data[c+1]), dcc(data[c+2]), dcc(data[c+3]), dcc(data[c+4]), dcc(data[c+5]), dcc(data[c+6]), dcc(data[c+7]));
- c += 8;
- break;
- case 7:
- printf(" %02X %02X %02X %02X %02X %02X %02X %c%c%c%c%c%c%c\n",
- data[c], data[c+1], data[c+2], data[c+3], data[c+4], data[c+5], data[c+6],
- dcc(data[c]), dcc(data[c+1]), dcc(data[c+2]), dcc(data[c+3]), dcc(data[c+4]), dcc(data[c+5]), dcc(data[c+6]));
- c += 7;
- break;
- case 6:
- printf(" %02X %02X %02X %02X %02X %02X %c%c%c%c%c%c\n",
- data[c], data[c+1], data[c+2], data[c+3], data[c+4], data[c+5],
- dcc(data[c]), dcc(data[c+1]), dcc(data[c+2]), dcc(data[c+3]), dcc(data[c+4]), dcc(data[c+5]));
- c += 6;
- break;
- case 5:
- printf(" %02X %02X %02X %02X %02X %c%c%c%c%c\n",
- data[c], data[c+1], data[c+2], data[c+3], data[c+4],
- dcc(data[c]), dcc(data[c+1]), dcc(data[c+2]), dcc(data[c+3]), dcc(data[c+4]));
- c += 5;
- break;
- case 4:
- printf(" %02X %02X %02X %02X %c%c%c%c\n",
- data[c], data[c+1], data[c+2], data[c+3],
- dcc(data[c]), dcc(data[c+1]), dcc(data[c+2]), dcc(data[c+3]));
- c += 4;
- break;
- case 3:
- printf(" %02X %02X %02X %c%c%c\n",
- data[c], data[c+1], data[c+2],
- dcc(data[c]), dcc(data[c+1]), dcc(data[c+2]));
- c += 3;
- break;
- case 2:
- printf(" %02X %02X %c%c\n",
- data[c], data[c+1],
- dcc(data[c]), dcc(data[c+1]));
- c += 2;
- break;
- case 1:
- printf(" %02X %c\n",
- data[c],
- dcc(data[c]));
- c += 1;
- break;
- }
- }
- }
-}
-
-unsigned char dcc(UCHAR c)
-{
- if (isspace(c)) return ' ';
- if (isprint(c)) return c;
- return '.';
-}
-*/
+++ /dev/null
-/*
- Copyright 2006 Chris Tallon
-
- This file is part of VOMP.
-
- VOMP is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- VOMP is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with VOMP. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-#ifndef UDP_H
-#define UDP_H
-
-#include <stdio.h>
-#include <signal.h>
-#include <ctype.h>
-
-#include "defines.h"
-
-#include "threadsystem.h"
-
-class DatagramSocket;
-class MessageQueue;
-class Log;
-
-class UDP : public Thread_TYPE
-{
- public:
- UDP();
- virtual ~UDP();
-
- int run(MessageQueue* messageQueue);
- int shutdown();
-
- private:
- void threadPostStopCleanup() {};
-
- void threadMethod();
- void processRequest(const void* data, UINT length);
-
- int initted;
- DatagramSocket* ds;
- MessageQueue* messageQueue;
- Log* log;
-};
-
-#endif
if (initted) return 0;
initted = 1;
+ // libcec calls bcm_host_init() - but in case CEC is disabled call it here as well.
+ // Seems safe to call it more than once.
+ bcm_host_init();
+
int ret=vc_gencmd_send("codec_enabled MPG2");
if (ret!=0) {
Log::getInstance()->log("Video", Log::DEBUG, "vc_gencmd_send failed %x",ret);
}
}
- InputMan::getInstance()->shutdown();
+ // InputMan::getInstance()->shutdown(); FIXME FIXME FIXME - disabling this temp, why does this have to run?
vc_tv_power_off();
if (mymode) {
Log::getInstance()->log("Video", Log::NOTICE, "Switch to optimum mode");
} else {
/* analog tv case */
Log::getInstance()->log("Video", Log::NOTICE, "Analog tv case");
- InputMan::getInstance()->shutdown();
- vc_tv_power_off();
+ // InputMan::getInstance()->shutdown(); FIXME FIXME FIXME - disabling this temp, why does this have to run? vc_tv_power_off();
SDTV_MODE_T setmode=SDTV_MODE_PAL;
SDTV_OPTIONS_T options;
hdmi=false;
}
- InputMan::getInstance()->init(); // FIXME complete shutdown and reinit maybe heavy handed.
+// InputMan::getInstance()->init(); // FIXME complete shutdown and reinit maybe heavy handed. FIXME FIXME FIXME - disabled temp
// If this was just to reinit CEC then funcitons should be made to do that
if (sec == -1)
{
- Message* m2 = new Message(); // Delete self
- m2->message = Message::UDP_BUTTON;
+ Message* m2 = new Message();
+ m2->message = Message::INPUT_EVENT;
m2->to = Command::getInstance();
m2->from = this;
- m2->parameter = 61; // FIXME use constant name when they're sorted out
+ m2->parameter = Input::POWER;
MessageQueue::getInstance()->postMessage(m2);
shutdown();
}
Timers::getInstance()->setTimerD(this, 1, 1);
}
-void VCountdown::timercall(int clientReference)
+void VCountdown::timercall(int /* clientReference */)
{
// delete me!
Message* m = new Message(); // Delete self
/*
- Copyright 2007 Chris Tallon, Marten Richter
+ Copyright 2007-2020 Chris Tallon, Marten Richter
This file is part of VOMP.
along with VOMP. If not, see <https://www.gnu.org/licenses/>.
*/
-#include "wremoteconfig.h"
+#include <string>
+#include "log.h"
#include "input.h"
#include "inputman.h"
#include "wsymbol.h"
#include "colour.h"
#include "i18n.h"
#include "boxstack.h"
+#include "wremoteconfig.h"
+
+
WRemoteConfig::WRemoteConfig()
{
void WRemoteConfig::initSelectList(bool startup)
{
+ InputMan* inputMan = InputMan::getInstance();
+
ULONG selection = 0;
ULONG top = 0;
sl.addColumn(150);
sl.addColumn(300);
- ULONG i;
- for (i = 0; i < 256; i++)
+ for (UINT i = 0; i < 256; i++)
{
- const char * name = InputMan::CommandDesc((UCHAR)i);
- if (name != NULL)
+ Log::getInstance()->log("WRemoteConfig", Log::DEBUG, "%u", i);
+ const char* vompKeyName = InputMan::getVompKeyName(static_cast<UCHAR>(i));
+ if (vompKeyName != NULL)
{
- //char *line = remote->CommandTranslateStr((UCHAR)i);
-
- const char* line = "UNK,FIXME";
+ std::string line;
+ line.reserve(150);
+ line += vompKeyName;
+ line += ":\t";
+ Log::getInstance()->log("WRemoteConfig", Log::DEBUG, "A");
+ line += inputMan->getHardCodedHardwareKeyNamesForVompKey(static_cast<UCHAR>(i));
+ line += '\t';
+ Log::getInstance()->log("WRemoteConfig", Log::DEBUG, "B");
+ line += inputMan->getAllHardwareKeyNamesAssignedToVompKey(static_cast<UCHAR>(i));
+ Log::getInstance()->log("WRemoteConfig", Log::DEBUG, "C");
- sl.addOption(line,i,0);
+ sl.addOption(line.c_str(), i, 0);
}
}
+
if (!startup)
{
sl.hintSetCurrent(selection);