cryptnox-pos
1.0.0
Standalone USDC payment terminal firmware (ESP32 + Cryptnox smart card)
Toggle main menu visibility
Loading...
Searching...
No Matches
net.h
Go to the documentation of this file.
1
/*
2
* SPDX-License-Identifier: LGPL-3.0-or-later
3
* Copyright (c) 2026 Cryptnox SA
4
*/
5
13
14
#ifndef NET_H
15
#define NET_H
16
17
/******************************************************************
18
* 1. Included files
19
******************************************************************/
20
21
#include <stdint.h>
22
#include <stdbool.h>
23
24
#ifdef __cplusplus
25
extern
"C"
{
26
#endif
27
28
/******************************************************************
29
* 2. Types
30
******************************************************************/
31
33
typedef
struct
{
34
char
ssid
[33];
35
int8_t
rssi
;
36
bool
open
;
37
}
net_wifi_ap_t
;
38
39
/******************************************************************
40
* 3. Public API
41
******************************************************************/
42
49
void
net_wifi_init
(
void
);
50
58
uint16_t
net_wifi_scan
(
net_wifi_ap_t
*out, uint16_t max);
59
68
bool
net_wifi_connect
(
const
char
*ssid,
const
char
*password);
69
81
void
net_wifi_disconnect
(
void
);
82
107
bool
net_ap_start
(
const
char
*ssid,
const
char
*pass);
108
117
void
net_ap_stop
(
void
);
118
129
void
net_wifi_keep_trying
(
void
);
130
132
bool
net_wifi_online
(
void
);
133
135
bool
net_wifi_reconnecting
(
void
);
136
144
bool
net_wifi_rssi
(int8_t *rssi_out);
145
168
bool
net_time_sync
(uint32_t timeout_ms);
169
178
void
net_time_background
(
void
);
179
180
#ifdef __cplusplus
181
}
182
#endif
183
184
#endif
// NET_H
net_ap_start
bool net_ap_start(const char *ssid, const char *pass)
Raise a WPA2 SoftAP as the radio's only interface, for phone-based configuration.
Definition
net.cpp:215
net_wifi_disconnect
void net_wifi_disconnect(void)
Drop the station association, without the retry loop pulling it back.
Definition
net.cpp:268
net_time_background
void net_time_background(void)
Subscribe SNTP without waiting, so the clock is set whenever the network comes back.
Definition
net.cpp:529
net_wifi_keep_trying
void net_wifi_keep_trying(void)
Hold on to the network last configured, even though it is down now.
Definition
net.cpp:430
net_time_sync
bool net_time_sync(uint32_t timeout_ms)
Block until the system clock has been set via SNTP and sanity-checked.
Definition
net.cpp:536
net_ap_stop
void net_ap_stop(void)
Drop the SoftAP, return the radio to station-only, and re-join.
Definition
net.cpp:286
net_wifi_rssi
bool net_wifi_rssi(int8_t *rssi_out)
Read the RSSI of the currently associated access point.
Definition
net.cpp:448
net_wifi_online
bool net_wifi_online(void)
true while the station holds an IP address.
Definition
net.cpp:437
net_wifi_connect
bool net_wifi_connect(const char *ssid, const char *password)
Connect to a WiFi network and block until an IP is obtained (up to 30 s). May be called repeatedly to...
Definition
net.cpp:376
net_wifi_scan
uint16_t net_wifi_scan(net_wifi_ap_t *out, uint16_t max)
Scan for nearby access points (blocking).
Definition
net.cpp:322
net_wifi_init
void net_wifi_init(void)
Bring up the WiFi driver in station mode (idempotent).
Definition
net.cpp:175
net_wifi_reconnecting
bool net_wifi_reconnecting(void)
true while a kept network is down and the re-join is running.
Definition
net.cpp:443
net_wifi_ap_t
A scanned access point (subset of fields the UI needs).
Definition
net.h:33
net_wifi_ap_t::ssid
char ssid[33]
Definition
net.h:34
net_wifi_ap_t::open
bool open
Definition
net.h:36
net_wifi_ap_t::rssi
int8_t rssi
Definition
net.h:35
main
net.h
Generated by
1.17.0