Subversion Repositories tpanel

Rev

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

Rev 90 Rev 104
Line 75... Line 75...
75
    string password4;           //!< Fourth panel password
75
    string password4;           //!< Fourth panel password
76
    string systemSound;         //!< name of the set system sound played on every touch.
76
    string systemSound;         //!< name of the set system sound played on every touch.
77
    bool systemSoundState{false};   //!< TRUE = play systemsound on every touch
77
    bool systemSoundState{false};   //!< TRUE = play systemsound on every touch
78
    string systemSingleBeep;    //!< name of the system sound file to play a single beep.
78
    string systemSingleBeep;    //!< name of the system sound file to play a single beep.
79
    string systemDoubleBeep;    //!< name of the system sound file to play a double beep.
79
    string systemDoubleBeep;    //!< name of the system sound file to play a double beep.
-
 
80
    // SIP settings
-
 
81
    string sip_proxy;           //!< The address of the SIP proxy
-
 
82
    int sip_port{5060};         //!< Initializes the port of the SIP proxy to 5060
-
 
83
    string sip_stun;            //!< STUN address
-
 
84
    string sip_domain;          //!< Local domain
-
 
85
    string sip_user;            //!< The SIP user to connect.
-
 
86
    string sip_password;        //!< The SIP password to connect. Note: This password is saved in plain text!
-
 
87
    bool sip_enabled{false};    //!< By default SIP is disabled
80
};
88
};
81
 
89
 
82
typedef struct SETTINGS settings_t;
90
typedef struct SETTINGS settings_t;
83
static settings_t localSettings;    //!< Global defines settings used in class TConfig.
91
static settings_t localSettings;    //!< Global defines settings used in class TConfig.
84
 
92
 
Line 446... Line 454...
446
void TConfig::saveSystemSoundState(bool state)
454
void TConfig::saveSystemSoundState(bool state)
447
{
455
{
448
    localSettings.systemSoundState = state;
456
    localSettings.systemSoundState = state;
449
}
457
}
450
 
458
 
-
 
459
std::string& TConfig::getSIPproxy()
-
 
460
{
-
 
461
    return localSettings.sip_proxy;
-
 
462
}
-
 
463
 
-
 
464
void TConfig::setSIPproxy(const std::string& address)
-
 
465
{
-
 
466
    localSettings.sip_proxy = address;
-
 
467
}
-
 
468
 
-
 
469
int TConfig::getSIPport()
-
 
470
{
-
 
471
    return localSettings.sip_port;
-
 
472
}
-
 
473
 
-
 
474
void TConfig::setSIPport(int port)
-
 
475
{
-
 
476
    localSettings.sip_port = port;
-
 
477
}
-
 
478
 
-
 
479
std::string& TConfig::getSIPstun()
-
 
480
{
-
 
481
    return localSettings.sip_stun;
-
 
482
}
-
 
483
 
-
 
484
void TConfig::setSIPstun(const std::string& address)
-
 
485
{
-
 
486
    localSettings.sip_stun = address;
-
 
487
}
-
 
488
 
-
 
489
std::string& TConfig::getSIPdomain()
-
 
490
{
-
 
491
    return localSettings.sip_domain;
-
 
492
}
-
 
493
 
-
 
494
void TConfig::setSIPdomain(const std::string& domain)
-
 
495
{
-
 
496
    localSettings.sip_domain = domain;
-
 
497
}
-
 
498
 
-
 
499
std::string& TConfig::getSIPuser()
-
 
500
{
-
 
501
    return localSettings.sip_user;
-
 
502
}
-
 
503
 
-
 
504
void TConfig::setSIPuser(const std::string& user)
-
 
505
{
-
 
506
    localSettings.sip_user = user;
-
 
507
}
-
 
508
 
-
 
509
std::string& TConfig::getSIPpassword()
-
 
510
{
-
 
511
    return localSettings.sip_password;
-
 
512
}
-
 
513
 
-
 
514
void TConfig::setSIPpassword(const std::string& pw)
-
 
515
{
-
 
516
    localSettings.sip_password = pw;
-
 
517
}
-
 
518
 
-
 
519
bool TConfig::getSIPstatus()
-
 
520
{
-
 
521
    return localSettings.sip_enabled;
-
 
522
}
-
 
523
 
-
 
524
void TConfig::setSIPstatus(bool state)
-
 
525
{
-
 
526
    localSettings.sip_enabled = state;
-
 
527
}
-
 
528
 
451
bool TConfig::saveSettings()
529
bool TConfig::saveSettings()
452
{
530
{
453
    DECL_TRACER("TConfig::saveSettings()");
531
    DECL_TRACER("TConfig::saveSettings()");
454
 
532
 
455
    try
533
    try
Line 476... Line 554...
476
        lines += string("Password4=") + localSettings.password4 + "\n";
554
        lines += string("Password4=") + localSettings.password4 + "\n";
477
        lines += string("SystemSoundFile=") + localSettings.systemSound + "\n";
555
        lines += string("SystemSoundFile=") + localSettings.systemSound + "\n";
478
        lines += string("SystemSoundState=") + (localSettings.systemSoundState ? "ON" : "OFF") + "\n";
556
        lines += string("SystemSoundState=") + (localSettings.systemSoundState ? "ON" : "OFF") + "\n";
479
        lines += string("SystemSingleBeep=") + localSettings.systemSingleBeep + "\n";
557
        lines += string("SystemSingleBeep=") + localSettings.systemSingleBeep + "\n";
480
        lines += string("SystemDoubleBeep=") + localSettings.systemDoubleBeep + "\n";
558
        lines += string("SystemDoubleBeep=") + localSettings.systemDoubleBeep + "\n";
-
 
559
        // SIP settings
-
 
560
        lines += string("SIP_DOMAIN") + localSettings.sip_domain + "\n";
-
 
561
        lines += string("SIP_PROXY") + localSettings.sip_password + "\n";
-
 
562
        lines += string("SIP_PORT") + std::to_string(localSettings.sip_port) + "\n";
-
 
563
        lines += string("SIP_STUN") + localSettings.sip_stun + "\n";
-
 
564
        lines += string("SIP_USER") + localSettings.sip_user + "\n";
-
 
565
        lines += string("SIP_PASSWORD") + localSettings.sip_password + "\n";
-
 
566
        lines += string("SIP_ENABLED") + (localSettings.sip_enabled ? "true" : "false") + "\n";
481
        file.write(lines.c_str(), lines.size());
567
        file.write(lines.c_str(), lines.size());
482
        file.close();
568
        file.close();
483
        MSG_INFO("Actual log level: " << localSettings.logLevel);
569
        MSG_INFO("Actual log level: " << localSettings.logLevel);
484
    }
570
    }
485
    catch (std::exception& e)
571
    catch (std::exception& e)
Line 989... Line 1075...
989
                localSettings.systemSoundState = isTrue(right);
1075
                localSettings.systemSoundState = isTrue(right);
990
            else if (caseCompare(left, "SystemSingleBeep") == 0 && !right.empty())
1076
            else if (caseCompare(left, "SystemSingleBeep") == 0 && !right.empty())
991
                localSettings.systemSingleBeep = right;
1077
                localSettings.systemSingleBeep = right;
992
            else if (caseCompare(left, "SystemDoubleBeep") == 0 && !right.empty())
1078
            else if (caseCompare(left, "SystemDoubleBeep") == 0 && !right.empty())
993
                localSettings.systemDoubleBeep = right;
1079
                localSettings.systemDoubleBeep = right;
-
 
1080
            else if (caseCompare(left, "SIP_PROXY") == 0 && !right.empty())     // SIP settings starting here
-
 
1081
                localSettings.sip_proxy = right;
-
 
1082
            else if (caseCompare(left, "SIP_PORT") == 0 && !right.empty())
-
 
1083
                localSettings.sip_port = atoi(right.c_str());
-
 
1084
            else if (caseCompare(left, "SIP_STUN") == 0 && !right.empty())
-
 
1085
                localSettings.sip_stun = right;
-
 
1086
            else if (caseCompare(left, "SIP_DOMAIN") == 0 && !right.empty())
-
 
1087
                localSettings.sip_domain = right;
-
 
1088
            else if (caseCompare(left, "SIP_USER") == 0 && !right.empty())
-
 
1089
                localSettings.sip_user = right;
-
 
1090
            else if (caseCompare(left, "SIP_PASSWORD") == 0 && !right.empty())
-
 
1091
                localSettings.sip_password = right;
-
 
1092
            else if (caseCompare(left, "SIP_ENABLED") == 0 && !right.empty())
-
 
1093
                localSettings.sip_enabled = isTrue(right);
994
        }
1094
        }
995
    }
1095
    }
996
 
1096
 
997
    fs.close();
1097
    fs.close();
998
 
1098