feat: wi-fi - expand support and fix issues, add GUI components
This commit is contained in:
1 parent
bbe1df62fd
commit
9eb21eb3e3
67 files changed
+4573
-245
No files matched your search
@@ -160,6 +160,38 @@ namespace montauk::abi {
|
||||
}
|
||||
}
|
||||
|
||||
// List the registered link-layer interfaces. The panel needs this to keep
|
||||
// wired and wireless status apart: the IP configuration is global, so the
|
||||
// only way to say which interface owns it is `active`.
|
||||
static int Sys_NetIfs(NetIfInfo* out, int maxCount) {
|
||||
if (out == nullptr || maxCount <= 0) return -1;
|
||||
|
||||
const auto* active = ::Net::NetIf::Active();
|
||||
int count = ::Net::NetIf::Count();
|
||||
int n = 0;
|
||||
|
||||
for (int i = 0; i < count && n < maxCount; i++) {
|
||||
const auto* iface = ::Net::NetIf::At(i);
|
||||
if (iface == nullptr) continue;
|
||||
|
||||
NetIfInfo& info = out[n];
|
||||
for (uint64_t k = 0; k < sizeof(info.name); k++) info.name[k] = '\0';
|
||||
for (uint64_t k = 0; k + 1 < sizeof(info.name) && iface->Name && iface->Name[k]; k++)
|
||||
info.name[k] = iface->Name[k];
|
||||
|
||||
const uint8_t* mac = iface->GetMac ? iface->GetMac() : nullptr;
|
||||
for (int k = 0; k < 6; k++) info.mac[k] = mac ? mac[k] : 0;
|
||||
|
||||
info.kind = iface->Type == ::Net::NetIf::Kind::Wireless
|
||||
? NETIF_KIND_WIRELESS : NETIF_KIND_ETHERNET;
|
||||
info.linkUp = (iface->IsLinkUp && iface->IsLinkUp()) ? 1 : 0;
|
||||
info.active = iface == active ? 1 : 0;
|
||||
info._pad[0] = info._pad[1] = info._pad[2] = 0;
|
||||
n++;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
static int Sys_SetNetCfg(const NetCfg* in) {
|
||||
if (in == nullptr) return -1;
|
||||
Net::SetIpAddress(in->ipAddress);
|
||||
|
||||
Reference in new issue
Block a user