src/nhttpd/tuxboxapi: remove unused dbox code

Origin commit data
------------------
Branch: ni/coolstream
Commit: e59f8adccc
Author: vanhofen <vanhofen@gmx.de>
Date: 2015-05-06 (Wed, 06 May 2015)

Origin message was:
------------------
- src/nhttpd/tuxboxapi: remove unused dbox code

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2015-05-06 22:07:35 +02:00
parent 82512848ca
commit 427915ab83
19 changed files with 33 additions and 4375 deletions

View File

@@ -266,7 +266,6 @@ src/nhttpd/web/scripts/Makefile
src/nhttpd/web/languages/Makefile src/nhttpd/web/languages/Makefile
src/nhttpd/web/styles/Makefile src/nhttpd/web/styles/Makefile
src/nhttpd/tuxboxapi/Makefile src/nhttpd/tuxboxapi/Makefile
src/nhttpd/tuxboxapi/coolstream/Makefile
src/nhttpd/yhttpd_core/Makefile src/nhttpd/yhttpd_core/Makefile
src/nhttpd/yhttpd_mods/Makefile src/nhttpd/yhttpd_mods/Makefile
src/nhttpd/nhttpd.conf src/nhttpd/nhttpd.conf

View File

@@ -1,20 +0,0 @@
AUTHORS
in order of appearance (bottom up)
Johannes Golombek [yjogol@cvs.tuxbox.org]
Bengt Martensson [barf@cvs.tuxbox.org]
Jacek Jendrzej [metallica@cvs.tuxbox.org]
Henning Behrend [sat_man@cvs.tuxbox.org]
Axel Buehning [diemade@cvs.tuxbox.org]
Michael Schuele [chakazulu@cvs.tuxbox.org]
Peter Reich [digi_casi@cvs.tuxbox.org]
H.Heinold [heinold@physik.tu-cottbus.de]
Sven Traenkle [zwen@cvs.tuxbox.org]
gagga <gagga@berlios.de>
wjoost <wjoost@berlios.de>
Ralf Gandy <thegoodguy@berlios.de>
Michael Lantzen <leahcim@berlios.de>
Andreas Oberritter <obi@berlios.de>
Dirk Szymanski [dirch@cvs.tuxbox.org]
Steffen Hehn <mcclean@berlios.de>

View File

@@ -1,2 +1,34 @@
SUBDIRS = coolstream AM_CPPFLAGS = -fno-rtti -fno-exceptions -D__STDC_FORMAT_MACROS -D_FILE_OFFSET_BITS=64
AM_CPPFLAGS += \
-I$(top_builddir) \
-I$(top_srcdir) \
-I$(top_srcdir)/lib \
-I$(top_srcdir)/src/zapit/include \
-I$(top_srcdir)/src \
-I$(top_srcdir)/src/nhttpd \
-I$(top_srcdir)/src/nhttpd/yhttpd_core \
-I$(top_srcdir)/src/nhttpd/yhttpd_mods \
-I$(top_srcdir)/lib/connection \
-I$(top_srcdir)/lib/libeventserver \
-I$(top_srcdir)/lib/libconfigfile \
-I$(top_srcdir)/lib/xmltree \
@SIGC_CFLAGS@ \
@FREETYPE_CFLAGS@
if BOXTYPE_COOL
if BOXMODEL_APOLLO
AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream2
else
AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream
endif
endif
if BOXTYPE_TRIPLE
AM_CPPFLAGS += -I$(top_srcdir)/lib/libtriple
endif
noinst_LIBRARIES = libnhttpd_tuxboxapi.a
libnhttpd_tuxboxapi_a_SOURCES = \
neutrinoapi.cpp neutrinoyparser.cpp controlapi.cpp

View File

@@ -1,34 +0,0 @@
AM_CPPFLAGS = -fno-rtti -fno-exceptions -D__STDC_FORMAT_MACROS -D_FILE_OFFSET_BITS=64
AM_CPPFLAGS += \
-I$(top_builddir) \
-I$(top_srcdir) \
-I$(top_srcdir)/lib \
-I$(top_srcdir)/src/zapit/include \
-I$(top_srcdir)/src \
-I$(top_srcdir)/src/nhttpd \
-I$(top_srcdir)/src/nhttpd/yhttpd_core \
-I$(top_srcdir)/src/nhttpd/yhttpd_mods \
-I$(top_srcdir)/lib/connection \
-I$(top_srcdir)/lib/libeventserver \
-I$(top_srcdir)/lib/libconfigfile \
-I$(top_srcdir)/lib/xmltree \
@SIGC_CFLAGS@ \
@FREETYPE_CFLAGS@
if BOXTYPE_COOL
if BOXMODEL_APOLLO
AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream2
else
AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream
endif
endif
if BOXTYPE_TRIPLE
AM_CPPFLAGS += -I$(top_srcdir)/lib/libtriple
endif
noinst_LIBRARIES = libnhttpd_tuxboxapi.a
libnhttpd_tuxboxapi_a_SOURCES = \
neutrinoapi.cpp neutrinoyparser.cpp controlapi.cpp

View File

@@ -1,20 +0,0 @@
AM_CPPFLAGS = -fno-rtti -fno-exceptions -D_FILE_OFFSET_BITS=64
AM_CPPFLAGS += \
-I$(top_srcdir)/lib \
-I$(top_srcdir)/src/zapit/include \
-I$(top_srcdir)/src \
-I$(top_srcdir)/src/nhttpd \
-I$(top_srcdir)/src/nhttpd/yhttpd_core \
-I$(top_srcdir)/src/nhttpd/yhttpd_mods \
-I$(top_srcdir)/lib/connection \
-I$(top_srcdir)/lib/libeventserver \
-I$(top_srcdir)/lib/libconfigfile \
-I$(top_srcdir)/lib/xmltree \
@FREETYPE_CFLAGS@
noinst_LIBRARIES = libnhttpd_tuxboxapi.a
libnhttpd_tuxboxapi_a_SOURCES = \
neutrinoapi.cpp neutrinoyparser.cpp lcdapi.cpp controlapi.cpp

File diff suppressed because it is too large Load Diff

View File

@@ -1,117 +0,0 @@
//=============================================================================
// NHTTPD
// Neutrino ControlAPI
//=============================================================================
#ifndef __nhttpd_neutrinocontrolapi_hpp__
#define __nhttpd_neutrinocontrolapi_hpp__
// C++
#include <string>
// yhttpd
#include "yhook.h"
// forward declaration
class CNeutrinoAPI;
//-----------------------------------------------------------------------------
class CControlAPI : public Cyhook
{
private:
// Dispatcher Array
typedef void (CControlAPI::*TyFunc)(CyhookHandler *hh);
typedef struct
{
const char *func_name;
TyFunc pfunc;
const char *mime_type;
} TyCgiCall;
const static TyCgiCall yCgiCallList[];
int rc_send(int ev, unsigned int code, unsigned int value);
// send functions for ExecuteCGI (controld api)
void SendEventList(CyhookHandler *hh,t_channel_id channel_id);
void SendcurrentVAPid(CyhookHandler *hh);
void SendAllCurrentVAPid(CyhookHandler *hh);
void SendSettings(CyhookHandler *hh);
void SendStreamInfo(CyhookHandler *hh);
void SendBouquets(CyhookHandler *hh);
void SendBouquet(CyhookHandler *hh,int BouquetNr);
void SendChannelList(CyhookHandler *hh);
void SendTimers(CyhookHandler *hh);
// subs
friend class CNeutrinoWebserver; // for timer /fb/ compatibility
void doModifyTimer(CyhookHandler *hh);
void doNewTimer(CyhookHandler *hh);
//yweb
void YWeb_SendVideoStreamingPids(CyhookHandler *hh, int apid_no);
void YWeb_SendRadioStreamingPid(CyhookHandler *hh);
void compatibility_Timer(CyhookHandler *hh);
std::string YexecuteScript(CyhookHandler *hh, std::string cmd);
// CGI functions for ExecuteCGI
void TimerCGI(CyhookHandler *hh);
void SetModeCGI(CyhookHandler *hh);
void GetModeCGI(CyhookHandler *hh);
void ExecCGI(CyhookHandler *hh);
void SystemCGI(CyhookHandler *hh);
void StandbyCGI(CyhookHandler *hh);
void EsoundCGI(CyhookHandler *hh);
void RCCGI(CyhookHandler *hh);
void GetDateCGI(CyhookHandler *hh);
void GetTimeCGI(CyhookHandler *hh);
void SettingsCGI(CyhookHandler *hh);
void GetServicesxmlCGI(CyhookHandler *hh);
void GetBouquetsxmlCGI(CyhookHandler *hh);
void GetChannel_IDCGI(CyhookHandler *hh);
void MessageCGI(CyhookHandler *hh);
void InfoCGI(CyhookHandler *hh);
void ShutdownCGI(CyhookHandler *hh);
void VolumeCGI(CyhookHandler *hh);
void ChannellistCGI(CyhookHandler *hh);
void GetBouquetCGI(CyhookHandler *hh);
void GetBouquetsCGI(CyhookHandler *hh);
void EpgCGI(CyhookHandler *hh);
void VersionCGI(CyhookHandler *hh);
void ZaptoCGI(CyhookHandler *hh);
void StartPluginCGI(CyhookHandler *hh);
void LCDAction(CyhookHandler *hh);
void YWebCGI(CyhookHandler *hh);
void RebootCGI(CyhookHandler *hh);
void RCEmCGI(CyhookHandler *hh);
void AspectRatioCGI(CyhookHandler *hh);
void VideoFormatCGI(CyhookHandler *hh);
void VideoOutputCGI(CyhookHandler *hh);
void VCROutputCGI(CyhookHandler *hh);
void ScartModeCGI(CyhookHandler *hh);
void setBouquetCGI(CyhookHandler *hh);
void saveBouquetCGI(CyhookHandler *hh);
void moveBouquetCGI(CyhookHandler *hh);
void deleteBouquetCGI(CyhookHandler *hh);
void addBouquetCGI(CyhookHandler *hh);
void renameBouquetCGI(CyhookHandler *hh);
void changeBouquetCGI(CyhookHandler *hh);
void updateBouquetCGI(CyhookHandler *hh);
void build_live_url(CyhookHandler *hh);
protected:
static const unsigned int PLUGIN_DIR_COUNT = 5;
static std::string PLUGIN_DIRS[PLUGIN_DIR_COUNT];
CNeutrinoAPI *NeutrinoAPI;
void init(CyhookHandler *hh);
void Execute(CyhookHandler *hh);
public:
// constructor & deconstructor
CControlAPI(CNeutrinoAPI *_NeutrinoAPI);
// virtual functions for HookHandler/Hook
virtual std::string getHookName(void) {return std::string("mod_ControlAPI");}
virtual std::string getHookVersion(void) {return std::string("$Revision$");}
virtual THandleStatus Hook_SendResponse(CyhookHandler *hh);
virtual THandleStatus Hook_PrepareResponse(CyhookHandler *hh);
};
#endif /* __nhttpd_neutrinocontrolapi_hpp__ */

View File

@@ -1,220 +0,0 @@
/*
nhttpd - DBoxII-Project
Copyright (C) 2001/2002 Dirk Szymanski 'Dirch'
Copyright (C) 2005 SnowHead
$Id: lcdapi.cpp,v 1.1.2.1 2010/02/21 10:10:12 cvs Exp $
License: GPL
This program 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.
This program 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 this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// c++
#include <cstdlib>
#include <cstring>
#include <config.h>
// tuxbox
#if HAVE_LCD
#include <driver/lcdd.h>
#endif
#include <global.h>
#include <neutrino.h>
#include <system/settings.h>
#if HAVE_LCD
#include <lcddisplay/lcddisplay.h>
#endif
#include <fcntl.h>
#include <unistd.h>
// nhttpd
//#include "ylogging.h"
#include "lcdapi.h"
#if HAVE_LCD
static char font_name[3][10]={"Micron","Micron","Pakenham"};
#endif
//-------------------------------------------------------------------------
void CLCDAPI::Clear(void)
{
#if HAVE_LCD
display.draw_fill_rect(-1, -1, 120, 64, CLCDDisplay::PIXEL_OFF); // clear lcd
#endif
}
void CLCDAPI::Update(void)
{
#if HAVE_LCD
display.update();
#endif
}
void CLCDAPI::LockDisplay(int plock)
{
if (plock)
{
FILE *lfh=fopen("/tmp/lcd.locked","w");
if(lfh)
{
fprintf(lfh,"lcdlock");
fclose(lfh);
usleep(100000L);
}
}
else
{
remove("/tmp/lcd.locked");
}
}
void CLCDAPI::DrawLine(int x1, int y1, int x2, int y2, int col)
{
#if HAVE_LCD
int color=(col==0)?(CLCDDisplay::PIXEL_OFF):((col==2)?(CLCDDisplay::PIXEL_INV):(CLCDDisplay::PIXEL_ON));
display.draw_line(x1,y1,x2,y2,color);
#endif
}
void CLCDAPI::DrawRect(int x1, int y1, int x2, int y2, int coll, int colf)
{
#if HAVE_LCD
int colorl=(coll==0)?(CLCDDisplay::PIXEL_OFF):((coll==2)?(CLCDDisplay::PIXEL_INV):(CLCDDisplay::PIXEL_ON));
int colorf=(colf==0)?(CLCDDisplay::PIXEL_OFF):((colf==2)?(CLCDDisplay::PIXEL_INV):(CLCDDisplay::PIXEL_ON));
display.draw_rectangle(x1,y1,x2,y2,colorl,colorf);
#endif
}
void CLCDAPI::DrawText(int px, int py, int psize, int pcolor, int pfont, char *pmsg)
{
#if HAVE_LCD
int color=(pcolor==0)?(CLCDDisplay::PIXEL_OFF):((pcolor==2)?(CLCDDisplay::PIXEL_INV):(CLCDDisplay::PIXEL_ON));
if(!(font = fontRenderer->getFont(font_name[pfont], style_name[pfont], psize)))
{
printf("[nhttpd] Kein Font gefunden.\n");
return;
}
font->RenderString(px, py, 130, pmsg, color, 0, true); // UTF-8
#endif
}
bool CLCDAPI::ShowPng(char *filename)
{
#if HAVE_LCD
return display.load_png(filename);
#endif
return 0;
}
void CLCDAPI::ShowRaw(int xpos, int ypos, int xsize, int ysize, char *ascreen)
{
#if HAVE_LCD
int sbyte,dbit,dxpos,dypos,wasinc=0,gotval;
char *sptr=ascreen;
raw_display_t rscreen;
display.dump_screen(&rscreen);
gotval=sscanf(sptr,"%d",&sbyte);
for(dypos=ypos; gotval && (dypos<(ypos+ysize)); dypos++)
{
dbit=7;
for(dxpos=xpos; gotval && (dxpos<(xpos+xsize)); dxpos++)
{
wasinc=0;
if((dypos<LCD_ROWS*8) && (dxpos<LCD_COLS))
{
rscreen[dypos][dxpos]=(sbyte & (1<<dbit))?1:0;
}
if(--dbit<0)
{
dbit=7;
if((sptr=strchr(sptr,','))!=NULL)
{
gotval=sscanf(++sptr,"%d",&sbyte);
}
else
{
gotval=0;
}
wasinc=1;
}
}
if(!wasinc)
{
if((sptr=strchr(sptr,','))!=NULL)
{
gotval=sscanf(++sptr,"%d",&sbyte);
}
else
{
gotval=0;
}
}
}
display.load_screen(&rscreen);
#endif
}
//-------------------------------------------------------------------------
// Konstruktor und destruktor
//-------------------------------------------------------------------------
CLCDAPI::CLCDAPI()
{
#if HAVE_LCD
// int i;
// display = new CLCDDisplay();
fontRenderer = new LcdFontRenderClass(&display);
style_name[0] = fontRenderer->AddFont("/share/fonts/micron.ttf");
style_name[1] = fontRenderer->AddFont("/share/fonts/micron_bold.ttf");
style_name[2] = fontRenderer->AddFont("/share/fonts/pakenham.ttf");
fontRenderer->InitFontCache();
/* for(i=0; i<3; i++)
{
if(font=fontRenderer->getFont(font_name[i], style_name[i], 14))
{
font->RenderString(10, 10, 30, "X", CLCDDisplay::PIXEL_OFF, 0, true);
}
}
*/
#endif
}
//-------------------------------------------------------------------------
CLCDAPI::~CLCDAPI(void)
{
#if HAVE_LCD
if(fontRenderer)
{
delete fontRenderer;
}
/* if(display)
{
delete display;
}
*/
#endif
}

View File

@@ -1,61 +0,0 @@
/*
nhttpd - DBoxII-Project
Copyright (C) 2001/2002 Dirk Szymanski 'Dirch'
Copyright (C) 2005 SnowHead
$Id: lcdapi.h,v 1.1.2.1 2010/02/21 10:10:12 cvs Exp $
License: GPL
This program 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.
This program 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 this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __nhttpd_lcdapi_h__
#define __nhttpd_lcdapi_h__
// tuxbox
#if HAVE_LCD
#include <driver/lcdd.h>
#include <lcddisplay/lcddisplay.h>
#include <lcddisplay/fontrenderer.h>
#endif
class CLCDDisplay;
class LcdFontRenderClass;
//-------------------------------------------------------------------------
class CLCDAPI
{
#if HAVE_LCD
CLCDDisplay display;
LcdFontRenderClass *fontRenderer;
LcdFont *font;
#endif
const char *style_name[3];
public:
CLCDAPI();
~CLCDAPI(void);
void LockDisplay(int lock);
void DrawText(int px, int py, int psize, int pcolor, int pfont, char *pmsg);
void DrawLine(int x1, int y1, int x2, int y2, int col);
void DrawRect(int x1, int y1, int x2, int y2, int coll, int colf);
bool ShowPng(char *filename);
void ShowRaw(int xpos, int ypos, int xsize, int ysize, char *screen);
void Update(void);
void Clear(void);
};
#endif /* __nhttpd_lcdapi_h__ */

View File

@@ -1,424 +0,0 @@
//=============================================================================
// NHTTPD
// NeutrionAPI
//
// Aggregates: NeutrinoYParser, NeutrinoControlAPI
// Defines Interfaces to:CControldClient, CSectionsdClient, CZapitClient,
// CTimerdClient,CLCDAPI
// Place for common used Neutrino-functions used by NeutrinoYParser, NeutrinoControlAPI
//=============================================================================
// C
#include <cstdlib>
#include <cstring>
// C++
#include <string>
#include <fstream>
#include <map>
// tuxbox
#include <neutrinoMessages.h>
#include <zapit/client/zapitclient.h>
#include <zapit/channel.h>
#include <zapit/bouquets.h>
extern tallchans allchans;
extern CBouquetManager *g_bouquetManager;
// yhttpd
#include "ylogging.h"
// nhttpd
#include "neutrinoapi.h"
#include "lcdapi.h"
void sectionsd_getChannelEvents(CChannelEventList &eList, const bool tv_mode = true, t_channel_id *chidlist = NULL, int clen = 0);
//=============================================================================
// No Class Helpers
//=============================================================================
static std::map<std::string, std::string> iso639;
#ifndef initialize_iso639_map
bool _initialize_iso639_map(void)
{
std::string s, t, u, v;
std::ifstream in("/share/iso-codes/iso-639.tab");
if (in.is_open())
{
while (in.peek() == '#')
getline(in, s);
while (in >> s >> t >> u >> std::ws)
{
getline(in, v);
iso639[s] = v;
if (s != t)
iso639[t] = v;
}
in.close();
return true;
}
else
return false;
}
#endif
//-----------------------------------------------------------------------------
const char * _getISO639Description(const char * const iso)
{
std::map<std::string, std::string>::const_iterator it = iso639.find(std::string(iso));
if (it == iso639.end())
return iso;
else
return it->second.c_str();
}
//=============================================================================
// Initialization of static variables
//=============================================================================
std::string CNeutrinoAPI::Dbox_Hersteller[4] = {"none", "Nokia", "Philips", "Sagem"};
std::string CNeutrinoAPI::videooutput_names[5] = {"CVBS", "RGB with CVBS", "S-Video", "YUV with VBS", "YUV with CVBS"};
std::string CNeutrinoAPI::videoformat_names[4] = {"automatic", "16:9", "4:3 (LB)", "4:3 (PS)"};
std::string CNeutrinoAPI::audiotype_names[5] = {"none", "single channel","dual channel","joint stereo","stereo"};
//=============================================================================
// Constructor & Destructor
//=============================================================================
CNeutrinoAPI::CNeutrinoAPI()
{
Controld = new CControldClient();
Sectionsd = new CSectionsdClient();
Zapit = new CZapitClient();
Timerd = new CTimerdClient();
NeutrinoYParser = new CNeutrinoYParser(this);
ControlAPI = new CControlAPI(this);
LcdAPI = new CLCDAPI();
UpdateBouquets();
EventServer = new CEventServer;
EventServer->registerEvent2( NeutrinoMessages::SHUTDOWN, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
EventServer->registerEvent2( NeutrinoMessages::STANDBY_ON, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
EventServer->registerEvent2( NeutrinoMessages::STANDBY_OFF, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
EventServer->registerEvent2( NeutrinoMessages::STANDBY_TOGGLE, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
EventServer->registerEvent2( NeutrinoMessages::EVT_POPUP, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
EventServer->registerEvent2( NeutrinoMessages::EVT_EXTMSG, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
EventServer->registerEvent2( NeutrinoMessages::CHANGEMODE, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
EventServer->registerEvent2( NeutrinoMessages::EVT_START_PLUGIN, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
EventServer->registerEvent2( NeutrinoMessages::LOCK_RC, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
EventServer->registerEvent2( NeutrinoMessages::UNLOCK_RC, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
EventServer->registerEvent2( NeutrinoMessages::ESOUND_ON, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
EventServer->registerEvent2( NeutrinoMessages::ESOUND_OFF, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
}
//-------------------------------------------------------------------------
CNeutrinoAPI::~CNeutrinoAPI(void)
{
if (LcdAPI)
delete LcdAPI;
if (NeutrinoYParser)
delete NeutrinoYParser;
if (ControlAPI)
delete ControlAPI;
if (Controld)
delete Controld;
if (Sectionsd)
delete Sectionsd;
if (Zapit)
delete Zapit;
if (Timerd)
delete Timerd;
if (EventServer)
delete EventServer;
}
//-------------------------------------------------------------------------
void CNeutrinoAPI::UpdateBouquets(void)
{
BouquetList.clear();
Zapit->getBouquets(BouquetList, true);
for (unsigned int i = 1; i <= BouquetList.size(); i++)
UpdateBouquet(i);
UpdateChannelList();
}
//-------------------------------------------------------------------------
void CNeutrinoAPI::ZapTo(const char * const target)
{
t_channel_id channel_id;
sscanf(target,
SCANF_CHANNEL_ID_TYPE,
&channel_id);
ZapToChannelId(channel_id);
}
//-------------------------------------------------------------------------
void CNeutrinoAPI::ZapToChannelId(t_channel_id channel_id)
{
if (channel_id == Zapit->getCurrentServiceID())
{
//printf("Kanal ist aktuell\n");
return;
}
if (Zapit->zapTo_serviceID(channel_id) != CZapitClient::ZAP_INVALID_PARAM)
Sectionsd->setServiceChanged(channel_id, false);
}
//-------------------------------------------------------------------------
void CNeutrinoAPI::ZapToSubService(const char * const target)
{
t_channel_id channel_id;
sscanf(target,
SCANF_CHANNEL_ID_TYPE,
&channel_id);
if (Zapit->zapTo_subServiceID(channel_id) != CZapitClient::ZAP_INVALID_PARAM)
Sectionsd->setServiceChanged(channel_id, false);
}
//-------------------------------------------------------------------------
t_channel_id CNeutrinoAPI::ChannelNameToChannelId(std::string search_channel_name)
{
//FIXME depending on mode missing
//int mode = Zapit->getMode();
t_channel_id channel_id = (t_channel_id)-1;
CStringArray channel_names = ySplitStringVector(search_channel_name, ",");
CZapitClient::BouquetChannelList *channellist = GetChannelList(CZapitClient::MODE_CURRENT);
CZapitClient::BouquetChannelList::iterator channel = channellist->begin();
for(; channel != channellist->end();channel++)
{
std::string channel_name = channel->name;
for(unsigned int j=0;j<channel_names.size();j++)
{
if(channel_names[j].length() == channel_name.length() &&
equal(channel_names[j].begin(), channel_names[j].end(),
channel_name.begin(), nocase_compare)) //case insensitive compare
{
channel_id = channel->channel_id;
break;
}
}
}
return channel_id;
}
//-------------------------------------------------------------------------
// Get functions
//-------------------------------------------------------------------------
bool CNeutrinoAPI::GetStreamInfo(int bitInfo[10])
{
char *key, *tmpptr, buf[100];
long value;
int pos = 0;
memset(bitInfo, 0, sizeof(bitInfo));
FILE *fd = fopen("/proc/bus/bitstream", "rt");
if (fd == NULL)
{
dprintf("error while opening proc-bitstream\n" );
return false;
}
fgets(buf,35,fd);//dummy
while(!feof(fd))
{
if(fgets(buf,35,fd)!=NULL)
{
buf[strlen(buf)-1]=0;
tmpptr=buf;
key=strsep(&tmpptr,":");
value=strtoul(tmpptr,NULL,0);
bitInfo[pos]= value;
pos++;
}
}
bitInfo[4] = 37500;
bitInfo[6] = 3;
fclose(fd);
return true;
}
//-------------------------------------------------------------------------
bool CNeutrinoAPI::GetChannelEvents(void)
{
eList = Sectionsd->getChannelEvents();
CChannelEventList::iterator eventIterator;
ChannelListEvents.clear();
if (eList.begin() == eList.end())
return false;
for (eventIterator = eList.begin(); eventIterator != eList.end(); eventIterator++)
ChannelListEvents[(*eventIterator).get_channel_id()] = &(*eventIterator);
return true;
}
//-------------------------------------------------------------------------
std::string CNeutrinoAPI::GetServiceName(t_channel_id channel_id)
{
unsigned int i;
for (i = 0; i < TVChannelList.size(); i++)
if (TVChannelList[i].channel_id == channel_id)
return TVChannelList[i].name;
for (i = 0; i < RadioChannelList.size(); i++)
if (RadioChannelList[i].channel_id == channel_id)
return RadioChannelList[i].name;
return "";
}
//-------------------------------------------------------------------------
CZapitClient::BouquetChannelList *CNeutrinoAPI::GetBouquet(unsigned int BouquetNr, int Mode)
{
int mode;
if (Mode == CZapitClient::MODE_CURRENT)
mode = Zapit->getMode();
else
mode = Mode;
if (mode == CZapitClient::MODE_TV)
return &TVBouquetsList[BouquetNr];
else
return &RadioBouquetsList[BouquetNr];
}
//-------------------------------------------------------------------------
CZapitClient::BouquetChannelList *CNeutrinoAPI::GetChannelList(int Mode)
{
int mode;
if (Mode == CZapitClient::MODE_CURRENT)
mode = Zapit->getMode();
else
mode = Mode;
if (mode == CZapitClient::MODE_TV)
return &TVChannelList;
else
return &RadioChannelList;
}
//-------------------------------------------------------------------------
void CNeutrinoAPI::UpdateBouquet(unsigned int BouquetNr)
{
TVBouquetsList[BouquetNr].clear();
RadioBouquetsList[BouquetNr].clear();
Zapit->getBouquetChannels(BouquetNr - 1, TVBouquetsList[BouquetNr], CZapitClient::MODE_TV);
Zapit->getBouquetChannels(BouquetNr - 1, RadioBouquetsList[BouquetNr], CZapitClient::MODE_RADIO);
}
//-------------------------------------------------------------------------
void CNeutrinoAPI::UpdateChannelList(void)
{
TVChannelList.clear();
RadioChannelList.clear();
Zapit->getChannels(RadioChannelList, CZapitClient::MODE_RADIO);
Zapit->getChannels(TVChannelList, CZapitClient::MODE_TV);
}
//-------------------------------------------------------------------------
std::string CNeutrinoAPI::timerEventType2Str(CTimerd::CTimerEventTypes type)
{
std::string result;
switch (type) {
case CTimerd::TIMER_SHUTDOWN:
result = "Shutdown";
break;
case CTimerd::TIMER_NEXTPROGRAM:
result = "Next program";
break;
case CTimerd::TIMER_ZAPTO:
result = "Zap to";
break;
case CTimerd::TIMER_STANDBY:
result = "Standby";
break;
case CTimerd::TIMER_RECORD:
result = "Record";
break;
case CTimerd::TIMER_REMIND:
result = "Reminder";
break;
case CTimerd::TIMER_EXEC_PLUGIN:
result = "Execute plugin";
break;
case CTimerd::TIMER_SLEEPTIMER:
result = "Sleeptimer";
break;
default:
result = "Unknown";
break;
}
return result;
}
//-------------------------------------------------------------------------
std::string CNeutrinoAPI::timerEventRepeat2Str(CTimerd::CTimerEventRepeat rep)
{
std::string result;
switch (rep) {
case CTimerd::TIMERREPEAT_ONCE:
result = "once";
break;
case CTimerd::TIMERREPEAT_DAILY:
result = "daily";
break;
case CTimerd::TIMERREPEAT_WEEKLY:
result = "weekly";
break;
case CTimerd::TIMERREPEAT_BIWEEKLY:
result = "2-weekly";
break;
case CTimerd::TIMERREPEAT_FOURWEEKLY:
result = "4-weekly";
break;
case CTimerd::TIMERREPEAT_MONTHLY:
result = "monthly";
break;
case CTimerd::TIMERREPEAT_BYEVENTDESCRIPTION:
result = "event";
break;
case CTimerd::TIMERREPEAT_WEEKDAYS:
result = "weekdays";
break;
default:
if (rep > CTimerd::TIMERREPEAT_WEEKDAYS)
{
if (rep & 0x0200)
result += "Mo ";
if (rep & 0x0400)
result += "Tu ";
if (rep & 0x0800)
result += "We ";
if (rep & 0x1000)
result += "Th ";
if (rep & 0x2000)
result += "Fr ";
if (rep & 0x4000)
result += "Sa ";
if (rep & 0x8000)
result += "Su ";
}
else
result = "Unknown";
}
return result;
}

View File

@@ -1,90 +0,0 @@
#ifndef __nhttpd_neutrinoapi_h__
#define __nhttpd_neutrinoapi_h__
// c++
#include <map>
#include <string>
// tuxbox
#include <controldclient/controldclient.h>
#include <eventserver.h>
#include <sectionsdclient/sectionsdclient.h>
#include <timerdclient/timerdclient.h>
#include <zapit/client/zapitclient.h>
// nhttpd
#include "helper.h"
#include "lcdapi.h"
#include "neutrinoyparser.h"
#include "controlapi.h"
#include "lcdapi.h"
//-------------------------------------------------------------------------
// No Class Helpers
const char * _getISO639Description(const char * const iso);
bool _initialize_iso639_map(void);
//-------------------------------------------------------------------------
class CNeutrinoAPI
{
// Clientlibs
CControldClient *Controld;
CSectionsdClient *Sectionsd;
CZapitClient *Zapit;
CTimerdClient *Timerd;
CLCDAPI *LcdAPI;
CEventServer *EventServer;
// complete channellists
CZapitClient::BouquetChannelList RadioChannelList,TVChannelList;
// events of actual channel
std::map<unsigned, CChannelEvent *> ChannelListEvents;
// List of available tv bouquets
std::map<int, CZapitClient::BouquetChannelList> TVBouquetsList;
// List of available radio bouquets
std::map<int, CZapitClient::BouquetChannelList> RadioBouquetsList;
// List of bouquets
CZapitClient::BouquetList BouquetList;
//bool standby_mode;
// some constants
static std::string Dbox_Hersteller[4];
static std::string videooutput_names[5];
static std::string videoformat_names[4];
static std::string audiotype_names[5];
// get functions to collect data
bool GetChannelEvents(void);
bool GetStreamInfo(int bitinfo[10]);
std::string GetServiceName(t_channel_id channel_id);
CZapitClient::BouquetChannelList *GetBouquet(unsigned int BouquetNr, int Mode);
CZapitClient::BouquetChannelList *GetChannelList(int Mode);
// support functions
void ZapTo (const char * const target);
void ZapToSubService(const char * const target);
void ZapToChannelId (t_channel_id channel_id);
t_channel_id ChannelNameToChannelId(std::string search_channel_name);
void UpdateBouquet(unsigned int BouquetNr);
void UpdateChannelList(void);
void UpdateBouquets(void);
std::string timerEventType2Str(CTimerd::CTimerEventTypes type);
std::string timerEventRepeat2Str(CTimerd::CTimerEventRepeat rep);
public:
CNeutrinoAPI();
~CNeutrinoAPI(void);
CChannelEventList eList;
CNeutrinoYParser *NeutrinoYParser;
CControlAPI *ControlAPI;
friend class CNeutrinoYParser; // Backreference
friend class CNeutrinoYParserCoolstream; // Backreference
friend class CControlAPI;
};
#endif /*__nhttpd_neutrinoapi_h__*/

File diff suppressed because it is too large Load Diff

View File

@@ -1,70 +0,0 @@
//=============================================================================
// NHTTPD
// Neutrino yParser Extenstion
//=============================================================================
#ifndef __nhttpd_neutrinoyparser_h__
#define __nhttpd_neutrinoyparser_h__
// c++
#include <string>
// yhttpd
#include "yhttpd.h"
#include "ytypes_globals.h"
#include "mod_yparser.h"
// forward declaration
class CNeutrinoAPI;
//-----------------------------------------------------------------------------
class CNeutrinoYParser : public CyParser
{
private:
// yParser funcs for Tuxbox
typedef std::string (CNeutrinoYParser::*TyFunc)(CyhookHandler *hh, std::string para);
typedef struct
{
const char *func_name;
TyFunc pfunc;
} TyFuncCall;
const static TyFuncCall yFuncCallList[];
// func TUXBOX
std::string func_mount_get_list(CyhookHandler *hh, std::string para);
std::string func_mount_set_values(CyhookHandler *hh, std::string para);
std::string func_get_bouquets_as_dropdown(CyhookHandler *hh, std::string para);
std::string func_get_bouquets_as_templatelist(CyhookHandler *hh, std::string para);
std::string func_get_actual_bouquet_number(CyhookHandler *hh, std::string para);
std::string func_get_channels_as_dropdown(CyhookHandler *hh, std::string para);
std::string func_get_actual_channel_id(CyhookHandler *hh, std::string para);
std::string func_get_bouquets_with_epg(CyhookHandler *hh, std::string para);
std::string func_get_mode(CyhookHandler *hh, std::string para);
std::string func_get_video_pids(CyhookHandler *hh, std::string para);
std::string func_get_radio_pid(CyhookHandler *hh, std::string para);
std::string func_get_audio_pids_as_dropdown(CyhookHandler *hh, std::string para);
std::string func_unmount_get_list(CyhookHandler *hh, std::string para);
std::string func_get_partition_list(CyhookHandler *hh, std::string para);
std::string func_get_boxtype(CyhookHandler *hh, std::string para);
std::string func_get_current_stream_info(CyhookHandler *hh, std::string para);
std::string func_get_timer_list(CyhookHandler *hh, std::string para);
std::string func_set_timer_form(CyhookHandler *hh, std::string para);
std::string func_bouquet_editor_main(CyhookHandler *hh, std::string para);
std::string func_set_bouquet_edit_form(CyhookHandler *hh, std::string para);
protected:
CNeutrinoAPI *NeutrinoAPI;
public:
// constructor & deconstructor
CNeutrinoYParser(CNeutrinoAPI *_NeutrinoAPI);
virtual ~CNeutrinoYParser(void);
// virtual functions for BaseClass
virtual std::string YWeb_cgi_func(CyhookHandler *hh, std::string ycmd);
// virtual functions for HookHandler/Hook
virtual std::string getHookName(void) {return std::string("mod_NeutrinoYParser");}
virtual std::string getHookVersion(void) {return std::string("$Revision$");}
virtual THandleStatus Hook_SendResponse(CyhookHandler *hh);
virtual THandleStatus Hook_ReadConfig(CConfigFile *Config, CStringList &ConfigList);
};
#endif /*__nhttpd_neutrinoyparser_h__*/