CTRE Phoenix 6 C++ 26.0.0-beta-1
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
19 public:
20 /**
21 * \brief The default maximum amount of time to wait for a config.
22 */
23 units::time::second_t DefaultTimeoutSeconds{0.100_s};
24
25 private:
26 hardware::DeviceIdentifier deviceIdentifier;
27 mutable std::mutex _m;
28
29 mutable units::second_t _creationTime = utils::GetCurrentTime();
30 mutable units::second_t _lastConfigTime = _creationTime;
31 mutable units::second_t _freqConfigStart = 0_s;
32
33 protected:
34 ParentConfigurator(hardware::DeviceIdentifier deviceIdentifier) : deviceIdentifier{std::move(deviceIdentifier)}
35 {}
36
39
40 void ReportIfFrequent() const;
41
42 ctre::phoenix::StatusCode SetConfigsPrivate(std::string_view serializedString, units::time::second_t timeoutSeconds, bool futureProofConfigs, bool overrideIfDuplicate);
43 ctre::phoenix::StatusCode GetConfigsPrivate(std::string &serializedString, units::time::second_t timeoutSeconds) const;
44 };
45
46}
47}
48}
Definition Configurator.hpp:18
ParentConfigurator(hardware::DeviceIdentifier deviceIdentifier)
Definition Configurator.hpp:34
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:23
Definition DeviceIdentifier.hpp:16
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