summaryrefslogtreecommitdiff
path: root/firmware/os/algos/calibration/online_calibration/common_data/config_callback.h
blob: de122801a790a8b84354be0185da5d616f4babd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef LOCATION_LBS_CONTEXTHUB_NANOAPPS_CALIBRATION_ONLINE_CALIBRATION_COMMON_DATA_CONFIG_CALLBACK_H_
#define LOCATION_LBS_CONTEXTHUB_NANOAPPS_CALIBRATION_ONLINE_CALIBRATION_COMMON_DATA_CONFIG_CALLBACK_H_

#include <cstdint>

namespace online_calibration {

// Context-dependent configuration change types.
enum class ConfigChangeType : uint8_t {
  kNoConfigChange = 0,
  kMagGyroActiveMode,
  kMagGyroPassiveMode,
  kGyroActiveMode,
  kGyroPassiveMode,
  kNumConfigChangeTypes,
};

// Callback interface for changing an algorithm specific configuration (e.g.,
// sensor subscription properties, etc.).
class ConfigCallback {
 protected:
  // Protected destructor. The implementation can destroy itself, it can't be
  // destroyed through this interface.
  virtual ~ConfigCallback() = default;

 public:
  /*
   * Override this method to allow calibration objects to trigger changes in
   * sensor configurations or operational states (e.g., upon device motion the
   * MagGyroCal may switch to higher-rate gyroscope and magnetometer sampling
   * rates to produce a new calibration result).
   *
   * config_type: This enumerator indicates what configuration change must be
   *              made, the owner of the calibration object will make the
   *              appropriate platform dependent changes.
   *
   * sensor_index: The calibration algorithm will provide a sensor index to help
   *               uniquely identify the sensor it calibrates. This can be used
   *               to disambiguate what platform specific configuration response
   *               should be taken.
   */
  virtual void UpdateConfiguration(ConfigChangeType config_type,
                                   uint8_t sensor_index) = 0;
};

}  // namespace online_calibration

#endif  // LOCATION_LBS_CONTEXTHUB_NANOAPPS_CALIBRATION_ONLINE_CALIBRATION_COMMON_DATA_CONFIG_CALLBACK_H_