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.
DELIA-65998 Implement GNOME NetworkManager plugin events (#5610)
* Gnome event monitor added * updated onSignalStrength Change Cb * GnomeEvent class move to singleton class --------- Co-authored-by: Karunakaran A <[email protected]>
- Loading branch information
1 parent
f72ba11
commit 7f83b94
Showing
13 changed files
with
1,493 additions
and
646 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
Large diffs are not rendered by default.
Oops, something went wrong.
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,70 @@ | ||
/* | ||
* 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 <NetworkManager.h> | ||
#include <libnm/NetworkManager.h> | ||
#include <string.h> | ||
#include <iostream> | ||
#include <atomic> | ||
|
||
namespace WPEFramework | ||
{ | ||
namespace Plugin | ||
{ | ||
|
||
typedef struct { | ||
NMClient *client; | ||
GMainLoop *loop; | ||
NMDevice *device; | ||
NMDeviceWifi *wifiDevice; | ||
NMActiveConnection *activeConn; | ||
std::string ifnameWlan0; | ||
std::string ifnameEth0; | ||
} NMEvents; | ||
|
||
class GnomeNetworkManagerEvents | ||
{ | ||
|
||
public: | ||
static void onInterfaceStateChangeCb(uint8_t newState, std::string iface); // ReportInterfaceStateChangedEvent | ||
static void onAddressChangeCb(std::string iface, std::string ipAddress, bool acqired, bool isIPv6); // ReportIPAddressChangedEvent | ||
static void onActiveInterfaceChangeCb(std::string newInterface); // ReportActiveInterfaceChangedEvent | ||
static void onAvailableSSIDsCb(NMDeviceWifi *wifiDevice, GParamSpec *pspec, gpointer userData); // ReportAvailableSSIDsEvent | ||
static void onWIFIStateChanged(uint8_t state); // ReportWiFiStateChangedEvent | ||
|
||
public: | ||
static GnomeNetworkManagerEvents* getInstance(); | ||
bool startNetworkMangerEventMonitor(); | ||
void stopNetworkMangerEventMonitor(); | ||
void setwifiScanOptions(bool doScan, bool enableLogs = false); | ||
|
||
private: | ||
static void* networkMangerEventMonitor(void *arg); | ||
GnomeNetworkManagerEvents(); | ||
~GnomeNetworkManagerEvents(); | ||
std::atomic<bool>isEventThrdActive = {false}; | ||
std::atomic<bool>stopWifiScan = {false}; | ||
std::atomic<bool>debugLogs = {false}; | ||
NMEvents nmEvents; | ||
GThread *eventThrdID; | ||
}; | ||
|
||
} // Plugin | ||
} // WPEFramework |
Oops, something went wrong.