Skip to content

Commit

Permalink
add more log
Browse files Browse the repository at this point in the history
  • Loading branch information
cmuhammedrafi committed Aug 27, 2024
1 parent 2fd198b commit 3b81fdf
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 10 deletions.
5 changes: 5 additions & 0 deletions NetworkManager/LegacyPlugin_NetworkAPIs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -824,9 +824,14 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = {
}
}
}
else
NMLOG_ERROR("m_networkmanager is null");

if (m_subsIfaceStateChange && m_subsActIfaceChange && m_subsIPAddrChange && m_subsInternetChange)
{
m_timer.stop();
NMLOG_INFO("subscriber timer stoped");
}
}

string Network::getInterfaceMapping(const string & interface)
Expand Down
11 changes: 8 additions & 3 deletions NetworkManager/LegacyPlugin_WiFiManagerAPIs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ namespace WPEFramework
if (Core::ERROR_NONE == errCode)
m_subsWiFiStateChange = true;
else
NMLOG_ERROR ("Subscribe to onInterfaceStateChange failed, errCode: %u", errCode);
NMLOG_ERROR ("Subscribe to onWiFiStateChange failed, errCode: %u", errCode);
}

if (!m_subsAvailableSSIDs)
Expand All @@ -512,7 +512,7 @@ namespace WPEFramework
if (Core::ERROR_NONE == errCode)
m_subsAvailableSSIDs = true;
else
NMLOG_ERROR("Subscribe to onIPAddressChange failed, errCode: %u", errCode);
NMLOG_ERROR("Subscribe to onAvailableSSIDs failed, errCode: %u", errCode);
}

if (!m_subsWiFiStrengthChange)
Expand All @@ -521,12 +521,17 @@ namespace WPEFramework
if (Core::ERROR_NONE == errCode)
m_subsWiFiStrengthChange = true;
else
NMLOG_ERROR("Subscribe to onActiveInterfaceChange failed, errCode: %u", errCode);
NMLOG_ERROR("Subscribe to onWiFiSignalStrengthChange failed, errCode: %u", errCode);
}
}
else
NMLOG_ERROR("m_networkmanager is null");

if (m_subsWiFiStateChange && m_subsAvailableSSIDs && m_subsWiFiStrengthChange)
{
m_timer.stop();
NMLOG_INFO("subscriber timer stoped");
}
}

bool WiFiManager::ErrorCodeMapping(const uint32_t ipvalue, uint32_t &opvalue)
Expand Down
14 changes: 7 additions & 7 deletions NetworkManager/NetworkManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ namespace WPEFramework
public:
void onInterfaceStateChange(const Exchange::INetworkManager::InterfaceState event, const string interface) override
{
NMLOG_TRACE("%s", __FUNCTION__);
NMLOG_INFO("%s", __FUNCTION__);
JsonObject params;
params["interface"] = interface;
params["state"] = InterfaceStateToString(event);
Expand All @@ -128,7 +128,7 @@ namespace WPEFramework

void onIPAddressChange(const string interface, const bool isAcquired, const bool isIPv6, const string ipAddress) override
{
NMLOG_TRACE("%s", __FUNCTION__);
NMLOG_INFO("%s", __FUNCTION__);
JsonObject params;
params["status"] = string (isAcquired ? "ACQUIRED" : "LOST");
params["interface"] = interface;
Expand All @@ -139,7 +139,7 @@ namespace WPEFramework

void onActiveInterfaceChange(const string prevActiveInterface, const string currentActiveinterface) override
{
NMLOG_TRACE("%s", __FUNCTION__);
NMLOG_INFO("%s", __FUNCTION__);
JsonObject params;
params["oldInterfaceName"] = prevActiveInterface;
params["newInterfaceName"] = currentActiveinterface;
Expand All @@ -149,7 +149,7 @@ namespace WPEFramework

void onInternetStatusChange(const Exchange::INetworkManager::InternetStatus oldState, const Exchange::INetworkManager::InternetStatus newstate) override
{
NMLOG_TRACE("%s", __FUNCTION__);
NMLOG_INFO("%s", __FUNCTION__);
JsonObject params;

params["state"] = static_cast <int> (newstate);;
Expand All @@ -169,7 +169,7 @@ namespace WPEFramework
// WiFi Notifications that other processes can subscribe to
void onAvailableSSIDs(const string jsonOfWiFiScanResults) override
{
NMLOG_TRACE("%s", __FUNCTION__);
NMLOG_INFO("%s", __FUNCTION__);
JsonArray scanResults;
JsonObject result;
scanResults.FromString(jsonOfWiFiScanResults);
Expand All @@ -180,15 +180,15 @@ namespace WPEFramework

void onWiFiStateChange(const Exchange::INetworkManager::WiFiState state) override
{
NMLOG_TRACE("%s", __FUNCTION__);
NMLOG_INFO("%s", __FUNCTION__);
JsonObject result;
result["state"] = static_cast <int> (state);
_parent.Notify("onWiFiStateChange", result);
}

void onWiFiSignalStrengthChange(const string ssid, const string signalLevel, const Exchange::INetworkManager::WiFiSignalQuality signalQuality) override
{
NMLOG_TRACE("%s", __FUNCTION__);
NMLOG_INFO("%s", __FUNCTION__);
JsonObject result;
result["ssid"] = ssid;
result["signalQuality"] = WiFiSignalQualityToString(signalQuality);
Expand Down
7 changes: 7 additions & 0 deletions NetworkManager/NetworkManagerImplementation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@ namespace WPEFramework
{
LOG_ENTRY_FUNCTION();
NMLOG_INFO("Posting onInterfaceStateChange %s", interface.c_str());
NMLOG_INFO("Size of _notificationCallbacks: %d", static_cast<int>(_notificationCallbacks.size()));
_notificationLock.Lock();
for (const auto callback : _notificationCallbacks) {
callback->onInterfaceStateChange(state, interface);
Expand All @@ -496,6 +497,7 @@ namespace WPEFramework
{
LOG_ENTRY_FUNCTION();
NMLOG_INFO("Posting onIPAddressChange %s", ipAddress.c_str());
NMLOG_INFO("Size of _notificationCallbacks: %d", static_cast<int>(_notificationCallbacks.size()));
_notificationLock.Lock();
for (const auto callback : _notificationCallbacks) {
callback->onIPAddressChange(interface, isAcquired, isIPv6, ipAddress);
Expand All @@ -507,6 +509,7 @@ namespace WPEFramework
{
LOG_ENTRY_FUNCTION();
NMLOG_INFO("Posting onActiveInterfaceChange %s", currentActiveinterface.c_str());
NMLOG_INFO("Size of _notificationCallbacks: %d", static_cast<int>(_notificationCallbacks.size()));
_notificationLock.Lock();
for (const auto callback : _notificationCallbacks) {
callback->onActiveInterfaceChange(prevActiveInterface, currentActiveinterface);
Expand All @@ -518,6 +521,7 @@ namespace WPEFramework
{
LOG_ENTRY_FUNCTION();
NMLOG_INFO("Posting onInternetStatusChange");
NMLOG_INFO("Size of _notificationCallbacks: %d", static_cast<int>(_notificationCallbacks.size()));
_notificationLock.Lock();
for (const auto callback : _notificationCallbacks) {
callback->onInternetStatusChange(oldState, newstate);
Expand All @@ -530,6 +534,7 @@ namespace WPEFramework
LOG_ENTRY_FUNCTION();
_notificationLock.Lock();
NMLOG_INFO("Posting onAvailableSSIDs result is, %s", jsonOfWiFiScanResults.c_str());
NMLOG_INFO("Size of _notificationCallbacks: %d", static_cast<int>(_notificationCallbacks.size()));
for (const auto callback : _notificationCallbacks) {
callback->onAvailableSSIDs(jsonOfWiFiScanResults);
}
Expand All @@ -540,6 +545,7 @@ namespace WPEFramework
{
LOG_ENTRY_FUNCTION();
NMLOG_INFO("Posting onWiFiStateChange");
NMLOG_INFO("Size of _notificationCallbacks: %d", static_cast<int>(_notificationCallbacks.size()));
_notificationLock.Lock();
for (const auto callback : _notificationCallbacks) {
callback->onWiFiStateChange(state);
Expand All @@ -551,6 +557,7 @@ namespace WPEFramework
{
LOG_ENTRY_FUNCTION();
NMLOG_INFO("Posting onWiFiSignalStrengthChange");
NMLOG_INFO("Size of _notificationCallbacks: %d", static_cast<int>(_notificationCallbacks.size()));
_notificationLock.Lock();
for (const auto callback : _notificationCallbacks) {
callback->onWiFiSignalStrengthChange(ssid, signalLevel, signalQuality);
Expand Down

0 comments on commit 3b81fdf

Please sign in to comment.