Merge branch 'dvbsi++' of coolstreamtech.de:cst-public-gui-neutrino into dvbsi++

This commit is contained in:
svenhoefer
2012-10-11 17:03:45 +02:00
17 changed files with 200 additions and 347 deletions

View File

@@ -1799,6 +1799,8 @@ videomenu.videoformat_149 14:9
videomenu.videoformat_169 16:9 videomenu.videoformat_169 16:9
videomenu.videoformat_43 4:3 videomenu.videoformat_43 4:3
videomenu.videomode Digital video mode videomenu.videomode Digital video mode
wizard.initial_settings Initial settings found
wizard.install_settings Do you want to install channels for Astra 19.2°E ?
wizard.welcome_head Welcome to the Setup Wizard wizard.welcome_head Welcome to the Setup Wizard
wizard.welcome_text Next steps will guide you through initial installation of the device.\nImportant: Your CoolStream set-top box can be conveniently controlled\nwith the web interface for timer management or live TV on the Web browser.\nDo not make it accessible to untrusted networks!\nDo you want to continue? wizard.welcome_text Next steps will guide you through initial installation of the device.\nImportant: Your CoolStream set-top box can be conveniently controlled\nwith the web interface for timer management or live TV on the Web browser.\nDo not make it accessible to untrusted networks!\nDo you want to continue?
word.from from word.from from

View File

@@ -281,8 +281,10 @@ void CMiscMenue::showMiscSettingsMenuEnergy(CMenuWidget *ms_energy)
CStringInput * miscSettings_shutdown_count = new CStringInput(LOCALE_MISCSETTINGS_SHUTDOWN_COUNT, g_settings.shutdown_count, 3, LOCALE_MISCSETTINGS_SHUTDOWN_COUNT_HINT1, LOCALE_MISCSETTINGS_SHUTDOWN_COUNT_HINT2, "0123456789 "); CStringInput * miscSettings_shutdown_count = new CStringInput(LOCALE_MISCSETTINGS_SHUTDOWN_COUNT, g_settings.shutdown_count, 3, LOCALE_MISCSETTINGS_SHUTDOWN_COUNT_HINT1, LOCALE_MISCSETTINGS_SHUTDOWN_COUNT_HINT2, "0123456789 ");
CMenuForwarder *m2 = new CMenuDForwarder(LOCALE_MISCSETTINGS_SHUTDOWN_COUNT, !g_settings.shutdown_real, g_settings.shutdown_count, miscSettings_shutdown_count); CMenuForwarder *m2 = new CMenuDForwarder(LOCALE_MISCSETTINGS_SHUTDOWN_COUNT, !g_settings.shutdown_real, g_settings.shutdown_count, miscSettings_shutdown_count);
m2->setHint("", LOCALE_MENU_HINT_SHUTDOWN_COUNT); m2->setHint("", LOCALE_MENU_HINT_SHUTDOWN_COUNT);
miscNotifier = new CMiscNotifier( m1, m2 ); miscNotifier = new COnOffNotifier(1);
miscNotifier->addItem(m1);
miscNotifier->addItem(m2);
CMenuOptionChooser * mc = new CMenuOptionChooser(LOCALE_MISCSETTINGS_SHUTDOWN_REAL, &g_settings.shutdown_real, OPTIONS_OFF1_ON0_OPTIONS, OPTIONS_OFF1_ON0_OPTION_COUNT, true, miscNotifier); CMenuOptionChooser * mc = new CMenuOptionChooser(LOCALE_MISCSETTINGS_SHUTDOWN_REAL, &g_settings.shutdown_real, OPTIONS_OFF1_ON0_OPTIONS, OPTIONS_OFF1_ON0_OPTION_COUNT, true, miscNotifier);
mc->setHint("", LOCALE_MENU_HINT_SHUTDOWN_REAL); mc->setHint("", LOCALE_MENU_HINT_SHUTDOWN_REAL);

View File

@@ -40,7 +40,7 @@ class CMiscMenue : public CMenuTarget
private: private:
CFanControlNotifier *fanNotifier; CFanControlNotifier *fanNotifier;
CSectionsdConfigNotifier* sectionsdConfigNotifier; CSectionsdConfigNotifier* sectionsdConfigNotifier;
CMiscNotifier* miscNotifier; COnOffNotifier* miscNotifier;
int width; int width;

View File

@@ -2977,7 +2977,8 @@ bool CMovieBrowser::showMenu(MI_MOVIE_INFO* /*movie_info*/)
{ {
dirInput[i] = new CFileChooser(&m_settings.storageDir[i]); dirInput[i] = new CFileChooser(&m_settings.storageDir[i]);
forwarder[i] = new CMenuForwarder(LOCALE_MOVIEBROWSER_DIR, m_settings.storageDirUsed[i], m_settings.storageDir[i], dirInput[i]); forwarder[i] = new CMenuForwarder(LOCALE_MOVIEBROWSER_DIR, m_settings.storageDirUsed[i], m_settings.storageDir[i], dirInput[i]);
notifier[i] = new COnOffNotifier(forwarder[i]); notifier[i] = new COnOffNotifier();
notifier[i]->addItem(forwarder[i]);
chooser[i] = new CMenuOptionChooser(LOCALE_MOVIEBROWSER_USE_DIR , &m_settings.storageDirUsed[i] , MESSAGEBOX_YES_NO_OPTIONS, MESSAGEBOX_YES_NO_OPTIONS_COUNT, true,notifier[i]); chooser[i] = new CMenuOptionChooser(LOCALE_MOVIEBROWSER_USE_DIR , &m_settings.storageDirUsed[i] , MESSAGEBOX_YES_NO_OPTIONS, MESSAGEBOX_YES_NO_OPTIONS_COUNT, true,notifier[i]);
optionsMenuDir.addItem(chooser[i] ); optionsMenuDir.addItem(chooser[i] );
optionsMenuDir.addItem(forwarder[i] ); optionsMenuDir.addItem(forwarder[i] );

View File

@@ -51,37 +51,9 @@
#include <pthread.h> #include <pthread.h>
#include <sys/mount.h> #include <sys/mount.h>
#include <unistd.h> #include <unistd.h>
#include <neutrino.h>
#include <zapit/client/zapittools.h> #include <zapit/client/zapittools.h>
class CNFSMountGuiNotifier : public CChangeObserver
{
private:
CMenuForwarder *m_opt1,*m_opt2, *m_user, *m_pass;
int *m_type;
public:
CNFSMountGuiNotifier( CMenuForwarder* a3, CMenuForwarder* a4 , int* type)
{
m_user = a3;
m_pass = a4;
m_type = type;
}
bool changeNotify(const neutrino_locale_t /*OptionName*/, void *)
{
if(*m_type == (int)CFSMounter::NFS)
{
m_user->setActive (false);
m_pass->setActive (false);
}
else
{
m_user->setActive (true);
m_pass->setActive (true);
}
return true;
}
};
CNFSMountGui::CNFSMountGui() CNFSMountGui::CNFSMountGui()
{ {
// FIXME #warning move probing from exec() to fsmounter // FIXME #warning move probing from exec() to fsmounter
@@ -149,10 +121,17 @@ int CNFSMountGui::exec( CMenuTarget* parent, const std::string & actionKey )
else if(actionKey.substr(0,7)=="domount") else if(actionKey.substr(0,7)=="domount")
{ {
int nr=atoi(actionKey.substr(7,1).c_str()); int nr=atoi(actionKey.substr(7,1).c_str());
CFSMounter::mount(g_settings.network_nfs_ip[nr].c_str(), g_settings.network_nfs_dir[nr], CFSMounter::MountRes mres = CFSMounter::mount(
g_settings.network_nfs_ip[nr].c_str(), g_settings.network_nfs_dir[nr],
g_settings.network_nfs_local_dir[nr], (CFSMounter::FSType) g_settings.network_nfs_type[nr], g_settings.network_nfs_local_dir[nr], (CFSMounter::FSType) g_settings.network_nfs_type[nr],
g_settings.network_nfs_username[nr], g_settings.network_nfs_password[nr], g_settings.network_nfs_username[nr], g_settings.network_nfs_password[nr],
g_settings.network_nfs_mount_options1[nr], g_settings.network_nfs_mount_options2[nr]); g_settings.network_nfs_mount_options1[nr], g_settings.network_nfs_mount_options2[nr]);
if (mres == CFSMounter::MRES_OK || mres == CFSMounter::MRES_FS_ALREADY_MOUNTED)
mountMenuEntry[nr]->iconName = NEUTRINO_ICON_MOUNTED;
else
mountMenuEntry[nr]->iconName = NEUTRINO_ICON_NOT_MOUNTED;
// TODO show msg in case of error // TODO show msg in case of error
returnval = menu_return::RETURN_EXIT; returnval = menu_return::RETURN_EXIT;
} }
@@ -176,15 +155,16 @@ int CNFSMountGui::menu()
{ {
sprintf(s2,"mountentry%d",i); sprintf(s2,"mountentry%d",i);
sprintf(ISO_8859_1_entry[i],ZapitTools::UTF8_to_Latin1(m_entry[i]).c_str()); sprintf(ISO_8859_1_entry[i],ZapitTools::UTF8_to_Latin1(m_entry[i]).c_str());
CMenuForwarderNonLocalized *forwarder = new CMenuForwarderNonLocalized(ISO_8859_1_entry[i], true, NULL, this, s2); mountMenuEntry[i] = new CMenuForwarderNonLocalized("", true, ISO_8859_1_entry[i], this, s2);
if (CFSMounter::isMounted(g_settings.network_nfs_local_dir[i])) if (CFSMounter::isMounted(g_settings.network_nfs_local_dir[i]))
{ {
forwarder->iconName = NEUTRINO_ICON_MOUNTED; mountMenuEntry[i]->iconName = NEUTRINO_ICON_MOUNTED;
} else } else
{ {
forwarder->iconName = NEUTRINO_ICON_NOT_MOUNTED; mountMenuEntry[i]->iconName = NEUTRINO_ICON_NOT_MOUNTED;
} }
mountMenuW.addItem(forwarder); mountMenuW.addItem(mountMenuEntry[i]);
} }
int ret=mountMenuW.exec(this,""); int ret=mountMenuW.exec(this,"");
return ret; return ret;
@@ -251,13 +231,16 @@ int CNFSMountGui::menuEntry(int nr)
CStringInputSMS options2Input(LOCALE_NFS_MOUNT_OPTIONS, options2, 30, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789-_=.,:|!?/ "); CStringInputSMS options2Input(LOCALE_NFS_MOUNT_OPTIONS, options2, 30, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789-_=.,:|!?/ ");
CMenuForwarder *options2_fwd = new CMenuForwarder(LOCALE_NFS_MOUNT_OPTIONS, true, options2, &options2Input); CMenuForwarder *options2_fwd = new CMenuForwarder(LOCALE_NFS_MOUNT_OPTIONS, true, options2, &options2Input);
CStringInputSMS userInput(LOCALE_NFS_USERNAME, username, 30, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789-_.,:|!?/ "); CStringInputSMS userInput(LOCALE_NFS_USERNAME, username, 30, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789-_.,:|!?/ ");
CMenuForwarder *username_fwd = new CMenuForwarder(LOCALE_NFS_USERNAME, (*type==CFSMounter::CIFS || CFSMounter::LUFS), username, &userInput); CMenuForwarder *username_fwd = new CMenuForwarder(LOCALE_NFS_USERNAME, (*type != (int)CFSMounter::NFS), username, &userInput);
CStringInputSMS passInput(LOCALE_NFS_PASSWORD, password, 30, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789-_.,:|!?/ "); CStringInputSMS passInput(LOCALE_NFS_PASSWORD, password, 30, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789-_.,:|!?/ ");
CMenuForwarder *password_fwd = new CMenuForwarder(LOCALE_NFS_PASSWORD, (*type==CFSMounter::CIFS || CFSMounter::LUFS), NULL, &passInput); CMenuForwarder *password_fwd = new CMenuForwarder(LOCALE_NFS_PASSWORD, (*type != (int)CFSMounter::NFS), NULL, &passInput);
CMACInput macInput(LOCALE_RECORDINGMENU_SERVER_MAC, g_settings.network_nfs_mac[nr], LOCALE_IPSETUP_HINT_1, LOCALE_IPSETUP_HINT_2); CMACInput macInput(LOCALE_RECORDINGMENU_SERVER_MAC, g_settings.network_nfs_mac[nr], LOCALE_IPSETUP_HINT_1, LOCALE_IPSETUP_HINT_2);
CMenuForwarder * macInput_fwd = new CMenuForwarder(LOCALE_RECORDINGMENU_SERVER_MAC, true, g_settings.network_nfs_mac[nr], &macInput); CMenuForwarder * macInput_fwd = new CMenuForwarder(LOCALE_RECORDINGMENU_SERVER_MAC, true, g_settings.network_nfs_mac[nr], &macInput);
CMenuForwarder *mountnow_fwd = new CMenuForwarder(LOCALE_NFS_MOUNTNOW, !(CFSMounter::isMounted(g_settings.network_nfs_local_dir[nr])), NULL, this, cmd);
CNFSMountGuiNotifier notifier(username_fwd, password_fwd, type); mountnow_fwd->setItemButton(NEUTRINO_ICON_BUTTON_OKAY, true);
COnOffNotifier notifier(CFSMounter::NFS);
notifier.addItem(username_fwd);
notifier.addItem(password_fwd);
mountMenuEntryW.addItem(new CMenuOptionChooser(LOCALE_NFS_TYPE, type, NFS_TYPE_OPTIONS, NFS_TYPE_OPTION_COUNT, typeEnabled, &notifier)); mountMenuEntryW.addItem(new CMenuOptionChooser(LOCALE_NFS_TYPE, type, NFS_TYPE_OPTIONS, NFS_TYPE_OPTION_COUNT, typeEnabled, &notifier));
mountMenuEntryW.addItem(new CMenuForwarder(LOCALE_NFS_IP , true, g_settings.network_nfs_ip[nr], &ipInput )); mountMenuEntryW.addItem(new CMenuForwarder(LOCALE_NFS_IP , true, g_settings.network_nfs_ip[nr], &ipInput ));
@@ -269,7 +252,7 @@ int CNFSMountGui::menuEntry(int nr)
mountMenuEntryW.addItem(username_fwd); mountMenuEntryW.addItem(username_fwd);
mountMenuEntryW.addItem(password_fwd); mountMenuEntryW.addItem(password_fwd);
mountMenuEntryW.addItem(macInput_fwd); mountMenuEntryW.addItem(macInput_fwd);
mountMenuEntryW.addItem(new CMenuForwarder(LOCALE_NFS_MOUNTNOW, true, NULL , this , cmd )); mountMenuEntryW.addItem(mountnow_fwd);
int ret = mountMenuEntryW.exec(this,""); int ret = mountMenuEntryW.exec(this,"");
return ret; return ret;
@@ -333,8 +316,10 @@ int CNFSSmallMenu::exec( CMenuTarget* parent, const std::string & actionKey )
CMenuWidget sm_menu(LOCALE_NFSMENU_HEAD, NEUTRINO_ICON_NETWORK, width); CMenuWidget sm_menu(LOCALE_NFSMENU_HEAD, NEUTRINO_ICON_NETWORK, width);
CNFSMountGui mountGui; CNFSMountGui mountGui;
CNFSUmountGui umountGui; CNFSUmountGui umountGui;
CMenuForwarder *remount_fwd = new CMenuForwarder(LOCALE_NFS_REMOUNT, true, NULL, this, "remount");
remount_fwd->setItemButton(NEUTRINO_ICON_BUTTON_OKAY, true);
sm_menu.addIntroItems(); sm_menu.addIntroItems();
sm_menu.addItem(new CMenuForwarder(LOCALE_NFS_REMOUNT, true, NULL, this, "remount")); sm_menu.addItem(remount_fwd);
sm_menu.addItem(new CMenuForwarder(LOCALE_NFS_MOUNT , true, NULL, & mountGui)); sm_menu.addItem(new CMenuForwarder(LOCALE_NFS_MOUNT , true, NULL, & mountGui));
sm_menu.addItem(new CMenuForwarder(LOCALE_NFS_UMOUNT, true, NULL, &umountGui)); sm_menu.addItem(new CMenuForwarder(LOCALE_NFS_UMOUNT, true, NULL, &umountGui));
return sm_menu.exec(parent, actionKey); return sm_menu.exec(parent, actionKey);

View File

@@ -46,7 +46,9 @@ class CNFSMountGui : public CMenuTarget
int menuEntry(int nr); int menuEntry(int nr);
char m_entry[NETWORK_NFS_NR_OF_ENTRIES][200]; char m_entry[NETWORK_NFS_NR_OF_ENTRIES][200];
char ISO_8859_1_entry[NETWORK_NFS_NR_OF_ENTRIES][200]; char ISO_8859_1_entry[NETWORK_NFS_NR_OF_ENTRIES][200];
CMenuForwarderNonLocalized* mountMenuEntry[NETWORK_NFS_NR_OF_ENTRIES];
CFSMounter::FS_Support m_nfs_sup; CFSMounter::FS_Support m_nfs_sup;
CFSMounter::FS_Support m_cifs_sup; CFSMounter::FS_Support m_cifs_sup;

View File

@@ -90,15 +90,4 @@ class COsdSetup : public CMenuTarget, public CChangeObserver
int showContextChanlistMenu(); int showContextChanlistMenu();
}; };
class COsdSetupChannelLogoNotifier : public CChangeObserver
{
private:
CMenuForwarder* toDisable1;
CMenuOptionChooser* toDisable2;
public:
COsdSetupChannelLogoNotifier( CMenuForwarder*, CMenuOptionChooser* );
bool changeNotify(const neutrino_locale_t, void * Data);
};
#endif #endif

View File

@@ -46,6 +46,8 @@
#include "osd_setup.h" #include "osd_setup.h"
#include "osdlang_setup.h" #include "osdlang_setup.h"
#include "scan_setup.h" #include "scan_setup.h"
#include <zapit/zapit.h>
#include <system/helpers.h>
#include <gui/widget/messagebox.h> #include <gui/widget/messagebox.h>
@@ -103,6 +105,17 @@ int CStartUpWizard::exec(CMenuTarget* parent, const string & /*actionKey*/)
res = CScanSetup::getInstance()->exec(NULL, ""); res = CScanSetup::getInstance()->exec(NULL, "");
CScanSetup::getInstance()->setWizardMode(CScanSetup::SCAN_SETUP_MODE_WIZARD_NO); CScanSetup::getInstance()->setWizardMode(CScanSetup::SCAN_SETUP_MODE_WIZARD_NO);
} }
bool init_settings = file_exists("/var/tuxbox/config/initial/");
if(init_settings && (res != menu_return::RETURN_EXIT_ALL))
{
if (ShowMsgUTF(LOCALE_WIZARD_INITIAL_SETTINGS, g_Locale->getText(LOCALE_WIZARD_INSTALL_SETTINGS),
CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbNo, NULL, 450, 30, false) == CMessageBox::mbrYes) {
system("/bin/cp /var/tuxbox/config/initial/* /var/tuxbox/config/zapit/");
CFEManager::getInstance()->loadSettings();
CFEManager::getInstance()->saveSettings();
CZapit::getInstance()->PrepareChannels();
}
}
} }

View File

@@ -1826,6 +1826,8 @@ typedef enum
LOCALE_VIDEOMENU_VIDEOFORMAT_169, LOCALE_VIDEOMENU_VIDEOFORMAT_169,
LOCALE_VIDEOMENU_VIDEOFORMAT_43, LOCALE_VIDEOMENU_VIDEOFORMAT_43,
LOCALE_VIDEOMENU_VIDEOMODE, LOCALE_VIDEOMENU_VIDEOMODE,
LOCALE_WIZARD_INITIAL_SETTINGS,
LOCALE_WIZARD_INSTALL_SETTINGS,
LOCALE_WIZARD_WELCOME_HEAD, LOCALE_WIZARD_WELCOME_HEAD,
LOCALE_WIZARD_WELCOME_TEXT, LOCALE_WIZARD_WELCOME_TEXT,
LOCALE_WORD_FROM, LOCALE_WORD_FROM,

View File

@@ -1826,6 +1826,8 @@ const char * locale_real_names[] =
"videomenu.videoformat_169", "videomenu.videoformat_169",
"videomenu.videoformat_43", "videomenu.videoformat_43",
"videomenu.videomode", "videomenu.videomode",
"wizard.initial_settings",
"wizard.install_settings",
"wizard.welcome_head", "wizard.welcome_head",
"wizard.welcome_text", "wizard.welcome_text",
"word.from", "word.from",

View File

@@ -88,43 +88,24 @@ extern cDemux *pcrDemux;
extern "C" int pinghost( const char *hostname ); extern "C" int pinghost( const char *hostname );
// gui/moviebrowser.cpp COnOffNotifier::COnOffNotifier(int OffValue)
COnOffNotifier::COnOffNotifier( CMenuItem* a1,CMenuItem* a2,CMenuItem* a3,CMenuItem* a4,CMenuItem* a5)
{ {
number = 0; offValue = OffValue;
if(a1 != NULL){ toDisable[0] =a1;number++;};
if(a2 != NULL){ toDisable[1] =a2;number++;};
if(a3 != NULL){ toDisable[2] =a3;number++;};
if(a4 != NULL){ toDisable[3] =a4;number++;};
if(a5 != NULL){ toDisable[4] =a5;number++;};
} }
bool COnOffNotifier::changeNotify(const neutrino_locale_t, void *Data) bool COnOffNotifier::changeNotify(const neutrino_locale_t, void *Data)
{ {
if(*(int*)(Data) == 0) bool active = (*(int*)(Data) != offValue);
{
for (int i=0; i<number ; i++) for (std::vector<CMenuItem*>::iterator it = toDisable.begin(); it != toDisable.end(); it++)
toDisable[i]->setActive(false); (*it)->setActive(active);
}
else return false;
{
for (int i=0; i<number ; i++)
toDisable[i]->setActive(true);
}
return false;
} }
//used in gui/miscsettings_menu.cpp void COnOffNotifier::addItem(CMenuItem* menuItem)
CMiscNotifier::CMiscNotifier( CMenuItem* i1, CMenuItem* i2)
{ {
toDisable[0]=i1; toDisable.push_back(menuItem);
toDisable[1]=i2;
}
bool CMiscNotifier::changeNotify(const neutrino_locale_t, void *)
{
toDisable[0]->setActive(!g_settings.shutdown_real);
toDisable[1]->setActive(!g_settings.shutdown_real);
return false;
} }
bool CSectionsdConfigNotifier::changeNotify(const neutrino_locale_t, void *) bool CSectionsdConfigNotifier::changeNotify(const neutrino_locale_t, void *)

View File

@@ -55,22 +55,16 @@ class CGenericMenuActivate
}; };
class COnOffNotifier : public CChangeObserver class COnOffNotifier : public CChangeObserver
{
private:
int number;
CMenuItem* toDisable[5];
public:
COnOffNotifier (CMenuItem* a1,CMenuItem* a2 = NULL,CMenuItem* a3 = NULL,CMenuItem* a4 = NULL,CMenuItem* a5 = NULL);
bool changeNotify(const neutrino_locale_t, void *Data);
};
class CMiscNotifier : public CChangeObserver
{ {
private: private:
CMenuItem* toDisable[2]; int offValue;
std::vector<CMenuItem*> toDisable;
public: public:
CMiscNotifier( CMenuItem*, CMenuItem* ); COnOffNotifier(int OffValue = 0);
bool changeNotify(const neutrino_locale_t, void *); bool changeNotify(const neutrino_locale_t, void *Data);
void addItem(CMenuItem* menuItem);
}; };
class CSectionsdConfigNotifier : public CChangeObserver class CSectionsdConfigNotifier : public CChangeObserver

View File

@@ -25,6 +25,7 @@
#define __zapit_frontend_h__ #define __zapit_frontend_h__
#include <inttypes.h> #include <inttypes.h>
#include <OpenThreads/Thread>
#include <zapit/types.h> #include <zapit/types.h>
#include <zapit/channel.h> #include <zapit/channel.h>
#include <zapit/satconfig.h> #include <zapit/satconfig.h>
@@ -78,8 +79,6 @@ static inline fe_rolloff_t dvbs_get_rolloff(fe_delivery_system_t delsys)
return ROLLOFF_35; return ROLLOFF_35;
} }
#define MAX_LNBS 64 /* due to Diseqc 1.1 (2003-01-10 rasc) */
class CFEManager; class CFEManager;
class CFrontend class CFrontend
@@ -87,12 +86,12 @@ class CFrontend
private: private:
/* frontend filedescriptor */ /* frontend filedescriptor */
int fd; int fd;
OpenThreads::Mutex mutex;
/* use count for locking purposes */ /* use count for locking purposes */
int usecount; int usecount;
/* current adapter where this frontend is on */ /* current adapter where this frontend is on */
int adapter; int adapter;
/* current frontend instance */
//static CFrontend *currentFe;
bool locked; bool locked;
/* tuning finished flag */ /* tuning finished flag */
bool tuned; bool tuned;
@@ -100,7 +99,6 @@ class CFrontend
struct dvb_frontend_info info; struct dvb_frontend_info info;
/* current 22kHz tone mode */ /* current 22kHz tone mode */
fe_sec_tone_mode_t currentToneMode; fe_sec_tone_mode_t currentToneMode;
int currentDiseqc;
fe_sec_voltage_t currentVoltage; fe_sec_voltage_t currentVoltage;
/* current satellite position */ /* current satellite position */
int32_t currentSatellitePosition; int32_t currentSatellitePosition;
@@ -117,7 +115,6 @@ class CFrontend
int repeatUsals; int repeatUsals;
int feTimeout; int feTimeout;
int diseqc;
uint8_t uncommitedInput; uint8_t uncommitedInput;
/* lnb offsets */ /* lnb offsets */
int32_t lnbOffsetLow; int32_t lnbOffsetLow;
@@ -125,15 +122,12 @@ class CFrontend
int32_t lnbSwitch; int32_t lnbSwitch;
/* current Transponderdata */ /* current Transponderdata */
TP_params currentTransponder; TP_params currentTransponder;
FrontendParameters curfe;
bool slave; bool slave;
int fenumber; int fenumber;
bool standby; bool standby;
bool buildProperties(const FrontendParameters*, struct dtv_properties &); bool buildProperties(const FrontendParameters*, struct dtv_properties &);
uint32_t getDiseqcReply(const int timeout_ms) const;
FrontendParameters getFrontend(void) const; FrontendParameters getFrontend(void) const;
void secResetOverload(void);
void secSetTone(const fe_sec_tone_mode_t mode, const uint32_t ms); void secSetTone(const fe_sec_tone_mode_t mode, const uint32_t ms);
void secSetVoltage(const fe_sec_voltage_t voltage, const uint32_t ms); void secSetVoltage(const fe_sec_voltage_t voltage, const uint32_t ms);
void sendDiseqcCommand(const struct dvb_diseqc_master_cmd *cmd, const uint32_t ms); void sendDiseqcCommand(const struct dvb_diseqc_master_cmd *cmd, const uint32_t ms);
@@ -146,12 +140,13 @@ class CFrontend
void sendToneBurst(const fe_sec_mini_cmd_t burst, const uint32_t ms); void sendToneBurst(const fe_sec_mini_cmd_t burst, const uint32_t ms);
int setFrontend(const FrontendParameters *feparams, bool nowait = false); int setFrontend(const FrontendParameters *feparams, bool nowait = false);
void setSec(const uint8_t sat_no, const uint8_t pol, const bool high_band); void setSec(const uint8_t sat_no, const uint8_t pol, const bool high_band);
void set12V(bool enable);
void reset(void); void reset(void);
/* Private constructor */ /* Private constructor */
CFrontend(int Number = 0, int Adapter = 0); CFrontend(int Number = 0, int Adapter = 0);
bool Open(bool init = false);
void Close(void);
void Init(void);
//static CFrontend *getInstance(int Number = 0, int Adapter = 0);
friend class CFEManager; friend class CFEManager;
public: public:
~CFrontend(void); ~CFrontend(void);
@@ -160,7 +155,7 @@ class CFrontend
uint8_t getDiseqcPosition(void) const { return currentTransponder.diseqc; } uint8_t getDiseqcPosition(void) const { return currentTransponder.diseqc; }
uint8_t getDiseqcRepeats(void) const { return config.diseqcRepeats; } uint8_t getDiseqcRepeats(void) const { return config.diseqcRepeats; }
diseqc_t getDiseqcType(void) const { return (diseqc_t) config.diseqcType; } diseqc_t getDiseqcType(void) const { return (diseqc_t) config.diseqcType; }
uint32_t getFrequency(void) const { return curfe.dvb_feparams.frequency; } uint32_t getFrequency(void) const { return currentTransponder.feparams.dvb_feparams.frequency; }
bool getHighBand() { return (int) getFrequency() >= lnbSwitch; } bool getHighBand() { return (int) getFrequency() >= lnbSwitch; }
static fe_modulation_t getModulation(const uint8_t modulation); static fe_modulation_t getModulation(const uint8_t modulation);
uint8_t getPolarization(void) const; uint8_t getPolarization(void) const;
@@ -177,7 +172,7 @@ class CFrontend
int32_t getRotorSatellitePosition() { return rotorSatellitePosition; } int32_t getRotorSatellitePosition() { return rotorSatellitePosition; }
void setDiseqcRepeats(const uint8_t repeats) { config.diseqcRepeats = repeats; } void setDiseqcRepeats(const uint8_t repeats) { config.diseqcRepeats = repeats; }
void setDiseqcType(const diseqc_t type); void setDiseqcType(const diseqc_t type, bool force = false);
void setTimeout(int timeout) { feTimeout = timeout; }; void setTimeout(int timeout) { feTimeout = timeout; };
void configUsals(double Latitude, double Longitude, int LaDirection, int LoDirection, bool _repeatUsals) void configUsals(double Latitude, double Longitude, int LaDirection, int LoDirection, bool _repeatUsals)
{ {
@@ -197,7 +192,6 @@ class CFrontend
int setParameters(TP_params *TP, bool nowait = 0); int setParameters(TP_params *TP, bool nowait = 0);
int tuneFrequency (FrontendParameters * feparams, uint8_t polarization, bool nowait = false); int tuneFrequency (FrontendParameters * feparams, uint8_t polarization, bool nowait = false);
const TP_params* getParameters(void) const { return &currentTransponder; }; const TP_params* getParameters(void) const { return &currentTransponder; };
struct dvb_frontend_event* setParametersResponse(TP_params *TP);
void setCurrentSatellitePosition(int32_t satellitePosition) {currentSatellitePosition = satellitePosition; } void setCurrentSatellitePosition(int32_t satellitePosition) {currentSatellitePosition = satellitePosition; }
void setRotorSatellitePosition(int32_t satellitePosition) {rotorSatellitePosition = satellitePosition; } void setRotorSatellitePosition(int32_t satellitePosition) {rotorSatellitePosition = satellitePosition; }
@@ -206,7 +200,6 @@ class CFrontend
void gotoXX(t_satellite_position pos); void gotoXX(t_satellite_position pos);
bool tuneChannel(CZapitChannel *channel, bool nvod); bool tuneChannel(CZapitChannel *channel, bool nvod);
bool retuneChannel(void); bool retuneChannel(void);
bool retuneTP(bool nowait = true);
fe_code_rate_t getCFEC (); fe_code_rate_t getCFEC ();
transponder_id_t getTsidOnid() { return currentTransponder.TP_id; } transponder_id_t getTsidOnid() { return currentTransponder.TP_id; }
@@ -218,8 +211,6 @@ class CFrontend
void setTsidOnid(transponder_id_t newid) { currentTransponder.TP_id = newid; } void setTsidOnid(transponder_id_t newid) { currentTransponder.TP_id = newid; }
uint32_t getRate (); uint32_t getRate ();
bool Open();
void Close();
void Lock(); void Lock();
void Unlock(); void Unlock();

View File

@@ -170,8 +170,7 @@ bool CFEManager::loadSettings()
frontend_config_t & fe_config = fe->getConfig(); frontend_config_t & fe_config = fe->getConfig();
INFO("load config for fe%d", fe->fenumber); INFO("load config for fe%d", fe->fenumber);
//fe_config.diseqcType = (diseqc_t) getConfigValue(fe, "diseqcType", NO_DISEQC); fe_config.diseqcType = (diseqc_t) getConfigValue(fe, "diseqcType", NO_DISEQC);
diseqc_t diseqcType = (diseqc_t) getConfigValue(fe, "diseqcType", NO_DISEQC);
fe_config.diseqcRepeats = getConfigValue(fe, "diseqcRepeats", 0); fe_config.diseqcRepeats = getConfigValue(fe, "diseqcRepeats", 0);
fe_config.motorRotationSpeed = getConfigValue(fe, "motorRotationSpeed", 18); fe_config.motorRotationSpeed = getConfigValue(fe, "motorRotationSpeed", 18);
fe_config.highVoltage = getConfigValue(fe, "highVoltage", 0); fe_config.highVoltage = getConfigValue(fe, "highVoltage", 0);
@@ -181,7 +180,10 @@ bool CFEManager::loadSettings()
fe->setRotorSatellitePosition(getConfigValue(fe, "lastSatellitePosition", 0)); fe->setRotorSatellitePosition(getConfigValue(fe, "lastSatellitePosition", 0));
//fe->setDiseqcType((diseqc_t) fe_config.diseqcType); //fe->setDiseqcType((diseqc_t) fe_config.diseqcType);
#if 0
diseqc_t diseqcType = (diseqc_t) getConfigValue(fe, "diseqcType", NO_DISEQC);
fe->setDiseqcType(diseqcType); fe->setDiseqcType(diseqcType);
#endif
char cfg_key[81]; char cfg_key[81];
sprintf(cfg_key, "fe%d_satellites", fe->fenumber); sprintf(cfg_key, "fe%d_satellites", fe->fenumber);
@@ -265,27 +267,29 @@ void CFEManager::saveSettings(bool write)
void CFEManager::setMode(fe_mode_t newmode, bool initial) void CFEManager::setMode(fe_mode_t newmode, bool initial)
{ {
if(newmode == mode) if(!initial && (newmode == mode))
return; return;
if(femap.size() == 1) {
mode = FE_MODE_SINGLE;
return;
}
mode = newmode; mode = newmode;
bool setslave = (mode == FE_MODE_LOOP); if(femap.size() == 1)
mode = FE_MODE_SINGLE;
bool setslave = (mode == FE_MODE_LOOP) || (mode == FE_MODE_SINGLE);
for(fe_map_iterator_t it = femap.begin(); it != femap.end(); it++) { for(fe_map_iterator_t it = femap.begin(); it != femap.end(); it++) {
CFrontend * fe = it->second;
if(it != femap.begin()) { if(it != femap.begin()) {
CFrontend * fe = it->second;
INFO("Frontend %d as slave: %s", fe->fenumber, setslave ? "yes" : "no"); INFO("Frontend %d as slave: %s", fe->fenumber, setslave ? "yes" : "no");
fe->setMasterSlave(setslave); fe->setMasterSlave(setslave);
} } else
fe->Init();
} }
#if 0
if(setslave && !initial) { if(setslave && !initial) {
CFrontend * fe = getFE(0); CFrontend * fe = getFE(0);
fe->Close(); fe->Close();
fe->Open(); fe->Open(true);
} }
#endif
} }
void CFEManager::Open() void CFEManager::Open()
@@ -293,7 +297,7 @@ void CFEManager::Open()
for(fe_map_iterator_t it = femap.begin(); it != femap.end(); it++) { for(fe_map_iterator_t it = femap.begin(); it != femap.end(); it++) {
CFrontend * fe = it->second; CFrontend * fe = it->second;
if(!fe->Locked()) if(!fe->Locked())
fe->Open(); fe->Open(true);
} }
} }

View File

@@ -137,19 +137,6 @@ typedef enum dvb_fec {
#define TIME_STEP 200 #define TIME_STEP 200
#define TIMEOUT_MAX_MS (feTimeout*100) #define TIMEOUT_MAX_MS (feTimeout*100)
/*********************************************************************************************************/ /*********************************************************************************************************/
#if 0
// Global fe instance
CFrontend *CFrontend::currentFe = NULL;
CFrontend *CFrontend::getInstance(int Number, int Adapter)
{
if (!currentFe) {
currentFe = new CFrontend(Number, Adapter);
currentFe->Open();
}
return currentFe;
}
#endif
CFrontend::CFrontend(int Number, int Adapter) CFrontend::CFrontend(int Number, int Adapter)
{ {
printf("[fe%d] New frontend on adapter %d\n", Number, Adapter); printf("[fe%d] New frontend on adapter %d\n", Number, Adapter);
@@ -161,15 +148,10 @@ CFrontend::CFrontend(int Number, int Adapter)
locked = false; locked = false;
usecount = 0; usecount = 0;
memset(&curfe, 0, sizeof(curfe));
curfe.dvb_feparams.u.qpsk.fec_inner = FEC_3_4;
curfe.dvb_feparams.u.qam.fec_inner = FEC_3_4;
curfe.dvb_feparams.u.qam.modulation = QAM_64;
tuned = false; tuned = false;
uncommitedInput = 255; uncommitedInput = 255;
diseqc = 255;
memset(&currentTransponder, 0, sizeof(currentTransponder));
currentTransponder.polarization = 1; currentTransponder.polarization = 1;
currentTransponder.feparams.dvb_feparams.frequency = 0; currentTransponder.feparams.dvb_feparams.frequency = 0;
currentTransponder.TP_id = 0; currentTransponder.TP_id = 0;
@@ -183,28 +165,22 @@ CFrontend::CFrontend(int Number, int Adapter)
config.motorRotationSpeed = 0; //in 0.1 degrees per second config.motorRotationSpeed = 0; //in 0.1 degrees per second
feTimeout = 40; feTimeout = 40;
// to allow Open() switch it off currentVoltage = SEC_VOLTAGE_OFF;
currentVoltage = SEC_VOLTAGE_OFF; //SEC_VOLTAGE_13;
currentToneMode = SEC_TONE_ON; currentToneMode = SEC_TONE_ON;
} }
CFrontend::~CFrontend(void) CFrontend::~CFrontend(void)
{ {
printf("[fe%d] close frontend fd %d\n", fenumber, fd); printf("[fe%d] close frontend fd %d\n", fenumber, fd);
if(fd >= 0) { if(fd >= 0)
Close(); Close();
close(fd);
}
//currentFe = NULL;
} }
bool CFrontend::Open(void) bool CFrontend::Open(bool init)
{ {
if(!standby) if(!standby)
return false; return false;
printf("[fe%d] open frontend\n", fenumber);
char filename[128]; char filename[128];
snprintf(filename, sizeof(filename), "/dev/dvb/adapter%d/frontend%d", adapter, fenumber); snprintf(filename, sizeof(filename), "/dev/dvb/adapter%d/frontend%d", adapter, fenumber);
printf("[fe%d] open %s\n", fenumber, filename); printf("[fe%d] open %s\n", fenumber, filename);
@@ -219,14 +195,9 @@ bool CFrontend::Open(void)
} }
//FIXME info.type = FE_QAM; //FIXME info.type = FE_QAM;
//currentVoltage = SEC_VOLTAGE_OFF;
//secSetVoltage(SEC_VOLTAGE_OFF, 15);
secSetVoltage(SEC_VOLTAGE_13, 15);
secSetTone(SEC_TONE_OFF, 15);
diseqc_t diseqcType = (diseqc_t) config.diseqcType; if (init)
config.diseqcType = NO_DISEQC; Init();
setDiseqcType(diseqcType);
currentTransponder.TP_id = 0; currentTransponder.TP_id = 0;
@@ -235,6 +206,15 @@ bool CFrontend::Open(void)
return true; return true;
} }
void CFrontend::Init(void)
{
mutex.lock();
secSetVoltage(SEC_VOLTAGE_13, 100);
secSetTone(SEC_TONE_OFF, 15);
setDiseqcType((diseqc_t) config.diseqcType, true);
mutex.unlock();
}
void CFrontend::Close(void) void CFrontend::Close(void)
{ {
if(standby) if(standby)
@@ -261,16 +241,10 @@ void CFrontend::setMasterSlave(bool _slave)
if(_slave) { if(_slave) {
secSetVoltage(SEC_VOLTAGE_OFF, 0); secSetVoltage(SEC_VOLTAGE_OFF, 0);
secSetTone(SEC_TONE_OFF, 15); secSetTone(SEC_TONE_OFF, 15);
}
slave = _slave;
if(!slave) {
secSetVoltage(SEC_VOLTAGE_13, 0);
#if 1
diseqc_t diseqcType = (diseqc_t) config.diseqcType;
config.diseqcType = NO_DISEQC;
setDiseqcType(diseqcType);
#endif
} }
slave = _slave;
if(!slave)
Init();
} }
void CFrontend::reset(void) void CFrontend::reset(void)
@@ -293,11 +267,10 @@ void CFrontend::Unlock()
fe_code_rate_t CFrontend::getCFEC() fe_code_rate_t CFrontend::getCFEC()
{ {
if (info.type == FE_QPSK) { if (info.type == FE_QPSK)
return curfe.dvb_feparams.u.qpsk.fec_inner; return currentTransponder.feparams.dvb_feparams.u.qpsk.fec_inner;
} else { else
return curfe.dvb_feparams.u.qam.fec_inner; return currentTransponder.feparams.dvb_feparams.u.qam.fec_inner;
}
} }
fe_code_rate_t CFrontend::getCodeRate(const uint8_t fec_inner, int system) fe_code_rate_t CFrontend::getCodeRate(const uint8_t fec_inner, int system)
@@ -380,25 +353,19 @@ uint8_t CFrontend::getPolarization(void) const
uint32_t CFrontend::getRate() uint32_t CFrontend::getRate()
{ {
if (info.type == FE_QPSK) { if (info.type == FE_QPSK)
return curfe.dvb_feparams.u.qpsk.symbol_rate; return currentTransponder.feparams.dvb_feparams.u.qpsk.symbol_rate;
} else { else
return curfe.dvb_feparams.u.qam.symbol_rate; return currentTransponder.feparams.dvb_feparams.u.qam.symbol_rate;
}
} }
fe_status_t CFrontend::getStatus(void) const fe_status_t CFrontend::getStatus(void) const
{ {
#if 1 // FIXME FE_READ_STATUS works ?
struct dvb_frontend_event event; struct dvb_frontend_event event;
fop(ioctl, FE_READ_STATUS, &event.status); fop(ioctl, FE_READ_STATUS, &event.status);
//printf("CFrontend::getStatus: %x\n", event.status);
return (fe_status_t) (event.status & FE_HAS_LOCK); return (fe_status_t) (event.status & FE_HAS_LOCK);
#else
fe_status_t status = (fe_status_t) tuned;
return status;
#endif
} }
#if 0 #if 0
//never used //never used
FrontendParameters CFrontend::getFrontend(void) const FrontendParameters CFrontend::getFrontend(void) const
@@ -406,6 +373,7 @@ FrontendParameters CFrontend::getFrontend(void) const
return currentTransponder.feparams; return currentTransponder.feparams;
} }
#endif #endif
uint32_t CFrontend::getBitErrorRate(void) const uint32_t CFrontend::getBitErrorRate(void) const
{ {
uint32_t ber = 0; uint32_t ber = 0;
@@ -452,12 +420,9 @@ struct dvb_frontend_event CFrontend::getEvent(void)
memset(&event, 0, sizeof(struct dvb_frontend_event)); memset(&event, 0, sizeof(struct dvb_frontend_event));
//printf("[fe%d] getEvent: max timeout: %d\n", fenumber, TIMEOUT_MAX_MS);
FE_TIMER_START(); FE_TIMER_START();
//while (msec <= TIMEOUT_MAX_MS ) {
while ((int) timer_msec < TIMEOUT_MAX_MS) { while ((int) timer_msec < TIMEOUT_MAX_MS) {
//int ret = poll(&pfd, 1, TIME_STEP);
int ret = poll(&pfd, 1, TIMEOUT_MAX_MS - timer_msec); int ret = poll(&pfd, 1, TIMEOUT_MAX_MS - timer_msec);
if (ret < 0) { if (ret < 0) {
perror("CFrontend::getEvent poll"); perror("CFrontend::getEvent poll");
@@ -472,7 +437,6 @@ struct dvb_frontend_event CFrontend::getEvent(void)
FE_TIMER_STOP("poll has event after"); FE_TIMER_STOP("poll has event after");
memset(&event, 0, sizeof(struct dvb_frontend_event)); memset(&event, 0, sizeof(struct dvb_frontend_event));
//fop(ioctl, FE_READ_STATUS, &event.status);
ret = ioctl(fd, FE_GET_EVENT, &event); ret = ioctl(fd, FE_GET_EVENT, &event);
if (ret < 0) { if (ret < 0) {
perror("CFrontend::getEvent ioctl"); perror("CFrontend::getEvent ioctl");
@@ -746,7 +710,7 @@ bool CFrontend::buildProperties(const FrontendParameters *feparams, struct dtv_p
return true; return true;
} }
int CFrontend::setFrontend(const FrontendParameters *feparams, bool /*nowait*/) int CFrontend::setFrontend(const FrontendParameters *feparams, bool nowait)
{ {
struct dtv_property cmdargs[FE_COMMON_PROPS + FE_DVBS2_PROPS]; // WARNING: increase when needed more space struct dtv_property cmdargs[FE_COMMON_PROPS + FE_DVBS2_PROPS]; // WARNING: increase when needed more space
struct dtv_properties cmdseq; struct dtv_properties cmdseq;
@@ -756,7 +720,6 @@ int CFrontend::setFrontend(const FrontendParameters *feparams, bool /*nowait*/)
tuned = false; tuned = false;
//printf("[fe%d] DEMOD: FEC %s system %s modulation %s pilot %s\n", fenumber, f, s, m, pilot == PILOT_ON ? "on" : "off");
struct dvb_frontend_event ev; struct dvb_frontend_event ev;
{ {
// Erase previous events // Erase previous events
@@ -767,7 +730,6 @@ int CFrontend::setFrontend(const FrontendParameters *feparams, bool /*nowait*/)
} }
} }
//printf("[fe%d] DEMOD: FEC %s system %s modulation %s pilot %s, freq %d\n", fenumber, f, s, m, pilot == PILOT_ON ? "on" : "off", p->props[FREQUENCY].u.data);
if (!buildProperties(feparams, cmdseq)) if (!buildProperties(feparams, cmdseq))
return 0; return 0;
@@ -780,6 +742,8 @@ int CFrontend::setFrontend(const FrontendParameters *feparams, bool /*nowait*/)
} }
FE_TIMER_STOP("FE_SET_PROPERTY took"); FE_TIMER_STOP("FE_SET_PROPERTY took");
} }
if (nowait)
return 0;
{ {
FE_TIMER_INIT(); FE_TIMER_INIT();
FE_TIMER_START(); FE_TIMER_START();
@@ -832,12 +796,6 @@ void CFrontend::secSetVoltage(const fe_sec_voltage_t voltage, const uint32_t ms)
return; return;
printf("[fe%d] voltage %s\n", fenumber, voltage == SEC_VOLTAGE_OFF ? "OFF" : voltage == SEC_VOLTAGE_13 ? "13" : "18"); printf("[fe%d] voltage %s\n", fenumber, voltage == SEC_VOLTAGE_OFF ? "OFF" : voltage == SEC_VOLTAGE_13 ? "13" : "18");
//printf("[fe%d] voltage %s high %d\n", fenumber, voltage == SEC_VOLTAGE_OFF ? "OFF" : voltage == SEC_VOLTAGE_13 ? "13" : "18", config.highVoltage);
//int val = config.highVoltage;
//fop(ioctl, FE_ENABLE_HIGH_LNB_VOLTAGE, val);
//FE_TIMER_INIT();
//FE_TIMER_START();
if (config.uni_scr >= 0) { if (config.uni_scr >= 0) {
/* see my comment in secSetTone... */ /* see my comment in secSetTone... */
currentVoltage = voltage; /* need to know polarization for unicable */ currentVoltage = voltage; /* need to know polarization for unicable */
@@ -847,34 +805,23 @@ void CFrontend::secSetVoltage(const fe_sec_voltage_t voltage, const uint32_t ms)
if (fop(ioctl, FE_SET_VOLTAGE, voltage) == 0) { if (fop(ioctl, FE_SET_VOLTAGE, voltage) == 0) {
currentVoltage = voltage; currentVoltage = voltage;
//FE_TIMER_STOP("[frontend] FE_SET_VOLTAGE took"); usleep(1000 * ms);
usleep(1000 * ms); // FIXME : is needed ?
} }
} }
#if 0
//never used
void CFrontend::secResetOverload(void)
{
}
#endif
void CFrontend::sendDiseqcCommand(const struct dvb_diseqc_master_cmd *cmd, const uint32_t ms) void CFrontend::sendDiseqcCommand(const struct dvb_diseqc_master_cmd *cmd, const uint32_t ms)
{ {
if (slave || info.type != FE_QPSK)
return;
printf("[fe%d] Diseqc cmd: ", fenumber); printf("[fe%d] Diseqc cmd: ", fenumber);
for (int i = 0; i < cmd->msg_len; i++) for (int i = 0; i < cmd->msg_len; i++)
printf("0x%X ", cmd->msg[i]); printf("0x%X ", cmd->msg[i]);
printf("\n"); printf("\n");
if (slave || info.type != FE_QPSK)
return;
if (fop(ioctl, FE_DISEQC_SEND_MASTER_CMD, cmd) == 0) if (fop(ioctl, FE_DISEQC_SEND_MASTER_CMD, cmd) == 0)
usleep(1000 * ms); usleep(1000 * ms);
} }
#if 0
//never used
uint32_t CFrontend::getDiseqcReply(const int /*timeout_ms*/) const
{
return 0;
}
#endif
void CFrontend::sendToneBurst(const fe_sec_mini_cmd_t burst, const uint32_t ms) void CFrontend::sendToneBurst(const fe_sec_mini_cmd_t burst, const uint32_t ms)
{ {
if (slave || info.type != FE_QPSK) if (slave || info.type != FE_QPSK)
@@ -883,7 +830,7 @@ void CFrontend::sendToneBurst(const fe_sec_mini_cmd_t burst, const uint32_t ms)
usleep(1000 * ms); usleep(1000 * ms);
} }
void CFrontend::setDiseqcType(const diseqc_t newDiseqcType) void CFrontend::setDiseqcType(const diseqc_t newDiseqcType, bool force)
{ {
switch (newDiseqcType) { switch (newDiseqcType) {
case NO_DISEQC: case NO_DISEQC:
@@ -923,19 +870,13 @@ void CFrontend::setDiseqcType(const diseqc_t newDiseqcType)
return; return;
} }
#if 0 if (force || ((config.diseqcType <= MINI_DISEQC)
if (!slave && (config.diseqcType <= MINI_DISEQC) && (newDiseqcType > MINI_DISEQC))) {
&& (newDiseqcType > MINI_DISEQC)) { secSetTone(SEC_TONE_OFF, 15);
sendDiseqcPowerOn(); sendDiseqcPowerOn();
sendDiseqcReset(); sendDiseqcReset();
secSetTone(SEC_TONE_ON, 20);
} }
#else
if (config.diseqcType != newDiseqcType) {
sendDiseqcPowerOn();
sendDiseqcReset();
}
#endif
config.diseqcType = newDiseqcType; config.diseqcType = newDiseqcType;
} }
@@ -966,8 +907,8 @@ void CFrontend::sendMotorCommand(uint8_t cmdtype, uint8_t address, uint8_t comma
cmd.msg_len = 3 + num_parameters; cmd.msg_len = 3 + num_parameters;
//secSetVoltage(config.highVoltage ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13, 15); //secSetVoltage(config.highVoltage ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13, 15);
secSetVoltage(SEC_VOLTAGE_13, 15);
secSetTone(SEC_TONE_OFF, 15); secSetTone(SEC_TONE_OFF, 15);
secSetVoltage(SEC_VOLTAGE_13, 100);
for(i = 0; i <= repeat; i++) for(i = 0; i <= repeat; i++)
sendDiseqcCommand(&cmd, 50); sendDiseqcCommand(&cmd, 50);
@@ -985,12 +926,12 @@ void CFrontend::positionMotor(uint8_t motorPosition)
}; };
if (motorPosition != 0) { if (motorPosition != 0) {
secSetVoltage(config.highVoltage ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13, 15);
secSetTone(SEC_TONE_OFF, 25); secSetTone(SEC_TONE_OFF, 25);
secSetVoltage(config.highVoltage ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13, 15);
cmd.msg[3] = motorPosition; cmd.msg[3] = motorPosition;
for (int i = 0; i <= repeatUsals; ++i) for (int i = 0; i <= repeatUsals; ++i)
sendDiseqcCommand(&cmd, 50); sendDiseqcCommand(&cmd, 50);
printf("[fe%d] motor positioning command sent.\n", fenumber); printf("[fe%d] motor positioning command sent.\n", fenumber);
} }
@@ -999,12 +940,10 @@ void CFrontend::positionMotor(uint8_t motorPosition)
bool CFrontend::setInput(CZapitChannel * channel, bool nvod) bool CFrontend::setInput(CZapitChannel * channel, bool nvod)
{ {
transponder_list_t::iterator tpI; transponder_list_t::iterator tpI;
//transponder_id_t ct = channel->getTransponderId();
transponder_id_t ct = nvod ? (channel->getTransponderId() & 0xFFFFFFFFULL) : channel->getTransponderId(); transponder_id_t ct = nvod ? (channel->getTransponderId() & 0xFFFFFFFFULL) : channel->getTransponderId();
transponder_id_t current_id = nvod ? (currentTransponder.TP_id & 0xFFFFFFFFULL) : currentTransponder.TP_id; transponder_id_t current_id = nvod ? (currentTransponder.TP_id & 0xFFFFFFFFULL) : currentTransponder.TP_id;
//printf("CFrontend::setInput tuned %d nvod %d current_id %llx new %llx\n\n", tuned, nvod, current_id, ct); //printf("CFrontend::setInput tuned %d nvod %d current_id %llx new %llx\n\n", tuned, nvod, current_id, ct);
//if (tuned && (ct == currentTransponder.TP_id))
if (tuned && (ct == current_id)) if (tuned && (ct == current_id))
return false; return false;
@@ -1022,6 +961,7 @@ bool CFrontend::setInput(CZapitChannel * channel, bool nvod)
} }
currentTransponder.TP_id = tpI->first; currentTransponder.TP_id = tpI->first;
currentTransponder.polarization = tpI->second.polarization;
currentSatellitePosition = channel->getSatellitePosition(); currentSatellitePosition = channel->getSatellitePosition();
setInput(channel->getSatellitePosition(), tpI->second.feparams.dvb_feparams.frequency, tpI->second.polarization); setInput(channel->getSatellitePosition(), tpI->second.feparams.dvb_feparams.frequency, tpI->second.polarization);
@@ -1032,11 +972,7 @@ void CFrontend::setInput(t_satellite_position satellitePosition, uint32_t freque
{ {
sat_iterator_t sit = satellites.find(satellitePosition); sat_iterator_t sit = satellites.find(satellitePosition);
#if 0 setLnbOffsets(sit->second.lnbOffsetLow, sit->second.lnbOffsetHigh, sit->second.lnbSwitch);
printf("[fe%d] setInput: SatellitePosition %d -> %d\n", fenumber, currentSatellitePosition, satellitePosition);
if (currentSatellitePosition != satellitePosition)
#endif
setLnbOffsets(sit->second.lnbOffsetLow, sit->second.lnbOffsetHigh, sit->second.lnbSwitch);
if (config.diseqcType != DISEQC_ADVANCED) { if (config.diseqcType != DISEQC_ADVANCED) {
setDiseqc(sit->second.diseqc, polarization, frequency); setDiseqc(sit->second.diseqc, polarization, frequency);
return; return;
@@ -1047,7 +983,7 @@ void CFrontend::setInput(t_satellite_position satellitePosition, uint32_t freque
sendUncommittedSwitchesCommand(sit->second.uncommited); sendUncommittedSwitchesCommand(sit->second.uncommited);
} else { } else {
if (sendUncommittedSwitchesCommand(sit->second.uncommited)) if (sendUncommittedSwitchesCommand(sit->second.uncommited))
diseqc = -1; currentTransponder.diseqc = -1;
setDiseqcSimple(sit->second.commited, polarization, frequency); setDiseqcSimple(sit->second.commited, polarization, frequency);
} }
} }
@@ -1092,49 +1028,42 @@ uint32_t CFrontend::sendEN50494TuningCommand(const uint32_t frequency, const int
bool CFrontend::tuneChannel(CZapitChannel * /*channel*/, bool /*nvod*/) bool CFrontend::tuneChannel(CZapitChannel * /*channel*/, bool /*nvod*/)
{ {
//printf("tuneChannel: tpid %llx\n", currentTransponder.TP_id);
transponder_list_t::iterator transponder = transponders.find(currentTransponder.TP_id); transponder_list_t::iterator transponder = transponders.find(currentTransponder.TP_id);
if (transponder == transponders.end()) if (transponder == transponders.end())
return false; return false;
return tuneFrequency(&transponder->second.feparams, transponder->second.polarization, false); return tuneFrequency(&transponder->second.feparams, transponder->second.polarization, false);
} }
#if 0
//never used
bool CFrontend::retuneTP(bool nowait)
{
/* used in pip only atm */
tuneFrequency(&curfe, currentTransponder.polarization, nowait);
return 0;
}
bool CFrontend::retuneChannel(void) bool CFrontend::retuneChannel(void)
{ {
setFrontend(&currentTransponder.feparams); mutex.lock();
return 0; setInput(currentSatellitePosition, currentTransponder.feparams.dvb_feparams.frequency, currentTransponder.polarization);
transponder_list_t::iterator transponder = transponders.find(currentTransponder.TP_id);
if (transponder == transponders.end())
return false;
mutex.unlock();
return tuneFrequency(&transponder->second.feparams, transponder->second.polarization, true);
} }
#endif
int CFrontend::tuneFrequency(FrontendParameters * feparams, uint8_t polarization, bool nowait) int CFrontend::tuneFrequency(FrontendParameters * feparams, uint8_t polarization, bool nowait)
{ {
TP_params TP; TP_params TP;
//printf("[fe%d] tune to frequency %d pol %s srate %d\n", fenumber, feparams->dvb_feparams.frequency, polarization ? "Vertical/Right" : "Horizontal/Left", feparams->dvb_feparams.u.qpsk.symbol_rate);
memmove(&curfe, feparams, sizeof(struct dvb_frontend_parameters)); memmove(&currentTransponder.feparams, feparams, sizeof(struct dvb_frontend_parameters));
memmove(&TP.feparams, feparams, sizeof(struct dvb_frontend_parameters)); memmove(&TP.feparams, feparams, sizeof(struct dvb_frontend_parameters));
TP.polarization = polarization; TP.polarization = polarization;
return setParameters(&TP, nowait); return setParameters(&TP, nowait);
} }
int CFrontend::setParameters(TP_params *TP, bool /*nowait*/) int CFrontend::setParameters(TP_params *TP, bool nowait)
{ {
int freq_offset = 0, freq; int freq_offset = 0, freq;
TP_params currTP; FrontendParameters feparams;
FrontendParameters *feparams;
/* Copy the data for local use */ /* Copy the data for local use */
currTP = *TP; memcpy(&feparams, &TP->feparams, sizeof(feparams));
feparams = &currTP.feparams; freq = (int) feparams.dvb_feparams.frequency;
freq = (int) feparams->dvb_feparams.frequency;
char * f, *s, *m; char * f, *s, *m;
if (info.type == FE_QPSK) { if (info.type == FE_QPSK) {
@@ -1148,49 +1077,18 @@ int CFrontend::setParameters(TP_params *TP, bool /*nowait*/)
freq_offset = lnbOffsetHigh; freq_offset = lnbOffsetHigh;
} }
feparams->dvb_feparams.frequency = abs(freq - freq_offset); feparams.dvb_feparams.frequency = abs(freq - freq_offset);
setSec(TP->diseqc, TP->polarization, high_band); setSec(TP->diseqc, TP->polarization, high_band);
getDelSys(feparams->dvb_feparams.u.qpsk.fec_inner, dvbs_get_modulation(feparams->dvb_feparams.u.qpsk.fec_inner), f, s, m); getDelSys(feparams.dvb_feparams.u.qpsk.fec_inner, dvbs_get_modulation(feparams.dvb_feparams.u.qpsk.fec_inner), f, s, m);
} else if (info.type == FE_QAM) { } else if (info.type == FE_QAM) {
if (freq < 1000*1000) if (freq < 1000*1000)
feparams->dvb_feparams.frequency = freq * 1000; feparams.dvb_feparams.frequency = freq * 1000;
getDelSys(feparams->dvb_feparams.u.qam.fec_inner,feparams->dvb_feparams.u.qam.modulation, f, s, m); getDelSys(feparams.dvb_feparams.u.qam.fec_inner, feparams.dvb_feparams.u.qam.modulation, f, s, m);
#if 0
switch (TP->feparams.dvb_feparams.inversion) {
case INVERSION_OFF:
TP->feparams.dvb_feparams.inversion = INVERSION_ON;
break;
case INVERSION_ON:
default:
TP->feparams.dvb_feparams.inversion = INVERSION_OFF;
break;
}
#endif
} }
//printf("[fe%d] tuner to frequency %d (offset %d timeout %d)\n", fenumber, feparams->dvb_feparams.frequency, freq_offset, TIMEOUT_MAX_MS);
//printf("[fe%d] tune to frequency %d (tuner %d offset %d timeout %d)\n", fenumber, freq, feparams->dvb_feparams.frequency, freq_offset, TIMEOUT_MAX_MS);
printf("[fe%d] tune to %d %s %s %s %s srate %d (tuner %d offset %d timeout %d)\n", fenumber, freq, s, m, f, printf("[fe%d] tune to %d %s %s %s %s srate %d (tuner %d offset %d timeout %d)\n", fenumber, freq, s, m, f,
TP->polarization & 1 ? "V/R" : "H/L", feparams->dvb_feparams.u.qpsk.symbol_rate, feparams->dvb_feparams.frequency, freq_offset, TIMEOUT_MAX_MS); TP->polarization & 1 ? "V/R" : "H/L", feparams.dvb_feparams.u.qpsk.symbol_rate, feparams.dvb_feparams.frequency, freq_offset, TIMEOUT_MAX_MS);
setFrontend(feparams); setFrontend(&feparams, nowait);
#if 0
if (tuned) {
ret = diff(event.parameters.frequency, TP->feparams.dvb_feparams.frequency);
/* if everything went ok, then it is a good idea to copy the real
* frontend parameters, so we can update the service list, if it differs.
* TODO: set a flag to indicate a change in the service list */
memmove(&currentTransponder.feparams, &event.parameters, sizeof(struct dvb_frontend_parameters));
}
#endif
#if 0
/* add the frequency offset to the frontend parameters again
* because they are used for the channel list and were given
* to this method as a pointer */
if (info.type == FE_QPSK)
TP->feparams.dvb_feparams.frequency += freq_offset;
#endif
return tuned; return tuned;
} }
@@ -1216,7 +1114,6 @@ bool CFrontend::sendUncommittedSwitchesCommand(int input)
/* off = low band, on - hi band , vertical 13v, horizontal 18v */ /* off = low band, on - hi band , vertical 13v, horizontal 18v */
bool CFrontend::setDiseqcSimple(int sat_no, const uint8_t pol, const uint32_t frequency) bool CFrontend::setDiseqcSimple(int sat_no, const uint8_t pol, const uint32_t frequency)
{ {
//for monoblock
fe_sec_voltage_t v = (pol & 1) ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18; fe_sec_voltage_t v = (pol & 1) ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18;
//fe_sec_mini_cmd_t b = (sat_no & 1) ? SEC_MINI_B : SEC_MINI_A; //fe_sec_mini_cmd_t b = (sat_no & 1) ? SEC_MINI_B : SEC_MINI_A;
bool high_band = ((int)frequency >= lnbSwitch); bool high_band = ((int)frequency >= lnbSwitch);
@@ -1225,20 +1122,15 @@ bool CFrontend::setDiseqcSimple(int sat_no, const uint8_t pol, const uint32_t fr
{0xe0, 0x10, 0x38, 0x00, 0x00, 0x00}, 4 {0xe0, 0x10, 0x38, 0x00, 0x00, 0x00}, 4
}; };
INFO("[fe%d] diseqc input %d -> %d", fenumber, diseqc, sat_no); INFO("[fe%d] diseqc input %d -> %d", fenumber, currentTransponder.diseqc, sat_no);
currentTransponder.diseqc = sat_no; currentTransponder.diseqc = sat_no;
if (slave) if (slave)
return true; return true;
if ((sat_no >= 0) && (diseqc != sat_no)) { if ((sat_no >= 0) /* && (diseqc != sat_no)*/) {
diseqc = sat_no;
printf("[fe%d] diseqc no. %d\n", fenumber, sat_no);
cmd.msg[3] = 0xf0 | (((sat_no * 4) & 0x0f) | (high_band ? 1 : 0) | ((pol & 1) ? 0 : 2)); cmd.msg[3] = 0xf0 | (((sat_no * 4) & 0x0f) | (high_band ? 1 : 0) | ((pol & 1) ? 0 : 2));
//for monoblock - needed ??
secSetVoltage(v, 15);
//secSetVoltage(SEC_VOLTAGE_13, 15);//FIXME for test
secSetTone(SEC_TONE_OFF, 20); secSetTone(SEC_TONE_OFF, 20);
secSetVoltage(v, 100);
sendDiseqcCommand(&cmd, 100); sendDiseqcCommand(&cmd, 100);
return true; return true;
@@ -1259,21 +1151,23 @@ void CFrontend::setDiseqc(int sat_no, const uint8_t pol, const uint32_t frequenc
uint8_t loop; uint8_t loop;
bool high_band = ((int)frequency >= lnbSwitch); bool high_band = ((int)frequency >= lnbSwitch);
struct dvb_diseqc_master_cmd cmd = { {0xE0, 0x10, 0x38, 0xF0, 0x00, 0x00}, 4 }; struct dvb_diseqc_master_cmd cmd = { {0xE0, 0x10, 0x38, 0xF0, 0x00, 0x00}, 4 };
//fe_sec_voltage_t polarity = (pol & 1) ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18;
//fe_sec_tone_mode_t tone = high_band ? SEC_TONE_ON : SEC_TONE_OFF;//seems needed?
fe_sec_mini_cmd_t b = (sat_no & 1) ? SEC_MINI_B : SEC_MINI_A; fe_sec_mini_cmd_t b = (sat_no & 1) ? SEC_MINI_B : SEC_MINI_A;
int delay = 0; int delay = 0;
printf("[fe%d] diseqc input %d -> %d\n", fenumber, diseqc, sat_no); if ((config.diseqcType == NO_DISEQC) || sat_no < 0)
return;
printf("[fe%d] diseqc input %d -> %d\n", fenumber, currentTransponder.diseqc, sat_no);
currentTransponder.diseqc = sat_no;
if (slave) if (slave)
return; return;
//secSetVoltage(polarity, 15); /* first of all set the "polarization" */
//secSetTone(tone, 1); /* set the "band" */
//secSetVoltage(SEC_VOLTAGE_13, 15);//FIXME for test
secSetTone(SEC_TONE_OFF, 20); secSetTone(SEC_TONE_OFF, 20);
#if 1
fe_sec_voltage_t v = (pol & 1) ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18;
secSetVoltage(v, 100);
#endif
sendDiseqcReset();
for (loop = 0; loop <= config.diseqcRepeats; loop++) { for (loop = 0; loop <= config.diseqcRepeats; loop++) {
//usleep(50*1000); /* sleep at least 50 milli seconds */ //usleep(50*1000); /* sleep at least 50 milli seconds */
@@ -1316,13 +1210,6 @@ void CFrontend::setDiseqc(int sat_no, const uint8_t pol, const uint32_t frequenc
if (config.diseqcType == SMATV_REMOTE_TUNING) if (config.diseqcType == SMATV_REMOTE_TUNING)
sendDiseqcSmatvRemoteTuningCommand(frequency); sendDiseqcSmatvRemoteTuningCommand(frequency);
#if 0 // setSec do this, when tune called
if (high_band)
secSetTone(SEC_TONE_ON, 20);
#endif
//secSetTone(tone, 20);
currentTransponder.diseqc = sat_no;
} }
void CFrontend::setSec(const uint8_t /*sat_no*/, const uint8_t pol, const bool high_band) void CFrontend::setSec(const uint8_t /*sat_no*/, const uint8_t pol, const bool high_band)
@@ -1330,33 +1217,29 @@ void CFrontend::setSec(const uint8_t /*sat_no*/, const uint8_t pol, const bool h
fe_sec_voltage_t v = (pol & 1) ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18; fe_sec_voltage_t v = (pol & 1) ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18;
fe_sec_tone_mode_t t = high_band ? SEC_TONE_ON : SEC_TONE_OFF; fe_sec_tone_mode_t t = high_band ? SEC_TONE_ON : SEC_TONE_OFF;
secSetVoltage(v, 15); currentTransponder.polarization = pol;
secSetTone(t, 15); secSetTone(t, 15);
currentTransponder.polarization = pol;// & 1; secSetVoltage(v, 100);
} }
void CFrontend::sendDiseqcPowerOn(void) void CFrontend::sendDiseqcPowerOn(void)
{ {
// FIXME power on can take a while. Should be wait // FIXME power on can take a while. Should be wait
// more time here ? 15 ms enough for some switches ? // more time here ? 15 ms enough for some switches ?
#if 1
printf("[fe%d] diseqc power on\n", fenumber); printf("[fe%d] diseqc power on\n", fenumber);
sendDiseqcZeroByteCommand(0xe0, 0x10, 0x03); sendDiseqcZeroByteCommand(0xe0, 0x10, 0x03);
#else
struct dvb_diseqc_master_cmd cmd = {
{0xE0, 0x10, 0x03, 0x00, 0x00, 0x00}, 3
};
sendDiseqcCommand(&cmd, 100);
#endif
} }
void CFrontend::sendDiseqcReset(void) void CFrontend::sendDiseqcReset(void)
{ {
printf("[fe%d] diseqc reset\n", fenumber); printf("[fe%d] diseqc reset\n", fenumber);
#if 0
/* Reset && Clear Reset */ /* Reset && Clear Reset */
sendDiseqcZeroByteCommand(0xe0, 0x10, 0x00); sendDiseqcZeroByteCommand(0xe0, 0x10, 0x00);
sendDiseqcZeroByteCommand(0xe0, 0x10, 0x01); sendDiseqcZeroByteCommand(0xe0, 0x10, 0x01);
//sendDiseqcZeroByteCommand(0xe0, 0x00, 0x00); // enigma #else
sendDiseqcZeroByteCommand(0xe0, 0x00, 0x00); // enigma
#endif
} }
void CFrontend::sendDiseqcStandby(void) void CFrontend::sendDiseqcStandby(void)
@@ -1402,7 +1285,6 @@ int CFrontend::driveToSatellitePosition(t_satellite_position satellitePosition,
//if(config.diseqcType == DISEQC_ADVANCED) //FIXME testing //if(config.diseqcType == DISEQC_ADVANCED) //FIXME testing
{ {
//printf("[fe%d] SatellitePosition %d -> %d\n", fenumber, rotorSatellitePosition, satellitePosition);
bool moved = false; bool moved = false;
sat_iterator_t sit = satellites.find(satellitePosition); sat_iterator_t sit = satellites.find(satellitePosition);
@@ -1417,7 +1299,6 @@ int CFrontend::driveToSatellitePosition(t_satellite_position satellitePosition,
if (sit != satellites.end()) if (sit != satellites.end())
old_position = sit->second.motor_position; old_position = sit->second.motor_position;
//printf("[fe%d] motorPosition %d -> %d usals %s\n", fenumber, old_position, new_position, use_usals ? "on" : "off");
printf("[fe%d] sat pos %d -> %d motor pos %d -> %d usals %s\n", fenumber, rotorSatellitePosition, satellitePosition, old_position, new_position, use_usals ? "on" : "off"); printf("[fe%d] sat pos %d -> %d motor pos %d -> %d usals %s\n", fenumber, rotorSatellitePosition, satellitePosition, old_position, new_position, use_usals ? "on" : "off");
if (rotorSatellitePosition == satellitePosition) if (rotorSatellitePosition == satellitePosition)

View File

@@ -293,12 +293,17 @@ bool CNit::ParseSatelliteDescriptor(SatelliteDeliverySystemDescriptor * sd, Tran
newSat += ((sd->getOrbitalPosition() >> 8) & 0xF) * 100; newSat += ((sd->getOrbitalPosition() >> 8) & 0xF) * 100;
newSat += ((sd->getOrbitalPosition() >> 4) & 0xF) * 10; newSat += ((sd->getOrbitalPosition() >> 4) & 0xF) * 10;
newSat += ((sd->getOrbitalPosition()) & 0xF); newSat += ((sd->getOrbitalPosition()) & 0xF);
if (newSat && (!sd->getWestEastFlag()))
if (newSat > 1800)
newSat = 3600 - newSat; newSat = 3600 - newSat;
if (!sd->getWestEastFlag())
newSat = -newSat;
if (abs(newSat - satellitePosition) < 5)
newSat = satellitePosition;
if(satellitePosition != newSat) { if(satellitePosition != newSat) {
printf("NIT: different satellite position: our %d nit %d\n", printf("NIT: different satellite position: our %d nit %d (%X)\n",
satellitePosition, sd->getOrbitalPosition()); satellitePosition, newSat, sd->getOrbitalPosition());
return false; return false;
} }
@@ -320,7 +325,7 @@ bool CNit::ParseSatelliteDescriptor(SatelliteDeliverySystemDescriptor * sd, Tran
break; break;
default: default:
#ifdef DEBUG_NIT #ifdef DEBUG_NIT
printf("NIT: undefined modulation system %08x\n", modulation_system; printf("NIT: undefined modulation system %08x\n", modulation_system);
#endif #endif
feparams.delsys = SYS_UNDEFINED; feparams.delsys = SYS_UNDEFINED;
break; break;

View File

@@ -2042,6 +2042,8 @@ bool CZapit::Start(Z_start_arg *ZapStart_arg)
audioDecoder = new cAudio(audioDemux->getBuffer(), videoDecoder->GetTVEnc(), NULL /*videoDecoder->GetTVEncSD()*/); audioDecoder = new cAudio(audioDemux->getBuffer(), videoDecoder->GetTVEnc(), NULL /*videoDecoder->GetTVEncSD()*/);
videoDecoder->SetAudioHandle(audioDecoder->GetHandle()); videoDecoder->SetAudioHandle(audioDecoder->GetHandle());
/* set initial volume with 100% */
SetVolumePercent(100);
#ifdef USE_VBI #ifdef USE_VBI
videoDecoder->OpenVBI(1); videoDecoder->OpenVBI(1);
#endif #endif
@@ -2132,10 +2134,6 @@ static bool zapit_parse_command(CBasicMessage::Header &rmsg, int connfd)
void CZapit::run() void CZapit::run()
{ {
#if 0
time_t stime = time(0);
time_t curtime;
#endif
printf("[zapit] starting... tid %ld\n", syscall(__NR_gettid)); printf("[zapit] starting... tid %ld\n", syscall(__NR_gettid));
abort_zapit = 0; abort_zapit = 0;
@@ -2184,14 +2182,15 @@ void CZapit::run()
/* yuck, don't waste that much cpu time :) */ /* yuck, don't waste that much cpu time :) */
usleep(0); usleep(0);
#if 0 #if 0
if(!standby && !CServiceScan::getInstance()->Scanning() &&current_channel) { static time_t stime = time(0);
curtime = time(0); if(!standby && !CServiceScan::getInstance()->Scanning() && current_channel) {
time_t curtime = time(0);
//FIXME check if sig_delay needed */
if(sig_delay && (curtime - stime) > sig_delay) { if(sig_delay && (curtime - stime) > sig_delay) {
stime = curtime; stime = curtime;
uint16_t sig = live_fe->getSignalStrength(); fe_status_t status = live_fe->getStatus();
//if(sig < 8000) printf("[zapit] frontend status %d\n", status);
if(sig < 28000) { if (status != FE_HAS_LOCK) {
printf("[monitor] signal %d, trying to re-tune...\n", sig);
live_fe->retuneChannel(); live_fe->retuneChannel();
} }
} }