#include "vinfo.h"
#include "boxx.h"
#include "boxstack.h"
-#include "oldlog.h"
+#include "log.h"
#include "sleeptimer.h"
#include "wjpeg.h"
#include "osdvector.h"
#include "control.h"
+static const char* TAG = "Control";
+
Control* Control::instance = NULL;
Control::Control()
{
if (initted) return false;
crashed = tcrashed;
- logger = Log::getInstance();
+ logger = LogNT::getInstance();
SkinFactory::InitSkin(0);
}
catch (int e)
{
- if (e == 10) logger->log("Control", Log::EMERG, "LED module failed to create");
- else if (e == 11) logger->log("Control", Log::EMERG, "LED module failed to initialise");
- else if (e == 20) logger->log("Control", Log::EMERG, "Timers module failed to create");
- else if (e == 21) logger->log("Control", Log::EMERG, "Timers module failed to initialise");
- else if (e == 30) logger->log("Control", Log::EMERG, "Video module failed to create");
- else if (e == 31) logger->log("Control", Log::EMERG, "Video module failed to initialise");
- else if (e == 40) logger->log("Control", Log::EMERG, "Audio module failed to create");
- else if (e == 41) logger->log("Control", Log::EMERG, "Audio module failed to initialise");
- else if (e == 50) logger->log("Control", Log::EMERG, "OSD module failed to create");
- else if (e == 51) logger->log("Control", Log::EMERG, "OSD module failed to initialise");
- else if (e == 60) logger->log("Control", Log::EMERG, "VDR module failed to create");
- else if (e == 61) logger->log("Control", Log::EMERG, "VDR module failed to initialise");
- else if (e == 70) logger->log("Control", Log::EMERG, "BoxStack module failed to create");
- else if (e == 71) logger->log("Control", Log::EMERG, "BoxStack module failed to initialise");
- else if (e == 80) logger->log("Control", Log::EMERG, "SleepTimer module failed to create");
- else if (e == 90) logger->log("Control", Log::EMERG, "WOL module failed to create");
- else if (e == 100) logger->log("Control", Log::EMERG, "InputMan module failed to create");
- else if (e == 101) logger->log("Control", Log::EMERG, "InputMan module failed to initialise");
+ if (e == 10) logger->crit(TAG, "LED module failed to create");
+ else if (e == 11) logger->crit(TAG, "LED module failed to initialise");
+ else if (e == 20) logger->crit(TAG, "Timers module failed to create");
+ else if (e == 21) logger->crit(TAG, "Timers module failed to initialise");
+ else if (e == 30) logger->crit(TAG, "Video module failed to create");
+ else if (e == 31) logger->crit(TAG, "Video module failed to initialise");
+ else if (e == 40) logger->crit(TAG, "Audio module failed to create");
+ else if (e == 41) logger->crit(TAG, "Audio module failed to initialise");
+ else if (e == 50) logger->crit(TAG, "OSD module failed to create");
+ else if (e == 51) logger->crit(TAG, "OSD module failed to initialise");
+ else if (e == 60) logger->crit(TAG, "VDR module failed to create");
+ else if (e == 61) logger->crit(TAG, "VDR module failed to initialise");
+ else if (e == 70) logger->crit(TAG, "BoxStack module failed to create");
+ else if (e == 71) logger->crit(TAG, "BoxStack module failed to initialise");
+ else if (e == 80) logger->crit(TAG, "SleepTimer module failed to create");
+ else if (e == 90) logger->crit(TAG, "WOL module failed to create");
+ else if (e == 100) logger->crit(TAG, "InputMan module failed to create");
+ else if (e == 101) logger->crit(TAG, "InputMan module failed to initialise");
switch(e)
{
inputMan->shutdown();
delete inputMan;
inputMan = NULL;
- logger->log("Control", Log::NOTICE, "InputMan module shut down");
+ logger->info(TAG, "InputMan module shut down");
}
if (wol)
{
delete wol;
- logger->log("Control", Log::NOTICE, "WOL module shut down");
+ logger->info(TAG, "WOL module shut down");
}
if (sleepTimer)
{
delete sleepTimer;
sleepTimer = NULL;
- logger->log("Control", Log::NOTICE, "SleepTimer module shut down");
+ logger->info(TAG, "SleepTimer module shut down");
}
if (boxstack)
boxstack->shutdown();
delete boxstack;
boxstack = NULL;
- logger->log("Control", Log::NOTICE, "BoxStack module shut down");
+ logger->info(TAG, "BoxStack module shut down");
}
if (vdr)
vdr->shutdown();
delete vdr;
vdr = NULL;
- logger->log("Control", Log::NOTICE, "VDR module shut down");
+ logger->info(TAG, "VDR module shut down");
}
if (osd)
osd->shutdown();
delete osd;
osd = NULL;
- logger->log("Control", Log::NOTICE, "OSD module shut down");
+ logger->info(TAG, "OSD module shut down");
}
if (audio)
audio->shutdown();
delete audio;
audio = NULL;
- logger->log("Control", Log::NOTICE, "Audio module shut down");
+ logger->info(TAG, "Audio module shut down");
}
if (video)
video->shutdown();
delete video;
video = NULL;
- logger->log("Control", Log::NOTICE, "Video module shut down");
+ logger->info(TAG, "Video module shut down");
}
if (timers)
timers->shutdown();
delete timers;
timers = NULL;
- logger->log("Control", Log::NOTICE, "Timers module shut down");
+ logger->info(TAG, "Timers module shut down");
}
if (led)
led->shutdown();
delete led;
led = NULL;
- logger->log("Control", Log::NOTICE, "LED module shut down");
+ logger->info(TAG, "LED module shut down");
}
}
void Control::stop()
{
- logger->log("Control", Log::NOTICE, "Request stop");
+ logger->info(TAG, "Request stop");
Message* m = new Message(); // break master loop
m->message = Message::SHUTDOWN;
if (video->getFormat() == Video::PAL)
{
- logger->log("Control", Log::DEBUG, "PAL wallpaper selected");
+ logger->debug(TAG, "PAL wallpaper selected");
#ifndef _MIPS_ARCH
wallpaper_pict->init("/wallpaperPAL.jpg");
#else
}
else
{
- logger->log("Control", Log::DEBUG, "NTSC wallpaper selected");
+ logger->debug(TAG, "NTSC wallpaper selected");
wallpaper_pict->init("/wallpaperNTSC.jpg");
}
while(irun)
{
messageQueueCond.wait(lockWrapper, [&] { return !irun || !messages.empty(); });
- logger->log("Control", Log::DEBUG, "woke");
+ logger->debug(TAG, "woke");
if (!irun) break;
// themselves as receivers to avoid the calling-a-deleted-object problem
// then only deliver/register/unregister would have to be protected
- logger->log("Control", Log::DEBUG, "processing message %i", m->message);
+ logger->debug(TAG, "processing message {}", m->message);
if ((m->p_to == Message::CONTROL) || (m->to == this)) // Maybe don't check m->to here? Always use predefined?
}
case Message::SCREENSHOT:
{
- logger->log("Osd", Log::NOTICE, "Screenshot Message arrived");
+ logger->info(TAG, "Screenshot Message arrived");
Osd::getInstance()->screenShot("out.jpg");
break;
}
}
case Message::INPUT_EVENT:
{
- logger->log("Control", Log::NOTICE, "INPUT_EVENT %i", m->parameter);
+ logger->info(TAG, "INPUT_EVENT {}", m->parameter);
handleCommand(m->parameter);
break;
This could all be done using the existing big control mutex to keep it simple
*/
- logger->log("Control", Log::DEBUG, "Sending message to boxstack");
+ logger->debug(TAG, "Sending message to boxstack");
boxstack->processMessage(m);
}
}
}
case Input::GO:
{
- logger->log("Control", Log::DEBUG, "Handling sleeptimer go");
+ logger->debug(TAG, "Handling sleeptimer go");
sleepTimer->go();
return;
}
{
if (connLost)
{
- logger->log("Control", Log::NOTICE, "Connection lost dialog already present");
+ logger->info(TAG, "Connection lost dialog already present");
return;
}
- logger->log("Control", Log::NOTICE, "Doing connection lost dialog");
+ logger->info(TAG, "Doing connection lost dialog");
connLost = new VInfo();
connLost->setSize(360, 200);
connLost->createBuffer();
logger->unsetExternLogger();
VDR::getInstance()->disconnect();
// just kill it...
- logger->log("Control", Log::NOTICE, "Reboot");
+ logger->info(TAG, "Reboot");
#ifndef WIN32
#ifndef VOMP_HAS_EXIT
// some plattforms, want a proper deinitialisation of their hardware before reboot
{
I18n::initialize();
if (!VDR::getInstance()->isConnected()) { connectionLost(); return; }
- logger->log("Control", Log::INFO, "Entering doJustConnected");
+ logger->info(TAG, "Entering doJustConnected");
boxstack->remove(vconnect);
config = vdr->configLoad("Advanced", "Network logging");
if (config && !STRCASECMP(config, "On"))
{
- logger->log("Control", Log::INFO, "Turning on network logging");
+ logger->info(TAG, "Turning on network logging");
logger->setExternLogger(vdr);
}
else
{
logger->unsetExternLogger();
- logger->log("Control", Log::INFO, "Turned off network logging");
+ logger->info(TAG, "Turned off network logging");
}
if (config) delete[] config;
config = vdr->configLoad("General", "Override Video Format");
if (config)
{
- logger->log("Control", Log::DEBUG, "Override Video Format is present");
+ logger->debug(TAG, "Override Video Format is present");
if ( (!strcmp(config, "PAL") && (video->getFormat() != Video::PAL))
|| (!strcmp(config, "NTSC") && (video->getFormat() != Video::NTSC))
// Get video and osd back up with the new mode
if (!strcmp(config, "PAL"))
{
- logger->log("Control", Log::DEBUG, "Switching to PAL");
+ logger->debug(TAG, "Switching to PAL");
video->init(Video::PAL);
}
else if (!strcmp(config, "NTSC"))
{
- logger->log("Control", Log::DEBUG, "Switching to NTSC");
+ logger->debug(TAG, "Switching to NTSC");
video->init(Video::NTSC);
} else if (!strcmp(config, "PAL_M"))
{
- logger->log("Control", Log::DEBUG, "Switching to PAL_M");
+ logger->debug(TAG, "Switching to PAL_M");
video->init(Video::PAL_M);
} else if (!strcmp(config, "NTSC_J"))
{
- logger->log("Control", Log::DEBUG, "Switching to NTSC_J");
+ logger->debug(TAG, "Switching to NTSC_J");
video->init(Video::NTSC_J);
}
delete[] config;
}
else
{
- logger->log("Control", Log::DEBUG, "Already in requested mode, or request was not 'PAL' or 'NTSC'");
+ logger->debug(TAG, "Already in requested mode, or request was not 'PAL' or 'NTSC'");
}
}
else
{
- logger->log("Control", Log::DEBUG, "Phew, no dangerous on-the-fly mode switching to do!");
+ logger->debug(TAG, "Phew, no dangerous on-the-fly mode switching to do!");
}
// Power off if first boot and config says so
{
firstBoot = false;
- logger->log("Control", Log::DEBUG, "Load power after boot");
+ logger->debug(TAG, "Load power after boot");
config = vdr->configLoad("General", "Power After Boot");
{
if (!STRCASECMP(config, "On"))
{
- logger->log("Control", Log::INFO, "Config says Power After Boot = On");
+ logger->info(TAG, "Config says Power After Boot = On");
}
else if (!STRCASECMP(config, "Off"))
{
- logger->log("Control", Log::INFO, "Config says Power After Boot = Off");
+ logger->info(TAG, "Config says Power After Boot = Off");
doStandby();
delete[] config;
return; // quit here
{
if (!STRCASECMP(lastPowerState, "On"))
{
- logger->log("Control", Log::INFO, "Config says Last Power State = On");
+ logger->info(TAG, "Config says Last Power State = On");
}
else if (!STRCASECMP(lastPowerState, "Off"))
{
- logger->log("Control", Log::INFO, "Config says Last Power State = Off");
+ logger->info(TAG, "Config says Last Power State = Off");
doStandby();
delete[] config;
return; // quit here
}
else
{
- logger->log("Control", Log::INFO, "Config General/Last Power State not understood");
+ logger->info(TAG, "Config General/Last Power State not understood");
}
}
else
{
- logger->log("Control", Log::INFO, "Config General/Last Power State not found");
+ logger->info(TAG, "Config General/Last Power State not found");
}
}
else
{
- logger->log("Control", Log::INFO, "Config/Power After Boot not understood");
+ logger->info(TAG, "Config/Power After Boot not understood");
}
delete[] config;
}
else
{
- logger->log("Control", Log::INFO, "Config General/Power After Boot not found");
+ logger->info(TAG, "Config General/Power After Boot not found");
}
}
{
if (!STRCASECMP(config, "S-Video"))
{
- logger->log("Control", Log::INFO, "Switching to S-Video as Connection=%s", config);
+ logger->info(TAG, "Switching to S-Video as Connection=%s", config);
video->setConnection(Video::SVIDEO);
} else if (!STRCASECMP(config, "HDMI"))
{
- logger->log("Control", Log::INFO, "Switching to HDMI as Connection=%s", config);
+ logger->info(TAG, "Switching to HDMI as Connection=%s", config);
video->setConnection(Video::HDMI);
} else if (!STRCASECMP(config, "HDMI3D"))
{
- logger->log("Control", Log::INFO, "Switching to HDMI3D as Connection=%s", config);
+ logger->info(TAG, "Switching to HDMI3D as Connection=%s", config);
video->setConnection(Video::HDMI3D);
}
else
{
- logger->log("Control", Log::INFO, "Switching to RGB/Composite as Connection=%s", config);
+ logger->info(TAG, "Switching to RGB/Composite as Connection=%s", config);
video->setConnection(Video::COMPOSITERGB);
}
delete[] config;
}
else
{
- logger->log("Control", Log::INFO, "Config TV/S-Video not found");
+ logger->info(TAG, "Config TV/S-Video not found");
}
// Set to shutdown VDR if config says
{
if (!STRCASECMP(config, "On"))
{
- logger->log("Control", Log::INFO, "Shutdown VDR when shutting down vomp");
+ logger->info(TAG, "Shutdown VDR when shutting down vomp");
vdr->setVDRShutdown(true);
}
else if (!STRCASECMP(config, "Off"))
{
- logger->log("Control", Log::INFO, "Shutdown only vomp");
+ logger->info(TAG, "Shutdown only vomp");
vdr->setVDRShutdown(false);
}
}
else
{
- logger->log("Control", Log::INFO, "Default shutdown only vomp");
+ logger->info(TAG, "Default shutdown only vomp");
vdr->setVDRShutdown(false); // Default
}
{
if (!STRCASECMP(config, "16:9"))
{
- logger->log("Control", Log::INFO, "/// Switching to TV aspect 16:9");
+ logger->info(TAG, "/// Switching to TV aspect 16:9");
video->setTVsize(Video::ASPECT16X9);
}
else
{
- logger->log("Control", Log::INFO, "/// Switching to TV aspect 4:3");
+ logger->info(TAG, "/// Switching to TV aspect 4:3");
video->setTVsize(Video::ASPECT4X3);
}
delete[] config;
}
else
{
- logger->log("Control", Log::INFO, "Config TV/Aspect type not found, going 4:3");
+ logger->info(TAG, "Config TV/Aspect type not found, going 4:3");
video->setTVsize(Video::ASPECT4X3);
}
{
if (!STRCASECMP(config, "Letterbox"))
{
- logger->log("Control", Log::INFO, "Setting letterbox mode");
+ logger->info(TAG, "Setting letterbox mode");
video->setMode(Video::LETTERBOX);
}
else
{
- logger->log("Control", Log::INFO, "Setting chop-sides mode");
+ logger->info(TAG, "Setting chop-sides mode");
video->setMode(Video::NORMAL);
}
delete[] config;
else
{
#ifdef __ANDROID__
- logger->log("Control", Log::INFO, "Config TV/Widemode not found, Setting letterbox mode");
+ logger->info(TAG, "Config TV/Widemode not found, Setting letterbox mode");
video->setMode(Video::LETTERBOX);
#else
- logger->log("Control", Log::INFO, "Config TV/Widemode not found, Setting chop-sides mode");
+ logger->info(TAG, "Config TV/Widemode not found, Setting chop-sides mode");
video->setMode(Video::NORMAL);
#endif
}
size_t newTCPsize = atoi(config);
delete[] config;
- logger->log("Control", Log::INFO, "Setting TCP window size %i", newTCPsize);
+ logger->info(TAG, "Setting TCP window size %i", newTCPsize);
vdr->setReceiveWindow(newTCPsize);
}
else
{
- logger->log("Control", Log::INFO, "TCP window size not found, setting 2048");
+ logger->info(TAG, "TCP window size not found, setting 2048");
if (DEFAULT_TCP_WINDOWSIZE) vdr->setReceiveWindow(2048); // Default
}
if (config)
{
Osd::getInstance()->setFont(config);
- logger->log("Control", Log::INFO, "Setting Font to %s", config);
+ logger->info(TAG, "Setting Font to %s", config);
delete[] config;
}
{
if (!STRCASECMP(config, "Advanced"))
{
- logger->log("Control", Log::INFO, "Switching to Advanced menu");
+ logger->info(TAG, "Switching to Advanced menu");
advMenus = true;
}
else
{
- logger->log("Control", Log::INFO, "Switching to Classic menu");
+ logger->info(TAG, "Switching to Classic menu");
advMenus = false;
}
delete[] config;
}
else
{
- logger->log("Control", Log::INFO, "Config General/menu type not found");
+ logger->info(TAG, "Config General/menu type not found");
advMenus = true;
}
#endif
{
if (!STRCASECMP(config, "Yes"))
{
- logger->log("Control", Log::INFO, "Config says disable WOL");
+ logger->info(TAG, "Config says disable WOL");
Wol::getInstance()->setEnabled(false);
}
else
{
- logger->log("Control", Log::INFO, "Config says enable WOL");
+ logger->info(TAG, "Config says enable WOL");
Wol::getInstance()->setEnabled(true);
}
}
else
{
- logger->log("Control", Log::INFO, "By default, enable WOL");
+ logger->info(TAG, "By default, enable WOL");
Wol::getInstance()->setEnabled(true);
}
/* device dependend config */
class InputMan;
class Boxx;
class BoxStack;
-class Log;
+class LogNT;
class VInfo;
class WJpeg;
class SleepTimer;
static Control* instance;
- Log* logger;
+ LogNT* logger;
bool initted{};
bool irun{};
#include "wremoteconfig.h"
#include "i18n.h"
-#include "oldlog.h"
+#include "log.h"
#include "vdr.h"
#include "wtabbar.h"
#include "message.h"
#include "inputman.h"
#include "input.h"
+static const char* TAG = "Input";
+
void Input::ResetToDefault()
{
translist.clear();
{
ULONG number=0;
if (sscanf(cfg,"%ld",&number) != 1) return;
- Log::getInstance()->log("Input", Log::INFO, "Config Input/Remote keys num keys %d",number);
+ LogNT::getInstance()->info(TAG, "Config Input/Remote keys num keys {}", number);
char keybuf[1024];
for (ULONG i = 0; i < number; i++) {
sprintf(keybuf, "RemoteKey%lu", i);
if (config)
{
- Log::getInstance()->log("Input", Log::INFO, "Config Input/Remote keys load");
+ LogNT::getInstance()->info(TAG, "Config Input/Remote keys load");
LoadKeysConfig(vdr,config);
delete[] config;
}
else
{
- Log::getInstance()->log("Input", Log::INFO, "Config Input/Remote keys not found");
+ LogNT::getInstance()->info(TAG, "Config Input/Remote keys not found");
InitHWCListwithDefaults();
}
return true;
*/
#include "config.h"
-#include "oldlog.h"
+#include "log.h"
#include "wremoteconfig.h"
#include "wtabbar.h"
#ifdef VOMP_PLATFORM_RASPBERRY
#include "inputman.h"
+static const char* TAG = "InputMan";
+
InputMan* InputMan::instance = NULL;
InputMan::InputMan()
if (!oneOK)
{
- Log::getInstance()->log("InputMan", Log::CRIT, "InputMan could not init any input module");
+ LogNT::getInstance()->crit(TAG, "InputMan could not init any input module");
return false;
}
bool InputMan::start()
{
- Log::getInstance()->log("InputMan", Log::DEBUG, "Start");
+ LogNT::getInstance()->debug(TAG, "Start");
bool oneOK{};
}
if (!oneOK)
- Log::getInstance()->log("InputMan", Log::CRIT, "InputMan could not start any input module");
+ LogNT::getInstance()->crit(TAG, "InputMan could not start any input module");
return oneOK;
}
void InputMan::stop()
{
- Log::getInstance()->log("InputMan", Log::DEBUG, "Stop called");
+ LogNT::getInstance()->debug(TAG, "Stop called");
#ifdef VOMP_PLATFORM_RASPBERRY
if (inputLinux) inputLinux->stop();
void InputMan::shutdown()
{
- Log::getInstance()->log("InputMan", Log::DEBUG, "Shutdown start");
+ LogNT::getInstance()->debug(TAG, "Shutdown start");
#ifdef VOMP_PLATFORM_RASPBERRY
if (inputLinux)
{
- Log::getInstance()->log("InputMan", Log::DEBUG, "Shutdown start - Linux");
+ LogNT::getInstance()->debug(TAG, "Shutdown start - Linux");
inputLinux->stop();
inputLinux->shutdown();
delete inputLinux;
if (inputCEC)
{
- Log::getInstance()->log("InputMan", Log::DEBUG, "Shutdown start - CEC");
+ LogNT::getInstance()->debug(TAG, "Shutdown start - CEC");
inputCEC->shutdown();
delete inputCEC;
inputCEC = NULL;
if (inputUDP)
{
- Log::getInstance()->log("InputMan", Log::DEBUG, "Shutdown start - UDP");
+ LogNT::getInstance()->debug(TAG, "Shutdown start - UDP");
inputUDP->stop();
inputUDP->shutdown();
delete inputUDP;
if (inputLirc)
{
- Log::getInstance()->log("InputMan", Log::DEBUG, "Shutdown start - LIRC");
+ LogNT::getInstance()->debug(TAG, "Shutdown start - LIRC");
inputLirc->stop();
inputLirc->shutdown();
delete inputLirc;
else if (!strcmp(vompKeyName, "PLAYPAUSE")) return Input::PLAYPAUSE;
else if (!strcmp(vompKeyName, "POWERON")) return Input::POWERON;
else if (!strcmp(vompKeyName, "POWEROFF")) return Input::POWEROFF;
- else return NULL;
+ else return Input::NA_UNKNOWN;
}
std::string InputMan::getHardCodedHardwareKeyNamesForVompKey(UCHAR vompKey)
#include <unistd.h>
#endif
-#include "oldlog.h"
+#include "log.h"
#include "inputudp.h"
+static const char* TAG = "InputUDP";
+
const char* InputUDP::myModName = "InputUDP";
bool InputUDP::init()
{
if (initted) return false;
initted = true;
- log = Log::getInstance();
- log->log("InputUDP", Log::DEBUG, "Starting InputUDP command server");
+ log = LogNT::getInstance();
+ log->debug(TAG, "Starting InputUDP command server");
if (!udp4.init(2000))
{
- log->log("InputUDP", Log::DEBUG, "UDP4 init error");
+ log->debug(TAG, "UDP4 init error");
initted = false;
return false;
}
quitPipe = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (quitPipe == INVALID_SOCKET)
{
- Log::getInstance()->log("InputUDP", Log::ERR, "Win32 socket fail");
+ log->error(TAG, "Win32 socket fail");
#else
if (pipe2(pfds, O_NONBLOCK) == -1)
{
- Log::getInstance()->log("InputUDP", Log::ERR, "pipe2() fail");
+ log->error(TAG, "pipe2() fail");
#endif
udp4.shutdown();
initted = false;
});
threadStartProtect.unlock();
- log->log("InputUDP", Log::DEBUG, "InputUDP command server started");
+ log->debug(TAG, "InputUDP command server started");
return true;
}
if (listenThread.joinable())
{
#ifdef WIN32
- Log::getInstance()->log("InputUDP", Log::DEBUG, "Calling CLOSESOCKET on WIN32 quitPipe");
+ log->debug(TAG, "Calling CLOSESOCKET on WIN32 quitPipe");
CLOSESOCKET(quitPipe);
#else
#else
retval = udp4.waitforMessage(3, pfds[0]);
#endif
- Log::getInstance()->log("InputUDP", Log::DEBUG, "Back from waitForMessage");
+ log->debug(TAG, "Back from waitForMessage");
if (retval == 2)
{
}
else if (retval == 3) // quit
{
- Log::getInstance()->log("InputUDP", Log::DEBUG, "quit");
+ log->debug(TAG, "quit");
break;
}
else
{
- log->log("InputUDP", Log::CRIT, "Wait for packet error");
+ log->crit(TAG, "Wait for packet error");
return;
}
}
void InputUDP::processRequest(const void* data, UINT length)
{
- log->log("InputUDP", Log::DEBUG, "Got request");
+ log->debug(TAG, "Got request");
char* temp = new char[length + 1];
memcpy(temp, data, length);
UINT command = static_cast<UINT>(atoi(temp));
delete[] temp;
- log->log("InputUDP", Log::DEBUG, "Command %i recieved", command);
+ log->debug(TAG, "Command {} recieved", command);
sendInputKey(command);
}
#include "udp4.h"
#include "input.h"
-class Log;
+class LogNT;
class InputUDP : public Input
{
bool initted{};
UDP4 udp4; // FIXME UDP6 ?
- Log* log{};
+ LogNT* log{};
std::thread listenThread;
std::mutex threadStartProtect;
enum levels { TRACE, DEBUG, INFO, WARN, ERROR, CRIT };
- template<typename... Ts> void trace(const char* TAG, Ts... args) { log(TAG, TRACE, args...); }
- template<typename... Ts> void debug(const char* TAG, Ts... args) { log(TAG, DEBUG, args...); }
- template<typename... Ts> void info (const char* TAG, Ts... args) { log(TAG, INFO, args...); }
- template<typename... Ts> void warn (const char* TAG, Ts... args) { log(TAG, WARN, args...); }
- template<typename... Ts> void error(const char* TAG, Ts... args) { log(TAG, ERROR, args...); }
- template<typename... Ts> void crit (const char* TAG, Ts... args) { log(TAG, CRIT, args...); }
-
+ template<typename... Ts> void trace(const char* TAG, Ts... args) { ilog(TAG, TRACE, args...); }
+ template<typename... Ts> void debug(const char* TAG, Ts... args) { ilog(TAG, DEBUG, args...); }
+ template<typename... Ts> void info (const char* TAG, Ts... args) { ilog(TAG, INFO, args...); }
+ template<typename... Ts> void warn (const char* TAG, Ts... args) { ilog(TAG, WARN, args...); }
+ template<typename... Ts> void error(const char* TAG, Ts... args) { ilog(TAG, ERROR, args...); }
+ template<typename... Ts> void crit (const char* TAG, Ts... args) { ilog(TAG, CRIT, args...); }
+ void setExternLogger(void*) {};
+ void unsetExternLogger() {};
template<typename T, typename... Ts>
- void log(const char* TAG, int level, T fmtString, Ts... args)
+ void ilog(const char* TAG, int level, T fmtString, Ts... args)
{
if (!enabled) return;
struct vt_mode old_vtmode;
#endif
-const char* TAG = "Main";
+static const char* TAG = "Main";
// Linux main function and sighandler
#ifndef WIN32
#include <sstream>
#include "defines.h"
-#include "oldlog.h"
+#include "log.h"
#include "tcp.h"
+static const char* TAG = "TCP";
+
TCP::~TCP()
{
shutdown();
bool TCP::init()
{
- logger = Log::getInstance();
+ logger = LogNT::getInstance();
#ifdef WIN32
abortSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (abortSocket == INVALID_SOCKET)
{
- logger->log("TCP", Log::CRIT, "socket error");
+ logger->crit(TAG, "socket error");
return false;
}
#else
if (pipe2(abortPipe, O_NONBLOCK) == -1)
{
- logger->log("TCP", Log::CRIT, "pipe2 error");
+ logger->crit(TAG, "pipe2 error");
return false;
}
#endif
if ((gaiResult != 0) || !aip)
{
- logger->log("TCP", Log::CRIT, "getaddrinfo error");
+ logger->crit(TAG, "getaddrinfo error");
return false;
}
sockfd = socket(aip->ai_family, SOCK_STREAM, 0);
- if (sockfd == -1) { logger->log("TCP", Log::CRIT, "socket error"); return false; }
+ if (sockfd == -1) { logger->crit(TAG, "socket error"); return false; }
#ifdef WIN32
ULONG param = 1;
{
CLOSESOCKET(sockfd);
sockfd = -1;
- logger->log("TCP", Log::CRIT, "connect error");
+ logger->crit(TAG, "connect error");
return false;
}
{
CLOSESOCKET(sockfd);
sockfd = -1;
- logger->log("TCP", Log::INFO, "connect/select aborting");
+ logger->info(TAG, "connect/select aborting");
return false;
}
if ((selectResult == 1) || FD_ISSET(sockfd, &writefds))
{
freeaddrinfo(aip);
- logger->log("TCP", Log::INFO, "Connected");
+ logger->info(TAG, "Connected");
connected = true;
return true;
}
{
CLOSESOCKET(sockfd);
sockfd = -1;
- logger->log("TCP", Log::CRIT, "connect/select error");
+ logger->crit(TAG, "connect/select error");
return false;
}
}
{
if (++abortCount == 1000)
{
- logger->log("TCP", Log::ALERT, "abortCount = 1000 - runaway error, or packet arrived in > 1000 pieces??");
+ logger->error(TAG, "abortCount = 1000 - runaway error, or packet arrived in > 1000 pieces??");
return false;
}
if (selectResult == 0) return false;
#ifdef WIN32
- if (FD_ISSET(abortSocket, &readfds)) { logger->log("TCP", Log::DEBUG, "Aborting..."); return false; }
+ if (FD_ISSET(abortSocket, &readfds)) { logger->debug(TAG, "Aborting..."); return false; }
#else
- if (FD_ISSET(abortPipe[0], &readfds)) { logger->log("TCP", Log::DEBUG, "Aborting..."); return false; }
+ if (FD_ISSET(abortPipe[0], &readfds)) { logger->debug(TAG, "Aborting..."); return false; }
#endif
int recvResult = recv(sockfd, pointer, numBytes - totalReceived, 0);
{
if (++abortCount == 20)
{
- logger->log("TCP", Log::DEBUG, "abortCount = 20");
+ logger->debug(TAG, "abortCount = 20");
return ss;
}
if (selectResult == 0) return ss;
#ifdef WIN32
- if (FD_ISSET(abortSocket, &readfds)) { logger->log("TCP", Log::DEBUG, "Aborting..."); return ss; }
+ if (FD_ISSET(abortSocket, &readfds)) { logger->debug(TAG, "Aborting..."); return ss; }
#else
- if (FD_ISSET(abortPipe[0], &readfds)) { logger->log("TCP", Log::DEBUG, "Aborting..."); return ss; }
+ if (FD_ISSET(abortPipe[0], &readfds)) { logger->debug(TAG, "Aborting..."); return ss; }
#endif
int recvResult = recv(sockfd, &recStringBuf[recStringBufUsed], recStringBufSize - recStringBufUsed, 0);
UCHAR mac[6];
};
-class Log;
+class LogNT;
class TCP
{
MACAddress getMAC();
private:
- Log* logger;
+ LogNT* logger;
int sockfd{-1};
bool connected{};
std::mutex writeMutex;
#define TXTDECVBIEBU_H
#include "draintarget.h"
-#include "oldlog.h"
+#include "log.h"
/* from osdteletext begin */
cTeletextChar getChar(int x, int y) {
// Read character content from page
if (x<0 || x>=40 || y<0 || y>=25) {
- Log::getInstance()->log("TeletextDecoderVBIEBU", Log::DEBUG, "Warning: out of bounds read access to teletext page");
+ LogNT::getInstance()->debug("TeletextDecoderVBIEBU", "Warning: out of bounds read access to teletext page");
return cTeletextChar();
}
return Page[x][y].ToDirty(false);
}
bool isDirty(int x, int y) {
if (x<0 || x>=40 || y<0 || y>=25) {
- Log::getInstance()->log("TeletextDecoderVBIEBU", Log::DEBUG, "Warning: out of bounds dirty access to teletext page");
+ LogNT::getInstance()->debug("TeletextDecoderVBIEBU", "Warning: out of bounds dirty access to teletext page");
return false;
}
return Page[x][y].GetDirty();
// Set character at given location
if (x<0 || x>=40 || y<0 || y>=25) {
- Log::getInstance()->log("TeletextDecoderVBIEBU", Log::DEBUG, "Warning: out of bounds write access to teletext page");
+ LogNT::getInstance()->debug("TeletextDecoderVBIEBU", "Warning: out of bounds write access to teletext page");
return;
}
if (getChar(x,y) != c) {
along with VOMP. If not, see <https://www.gnu.org/licenses/>.
*/
-#include "oldlog.h"
+#include "log.h"
#include "timers.h"
+static const char* TAG = "Timers";
+
Timers* Timers::instance = NULL;
Timers::Timers()
int Timers::init()
{
if (initted) return false;
- logger = Log::getInstance();
+ logger = LogNT::getInstance();
timersMutex.lock(); // Start thread with mutex locked
recalc = true;
timersThread = std::thread([this] { masterLoop(); });
- logger->log("Timers", Log::DEBUG, "Timers started");
+ logger->debug(TAG, "Timers started");
initted = true;
return true;
}
{
if (!initted) return 0;
- logger->log("Timers", Log::DEBUG, "Starting set timer chrono");
+ logger->debug(TAG, "Starting set timer chrono");
std::lock_guard<std::mutex> lock(timersMutex);
}
else
{
- logger->log("Timers", Log::DEBUG, "Editing existing timer");
+ logger->debug(TAG, "Editing existing timer");
// A waiting timer has been edited
recalc = true;
timerList.push_back(t);
recalc = true;
timersCond.notify_all();
- logger->log("Timers", Log::DEBUG, "Timer set for %p ref %i", client, clientReference);
+ logger->debug(TAG, "Timer set for {} ref {}", (void*)client, clientReference);
return true; // unlock
}
if (te->restartAfterFinish)
{
- logger->log("Timers", Log::DEBUG, "timerEventFinished RESTART for %p %i", te->client, te->clientReference);
+ logger->debug(TAG, "timerEventFinished RESTART for {} {}", (void*)te->client, te->clientReference);
te->restartAfterFinish = false;
te->running = false;
te->completed = false;
if (!initted) return false;
- logger->log("Timers", Log::DEBUG, "Starting cancel timer %p %i, list size = %i", client, clientReference, timerList.size());
+ logger->debug(TAG, "Starting cancel timer {} {}, list size = {}", (void*)client, clientReference, timerList.size());
std::unique_lock<std::mutex> lockWrapper(timersMutex); // lock
timerList.erase(i);
delete foundTimerEvent;
- logger->log("Timers", Log::DEBUG, "Removed timer for %p ref %i", client, clientReference);
+ logger->debug(TAG, "Removed timer for {} ref {}", (void*)client, clientReference);
recalc = true;
timersCond.notify_all(); // shutdown could be being called? notify_all guarantees we wake masterLoop
return true; // unlock
{
// Case 2 b.
// The thread requesting cancelTimer is the timer thread itself, the timer has already fired.
- logger->log("Timers", Log::DEBUG, "%p ref %i cancelTimer itself calling - ignore", client, clientReference);
+ logger->debug(TAG, "{} ref {} cancelTimer itself calling - ignore", (void*)client, clientReference);
foundTimerEvent->restartAfterFinish = false; // in case a restart had already been set.
return true; // unlock
}
// So, wait on the cond and go around each time we wake. One of them will have been after the timerThread finished,
// which turns it into a case 3.
- logger->log("Timers", Log::DEBUG, "%p ref %i cancelTimer WAITING", client, clientReference);
+ logger->debug(TAG, "{} ref {} cancelTimer WAITING", (void*)client, clientReference);
timersCond.wait(lockWrapper); //unlocks in wait
// locked
- logger->log("Timers", Log::DEBUG, "%p ref %i cancelTimer go-around", client, clientReference);
+ logger->debug(TAG, "{} ref {} cancelTimer go-around", (void*)client, clientReference);
} // end of the big while loop
}
threadStartProtect.lock();
threadStartProtect.unlock();
- Log::getInstance()->log("Timers", Log::DEBUG, "sending timer to %p with parameter %u", client, clientReference);
+ LogNT::getInstance()->debug(TAG, "sending timer to {} with parameter {}", (void*)client, clientReference);
client->timercall(clientReference);
Timers::getInstance()->reapTimerEvent(this);
});
void run();
};
-class Log;
+class LogNT;
typedef std::list<TimerEvent*> TimerList;
class Timers
void reapTimerEvent(TimerEvent*); // Internal only
private:
static Timers* instance;
- Log* logger{};
+ LogNT* logger{};
bool initted{};
bool quitThread{};
bool recalc{};
#include <errno.h>
#include "defines.h"
-#include "oldlog.h"
+#include "log.h"
#include "udp4.h"
+static const char* TAG = "UDP4";
+
UDP4::~UDP4()
{
if (initted) shutdown();
sentLength = sendto(socketnum, message, length, 0, reinterpret_cast<struct sockaddr *>(&sendAddr), addrlen);
if (sentLength == length) return true;
- Log::getInstance()->log("UDP6", Log::ERR, "sendto failed, errno = %i", errno);
+ LogNT::getInstance()->error(TAG, "sendto failed, errno = {}", errno);
return false;
}
#include <errno.h>
#include <fcntl.h>
-#include "oldlog.h"
+#include "log.h"
#include "udp6.h"
+static const char* TAG = "UDP6";
+
UDP6::~UDP6()
{
if (initted) shutdown();
{
ifIndex = ifs[i].if_index;
int res = setsockopt(socketnum, IPPROTO_IPV6, IPV6_MULTICAST_IF, &ifIndex, sizeof(ifIndex));
- Log::getInstance()->log("UDP6", Log::DEBUG, "Transmitting IPv6 MC UDP on %s", ifs[i].if_name);
+ LogNT::getInstance()->debug(TAG, "Transmitting IPv6 MC UDP on {}", ifs[i].if_name);
res = sendto(socketnum, message, length, 0, reinterpret_cast<struct sockaddr *>(&sendAddr), addrlen);
- Log::getInstance()->log("UDP6", Log::DEBUG, "Result: %i. Errno: %i", res, errno);
+ LogNT::getInstance()->debug(TAG, "Result: {}. Errno: {}", res, errno);
errno = 0;
}
{
sentLength = sendto(socketnum, message, length, 0, reinterpret_cast<struct sockaddr *>(&sendAddr), addrlen);
if (sentLength == length) return true;
- Log::getInstance()->log("UDP6", Log::ERR, "sendto failed, errno = %i", errno);
+ LogNT::getInstance()->error(TAG, "sendto failed, errno = {}", errno);
}
return false;
#include <chrono>
#include <algorithm>
-#include "oldlog.h"
+#include "log.h"
#include "wol.h"
#include "vdpc.h"
+static const char* TAG = "VDPC";
+
void VDPC::TEMPaddCLIServer(const std::string& cliServer)
{
std::lock_guard<std::mutex> lg(serversLock);
do
{
- Log::getInstance()->log("VDPC", Log::DEBUG, "Sending broadcasts");
+ LogNT::getInstance()->debug(TAG, "Sending broadcasts");
#ifdef IPV4
vdpc4.sendRequest();
#endif
waitCond.wait_for(ul, std::chrono::milliseconds(1500), [this]{ return stopNow == true; });
- Log::getInstance()->log("VDPC", Log::DEBUG, "go() wait finished");
+ LogNT::getInstance()->debug(TAG, "go() wait finished");
if (stopNow) break;
if (servers.size() == 0) Wol::getInstance()->doWakeUp();
bool VDPC::VDPC4::init(AddServerCallback& taddFunc)
{
- Log::getInstance()->log("VDPC4", Log::DEBUG, "init");
+ LogNT::getInstance()->debug("VDPC4", "init");
addFunc = taddFunc;
if (!udp4.init(0))
{
- Log::getInstance()->log("VDPC4", Log::CRIT, "Failed to init VDPC4 UDP");
+ LogNT::getInstance()->crit("VDPC4", "Failed to init VDPC4 UDP");
return false;
}
void VDPC::VDPC4::run()
{
- Log::getInstance()->log("VDPC4", Log::DEBUG, "run");
+ LogNT::getInstance()->debug("VDPC4", "run");
stopNow = false;
startProtect.lock();
void VDPC::VDPC4::stop()
{
- Log::getInstance()->log("VDPC4", Log::DEBUG, "stop");
+ LogNT::getInstance()->debug("VDPC4", "stop");
stopNow = true;
void VDPC::VDPC4::threadMethod()
{
- Log* logger = Log::getInstance();
+ LogNT* logger = LogNT::getInstance();
#ifdef WIN32
quitPipe = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (quitPipe == INVALID_SOCKET)
{
- logger->log("VDPC4", Log::ERR, "socket() fail");
+ logger->error("VDPC4", "socket() fail");
return;
}
#else
if (pipe2(pfdsUDP4, O_NONBLOCK) == -1)
{
- logger->log("VDPC4", Log::ERR, "pipe2 error B");
+ logger->error("VDPC4", "pipe2 error B");
return;
}
#endif
while (!stopNow)
{
- Log::getInstance()->log("VDPC4", Log::DEBUG, "goto waitformessage");
+ logger->debug("VDPC4", "goto waitformessage");
#ifdef WIN32
UCHAR retval = udp4.waitforMessage(3, quitPipe);
#else
UCHAR retval = udp4.waitforMessage(3, pfdsUDP4[0]);
#endif
- Log::getInstance()->log("VDPC4", Log::DEBUG, "backfrom waitformessage");
+ logger->debug("VDPC4", "backfrom waitformessage");
if (retval == 2) // we got a reply
{
}
}
- Log::getInstance()->log("VDPC4", Log::DEBUG, "loop stopnow = %i", stopNow);
+ logger->debug("VDPC4", "loop stopnow = %i", stopNow);
}
}
void VDPC::VDPC4::sendRequest()
{
- Log::getInstance()->log("VDPC4", Log::DEBUG, "broadcast");
+ LogNT::getInstance()->debug("VDPC4", "broadcast");
char message[15];
memset(message, 0, 15);
bool VDPC::VDPC6::init(AddServerCallback& taddFunc)
{
- Log::getInstance()->log("VDPC6", Log::DEBUG, "init");
+ LogNT::getInstance()->debug("VDPC6", "init");
addFunc = taddFunc;
if (!udp6.init(0))
{
- Log::getInstance()->log("VDPC6", Log::CRIT, "Failed to init VDPC6 UDP");
+ LogNT::getInstance()->crit("VDPC6", "Failed to init VDPC6 UDP");
return false;
}
void VDPC::VDPC6::run()
{
- Log::getInstance()->log("VDPC6", Log::DEBUG, "run");
+ LogNT::getInstance()->debug("VDPC6", "run");
stopNow = false;
startProtect.lock();
void VDPC::VDPC6::stop()
{
- Log::getInstance()->log("VDPC6", Log::DEBUG, "stop");
+ LogNT::getInstance()->debug("VDPC6", "stop");
stopNow = true;
write(pfdsUDP6[1], "X", 1);
void VDPC::VDPC6::threadMethod()
{
- Log* logger = Log::getInstance();
+ LogNT* logger = LogNT::getInstance();
if (pipe2(pfdsUDP6, O_NONBLOCK) == -1)
{
- logger->log("VDPC6", Log::ERR, "pipe2 error B");
+ logger->error("VDPC6", "pipe2 error B");
return;
}
while (!stopNow)
{
- Log::getInstance()->log("VDPC6", Log::DEBUG, "goto waitformessage");
+ logger->debug("VDPC6", "goto waitformessage");
UCHAR retval = udp6.waitforMessage(3, pfdsUDP6[0]);
- Log::getInstance()->log("VDPC6", Log::DEBUG, "backfrom waitformessage");
+ logger->debug("VDPC6", "backfrom waitformessage");
if (retval == 2) // we got a reply
{
}
}
- Log::getInstance()->log("VDPC6", Log::DEBUG, "loop stopnow = %i", stopNow);
+ logger->debug("VDPC6", "loop stopnow = %i", stopNow);
}
}
void VDPC::VDPC6::sendRequest()
{
- Log::getInstance()->log("VDPC6", Log::DEBUG, "broadcast");
+ LogNT::getInstance()->debug("VDPC6", "broadcast");
char message[15];
memset(message, 0, 15);
#include "vdr.h"
+static const char* TAG = "VDR";
+
#define VOMP_PROTOCOL_VERSION 0x00000500
VDR* VDR::instance = NULL;
}
delete rq;
VDR_ResponsePacket *rp=RequestResponse(rt);
- logger->log("doRequestResponse",Log::DEBUG,"got response %p",rp);
+ logger->debug(TAG, "Got response {}", (void*)rp);
if ( !rp) {
delete rt;
return NULL;
ULONG expected=c->command;
if (c->deserialize(rp) != 0) {
delete rp;
- Log::getInstance()->log("VDR", Log::ERR, "decodeResponse unable to deserialize for command %lu",expected);
+ Log::getInstance()->error(TAG, "decodeResponse unable to deserialize for command {}", expected);
return -1;
}
delete rp;
if (c->command != expected) {
- Log::getInstance()->log("VDR", Log::ERR, "decodeResponse unexpected response received 0x%lx, expected 0x%lx",c->command,expected);
+ Log::getInstance()->error(TAG, "decodeResponse unexpected response received {:#x}, expected {:#x}", c->command, expected);
return -1;
}
- Log::getInstance()->log("VDR", Log::DEBUG, "decodeResponse successfully decoded command 0x%lx",expected);
+ Log::getInstance()->error(TAG, "decodeResponse successfully decoded command {:#x}", expected);
return 0;
}
{
if (initted) return 0;
initted = 1;
- logger = Log::getInstance();
+ logger = LogNT::getInstance();
tcp.init();
return 1;
}
disconnecting = false;
connected = false;
- logger->log("VDR", Log::DEBUG, "Disconnect");
+ logger->debug(TAG, "Disconnect");
}
void VDR::setReceiveWindow(size_t size)
void VDR::threadMethod()
{
- logger->log("VDR", Log::DEBUG, "VDR RUN");
+ logger->debug(TAG, "VDR RUN");
ULONG channelID;
if (!readSuccess)
{
- //logger->log("VDR", Log::DEBUG, "Net read timeout");
+ //logger->debug(TAG, "Net read timeout");
if (!tcp.status()) { connectionDied(); return; } // return to stop this thread
}
{
if (lastKArecv < (timeNow - 5))
{
- //logger->log("VDR", Log::DEBUG, "Sending KA packet");
+ //logger->debug(TAG, "Sending KA packet");
if (!sendKA(timeNow))
{
- logger->log("VDR", Log::DEBUG, "Could not send KA, calling connectionDied");
+ logger->debug(TAG, "Could not send KA, calling connectionDied");
connectionDied();
return;
}
{
if (lastKAsent <= (timeNow - 10))
{
- logger->log("VDR", Log::DEBUG, "lastKA over 10s ago, calling connectionDied");
+ logger->debug(TAG, "lastKA over 10s ago, calling connectionDied");
connectionDied();
return;
}
vresp = new VDR_ResponsePacket();
vresp->setResponse(requestID, reinterpret_cast<UCHAR*>(userData), userDataLength);
// vresp now owns userData unless something calls vresp->getUserData()
-// logger->log("VDR", Log::DEBUG, "Rxd a response packet, requestID=%lu, len=%lu", requestID, userDataLength);
+// logger->debug(TAG, "Rxd a response packet, requestID={}, len={}", requestID, userDataLength);
if (!edFindAndCall(vresp)) // makes ED lock, find receiver for vresp (using ed_cb_find() ) and then call (using ed_cb_call() )
{
vresp = new VDR_ResponsePacket();
vresp->setStream(streamID, flag, reinterpret_cast<UCHAR*>(userData), userDataLength, channelID);
- //logger->log("VDR", Log::DEBUG, "Rxd a stream packet, streamID=%lu, flag=%lu, len=%lu", streamID, flag, userDataLength);
+ //logger->debug(TAG, "Rxd a stream packet, streamID={}, flag={}, len={}", streamID, flag, userDataLength);
if (!edFindAndCall(vresp)) // makes ED lock, find receiver for vresp (using ed_cb_find() ) and then call (using ed_cb_call() )
{
{
lastKAsent = 0;
lastKArecv = KAreply;
- //logger->log("VDR", Log::DEBUG, "Rxd correct KA reply");
+ //logger->debug(TAG, "Rxd correct KA reply");
}
}
else
{
- logger->log("VDR", Log::ERR, "Rxd a response packet on channel %lu !!", channelID);
+ logger->error(TAG, "Rxd a response packet on channel {} !!", channelID);
break;
}
{
vresp = new VDR_ResponsePacket();
vresp->setResponse(vdrpr->requestSerialNumber, NULL, 0);
- logger->log("VDR", Log::DEBUG, "Timeouts: created blank response packet for request serial %lu", vdrpr->requestSerialNumber);
+ logger->debug(TAG, "Timeouts: created blank response packet for request serial {}", vdrpr->requestSerialNumber);
edMutex.unlock();
if (!edFindAndCall(vresp)) // makes ED lock, find receiver for vresp (using ed_cb_find() ) and then call (using ed_cb_call() )
{
// If edFindAndCall returns true, edr was called and vresp was handed off.
// else, delete vresp here.
- logger->log("VDR", Log::ERR, "Timeouts: no waiting thread found for request serial %lu !!!", vdrpr->requestSerialNumber);
+ logger->error(TAG, "Timeouts: no waiting thread found for request serial {} !!!", vdrpr->requestSerialNumber);
delete vresp;
}
edMutex.lock();
{
vresp = new VDR_ResponsePacket();
vresp->setStream(vdrpr->streamID, 2 /* connection-lost flag */ , NULL, 0, vdrpr->receiverChannel);
- logger->log("VDR", Log::DEBUG, "Timeouts: created blank response packet for streamid %lu", vdrpr->streamID);
+ logger->debug(TAG, "Timeouts: created blank response packet for streamid {}", vdrpr->streamID);
edMutex.unlock();
if (!edFindAndCall(vresp)) // makes ED lock, find receiver for vresp (using ed_cb_find() ) and then call (using ed_cb_call() )
{
// If edFindAndCall returns true, edr was called and vresp was handed off.
// else, delete vresp here.
- logger->log("VDR", Log::ERR, "Timeouts: no waiting stream receiver found for streamid %lu !!!", vdrpr->streamID);
+ logger->error(TAG, "Timeouts: no waiting stream receiver found for streamid {} !!!", vdrpr->streamID);
delete vresp;
}
edMutex.lock();
}
edMutex.unlock();
// Ok, all event receviers should be dealt with. just in case there weren't any, inform control
- logger->log("VDR", Log::DEBUG, "edUnlock at end of connectionDied");
+ logger->debug(TAG, "edUnlock at end of connectionDied");
Control::getInstance()->connectionLost();
}
// Is vresp for vdrpr ?
ULONG packetChannel = vresp->getChannelID();
- //logger->log("VDR", Log::DEBUG, "TVMedia debug %d %d %x", vdrpr->receiverChannel,packetChannel,vdrpr);
+ //logger->debug(TAG, "TVMedia debug {} {} {:#x}", vdrpr->receiverChannel,packetChannel,vdrpr);
if (vdrpr->receiverChannel != packetChannel) return false;
if (packetChannel == CHANNEL_REQUEST_RESPONSE)
VDR_ResponsePacket* VDR::RequestResponse(VDR_RequestPacket* vrp)
{
- //logger->log("VDR", Log::DEBUG, "RR %lu", vrp->getOpcode());
+ //logger->debug(TAG, "RR {}", vrp->getOpcode());
if (!connected || disconnecting)
{
- logger->log("VDR", Log::DEBUG, "RR when !connected || disconnecting");
+ logger->debug(TAG, "RR when !connected || disconnecting");
VDR_ResponsePacket* vresp = new VDR_ResponsePacket();
return vresp; // "no-response" return
}
}
// Sleep and block this thread. The sleep unlocks the mutex
-// logger->log("VDR", Log::DEBUG, "RR sleep - opcode %lu", vrp->getOpcode());
+// logger->debug(TAG, "RR sleep - opcode {}", vrp->getOpcode());
edSleepThisReceiver(&vdrpr);
-// logger->log("VDR", Log::DEBUG, "RR unsleep");
+// logger->debug(TAG, "RR unsleep");
// Woken because a response packet has arrived, mutex will be locked
-// logger->log("VDR", Log::DEBUG, "Packet delivered to me, requestID: %lu", vdrpr.save_vresp->getRequestID());
+// logger->debug(TAG, "Packet delivered to me, requestID: {}", vdrpr.save_vresp->getRequestID());
edMutex.unlock();
return vdrpr.save_vresp;
// delete the EDR. It's made once per media requested and wasn't owned/deleted by anything before
VDR_ResponsePacket* vresp = reinterpret_cast<VDR_ResponsePacket*>(userTag);
- Log::getInstance()->log("VDR", Log::DEBUG, "TVMedia Pictures arrived VDR %x", vresp->getStreamID());
+ LogNT::getInstance()->debug(TAG, "TVMedia Pictures arrived VDR %x", vresp->getStreamID());
OsdVector *osd=dynamic_cast<OsdVector*>(Osd::getInstance());
if (osd) osd->getPictReader()->receivePicture(vresp);
// else delete vresp; //nonsense // only rpi does CHANNEL_TVMEDIA, rpi has osdvector. therefore, can't get here.
if (vresp->noResponse()) { delete vresp; return 0; }
ULONG vdrTime = vresp->extractULONG();
- logger->log("VDR", Log::DEBUG, "vdrtime = %lu", vdrTime);
+ logger->debug(TAG, "vdrtime = {}", vdrTime);
long vdrTimeOffset = vresp->extractLONG();
- logger->log("VDR", Log::DEBUG, "offset = %i", vdrTimeOffset);
+ logger->debug(TAG, "offset = {}", vdrTimeOffset);
unsigned int version_min=vresp->extractULONG();
newpref.audiopref = vresp->extractLONG();
newpref.subtitlepref = vresp->extractLONG();
newpref.langcode = vresp->extractStdString();
- //logger->log("VDR", Log::DEBUG, "Langpref %s %d %d", newpref.langcode.c_str(), newpref.audiopref, newpref.subtitlepref);
+ //logger->debug(TAG, "Langpref {} {} {}", newpref.langcode.c_str(), newpref.audiopref, newpref.subtitlepref);
list.push_back(newpref);
}
}
int b = clock_settime(CLOCK_REALTIME, ¤tTime);
- logger->log("VDR", Log::DEBUG, "set clock = %u", b);
+ logger->debug(TAG, "set clock = {}", b);
// now make a TZ variable and set it
char sign;
hours = (int)vdrTimeOffset / 3600;
minutes = vdrTimeOffset % 3600;
- logger->log("VDR", Log::DEBUG, "%c %i %i", sign, hours, minutes);
+ logger->debug(TAG, "{} {} {}", sign, hours, minutes);
minutes = (int)minutes / 60;
- logger->log("VDR", Log::DEBUG, "%c %i %i", sign, hours, minutes);
+ logger->debug(TAG, "{} {} {}", sign, hours, minutes);
char newTZ[30];
sprintf(newTZ, "MVP%c%i:%i", sign, hours, minutes);
setenv("TZ", newTZ, 1);
- logger->log("VDR", Log::DEBUG, "Timezone data: %s", newTZ);
+ logger->debug(TAG, "Timezone data: {}", newTZ);
#endif
setCharset(Osd::getInstance()->charSet());
if (chan->type == type && ((chan->vstreamtype==0x1b && h264support)|| (chan->vstreamtype!=0x1b &&mpeg2support)) )
{
chanList->push_back(chan);
- logger->log("VDR", Log::DEBUG, "Have added a channel to list. %lu %lu %s", chan->number, chan->type, chan->name);
+ logger->debug(TAG, "Have added a channel to list. {} {} {}", chan->number, chan->type, chan->name);
if (chan->number > maxChannelNumber) maxChannelNumber = chan->number;
}
else
}
int toReturn = static_cast<int>(vresp->extractULONG());
- logger->log("VDR", Log::DEBUG, "VDR said %lu to start streaming request", toReturn);
+ logger->debug(TAG, "VDR said {} to start streaming request", toReturn);
delete vresp;
return toReturn;
if (vresp->serverError())
{
- logger->log("VDR", Log::DEBUG, "Detected getblock 0");
+ logger->debug(TAG, "Detected getblock 0");
*amountReceived = 0;
delete vresp;
return NULL;
*totalFrames = lengthFrames;
*IsPesRecording = (isPesRecording);//convert Uchar to bool
- logger->log("VDR", Log::DEBUG, "VDR said length is: %llu %lu, IsPesRecording %x", lengthBytes, lengthFrames, *IsPesRecording);
+ logger->debug(TAG, "VDR said length is: {} {}, IsPesRecording {:#x}", lengthBytes, lengthFrames, *IsPesRecording);
return lengthBytes;
}
ULLONG position = vresp->extractULLONG();
delete vresp;
- logger->log("VDR", Log::DEBUG, "VDR said new position is: %llu", position);
+ logger->debug(TAG, "VDR said new position is: {}", position);
return position;
}
ULONG framenumber = vresp->extractULONG();
delete vresp;
- logger->log("VDR", Log::DEBUG, "VDR said new framenumber is: %u", framenumber);
+ logger->debug(TAG, "VDR said new framenumber is: {}", framenumber);
return framenumber;
}
if (vresp->serverError())
{
- logger->log("VDR", Log::DEBUG, "Detected getNextIFrame error");
+ logger->debug(TAG, "Detected getNextIFrame error");
delete vresp;
return false;
}
delete vresp;
- logger->log("VDR", Log::DEBUG, "VDR GNIF said %llu %lu %lu", *rfilePosition, *rframeNumber, *rframeLength);
+ logger->debug(TAG, "VDR GNIF said {} {} {}", *rfilePosition, *rframeNumber, *rframeLength);
return true;
}
delete vresp;
- logger->log("VDR", Log::DEBUG, "Success got to end of getChannelSchedule");
+ logger->debug(TAG, "Success got to end of getChannelSchedule");
return eventList;
}
delete[] tempString;
recTimerList->push_back(newRecTimer);
- logger->log("VDR", Log::DEBUG, "TL: %lu %lu %lu %lu %lu %lu %lu %lu %s",
+ logger->debug(TAG, "TL: {} {} {} {} {} {} {} {} {}",
newRecTimer->active, newRecTimer->recording, newRecTimer->pending, newRecTimer->priority, newRecTimer->lifeTime,
newRecTimer->channelNumber, newRecTimer->startTime, newRecTimer->stopTime, newRecTimer->getFile());
}
if (vresp->serverError())
{
- logger->log("VDR", Log::DEBUG, "Could not get rec info");
+ logger->debug(TAG, "Could not get rec info");
delete vresp;
return NULL;
}
ULONG lengthFrames = vresp->extractULONG();
delete vresp;
- logger->log("VDR", Log::DEBUG, "VDR said length is: %llu %lu", lengthBytes, lengthFrames);
+ logger->debug(TAG, "VDR said length is: {} {}", lengthBytes, lengthFrames);
*totalFrames = lengthFrames;
return lengthBytes;
mark->pos = vresp->extractULONG();
markList->push_back(mark);
- logger->log("VDR", Log::DEBUG, "Have added a mark to list. %lu", mark->pos);
+ logger->debug(TAG, "Have added a mark to list. {}", mark->pos);
}
delete vresp;
*/
MediaList* VDR::getMediaList(const MediaURI * root)
{
- logger->log("VDR", Log::DEBUG, "getMediaList %s,d=%s, prov=%d", (root?root->getName():"NULL"),
+ logger->debug(TAG, "getMediaList {},d={}, prov={}", (root?root->getName():"NULL"),
((root && root->hasDisplayName())?root->getDisplayName():"NULL"),
(root?root->getProvider():providerId));
MediaURI remoteURI(root);
if (decodeResponse(vresp,&response) != 0) {
return -1;
}
- logger->log("VDR", Log::DEBUG, "openMedia len=%llu", *size);
+ logger->debug(TAG, "openMedia len={}", *size);
return 0;
}
int VDR::deleteTimer(RecTimer* delTimer)
{
- logger->log("VDR", Log::DEBUG, "Delete timer called");
+ logger->debug(TAG, "Delete timer called");
VDR_RequestPacket vrp;
if (!vrp.init(VDR_DELETETIMER, false, 0)) return 0;
void VDR::shutdownVDR()
{
if(doVDRShutdown)
- logger->log("VDR", Log::DEBUG, "Shutting down vdr");
+ logger->debug(TAG, "Shutting down vdr");
else
- logger->log("VDR", Log::DEBUG, "Shutting down vomp only");
+ logger->debug(TAG, "Shutting down vomp only");
if(!doVDRShutdown || !connected || disconnecting)
return;
VDR_RequestPacket vrp;
- logger->log("VDR", Log::DEBUG, "Sending shutdown");
+ logger->debug(TAG, "Sending shutdown");
if (!vrp.init(VDR_SHUTDOWN, false, 0)) return;
VDR_ResponsePacket* vresp = RequestResponse(&vrp);
delete vresp;
- logger->log("VDR", Log::DEBUG, "VDR shutdown");
+ logger->debug(TAG, "VDR shutdown");
}
void VDR::getScraperEventType(char * fileName, int & movieID,
VDR_RequestPacket vrp;
if (!vrp.init(VDR_GETRECSCRAPEREVENTTYPE, true, strlen(fileName) + 1)) return;
if (!vrp.addString(fileName)) return ;
- Log::getInstance()->log("Recording", Log::DEBUG, "Before Response ");
+ logger->debug(TAG, "Before response");
VDR_ResponsePacket* vresp = RequestResponse(&vrp);
- Log::getInstance()->log("Recording", Log::DEBUG, "After Response ");
+ logger->debug(TAG, "After response");
if (vresp->noResponse()) { delete vresp; return ; }
int type = vresp->extractUCHAR();
if (type == 0) //serie
if (!vrp.init(VDR_GETEVENTSCRAPEREVENTTYPE, false, 0)) return;
if (!vrp.addULONG(channelid)) return ;
if (!vrp.addULONG(eventid)) return ;
- Log::getInstance()->log("Recording", Log::DEBUG, "Before Response ");
+ logger->debug(TAG, "Before response");
VDR_ResponsePacket* vresp = RequestResponse(&vrp);
- Log::getInstance()->log("Recording", Log::DEBUG, "After Response ");
+ logger->debug(TAG, "After response");
if (vresp->noResponse()) { delete vresp; return ; }
int type = vresp->extractUCHAR();
if (type == 0) //serie
if (!vrp.addULONG(tvmedia.type_pict)) return ULONG_MAX;
if (!vrp.addULONG(tvmedia.container)) return ULONG_MAX;
if (!vrp.addULONG(tvmedia.container_member)) return ULONG_MAX;
-/* Log::getInstance()->log("VDR", Log::DEBUG, "TVMedia with ID %d %d; %d %d %d %d;%d",
+/* logger->debug(TAG, "TVMedia with ID {} {}; {} {} {} {};{}",
tvmedia.primary_id,tvmedia.secondary_id,tvmedia.type,tvmedia.type_pict,
tvmedia.container,tvmedia.container_member,vrp.getSerial());*/
//if (vresp->noResponse()) { delete vresp; return ULONG_MAX; }
delete vresp;
-// Log::getInstance()->log("VDR", Log::DEBUG, "TVMedia Channel Logo %d %x",
+// logger->debug(TAG, "TVMedia Channel Logo {} {:#x}",
// media.primary_id,vrp.getSerial());
return vrp.getSerial();
void connectionDied();
bool sendKA(ULONG timeStamp);
- Log* logger;
+ LogNT* logger;
int initted{};
int findingServer{};
TCP tcp;