Skip to content

Commit

Permalink
Revert to default MAC string format for getMAC method in `AccessPoi…
Browse files Browse the repository at this point in the history
…ntClass` and `StationClass` (SmingHub#1584)

By default reverts to previous behaviour, but supports alternative formats.
  • Loading branch information
mikee47 authored and jneuhauser committed Feb 1, 2019
1 parent cf53191 commit cf650e6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Sming/SmingCore/Platform/AccessPoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ bool AccessPointClass::setIP(IPAddress address)
return true;
}

String AccessPointClass::getMAC()
String AccessPointClass::getMAC(char sep)
{
uint8 hwaddr[6];
if(wifi_get_macaddr(SOFTAP_IF, hwaddr))
return makeHexString(hwaddr, sizeof(hwaddr), ':');
return makeHexString(hwaddr, sizeof(hwaddr), sep);
else
return nullptr;
}
Expand Down
3 changes: 2 additions & 1 deletion Sming/SmingCore/Platform/AccessPoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ class AccessPointClass : protected ISystemReadyHandler
bool setIP(IPAddress address);

/** @brief Get WiFi AP MAC address
* @param optional separator between bytes (e.g. ':')
* @retval String WiFi AP MAC address
*/
String getMAC();
String getMAC(char sep = '\0');

/** @brief Get WiFi AP network mask
* @retval IPAddress WiFi AP network mask
Expand Down
4 changes: 2 additions & 2 deletions Sming/SmingCore/Platform/Station.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,11 @@ IPAddress StationClass::getIP()
return info.ip;
}

String StationClass::getMAC()
String StationClass::getMAC(char sep)
{
uint8 hwaddr[6];
if(wifi_get_macaddr(STATION_IF, hwaddr))
return makeHexString(hwaddr, sizeof(hwaddr), ':');
return makeHexString(hwaddr, sizeof(hwaddr), sep);
else
return nullptr;
}
Expand Down
3 changes: 2 additions & 1 deletion Sming/SmingCore/Platform/Station.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,10 @@ class StationClass : protected ISystemReadyHandler
IPAddress getIP();

/** @brief Get WiFi station MAC address
* @param optional separator between bytes (e.g. ':')
* @retval String WiFi station MAC address
*/
String getMAC();
String getMAC(char sep = '\0');

/** @brief Get WiFi station network mask
* @retval IPAddress WiFi station network mask
Expand Down

0 comments on commit cf650e6

Please sign in to comment.