feat: wi-fi - expand support and fix issues, add GUI components
This commit is contained in:
@@ -607,8 +607,8 @@ namespace montauk {
|
||||
inline int wifi_info(montauk::abi::WifiInfo* out) {
|
||||
return (int)syscall1(montauk::abi::SYS_WIFI_INFO, (uint64_t)out);
|
||||
}
|
||||
// Association is groundwork only: open networks bring the firmware
|
||||
// contexts up, encrypted ones are rejected with -2.
|
||||
// Join a network. Blocks until the link is up or the attempt fails, and
|
||||
// returns 0 or a WIFI_ERR_* code.
|
||||
inline int wifi_connect(const char* ssid, const char* password) {
|
||||
return (int)syscall2(montauk::abi::SYS_WIFI_CONNECT, (uint64_t)ssid,
|
||||
(uint64_t)password);
|
||||
@@ -617,6 +617,33 @@ namespace montauk {
|
||||
return (int)syscall0(montauk::abi::SYS_WIFI_DISCONNECT);
|
||||
}
|
||||
|
||||
// Non-blocking pair for GUI code, which cannot stall for the seconds a
|
||||
// sweep or a handshake takes. scan_start() kicks off a sweep (0 started,
|
||||
// 1 one was already running, -1 no adapter); wifi_info().scanning drops
|
||||
// back to 0 and .scanGeneration moves on when it finishes, and
|
||||
// wifi_results() copies out the table without touching the radio.
|
||||
inline int wifi_scan_start(uint32_t timeoutMs) {
|
||||
return (int)syscall1(montauk::abi::SYS_WIFI_SCAN_START, (uint64_t)timeoutMs);
|
||||
}
|
||||
inline int wifi_results(montauk::abi::WifiNetwork* buf, int maxCount) {
|
||||
return (int)syscall2(montauk::abi::SYS_WIFI_RESULTS, (uint64_t)buf,
|
||||
(uint64_t)maxCount);
|
||||
}
|
||||
// Returns 0 once the join is under way, or a WIFI_ERR_* it failed on
|
||||
// before any frame went out. Watch wifi_info().joining for progress and
|
||||
// .lastError for the outcome.
|
||||
inline int wifi_connect_async(const char* ssid, const char* password) {
|
||||
return (int)syscall2(montauk::abi::SYS_WIFI_CONNECT_ASYNC, (uint64_t)ssid,
|
||||
(uint64_t)password);
|
||||
}
|
||||
|
||||
// List the registered link-layer interfaces. The IP configuration is
|
||||
// global to the stack; it belongs to whichever entry has active = 1.
|
||||
inline int net_interfaces(montauk::abi::NetIfInfo* buf, int maxCount) {
|
||||
return (int)syscall2(montauk::abi::SYS_NETIFS, (uint64_t)buf,
|
||||
(uint64_t)maxCount);
|
||||
}
|
||||
|
||||
// Software-defined radio (Rx). Receivers are identified by index [0, count);
|
||||
// open() returns a handle used by the rest of the calls. Samples are read
|
||||
// as interleaved 8-bit unsigned I/Q (CU8) from the device's ring buffer.
|
||||
|
||||
Reference in New Issue
Block a user