/*
 * This file is part of the Owl Positioning System (OwlPS) project.
 * It is subject to the copyright notice and license terms in the
 * COPYRIGHT.t2t file found in the top-level directory of this
 * distribution and at
 *   https://code.lm7.fr/mcy/owlps/src/master/COPYRIGHT.t2t
 * No part of the OwlPS Project, including this file, may be copied,
 * modified, propagated, or distributed except according to the terms
 * contained in the COPYRIGHT.t2t file; the COPYRIGHT.t2t file must be
 * distributed along with this file, either separately or by replacing
 * this notice by the COPYRIGHT.t2t file's contents.
 */


#ifndef _OWLPS_POSITIONING_AUTOCALIBRATIONLINE_HH_
#define _OWLPS_POSITIONING_AUTOCALIBRATIONLINE_HH_

class CapturePoint ;
class Point3D ;
class ReferencePoint ;

#include "autocalibration.hh"

#include <map>

/// Generates reference points following a path
class AutocalibrationLine: public Autocalibration
{
protected:
  /// Capture points to use for the generation
  const CapturePoint *cp1, *cp2 ;

  /// Reference (transmitter) capture point
  const CapturePoint *trx_cp ;
  /// True reference point corresponding to #trx_cp
  const ReferencePoint *trx_rp ;

  /// Generates the SSs for the current CP
  void generate_ss(void) ;
  /// Sorts the reference CPs for a receiver CP
  void sort_reference_cps(void) ;
  /// Computes a SS with several packets in it
  void compute_multi_packet_ss(void) ;
  /// Computes a SS with only one packet in it
  bool compute_single_packet_ss(pkt_id_t pkt_id) ;
  /// Actually computes a SS
  double compute_single_ss(const pkt_id_t pkt_id, const float point_dst) ;

public:
  AutocalibrationLine(const Point3D &_point,
                      const CapturePoint *const _cp1,
                      const CapturePoint *const _cp2 = nullptr) ;
} ;

#endif // _OWLPS_POSITIONING_AUTOCALIBRATIONLINE_HH_
