Skip to content

Commit

Permalink
removed obsolete managerRescan function
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-bibb committed Jan 9, 2022
1 parent 1f9a28f commit 038a898
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 56 deletions.
73 changes: 25 additions & 48 deletions apps/cmstapp/code/control_box/controlbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,31 @@ ControlBox::ControlBox(const QCommandLineParser& parser, QWidget *parent)
if (! con_manager->isValid() ) logErrors(CMST::Err_Invalid_Con_Iface);
else {
// Access connman.manager to retrieve the data
this->managerRescan(CMST::Manager_All);

// Reset the getXX errors
q16_errors &= ~CMST::Err_Properties;
q16_errors &= ~CMST::Err_Technologies;
q16_errors &= ~CMST::Err_Services;

if (! getTechnologies() ) logErrors(CMST::Err_Technologies);
else {
// connect technology signals to slots
for (int i = 0; i < technologies_list.size(); ++i) {
QDBusConnection::systemBus().disconnect(DBUS_CON_SERVICE, technologies_list.at(i).objpath.path(), "net.connman.Technology", "PropertyChanged", this, SLOT(dbsTechnologyPropertyChanged(QString, QDBusVariant, QDBusMessage)));
QDBusConnection::systemBus().connect(DBUS_CON_SERVICE, technologies_list.at(i).objpath.path(), "net.connman.Technology", "PropertyChanged", this, SLOT(dbsTechnologyPropertyChanged(QString, QDBusVariant, QDBusMessage)));
} // for
} //else

if (! getServices() ) logErrors(CMST::Err_Services);
else {
// connect service signals to slots
for (int i = 0; i < services_list.size(); ++i) {
QDBusConnection::systemBus().disconnect(DBUS_CON_SERVICE, services_list.at(i).objpath.path(), "net.connman.Service", "PropertyChanged", this, SLOT(dbsServicePropertyChanged(QString, QDBusVariant, QDBusMessage)));
QDBusConnection::systemBus().connect(DBUS_CON_SERVICE, services_list.at(i).objpath.path(), "net.connman.Service", "PropertyChanged", this, SLOT(dbsServicePropertyChanged(QString, QDBusVariant, QDBusMessage)));
} // for
} // else

if (! getProperties() ) logErrors(CMST::Err_Properties);

// register the agent
shared::processReply(con_manager->call(QDBus::AutoDetect, "RegisterAgent", QVariant::fromValue(QDBusObjectPath(AGENT_OBJECT))) );
Expand Down Expand Up @@ -1747,52 +1771,6 @@ bool ControlBox::eventFilter(QObject* obj, QEvent* evn)
// This function is now really misnamed. Originally we called it a lot, but now
// everything is dealt with using DBus signals so it is only called at startup
// as an initial scan.
int ControlBox::managerRescan(const int& srv)
{
if ( ((q16_errors & CMST::Err_No_DBus) | (q16_errors & CMST::Err_Invalid_Con_Iface)) == 0x00 ) {

// Reset the getXX errors, always a chance we could read them after
// a previous error. Don't actually believe it, but just in case.
q16_errors &= ~CMST::Err_Properties;
q16_errors &= ~CMST::Err_Technologies;
q16_errors &= ~CMST::Err_Services;

// Access connman.manager to retrieve the data
if (srv & CMST::Manager_Technologies) {
if (! getTechnologies() ) {
logErrors(CMST::Err_Technologies);
} // if
else {
// connect technology signals to slots
for (int i = 0; i < technologies_list.size(); ++i) {
QDBusConnection::systemBus().disconnect(DBUS_CON_SERVICE, technologies_list.at(i).objpath.path(), "net.connman.Technology", "PropertyChanged", this, SLOT(dbsTechnologyPropertyChanged(QString, QDBusVariant, QDBusMessage)));
QDBusConnection::systemBus().connect(DBUS_CON_SERVICE, technologies_list.at(i).objpath.path(), "net.connman.Technology", "PropertyChanged", this, SLOT(dbsTechnologyPropertyChanged(QString, QDBusVariant, QDBusMessage)));
} // for
} //else
} // if technolgies

if (srv & CMST::Manager_Services) {
if (! getServices() ) {
logErrors(CMST::Err_Services);
} // if
else {
// connect service signals to slots
for (int i = 0; i < services_list.size(); ++i) {
QDBusConnection::systemBus().disconnect(DBUS_CON_SERVICE, services_list.at(i).objpath.path(), "net.connman.Service", "PropertyChanged", this, SLOT(dbsServicePropertyChanged(QString, QDBusVariant, QDBusMessage)));
QDBusConnection::systemBus().connect(DBUS_CON_SERVICE, services_list.at(i).objpath.path(), "net.connman.Service", "PropertyChanged", this, SLOT(dbsServicePropertyChanged(QString, QDBusVariant, QDBusMessage)));
} // for
} // else
} // if services

if (srv & CMST::Manager_Properties) {
if (! getProperties() ) logErrors(CMST::Err_Properties);
}

} // if

return (q16_errors & CMST::Err_Properties) | (q16_errors & CMST::Err_Technologies) | (q16_errors & CMST::Err_Services);
}

//
// Function to assemble status tab of the dialog
void ControlBox::assembleTabStatus()
Expand Down Expand Up @@ -2853,7 +2831,6 @@ bool ControlBox::getTechnologies()
//
// Function to query connman.manager.GetServices
// Return a bool, true on success, false otherwise
// Called from managerRescan()
bool ControlBox::getServices()
{
// call connman and GetServices
Expand Down
1 change: 0 additions & 1 deletion apps/cmstapp/code/control_box/controlbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ class ControlBox : public QDialog
bool b_userinitiated;

// functions
int managerRescan(const int& srv = 0);
void assembleTabStatus();
void assembleTabDetails();
void assembleTabWireless();
Expand Down
8 changes: 1 addition & 7 deletions apps/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ DEALINGS IN THE SOFTWARE.
///////////////////////////////// Program Values ///////////////////////
//
// Program Info (may be visible, but don't mark for tranalation)
#define VERSION "2022.01.09-1"
#define VERSION "2022.01.09-2"

#define RELEASE_DATE "05 January 2022"
#define COPYRIGHT_DATE "2013-2022"
Expand Down Expand Up @@ -77,12 +77,6 @@ namespace CMST
Err_Services = (1 << 4), // There was an error reading connman.Manager.GetServices
Err_Invalid_VPN_Iface = (1 << 5), // Invalid interface

// methods
Manager_Properties = (1 << 1), // scan for properties
Manager_Technologies = (1 << 2), // scan for technologies
Manager_Services = (1 << 3), // scan for services
Manager_All = (CMST::Manager_Properties | CMST::Manager_Technologies | CMST::Manager_Services),

// provisioning editor
ProvEd_No_Selection = 0x00,
ProvEd_File_Read = (1 << 0),
Expand Down
1 change: 1 addition & 0 deletions text/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<b><center>Change Log</center></b>
<b> In Progress </b>
<ul>
<li>Removed obsolete managerRescan() function, moved code to where needed.</li>
<li>Fix VPN parsing not being done in various display elements (issue #192)</li>
</ul>
<b> 2022.01.05 </b>
Expand Down

0 comments on commit 038a898

Please sign in to comment.