Skip to content

Commit 51516ed

Browse files
committed
remote_access: add is_connected_local_ip
This function allows to check if the input IP address is connected via the remote access
1 parent 3cc8f71 commit 51516ed

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

software/src/modules/remote_access/remote_access.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2145,6 +2145,13 @@ int RemoteAccess::stop_ping() {
21452145
return 0;
21462146
}
21472147

2148+
bool RemoteAccess::is_connected_local_ip(const IPAddress &ip) {
2149+
if (connection_state.get(ip[2])->get("state")->asUint8() == 2) {
2150+
return true;
2151+
}
2152+
return false;
2153+
}
2154+
21482155
[[gnu::const]]
21492156
Config &RemoteAccess::get_ping_state() {
21502157
return ping_state;

software/src/modules/remote_access/remote_access.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ class RemoteAccess final : public IModule {
5959
void register_urls() override;
6060
void register_events() override;
6161

62+
bool is_connected_local_ip(const IPAddress &address);
63+
6264
Config &get_ping_state();
6365
micros_t get_ping_start();
6466

0 commit comments

Comments
 (0)