AP_Beacon: add get_boundary_points

This commit is contained in:
Shingo Matsuura 2017-06-08 15:57:24 +09:00 committed by Randy Mackay
parent b3bf72020f
commit c9475c2747
2 changed files with 20 additions and 0 deletions

View File

@ -225,6 +225,18 @@ uint32_t AP_Beacon::beacon_last_update_ms(uint8_t beacon_instance) const
return beacon_state[beacon_instance].distance_update_ms;
}
// return fence boundary array
const Vector2f* AP_Beacon::get_boundary_points(uint16_t& num_points) const
{
if (!device_ready()) {
num_points = 0;
return nullptr;
}
num_points = boundary_num_points + 1;
return boundary;
}
// check if the device is ready
bool AP_Beacon::device_ready(void) const
{

View File

@ -24,6 +24,7 @@ class AP_Beacon_Backend;
#define AP_BEACON_MAX_BEACONS 4
#define AP_BEACON_TIMEOUT_MS 300
#define AP_BEACON_MINIMUM_FENCE_BEACONS 3
class AP_Beacon
{
@ -90,6 +91,9 @@ public:
// return last update time from beacon in milliseconds
uint32_t beacon_last_update_ms(uint8_t beacon_instance) const;
// return fence boundary array
const Vector2f* get_boundary_points(uint16_t& num_points) const;
static const struct AP_Param::GroupInfo var_info[];
private:
@ -116,4 +120,8 @@ private:
// individual beacon data
uint8_t num_beacons = 0;
BeaconState beacon_state[AP_BEACON_MAX_BEACONS];
// fence boundary
Vector2f *boundary;
uint8_t boundary_num_beacons;
};