/*
 * 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_AUTOCALIBRATION_HH_
#define _OWLPS_POSITIONING_AUTOCALIBRATION_HH_

class Point3D ;

#include "measurement.hh"

/// Base class for the autocalibration methods
class Autocalibration
{
private:
  /// Number of generated "virtual" mobiles
  static uint32_t nb_virtual_mobiles ;

  /// Characteristics of the virtual mobile
  double vmob_gain, vmob_pow ;

  /// Work to do before actually generating a SS with generate_ss()
  bool init_ss_generation(void) ;

protected:
  /// The coordinates of the reference point to generate
  const Point3D &point ;

  /// Current CP to generate a SS for
  std::unordered_map<std::string, CapturePoint>::const_iterator rx ;

  /// Generated measurements' list
  std::unordered_map<std::string, Measurement> measurements ;

  /// Generates the SSs for the current CP (#rx)
  /**
   * Once the preliminary work done, this function should call
   * compute_ss() to actually compute the signal strength.
   */
  virtual void generate_ss(void) = 0 ;
  /// Computes the SS of the virtual mobile
  void compute_ss(void) ;
  /// Computes a SS with several packets in it
  virtual void compute_multi_packet_ss(void) = 0 ;
  /// Computes a SS with only one packet in it
  virtual bool compute_single_packet_ss(pkt_id_t pkt_id) = 0 ;

public:
  explicit Autocalibration(const Point3D &_point): point(_point) {}

  /// Generates a single reference point
  void generate_reference_point(void) ;
} ;

#endif // _OWLPS_POSITIONING_AUTOCALIBRATION_HH_
