CTRE Phoenix 6 C++ 26.70.0-alpha-2
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
13#include <mutex>
14
15namespace ctre {
16namespace phoenix6 {
17namespace configs {
18
19 /**
20 * \brief The base class for all device configurators.
21 */
23 public:
24 /**
25 * \brief The default maximum amount of time to wait for a config.
26 */
27 wpi::units::second_t DefaultTimeoutSeconds{0.100_s};
28
29 private:
30 hardware::DeviceIdentifier deviceIdentifier;
31 mutable std::mutex _m;
32
33 mutable wpi::units::second_t _creationTime = utils::GetCurrentTime();
34 mutable wpi::units::second_t _lastConfigTime = _creationTime;
35 mutable wpi::units::second_t _freqConfigStart = 0_s;
36
37 mutable PhoenixMultiAlert _applyAlert;
38 mutable PhoenixMultiAlert _refreshAlert;
39 mutable PhoenixAlert _freqConfigAlert;
40
41 protected:
43
46
47 void ReportIfFrequent() const;
48
49 ctre::phoenix::StatusCode SetConfigsPrivate(std::string_view serializedString, wpi::units::second_t timeoutSeconds, bool futureProofConfigs, bool overrideIfDuplicate);
50 ctre::phoenix::StatusCode GetConfigsPrivate(std::string &serializedString, wpi::units::second_t timeoutSeconds) const;
51 };
52
53}
54}
55}
Persistent alert with debouncing.
Definition Alerts.hpp:24
Persistent multi-level alert with debouncing.
Definition Alerts.hpp:120
ctre::phoenix::StatusCode SetConfigsPrivate(std::string_view serializedString, wpi::units::second_t timeoutSeconds, bool futureProofConfigs, bool overrideIfDuplicate)
wpi::units::second_t DefaultTimeoutSeconds
The default maximum amount of time to wait for a config.
Definition Configurator.hpp:27
ParentConfigurator(hardware::DeviceIdentifier deviceIdentifier)
ctre::phoenix::StatusCode GetConfigsPrivate(std::string &serializedString, wpi::units::second_t timeoutSeconds) const
ParentConfigurator(ParentConfigurator const &)=delete
ParentConfigurator & operator=(ParentConfigurator const &)=delete
The unique identifier for a device.
Definition DeviceIdentifier.hpp:19
Status codes reported by APIs, including OK, warnings, and errors.
Definition StatusCodes.h:28
Definition ExternalFeedbackConfigs.hpp:21
wpi::units::second_t GetCurrentTime()
Get the current timestamp.
Definition Utils.hpp:27
Definition ExternalFeedbackConfigs.hpp:16
Definition motor_constants.h:14