Skip to content

Commit

Permalink
AP_Networking: add get_str() accessor to IP address parms
Browse files Browse the repository at this point in the history
  • Loading branch information
magicrub committed Nov 15, 2023
1 parent 2e9035a commit 587fe52
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libraries/AP_Networking/AP_Networking_address.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,9 @@ void AP_Networking_IPV4::set_default_uint32(uint32_t v)
}
}

const char* AP_Networking_IPV4::get_str() const
{
return AP_Networking::convert_ip_to_str(get_uint32());
}

#endif // AP_NETWORKING_ENABLED
5 changes: 5 additions & 0 deletions libraries/AP_Networking/AP_Networking_address.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once

#include <AP_Param/AP_Param.h>

/*
class for an IPV4 address as a parameter
*/
Expand All @@ -15,6 +17,9 @@ class AP_Networking_IPV4
// set address from a uint32_t
void set_uint32(uint32_t addr);

// return address as a null-terminated string
const char* get_str() const;

// set default address from a uint32
void set_default_uint32(uint32_t addr);

Expand Down

0 comments on commit 587fe52

Please sign in to comment.