2014-03-08 12:07:47 +01:00
/*
* setup . c : SAT > IP plugin for the Video Disk Recorder
*
* See the README file for copyright information and how to reach the author .
*
*/
# include <vdr/status.h>
# include <vdr/menu.h>
# include "common.h"
# include "config.h"
# include "device.h"
# include "discover.h"
2014-12-05 22:14:40 +01:00
# include "log.h"
2014-03-08 12:07:47 +01:00
# include "setup.h"
2014-10-31 21:07:33 +01:00
// --- cSatipEditSrcItem ------------------------------------------------------
// This class is a 99% copy of cMenuEditSrcItem() taken from VDR's menu.c
class cSatipEditSrcItem : public cMenuEditIntItem {
private :
const cSource * source ;
protected :
virtual void Set ( void ) ;
public :
cSatipEditSrcItem ( const char * Name , int * Value ) ;
eOSState ProcessKey ( eKeys Key ) ;
} ;
cSatipEditSrcItem : : cSatipEditSrcItem ( const char * Name , int * Value )
: cMenuEditIntItem ( Name , Value , 0 )
{
source = Sources . Get ( * Value ) ;
if ( ! source )
source = Sources . First ( ) ;
Set ( ) ;
}
void cSatipEditSrcItem : : Set ( void )
{
if ( source )
SetValue ( cString : : sprintf ( " %s - %s " , * cSource : : ToString ( source - > Code ( ) ) , source - > Description ( ) ) ) ;
else
cMenuEditIntItem : : Set ( ) ;
}
eOSState cSatipEditSrcItem : : ProcessKey ( eKeys Key )
{
eOSState state = cMenuEditItem : : ProcessKey ( Key ) ;
if ( state = = osUnknown ) {
bool IsRepeat = Key & k_Repeat ;
Key = NORMALKEY ( Key ) ;
if ( Key = = kLeft ) { // TODO might want to increase the delta if repeated quickly?
if ( source ) {
if ( source - > Prev ( ) )
source = ( cSource * ) source - > Prev ( ) ;
else if ( ! IsRepeat )
source = Sources . Last ( ) ;
* value = source - > Code ( ) ;
}
}
else if ( Key = = kRight ) {
if ( source ) {
if ( source - > Next ( ) )
source = ( cSource * ) source - > Next ( ) ;
else if ( ! IsRepeat )
source = Sources . First ( ) ;
}
else
source = Sources . First ( ) ;
if ( source )
* value = source - > Code ( ) ;
}
else
return state ; // we don't call cMenuEditIntItem::ProcessKey(Key) here since we don't accept numerical input
Set ( ) ;
state = osContinue ;
}
return state ;
}
2014-03-10 20:21:08 +01:00
// --- cSatipServerInfo -------------------------------------------------------
2014-03-08 12:07:47 +01:00
2014-03-10 20:21:08 +01:00
class cSatipServerInfo : public cOsdMenu
2014-03-08 12:07:47 +01:00
{
private :
2014-03-13 17:23:55 +01:00
cString addressM ;
cString modelM ;
cString descriptionM ;
2015-01-06 18:45:39 +01:00
cString ciExtensionM ;
2014-03-13 17:23:55 +01:00
uint64_t createdM ;
void Setup ( void ) ;
2014-03-08 12:07:47 +01:00
public :
2015-08-16 00:38:03 +02:00
explicit cSatipServerInfo ( cSatipServer * serverP ) ;
2014-03-10 20:21:08 +01:00
virtual ~ cSatipServerInfo ( ) ;
2014-03-08 12:07:47 +01:00
virtual eOSState ProcessKey ( eKeys keyP ) ;
} ;
2014-03-10 20:21:08 +01:00
cSatipServerInfo : : cSatipServerInfo ( cSatipServer * serverP )
2014-11-03 20:55:28 +01:00
: cOsdMenu ( tr ( " SAT>IP Server " ) , 20 ) ,
2014-03-13 17:23:55 +01:00
addressM ( serverP ? serverP - > Address ( ) : " --- " ) ,
modelM ( serverP ? serverP - > Model ( ) : " --- " ) ,
descriptionM ( serverP ? serverP - > Description ( ) : " --- " ) ,
2015-01-25 23:21:55 +01:00
ciExtensionM ( serverP & & serverP - > HasCI ( ) ? trVDR ( " yes " ) : trVDR ( " no " ) ) ,
2014-03-13 17:23:55 +01:00
createdM ( serverP ? serverP - > Created ( ) : 0 )
2014-03-08 12:07:47 +01:00
{
2014-03-13 17:23:55 +01:00
SetMenuCategory ( mcSetupPlugins ) ;
Setup ( ) ;
2014-03-10 20:21:08 +01:00
SetHelp ( NULL , NULL , NULL , NULL ) ;
2014-03-08 12:07:47 +01:00
}
2014-03-10 20:21:08 +01:00
cSatipServerInfo : : ~ cSatipServerInfo ( )
2014-03-08 12:07:47 +01:00
{
}
2014-03-13 17:23:55 +01:00
void cSatipServerInfo : : Setup ( void )
2014-03-08 12:07:47 +01:00
{
2014-03-13 17:23:55 +01:00
Add ( new cOsdItem ( cString : : sprintf ( " %s: \t %s " , tr ( " Address " ) , * addressM ) , osUnknown , false ) ) ;
Add ( new cOsdItem ( cString : : sprintf ( " %s: \t %s " , tr ( " Model " ) , * modelM ) , osUnknown , false ) ) ;
Add ( new cOsdItem ( cString : : sprintf ( " %s: \t %s " , tr ( " Description " ) , * descriptionM ) , osUnknown , false ) ) ;
2015-01-06 18:45:39 +01:00
Add ( new cOsdItem ( cString : : sprintf ( " %s: \t %s " , tr ( " CI extension " ) , * ciExtensionM ) , osUnknown , false ) ) ;
2014-03-13 17:23:55 +01:00
Add ( new cOsdItem ( cString : : sprintf ( " %s: \t %s " , tr ( " Creation date " ) , * DayDateTime ( createdM ) ) , osUnknown , false ) ) ;
2014-03-08 12:07:47 +01:00
}
2014-03-10 20:21:08 +01:00
eOSState cSatipServerInfo : : ProcessKey ( eKeys keyP )
2014-03-08 12:07:47 +01:00
{
eOSState state = cOsdMenu : : ProcessKey ( keyP ) ;
if ( state = = osUnknown ) {
switch ( keyP ) {
2014-03-13 17:23:55 +01:00
case kOk : state = osBack ; break ;
default : state = osContinue ; break ;
2014-03-08 12:07:47 +01:00
}
}
return state ;
}
2014-03-10 20:21:08 +01:00
// --- cSatipServerItem -------------------------------------------------------
2014-03-08 12:07:47 +01:00
class cSatipServerItem : public cOsdItem {
private :
cSatipServer * serverM ;
public :
2015-08-16 00:38:03 +02:00
explicit cSatipServerItem ( cSatipServer * serverP ) ;
2014-03-08 12:07:47 +01:00
cSatipServer * Server ( void ) { return serverM ; }
virtual void SetMenuItem ( cSkinDisplayMenu * displayMenuP , int indexP , bool currentP , bool selectableP ) ;
} ;
cSatipServerItem : : cSatipServerItem ( cSatipServer * serverP )
: serverM ( serverP )
{
SetSelectable ( true ) ;
// Must begin with a '#' character!
SetText ( * cString : : sprintf ( " # %s (%s) \t %s " , serverM - > Address ( ) , serverM - > Model ( ) , serverM - > Description ( ) ) ) ;
}
void cSatipServerItem : : SetMenuItem ( cSkinDisplayMenu * displayMenuP , int indexP , bool currentP , bool selectableP )
{
if ( displayMenuP )
displayMenuP - > SetItem ( Text ( ) , indexP , currentP , selectableP ) ;
}
2014-11-03 20:55:28 +01:00
// --- cSatipMenuDeviceStatus -------------------------------------------------
class cSatipMenuDeviceStatus : public cOsdMenu
{
private :
enum {
eInfoTimeoutMs = 15000
} ;
cString textM ;
cTimeMs timeoutM ;
void UpdateInfo ( ) ;
public :
cSatipMenuDeviceStatus ( ) ;
virtual ~ cSatipMenuDeviceStatus ( ) ;
virtual void Display ( void ) ;
virtual eOSState ProcessKey ( eKeys keyP ) ;
} ;
cSatipMenuDeviceStatus : : cSatipMenuDeviceStatus ( )
: cOsdMenu ( tr ( " SAT>IP Device Status " ) ) ,
textM ( " " ) ,
timeoutM ( )
{
SetMenuCategory ( mcText ) ;
timeoutM . Set ( eInfoTimeoutMs ) ;
UpdateInfo ( ) ;
SetHelp ( NULL , NULL , NULL , NULL ) ;
}
cSatipMenuDeviceStatus : : ~ cSatipMenuDeviceStatus ( )
{
}
void cSatipMenuDeviceStatus : : UpdateInfo ( )
{
2014-11-10 22:46:45 +01:00
textM = cSatipDevice : : GetSatipStatus ( ) ;
2014-11-03 20:55:28 +01:00
Display ( ) ;
timeoutM . Set ( eInfoTimeoutMs ) ;
}
void cSatipMenuDeviceStatus : : Display ( void )
{
cOsdMenu : : Display ( ) ;
DisplayMenu ( ) - > SetText ( textM , true ) ;
if ( * textM )
cStatus : : MsgOsdTextItem ( textM ) ;
}
eOSState cSatipMenuDeviceStatus : : ProcessKey ( eKeys keyP )
{
eOSState state = cOsdMenu : : ProcessKey ( keyP ) ;
if ( state = = osUnknown ) {
switch ( keyP ) {
case kOk : state = osBack ; break ;
default : if ( timeoutM . TimedOut ( ) )
UpdateInfo ( ) ;
state = osContinue ;
break ;
}
}
return state ;
}
2014-03-08 12:07:47 +01:00
// --- cSatipMenuInfo ---------------------------------------------------------
class cSatipMenuInfo : public cOsdMenu
{
private :
enum {
2014-03-13 17:23:55 +01:00
eInfoTimeoutMs = 2000
2014-03-08 12:07:47 +01:00
} ;
cString textM ;
cTimeMs timeoutM ;
unsigned int pageM ;
void UpdateInfo ( ) ;
public :
cSatipMenuInfo ( ) ;
virtual ~ cSatipMenuInfo ( ) ;
virtual void Display ( void ) ;
virtual eOSState ProcessKey ( eKeys keyP ) ;
} ;
cSatipMenuInfo : : cSatipMenuInfo ( )
: cOsdMenu ( tr ( " SAT>IP Information " ) ) ,
textM ( " " ) ,
timeoutM ( ) ,
pageM ( SATIP_DEVICE_INFO_GENERAL )
{
SetMenuCategory ( mcText ) ;
2014-03-13 17:23:55 +01:00
timeoutM . Set ( eInfoTimeoutMs ) ;
2014-03-08 12:07:47 +01:00
UpdateInfo ( ) ;
SetHelp ( tr ( " General " ) , tr ( " Pids " ) , tr ( " Filters " ) , tr ( " Bits/bytes " ) ) ;
}
cSatipMenuInfo : : ~ cSatipMenuInfo ( )
{
}
void cSatipMenuInfo : : UpdateInfo ( )
{
cSatipDevice * device = cSatipDevice : : GetSatipDevice ( cDevice : : ActualDevice ( ) - > CardIndex ( ) ) ;
if ( device )
textM = device - > GetInformation ( pageM ) ;
else
textM = cString ( tr ( " SAT>IP information not available! " ) ) ;
Display ( ) ;
2014-03-13 17:23:55 +01:00
timeoutM . Set ( eInfoTimeoutMs ) ;
2014-03-08 12:07:47 +01:00
}
void cSatipMenuInfo : : Display ( void )
{
cOsdMenu : : Display ( ) ;
DisplayMenu ( ) - > SetText ( textM , true ) ;
if ( * textM )
cStatus : : MsgOsdTextItem ( textM ) ;
}
eOSState cSatipMenuInfo : : ProcessKey ( eKeys keyP )
{
switch ( int ( keyP ) ) {
case kUp | k_Repeat :
case kUp :
case kDown | k_Repeat :
case kDown :
case kLeft | k_Repeat :
case kLeft :
case kRight | k_Repeat :
case kRight :
DisplayMenu ( ) - > Scroll ( NORMALKEY ( keyP ) = = kUp | | NORMALKEY ( keyP ) = = kLeft , NORMALKEY ( keyP ) = = kLeft | | NORMALKEY ( keyP ) = = kRight ) ;
cStatus : : MsgOsdTextItem ( NULL , NORMALKEY ( keyP ) = = kUp | | NORMALKEY ( keyP ) = = kLeft ) ;
return osContinue ;
default : break ;
}
eOSState state = cOsdMenu : : ProcessKey ( keyP ) ;
if ( state = = osUnknown ) {
switch ( keyP ) {
case kOk : return osBack ;
case kRed : pageM = SATIP_DEVICE_INFO_GENERAL ;
UpdateInfo ( ) ;
break ;
case kGreen : pageM = SATIP_DEVICE_INFO_PIDS ;
UpdateInfo ( ) ;
break ;
case kYellow : pageM = SATIP_DEVICE_INFO_FILTERS ;
UpdateInfo ( ) ;
break ;
case kBlue : SatipConfig . SetUseBytes ( SatipConfig . GetUseBytes ( ) ? 0 : 1 ) ;
UpdateInfo ( ) ;
break ;
default : if ( timeoutM . TimedOut ( ) )
UpdateInfo ( ) ;
state = osContinue ;
break ;
}
}
return state ;
}
// --- cSatipPluginSetup ------------------------------------------------------
cSatipPluginSetup : : cSatipPluginSetup ( )
2015-03-17 20:25:15 +01:00
: detachedModeM ( SatipConfig . GetDetachedMode ( ) ) ,
deviceCountM ( 0 ) ,
2014-03-10 20:21:08 +01:00
operatingModeM ( SatipConfig . GetOperatingMode ( ) ) ,
2015-01-05 23:58:35 +01:00
ciExtensionM ( SatipConfig . GetCIExtension ( ) ) ,
2014-03-08 12:07:47 +01:00
eitScanM ( SatipConfig . GetEITScan ( ) ) ,
2014-10-31 21:07:33 +01:00
numDisabledSourcesM ( SatipConfig . GetDisabledSourcesCount ( ) ) ,
2014-03-08 12:07:47 +01:00
numDisabledFiltersM ( SatipConfig . GetDisabledFiltersCount ( ) )
{
2014-12-06 16:02:45 +01:00
debug1 ( " %s " , __PRETTY_FUNCTION__ ) ;
2014-03-13 17:23:55 +01:00
operatingModeTextsM [ cSatipConfig : : eOperatingModeOff ] = tr ( " off " ) ;
operatingModeTextsM [ cSatipConfig : : eOperatingModeLow ] = tr ( " low " ) ;
operatingModeTextsM [ cSatipConfig : : eOperatingModeNormal ] = tr ( " normal " ) ;
operatingModeTextsM [ cSatipConfig : : eOperatingModeHigh ] = tr ( " high " ) ;
2015-01-11 00:49:59 +01:00
for ( unsigned int i = 0 ; i < ELEMENTS ( cicamsM ) ; + + i )
cicamsM [ i ] = SatipConfig . GetCICAM ( i ) ;
for ( unsigned int i = 0 ; i < ELEMENTS ( ca_systems_table ) ; + + i )
cicamTextsM [ i ] = ca_systems_table [ i ] . description ;
2014-10-31 21:07:33 +01:00
if ( numDisabledSourcesM > MAX_DISABLED_SOURCES_COUNT )
numDisabledSourcesM = MAX_DISABLED_SOURCES_COUNT ;
for ( int i = 0 ; i < MAX_DISABLED_SOURCES_COUNT ; + + i )
disabledSourcesM [ i ] = SatipConfig . GetDisabledSources ( i ) ;
2014-03-08 12:07:47 +01:00
if ( numDisabledFiltersM > SECTION_FILTER_TABLE_SIZE )
numDisabledFiltersM = SECTION_FILTER_TABLE_SIZE ;
for ( int i = 0 ; i < SECTION_FILTER_TABLE_SIZE ; + + i ) {
disabledFilterIndexesM [ i ] = SatipConfig . GetDisabledFilters ( i ) ;
disabledFilterNamesM [ i ] = tr ( section_filter_table [ i ] . description ) ;
}
SetMenuCategory ( mcSetupPlugins ) ;
Setup ( ) ;
2014-11-03 20:55:28 +01:00
SetHelp ( trVDR ( " Button$Scan " ) , NULL , tr ( " Button$Devices " ) , trVDR ( " Button$Info " ) ) ;
2014-03-08 12:07:47 +01:00
}
void cSatipPluginSetup : : Setup ( void )
{
int current = Current ( ) ;
Clear ( ) ;
helpM . Clear ( ) ;
2014-03-10 20:21:08 +01:00
Add ( new cMenuEditStraItem ( tr ( " Operating mode " ) , & operatingModeM , ELEMENTS ( operatingModeTextsM ) , operatingModeTextsM ) ) ;
helpM . Append ( tr ( " Define the used operating mode for all SAT>IP devices: \n \n off - devices are disabled \n low - devices are working at the lowest priority \n normal - devices are working within normal parameters \n high - devices are working at the highest priority " ) ) ;
2014-03-08 12:07:47 +01:00
2014-03-10 20:21:08 +01:00
if ( operatingModeM ) {
2015-01-05 23:58:35 +01:00
Add ( new cMenuEditBoolItem ( tr ( " Enable CI extension " ) , & ciExtensionM ) ) ;
helpM . Append ( tr ( " Define whether a CI extension shall be used. \n \n This setting enables integrated CI/CAM handling found in some SAT>IP hardware (e.g. Digital Devices OctopusNet). " ) ) ;
2015-01-11 00:49:59 +01:00
for ( unsigned int i = 0 ; ciExtensionM & & i < ELEMENTS ( cicamsM ) ; + + i ) {
2015-01-11 22:49:12 +01:00
Add ( new cMenuEditStraItem ( * cString : : sprintf ( " %s #%d " , tr ( " CI/CAM " ) , i + 1 ) , & cicamsM [ i ] , ELEMENTS ( cicamTextsM ) , cicamTextsM ) ) ;
helpM . Append ( tr ( " Define a desired CAM type for the CI slot. \n \n The '---' option lets SAT>IP hardware do the auto-selection. " ) ) ;
2015-01-11 00:49:59 +01:00
}
2015-01-18 13:48:29 +01:00
2014-03-10 20:21:08 +01:00
Add ( new cMenuEditBoolItem ( tr ( " Enable EPG scanning " ) , & eitScanM ) ) ;
helpM . Append ( tr ( " Define whether the EPG background scanning shall be used. \n \n This setting disables the automatic EIT scanning functionality for all SAT>IP devices. " ) ) ;
2014-03-08 12:07:47 +01:00
2014-10-31 21:07:33 +01:00
Add ( new cMenuEditIntItem ( tr ( " Disabled sources " ) , & numDisabledSourcesM , 0 , MAX_DISABLED_SOURCES_COUNT , tr ( " none " ) ) ) ;
helpM . Append ( tr ( " Define number of sources to be disabled. \n \n SAT>IP servers might not have all satellite positions available and such sources can be blacklisted here. " ) ) ;
for ( int i = 0 ; i < numDisabledSourcesM ; + + i ) {
Add ( new cSatipEditSrcItem ( * cString : : sprintf ( " %s %d " , trVDR ( " Source " ) , i + 1 ) , & disabledSourcesM [ i ] ) ) ;
helpM . Append ( tr ( " Define a source to be blacklisted. " ) ) ;
}
2014-03-10 20:21:08 +01:00
Add ( new cMenuEditIntItem ( tr ( " Disabled filters " ) , & numDisabledFiltersM , 0 , SECTION_FILTER_TABLE_SIZE , tr ( " none " ) ) ) ;
2014-10-31 21:07:33 +01:00
helpM . Append ( tr ( " Define number of section filters to be disabled. \n \n Certain section filters might cause some unwanted behaviour to VDR such as time being falsely synchronized. By blacklisting the filters here, useful section data can be left intact for VDR to process. " ) ) ;
2014-03-08 12:07:47 +01:00
2014-03-10 20:21:08 +01:00
for ( int i = 0 ; i < numDisabledFiltersM ; + + i ) {
Add ( new cMenuEditStraItem ( * cString : : sprintf ( " %s %d " , tr ( " Filter " ) , i + 1 ) , & disabledFilterIndexesM [ i ] , SECTION_FILTER_TABLE_SIZE , disabledFilterNamesM ) ) ;
helpM . Append ( tr ( " Define an ill-behaving filter to be blacklisted. " ) ) ;
}
}
2014-11-03 20:55:28 +01:00
Add ( new cOsdItem ( tr ( " Active SAT>IP servers: " ) , osUnknown , false ) ) ;
2014-03-08 12:07:47 +01:00
helpM . Append ( " " ) ;
2015-03-17 20:25:15 +01:00
detachedModeM = SatipConfig . GetDetachedMode ( ) ;
if ( ! detachedModeM ) {
cSatipServers * servers = cSatipDiscover : : GetInstance ( ) - > GetServers ( ) ;
deviceCountM = servers - > Count ( ) ;
for ( cSatipServer * s = servers - > First ( ) ; s ; s = servers - > Next ( s ) ) {
Add ( new cSatipServerItem ( s ) ) ;
helpM . Append ( " " ) ;
}
}
2014-03-08 12:07:47 +01:00
SetCurrent ( Get ( current ) ) ;
Display ( ) ;
}
2014-03-13 17:23:55 +01:00
eOSState cSatipPluginSetup : : DeviceScan ( void )
{
2014-12-06 16:02:45 +01:00
debug1 ( " %s " , __PRETTY_FUNCTION__ ) ;
2014-03-13 17:23:55 +01:00
cSatipDiscover : : GetInstance ( ) - > TriggerScan ( ) ;
return osContinue ;
}
eOSState cSatipPluginSetup : : DeviceInfo ( void )
2014-03-08 12:07:47 +01:00
{
2014-12-06 16:02:45 +01:00
debug1 ( " %s " , __PRETTY_FUNCTION__ ) ;
2014-03-08 12:07:47 +01:00
if ( HasSubMenu ( ) | | Count ( ) = = 0 )
return osContinue ;
cSatipServerItem * item = reinterpret_cast < cSatipServerItem * > ( Get ( Current ( ) ) ) ;
2014-03-13 17:23:55 +01:00
if ( item & & ! ! cSatipDiscover : : GetInstance ( ) - > GetServer ( item - > Server ( ) ) )
2014-03-10 20:21:08 +01:00
return AddSubMenu ( new cSatipServerInfo ( item - > Server ( ) ) ) ;
2014-03-08 12:07:47 +01:00
return osContinue ;
}
2014-11-03 20:55:28 +01:00
eOSState cSatipPluginSetup : : ShowDeviceStatus ( void )
{
2014-12-06 16:02:45 +01:00
debug1 ( " %s " , __PRETTY_FUNCTION__ ) ;
2014-11-03 20:55:28 +01:00
if ( HasSubMenu ( ) | | Count ( ) = = 0 )
return osContinue ;
return AddSubMenu ( new cSatipMenuDeviceStatus ( ) ) ;
}
2014-03-08 12:07:47 +01:00
eOSState cSatipPluginSetup : : ShowInfo ( void )
{
2014-12-06 16:02:45 +01:00
debug1 ( " %s " , __PRETTY_FUNCTION__ ) ;
2014-03-08 12:07:47 +01:00
if ( HasSubMenu ( ) | | Count ( ) = = 0 )
return osContinue ;
return AddSubMenu ( new cSatipMenuInfo ( ) ) ;
}
eOSState cSatipPluginSetup : : ProcessKey ( eKeys keyP )
{
bool hadSubMenu = HasSubMenu ( ) ;
2014-03-10 20:21:08 +01:00
int oldOperatingMode = operatingModeM ;
2015-01-11 00:49:59 +01:00
int oldCiExtension = ciExtensionM ;
2014-10-31 21:07:33 +01:00
int oldNumDisabledSources = numDisabledSourcesM ;
2014-03-08 12:07:47 +01:00
int oldNumDisabledFilters = numDisabledFiltersM ;
eOSState state = cMenuSetupPage : : ProcessKey ( keyP ) ;
// Ugly hack with hardcoded '#' character :(
const char * p = Get ( Current ( ) ) - > Text ( ) ;
if ( ! hadSubMenu & & ! HasSubMenu ( ) & & ( * p = = ' # ' ) & & ( keyP = = kOk ) )
2014-03-13 17:23:55 +01:00
return DeviceInfo ( ) ;
2014-03-08 12:07:47 +01:00
if ( state = = osUnknown ) {
switch ( keyP ) {
2014-11-03 20:55:28 +01:00
case kRed : return DeviceScan ( ) ;
case kYellow : return ShowDeviceStatus ( ) ;
case kBlue : return ShowInfo ( ) ;
case kInfo : if ( Current ( ) < helpM . Size ( ) )
return AddSubMenu ( new cMenuText ( cString : : sprintf ( " %s - %s '%s' " , tr ( " Help " ) , trVDR ( " Plugin " ) , PLUGIN_NAME_I18N ) , helpM [ Current ( ) ] ) ) ;
default : state = osContinue ; break ;
2014-03-08 12:07:47 +01:00
}
}
if ( ( keyP = = kNone ) & & ( cSatipDiscover : : GetInstance ( ) - > GetServers ( ) - > Count ( ) ! = deviceCountM ) )
Setup ( ) ;
2015-03-17 20:25:15 +01:00
if ( ( keyP ! = kNone ) & & ( ( numDisabledSourcesM ! = oldNumDisabledSources ) | | ( numDisabledFiltersM ! = oldNumDisabledFilters ) | | ( operatingModeM ! = oldOperatingMode ) | | ( ciExtensionM ! = oldCiExtension ) | | ( detachedModeM ! = SatipConfig . GetDetachedMode ( ) ) ) ) {
2014-10-31 21:07:33 +01:00
while ( ( numDisabledSourcesM < oldNumDisabledSources ) & & ( oldNumDisabledSources > 0 ) )
disabledSourcesM [ - - oldNumDisabledSources ] = cSource : : stNone ;
2014-03-08 12:07:47 +01:00
while ( ( numDisabledFiltersM < oldNumDisabledFilters ) & & ( oldNumDisabledFilters > 0 ) )
disabledFilterIndexesM [ - - oldNumDisabledFilters ] = - 1 ;
Setup ( ) ;
}
return state ;
}
2015-01-11 00:49:59 +01:00
void cSatipPluginSetup : : StoreCicams ( const char * nameP , int * cicamsP )
{
cString buffer = " " ;
int n = 0 ;
for ( int i = 0 ; i < MAX_CICAM_COUNT ; + + i ) {
if ( cicamsP [ i ] < 0 )
break ;
if ( n + + > 0 )
buffer = cString : : sprintf ( " %s %d " , * buffer , cicamsP [ i ] ) ;
else
buffer = cString : : sprintf ( " %d " , cicamsP [ i ] ) ;
}
debug3 ( " %s (%s, %s) " , __PRETTY_FUNCTION__ , nameP , * buffer ) ;
SetupStore ( nameP , * buffer ) ;
}
2014-10-31 21:07:33 +01:00
void cSatipPluginSetup : : StoreSources ( const char * nameP , int * sourcesP )
{
cString buffer = " " ;
int n = 0 ;
for ( int i = 0 ; i < MAX_DISABLED_SOURCES_COUNT ; + + i ) {
if ( sourcesP [ i ] = = cSource : : stNone )
break ;
if ( n + + > 0 )
buffer = cString : : sprintf ( " %s %s " , * buffer , * cSource : : ToString ( sourcesP [ i ] ) ) ;
else
buffer = cString : : sprintf ( " %s " , * cSource : : ToString ( sourcesP [ i ] ) ) ;
}
2015-01-11 00:49:59 +01:00
debug3 ( " %s (%s, %s) " , __PRETTY_FUNCTION__ , nameP , * buffer ) ;
2014-10-31 21:07:33 +01:00
SetupStore ( nameP , * buffer ) ;
}
2014-03-08 12:07:47 +01:00
void cSatipPluginSetup : : StoreFilters ( const char * nameP , int * valuesP )
{
2014-10-31 21:07:33 +01:00
cString buffer = " " ;
int n = 0 ;
2014-03-08 12:07:47 +01:00
for ( int i = 0 ; i < SECTION_FILTER_TABLE_SIZE ; + + i ) {
if ( valuesP [ i ] < 0 )
break ;
2014-10-31 21:07:33 +01:00
if ( n + + > 0 )
buffer = cString : : sprintf ( " %s %d " , * buffer , valuesP [ i ] ) ;
else
buffer = cString : : sprintf ( " %d " , valuesP [ i ] ) ;
2014-03-08 12:07:47 +01:00
}
2015-01-11 00:49:59 +01:00
debug3 ( " %s (%s, %s) " , __PRETTY_FUNCTION__ , nameP , * buffer ) ;
2014-10-31 21:07:33 +01:00
SetupStore ( nameP , * buffer ) ;
2014-03-08 12:07:47 +01:00
}
void cSatipPluginSetup : : Store ( void )
{
// Store values into setup.conf
2014-03-10 20:21:08 +01:00
SetupStore ( " OperatingMode " , operatingModeM ) ;
2015-01-05 23:58:35 +01:00
SetupStore ( " EnableCIExtension " , ciExtensionM ) ;
2014-03-08 12:07:47 +01:00
SetupStore ( " EnableEITScan " , eitScanM ) ;
2015-01-11 00:49:59 +01:00
StoreCicams ( " CICAM " , cicamsM ) ;
2014-10-31 21:07:33 +01:00
StoreSources ( " DisabledSources " , disabledSourcesM ) ;
2014-03-08 12:07:47 +01:00
StoreFilters ( " DisabledFilters " , disabledFilterIndexesM ) ;
// Update global config
2014-03-10 20:21:08 +01:00
SatipConfig . SetOperatingMode ( operatingModeM ) ;
2015-01-05 23:58:35 +01:00
SatipConfig . SetCIExtension ( ciExtensionM ) ;
2014-03-08 12:07:47 +01:00
SatipConfig . SetEITScan ( eitScanM ) ;
2015-01-11 00:49:59 +01:00
for ( int i = 0 ; i < MAX_CICAM_COUNT ; + + i )
SatipConfig . SetCICAM ( i , cicamsM [ i ] ) ;
2014-10-31 21:07:33 +01:00
for ( int i = 0 ; i < MAX_DISABLED_SOURCES_COUNT ; + + i )
SatipConfig . SetDisabledSources ( i , disabledSourcesM [ i ] ) ;
2014-03-08 12:07:47 +01:00
for ( int i = 0 ; i < SECTION_FILTER_TABLE_SIZE ; + + i )
SatipConfig . SetDisabledFilters ( i , disabledFilterIndexesM [ i ] ) ;
}