forked from rdkcentral/networkmanager
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
37c5d5b
commit b19a37a
Showing
19 changed files
with
995 additions
and
1,456 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{ | ||
"files.associations": { | ||
"cstdio": "cpp", | ||
"array": "cpp", | ||
"atomic": "cpp", | ||
"bit": "cpp", | ||
"*.tcc": "cpp", | ||
"cctype": "cpp", | ||
"chrono": "cpp", | ||
"clocale": "cpp", | ||
"cmath": "cpp", | ||
"compare": "cpp", | ||
"concepts": "cpp", | ||
"condition_variable": "cpp", | ||
"cstdarg": "cpp", | ||
"cstddef": "cpp", | ||
"cstdint": "cpp", | ||
"cstdlib": "cpp", | ||
"cstring": "cpp", | ||
"ctime": "cpp", | ||
"cwchar": "cpp", | ||
"cwctype": "cpp", | ||
"deque": "cpp", | ||
"list": "cpp", | ||
"map": "cpp", | ||
"set": "cpp", | ||
"string": "cpp", | ||
"unordered_map": "cpp", | ||
"vector": "cpp", | ||
"exception": "cpp", | ||
"algorithm": "cpp", | ||
"functional": "cpp", | ||
"iterator": "cpp", | ||
"memory": "cpp", | ||
"memory_resource": "cpp", | ||
"numeric": "cpp", | ||
"random": "cpp", | ||
"ratio": "cpp", | ||
"string_view": "cpp", | ||
"system_error": "cpp", | ||
"tuple": "cpp", | ||
"type_traits": "cpp", | ||
"utility": "cpp", | ||
"fstream": "cpp", | ||
"initializer_list": "cpp", | ||
"iosfwd": "cpp", | ||
"iostream": "cpp", | ||
"istream": "cpp", | ||
"limits": "cpp", | ||
"mutex": "cpp", | ||
"new": "cpp", | ||
"numbers": "cpp", | ||
"ostream": "cpp", | ||
"semaphore": "cpp", | ||
"sstream": "cpp", | ||
"stdexcept": "cpp", | ||
"stop_token": "cpp", | ||
"streambuf": "cpp", | ||
"thread": "cpp", | ||
"typeinfo": "cpp" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/** | ||
* If not stated otherwise in this file or this component's LICENSE | ||
* file the following copyright and licenses apply: | ||
* | ||
* Copyright 2022 RDK Management | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
**/ | ||
|
||
#include <glib.h> | ||
#include <gio/gio.h> | ||
#include <string> | ||
|
||
#include "NetworkManagerDbusMgr.h" | ||
#include "NetworkManagerLogger.h" | ||
|
||
namespace WPEFramework | ||
{ | ||
namespace Plugin | ||
{ | ||
|
||
DbusConnectionManager::DbusConnectionManager() : connection(nullptr) { | ||
NMLOG_INFO("DbusConnectionManager created"); | ||
} | ||
|
||
DbusConnectionManager::~DbusConnectionManager() { | ||
DeinitializeDbusConnection(); | ||
} | ||
|
||
bool DbusConnectionManager::InitializeBusConnection(const std::string& busName) { | ||
GError* error = nullptr; | ||
connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, nullptr, &error); | ||
|
||
if (!connection) { | ||
NMLOG_ERROR("Failed to initialize D-Bus connection: %s ", error->message); | ||
g_error_free(error); | ||
return false; | ||
} | ||
|
||
NMLOG_INFO("D-Bus connection initialized successfully for bus: %s", busName.c_str()); | ||
return true; | ||
} | ||
|
||
void DbusConnectionManager::DeinitializeDbusConnection() { | ||
if (connection) { | ||
g_object_unref(connection); | ||
connection = nullptr; | ||
NMLOG_INFO("D-Bus connection deinitialized successfully"); | ||
} | ||
} | ||
|
||
GDBusConnection* DbusConnectionManager::getConnection() const { | ||
return connection; | ||
} | ||
|
||
} // Plugin | ||
} // WPEFramework | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* If not stated otherwise in this file or this component's LICENSE file the | ||
* following copyright and licenses apply: | ||
* | ||
* Copyright 2020 RDK Management | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#pragma once | ||
#include <gio/gio.h> | ||
#include <iostream> | ||
#include <string> | ||
#include <list> | ||
|
||
/* include NetworkManager.h for the defines, but we don't link against libnm. */ | ||
#include <nm-dbus-interface.h> | ||
|
||
namespace WPEFramework | ||
{ | ||
namespace Plugin | ||
{ | ||
class DbusConnectionManager { | ||
public: | ||
DbusConnectionManager(); | ||
~DbusConnectionManager(); | ||
|
||
bool InitializeBusConnection(const std::string& busName); | ||
void DeinitializeDbusConnection(); | ||
GDBusConnection* getConnection() const; | ||
|
||
private: | ||
GDBusConnection* connection; | ||
}; | ||
|
||
} | ||
} |
Oops, something went wrong.