Subversion Repositories tpanel

Rev

Rev 140 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 140 Rev 141
Line 44... Line 44...
44
using std::cerr;
44
using std::cerr;
45
using std::endl;
45
using std::endl;
46
 
46
 
47
bool TConfig::mInitialized{false};
47
bool TConfig::mInitialized{false};
48
int TConfig::mChannel{0};
48
int TConfig::mChannel{0};
-
 
49
bool TConfig::mMute{false};
49
 
50
 
50
/**
51
/**
51
 * @struct SETTINGS
52
 * @struct SETTINGS
52
 * @brief The SETTINGS struct bundles the configuration options.
53
 * @brief The SETTINGS struct bundles the configuration options.
53
 *
54
 *
Line 78... Line 79...
78
    bool profiling{false};      //!< TRUE = The declaration traces meassure the time and write it to the log
79
    bool profiling{false};      //!< TRUE = The declaration traces meassure the time and write it to the log
79
    string password1;           //!< First panel password
80
    string password1;           //!< First panel password
80
    string password2;           //!< Second panel password
81
    string password2;           //!< Second panel password
81
    string password3;           //!< Third panel password
82
    string password3;           //!< Third panel password
82
    string password4;           //!< Fourth panel password
83
    string password4;           //!< Fourth panel password
83
    string systemSound;         //!< name of the set system sound played on every touch.
-
 
84
    bool systemSoundState{false};   //!< TRUE = play systemsound on every touch
-
 
85
    string systemSingleBeep;    //!< name of the system sound file to play a single beep.
-
 
86
    string systemDoubleBeep;    //!< name of the system sound file to play a double beep.
-
 
87
    bool systemRotationFix{false};  //!< TRUE = Rotation is blocked and orientation sensor is ignored.
84
    bool systemRotationFix{false};  //!< TRUE = Rotation is blocked and orientation sensor is ignored.
88
    string uuid;                //!< An UUID set automatically after first start.
85
    string uuid;                //!< An UUID set automatically after first start.
89
    // FTP credentials
86
    // FTP credentials
90
    string ftpUser;             //!< The username for FTP of the controller (default: administrator)
87
    string ftpUser;             //!< The username for FTP of the controller (default: administrator)
91
    string ftpPassword;         //!< The password for FTP of the controller (default: password)
88
    string ftpPassword;         //!< The password for FTP of the controller (default: password)
Line 103... Line 100...
103
    bool sip_ipv4{true};        //!< Default: TRUE, Enables or disables IPv4.
100
    bool sip_ipv4{true};        //!< Default: TRUE, Enables or disables IPv4.
104
    bool sip_ipv6{true};        //!< Default: TRUE, Enables or disables IPv6. Has precedence over IPv4.
101
    bool sip_ipv6{true};        //!< Default: TRUE, Enables or disables IPv6. Has precedence over IPv4.
105
    bool sip_iphone{false};     //!< Default: FALSE, if enabled and SIP is enabled then the internal phone dialog is used.
102
    bool sip_iphone{false};     //!< Default: FALSE, if enabled and SIP is enabled then the internal phone dialog is used.
106
    TConfig::SIP_FIREWALL_t sip_firewall{TConfig::SIP_NO_FIREWALL}; //!< Defines how to deal with a firewall.
103
    TConfig::SIP_FIREWALL_t sip_firewall{TConfig::SIP_NO_FIREWALL}; //!< Defines how to deal with a firewall.
107
    bool sip_enabled{false};    //!< By default SIP is disabled
104
    bool sip_enabled{false};    //!< By default SIP is disabled
-
 
105
    // Sound settings
-
 
106
    string systemSound;         //!< name of the set system sound played on every touch.
-
 
107
    bool systemSoundState{false};   //!< TRUE = play systemsound on every touch
-
 
108
    string systemSingleBeep;    //!< name of the system sound file to play a single beep.
-
 
109
    string systemDoubleBeep;    //!< name of the system sound file to play a double beep.
-
 
110
    int systemVolume{100};      //!< The set volume to use [0 ... 100]
-
 
111
    int systemGain{100};        //!< The set microphone level to use [0 ... 100]
108
};
112
};
109
 
113
 
110
typedef struct SETTINGS settings_t;
114
typedef struct SETTINGS settings_t;
111
static settings_t localSettings;    //!< Global defines settings used in class TConfig.
115
static settings_t localSettings;    //!< Global defines settings used in class TConfig.
112
 
116
 
Line 529... Line 533...
529
    DECL_TRACER("TConfig::saveSystemSoundState(bool state)");
533
    DECL_TRACER("TConfig::saveSystemSoundState(bool state)");
530
 
534
 
531
    localSettings.systemSoundState = state;
535
    localSettings.systemSoundState = state;
532
}
536
}
533
 
537
 
-
 
538
void TConfig::saveSingleBeepFile(const std::string& snd)
-
 
539
{
-
 
540
    DECL_TRACER("TConfig::saveSingleBeepFile(const std::string& snd)");
-
 
541
 
-
 
542
    localSettings.systemSingleBeep = snd;
-
 
543
}
-
 
544
 
-
 
545
void TConfig::saveDoubleBeepFile(const std::string& snd)
-
 
546
{
-
 
547
    DECL_TRACER("TConfig::saveDoubleBeepFile(const std::string& snd)");
-
 
548
 
-
 
549
    localSettings.systemDoubleBeep = snd;
-
 
550
}
-
 
551
 
-
 
552
void TConfig::saveSystemVolume(int volume)
-
 
553
{
-
 
554
    DECL_TRACER("TConfig::saveSystemVolume(int volume)");
-
 
555
 
-
 
556
    if (volume < 0 || volume > 100)
-
 
557
        return;
-
 
558
 
-
 
559
    localSettings.systemVolume = volume;
-
 
560
}
-
 
561
 
-
 
562
void TConfig::saveSystemGain(int gain)
-
 
563
{
-
 
564
    DECL_TRACER("TConfig::saveSystemGain(int gain)");
-
 
565
 
-
 
566
    if (gain < 0 || gain > 100)
-
 
567
        return;
-
 
568
 
-
 
569
    localSettings.systemGain = gain;
-
 
570
}
-
 
571
 
534
void TConfig::saveFtpUser(const string& user)
572
void TConfig::saveFtpUser(const string& user)
535
{
573
{
536
    DECL_TRACER("TConfig::saveFtpUser(const string& user)");
574
    DECL_TRACER("TConfig::saveFtpUser(const string& user)");
537
 
575
 
538
    localSettings.ftpUser = user;
576
    localSettings.ftpUser = user;
Line 770... Line 808...
770
        lines += string("Password4=") + localSettings.password4 + "\n";
808
        lines += string("Password4=") + localSettings.password4 + "\n";
771
        lines += string("SystemSoundFile=") + localSettings.systemSound + "\n";
809
        lines += string("SystemSoundFile=") + localSettings.systemSound + "\n";
772
        lines += string("SystemSoundState=") + (localSettings.systemSoundState ? "ON" : "OFF") + "\n";
810
        lines += string("SystemSoundState=") + (localSettings.systemSoundState ? "ON" : "OFF") + "\n";
773
        lines += string("SystemSingleBeep=") + localSettings.systemSingleBeep + "\n";
811
        lines += string("SystemSingleBeep=") + localSettings.systemSingleBeep + "\n";
774
        lines += string("SystemDoubleBeep=") + localSettings.systemDoubleBeep + "\n";
812
        lines += string("SystemDoubleBeep=") + localSettings.systemDoubleBeep + "\n";
-
 
813
        lines += "SystemVolume=" + std::to_string(localSettings.systemVolume) + "\n";
-
 
814
        lines += "SystemGain=" + std::to_string(localSettings.systemGain) + "\n";
775
        lines += string("SystemRotationFix=") + (localSettings.systemRotationFix ? "ON" : "OFF") + "\n";
815
        lines += string("SystemRotationFix=") + (localSettings.systemRotationFix ? "ON" : "OFF") + "\n";
776
        lines += string("UUID=") + localSettings.uuid + "\n";
816
        lines += string("UUID=") + localSettings.uuid + "\n";
777
        // FTP credentials
817
        // FTP credentials
778
        lines += string("FTPuser=") + localSettings.ftpUser + "\n";
818
        lines += string("FTPuser=") + localSettings.ftpUser + "\n";
779
        lines += string("FTPpassword=") + localSettings.ftpPassword + "\n";
819
        lines += string("FTPpassword=") + localSettings.ftpPassword + "\n";
Line 901... Line 941...
901
    DECL_TRACER("TConfig::getSystemSoundState()");
941
    DECL_TRACER("TConfig::getSystemSoundState()");
902
 
942
 
903
    return localSettings.systemSoundState;
943
    return localSettings.systemSoundState;
904
}
944
}
905
 
945
 
-
 
946
int TConfig::getSystemVolume()
-
 
947
{
-
 
948
    DECL_TRACER("TConfig::getSystemVolume()");
-
 
949
 
-
 
950
    return localSettings.systemVolume;
-
 
951
}
-
 
952
 
-
 
953
int TConfig::getSystemGain()
-
 
954
{
-
 
955
    DECL_TRACER("TConfig::getSystemGain()");
-
 
956
 
-
 
957
    return localSettings.systemGain;
-
 
958
}
-
 
959
 
906
bool TConfig::getRotationFixed()
960
bool TConfig::getRotationFixed()
907
{
961
{
908
    DECL_TRACER("TConfig::getRotationFixed()");
962
    DECL_TRACER("TConfig::getRotationFixed()");
909
 
963
 
910
    return localSettings.systemRotationFix;
964
    return localSettings.systemRotationFix;
Line 1501... Line 1555...
1501
                localSettings.systemSoundState = isTrue(right);
1555
                localSettings.systemSoundState = isTrue(right);
1502
            else if (caseCompare(left, "SystemSingleBeep") == 0 && !right.empty())
1556
            else if (caseCompare(left, "SystemSingleBeep") == 0 && !right.empty())
1503
                localSettings.systemSingleBeep = right;
1557
                localSettings.systemSingleBeep = right;
1504
            else if (caseCompare(left, "SystemDoubleBeep") == 0 && !right.empty())
1558
            else if (caseCompare(left, "SystemDoubleBeep") == 0 && !right.empty())
1505
                localSettings.systemDoubleBeep = right;
1559
                localSettings.systemDoubleBeep = right;
-
 
1560
            else if (caseCompare(left, "SystemVolume") == 0 && !right.empty())
-
 
1561
            {
-
 
1562
                int volume = atoi(right.c_str());
-
 
1563
 
-
 
1564
                if (volume < 0)
-
 
1565
                    volume = 0;
-
 
1566
                else if (volume > 100)
-
 
1567
                    volume = 100;
-
 
1568
 
-
 
1569
                localSettings.systemVolume = volume;
-
 
1570
            }
-
 
1571
            else if (caseCompare(left, "SystemGain") == 0 && !right.empty())
-
 
1572
            {
-
 
1573
                int gain = atoi(right.c_str());
-
 
1574
 
-
 
1575
                if (gain < 0)
-
 
1576
                    gain = 0;
-
 
1577
                else if (gain > 100)
-
 
1578
                    gain = 100;
-
 
1579
 
-
 
1580
                localSettings.systemGain = gain;
-
 
1581
            }
1506
            else if (caseCompare(left, "SystemRotationFix") == 0 && !right.empty())
1582
            else if (caseCompare(left, "SystemRotationFix") == 0 && !right.empty())
1507
                localSettings.systemRotationFix = isTrue(right);
1583
                localSettings.systemRotationFix = isTrue(right);
1508
            else if (caseCompare(left, "UUID") == 0 && !right.empty())
1584
            else if (caseCompare(left, "UUID") == 0 && !right.empty())
1509
                localSettings.uuid = right;
1585
                localSettings.uuid = right;
1510
            else if (caseCompare(left, "FTPuser") == 0 && !right.empty())       // FTP credentials
1586
            else if (caseCompare(left, "FTPuser") == 0 && !right.empty())       // FTP credentials
Line 1587... Line 1663...
1587
        MSG_INFO("    Profiling:    " << (localSettings.profiling ? "YES" : "NO"));
1663
        MSG_INFO("    Profiling:    " << (localSettings.profiling ? "YES" : "NO"));
1588
        MSG_INFO("    System Sound: " << localSettings.systemSound);
1664
        MSG_INFO("    System Sound: " << localSettings.systemSound);
1589
        MSG_INFO("    Sound state:  " << (localSettings.systemSoundState ? "ACTIVATED" : "DEACTIVATED"));
1665
        MSG_INFO("    Sound state:  " << (localSettings.systemSoundState ? "ACTIVATED" : "DEACTIVATED"));
1590
        MSG_INFO("    Single beep:  " << localSettings.systemSingleBeep);
1666
        MSG_INFO("    Single beep:  " << localSettings.systemSingleBeep);
1591
        MSG_INFO("    Double beep:  " << localSettings.systemDoubleBeep);
1667
        MSG_INFO("    Double beep:  " << localSettings.systemDoubleBeep);
-
 
1668
        MSG_INFO("    Volume:       " << localSettings.systemVolume);
-
 
1669
        MSG_INFO("    Gain:         " << localSettings.systemGain);
1592
        MSG_INFO("    Rotation:     " << (localSettings.systemRotationFix ? "LOCKED" : "UNLOCKED"));
1670
        MSG_INFO("    Rotation:     " << (localSettings.systemRotationFix ? "LOCKED" : "UNLOCKED"));
1593
        MSG_INFO("    UUID:         " << localSettings.uuid);
1671
        MSG_INFO("    UUID:         " << localSettings.uuid);
1594
        MSG_INFO("    FTP user:     " << localSettings.ftpUser);
1672
        MSG_INFO("    FTP user:     " << localSettings.ftpUser);
1595
        MSG_INFO("    FTP password: " << localSettings.ftpPassword);
1673
        MSG_INFO("    FTP password: " << localSettings.ftpPassword);
1596
        MSG_INFO("    FTP surface:  " << localSettings.ftpSurface);
1674
        MSG_INFO("    FTP surface:  " << localSettings.ftpSurface);