CTRE Phoenix 6 C++ 26.3.0
Loading...
Searching...
No Matches
Configurator.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) Cross The Road Electronics.  All rights reserved.
3 * License information can be found in CTRE_LICENSE.txt
4 * For support and suggestions contact support@ctr-electronics.com or file
5 * an issue tracker at https://github.com/CrossTheRoadElec/Phoenix-Releases
6 */
7#pragma once
8
12#include <mutex>
13
14namespace ctre {
15namespace phoenix6 {
16namespace configs {
17
18 /**
19 * \brief The base class for all device configurators.
20 */
22 public:
23 /**
24 * \brief The default maximum amount of time to wait for a config.
25 */
26 units::time::second_t DefaultTimeoutSeconds{0.100_s};
27
28 private:
29 hardware::DeviceIdentifier deviceIdentifier;
30 mutable std::mutex _m;
31
32 mutable units::second_t _creationTime = utils::GetCurrentTime();
33 mutable units::second_t _lastConfigTime = _creationTime;
34 mutable units::second_t _freqConfigStart = 0_s;
35
36 protected:
37 ParentConfigurator(hardware::DeviceIdentifier deviceIdentifier) : deviceIdentifier{std::move(deviceIdentifier)}
38 {}
39
42
43 void ReportIfFrequent() const;
44
45 ctre::phoenix::StatusCode SetConfigsPrivate(std::string_view serializedString, units::time::second_t timeoutSeconds, bool futureProofConfigs, bool overrideIfDuplicate);
46 ctre::phoenix::StatusCode GetConfigsPrivate(std::string &serializedString, units::time::second_t timeoutSeconds) const;
47 };
48
49}
50}
51}
The base class for all device configurators.
Definition Configurator.hpp:21
ParentConfigurator(hardware::DeviceIdentifier deviceIdentifier)
Definition Configurator.hpp:37
ctre::phoenix::StatusCode SetConfigsPrivate(std::string_view serializedString, units::time::second_t timeoutSeconds, bool futureProofConfigs, bool overrideIfDuplicate)
ParentConfigurator(ParentConfigurator const &)=delete
ctre::phoenix::StatusCode GetConfigsPrivate(std::string &serializedString, units::time::second_t timeoutSeconds) const
ParentConfigurator & operator=(ParentConfigurator const &)=delete
units::time::second_t DefaultTimeoutSeconds
The default maximum amount of time to wait for a config.
Definition Configurator.hpp:26
The unique identifier for a device.
Definition DeviceIdentifier.hpp:19
Status codes reported by APIs, including OK, warnings, and errors.
Definition StatusCodes.h:28
units::second_t GetCurrentTime()
Get the current timestamp.
Definition Utils.hpp:29
Definition motor_constants.h:14