add mac address to wifi status page
This commit is contained in:
parent
33be3ab1b2
commit
e8de21aaf4
@ -15,12 +15,13 @@ import WifiIcon from '@material-ui/icons/Wifi';
|
|||||||
import DNSIcon from '@material-ui/icons/Dns';
|
import DNSIcon from '@material-ui/icons/Dns';
|
||||||
import SettingsInputComponentIcon from '@material-ui/icons/SettingsInputComponent';
|
import SettingsInputComponentIcon from '@material-ui/icons/SettingsInputComponent';
|
||||||
import SettingsInputAntennaIcon from '@material-ui/icons/SettingsInputAntenna';
|
import SettingsInputAntennaIcon from '@material-ui/icons/SettingsInputAntenna';
|
||||||
|
import DeviceHubIcon from '@material-ui/icons/DeviceHub';
|
||||||
|
|
||||||
import SectionContent from '../components/SectionContent';
|
import SectionContent from '../components/SectionContent';
|
||||||
import { WIFI_STATUS_ENDPOINT } from '../constants/Endpoints';
|
import { WIFI_STATUS_ENDPOINT } from '../constants/Endpoints';
|
||||||
import { isConnected, connectionStatus, connectionStatusHighlight } from '../constants/WiFiConnectionStatus';
|
import { isConnected, connectionStatus, connectionStatusHighlight } from '../constants/WiFiConnectionStatus';
|
||||||
import * as Highlight from '../constants/Highlight';
|
import * as Highlight from '../constants/Highlight';
|
||||||
import { restComponent } from '../components/RestComponent';
|
import { restComponent } from '../components/RestComponent';
|
||||||
|
|
||||||
const styles = theme => ({
|
const styles = theme => ({
|
||||||
["wifiStatus_" + Highlight.IDLE]: {
|
["wifiStatus_" + Highlight.IDLE]: {
|
||||||
@ -52,10 +53,10 @@ class WiFiStatus extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dnsServers(status) {
|
dnsServers(status) {
|
||||||
if (!status.dns_ip_1){
|
if (!status.dns_ip_1) {
|
||||||
return "none";
|
return "none";
|
||||||
}
|
}
|
||||||
return status.dns_ip_1 + (status.dns_ip_2 ? ','+status.dns_ip_2 : '');
|
return status.dns_ip_1 + (status.dns_ip_2 ? ',' + status.dns_ip_2 : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
createListItems(data, classes) {
|
createListItems(data, classes) {
|
||||||
@ -83,6 +84,13 @@ class WiFiStatus extends Component {
|
|||||||
<ListItemText primary="IP Address" secondary={data.local_ip} />
|
<ListItemText primary="IP Address" secondary={data.local_ip} />
|
||||||
</ListItem>
|
</ListItem>
|
||||||
<Divider variant="inset" component="li" />
|
<Divider variant="inset" component="li" />
|
||||||
|
<ListItem>
|
||||||
|
<Avatar>
|
||||||
|
<DeviceHubIcon />
|
||||||
|
</Avatar>
|
||||||
|
<ListItemText primary="MAC Address" secondary={data.mac_address} />
|
||||||
|
</ListItem>
|
||||||
|
<Divider variant="inset" component="li" />
|
||||||
<ListItem>
|
<ListItem>
|
||||||
<Avatar>#</Avatar>
|
<Avatar>#</Avatar>
|
||||||
<ListItemText primary="Subnet Mask" secondary={data.subnet_mask} />
|
<ListItemText primary="Subnet Mask" secondary={data.subnet_mask} />
|
||||||
@ -109,44 +117,42 @@ class WiFiStatus extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderWiFiStatus(data, classes) {
|
renderWiFiStatus(data, classes) {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<List>
|
<List>
|
||||||
{this.createListItems(data, classes)}
|
{this.createListItems(data, classes)}
|
||||||
</List>
|
</List>
|
||||||
<Button variant="contained" color="secondary" className={classes.button} onClick={this.props.loadData}>
|
<Button variant="contained" color="secondary" className={classes.button} onClick={this.props.loadData}>
|
||||||
Refresh
|
Refresh
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { data, fetched, errorMessage, classes } = this.props;
|
const { data, fetched, errorMessage, classes } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SectionContent title="WiFi Status">
|
<SectionContent title="WiFi Status">
|
||||||
{
|
{
|
||||||
!fetched ?
|
!fetched ?
|
||||||
<div>
|
<div>
|
||||||
<LinearProgress className={classes.fetching}/>
|
<LinearProgress className={classes.fetching} />
|
||||||
<Typography variant="display1" className={classes.fetching}>
|
<Typography variant="display1" className={classes.fetching}>
|
||||||
Loading...
|
Loading...
|
||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
:
|
:
|
||||||
data ? this.renderWiFiStatus(data, classes)
|
data ? this.renderWiFiStatus(data, classes)
|
||||||
:
|
:
|
||||||
<div>
|
<div>
|
||||||
<Typography variant="display1" className={classes.fetching}>
|
<Typography variant="display1" className={classes.fetching}>
|
||||||
{errorMessage}
|
{errorMessage}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Button variant="contained" color="secondary" className={classes.button} onClick={this.props.loadData}>
|
<Button variant="contained" color="secondary" className={classes.button} onClick={this.props.loadData}>
|
||||||
Refresh
|
Refresh
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</SectionContent>
|
</SectionContent>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -55,6 +55,7 @@ void WiFiStatus::wifiStatus(AsyncWebServerRequest *request) {
|
|||||||
root["status"] = (uint8_t) status;
|
root["status"] = (uint8_t) status;
|
||||||
if (status == WL_CONNECTED){
|
if (status == WL_CONNECTED){
|
||||||
root["local_ip"] = WiFi.localIP().toString();
|
root["local_ip"] = WiFi.localIP().toString();
|
||||||
|
root["mac_address"] = WiFi.macAddress();
|
||||||
root["rssi"] = WiFi.RSSI();
|
root["rssi"] = WiFi.RSSI();
|
||||||
root["ssid"] = WiFi.SSID();
|
root["ssid"] = WiFi.SSID();
|
||||||
root["bssid"] = WiFi.BSSIDstr();
|
root["bssid"] = WiFi.BSSIDstr();
|
||||||
|
Loading…
Reference in New Issue
Block a user