CTRE Phoenix 6 C++ 26.70.0-alpha-2
Loading...
Searching...
No Matches
Wrappers.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
10#include <functional>
11#include <stdint.h>
12#include <string>
13
14namespace ctre {
15namespace phoenix6 {
16namespace networking {
17
19 {
20 public:
21 /**
22 * \brief Creates the device hash from provided parameters
23 *
24 * \param deviceID Device ID
25 * \param model Device Model
26 * \param canbus CAN bus name
27 * \returns Hash of the device
28 */
29 static uint32_t CompileDeviceHash(int deviceID, char const *model, char const *canbus);
30 /**
31 * \brief Sets the config value of the device
32 *
33 * \param network What network the device is on
34 * \param deviceHash The hash of the device
35 * \param timeoutSeconds How long to wait for the device to acknowledge in seconds
36 * \param serializedString Serialized configs to set
37 * \param futureProofConfigs True to factory default the configs before setting
38 * \param overrideIfDuplicate True to always configure this parameter, even if we detect it's unnecessary
39 * \returns Status of the config set
40 */
42 char const *network,
43 int deviceHash,
44 double timeoutSeconds,
45 std::string_view serializedString,
46 bool futureProofConfigs,
47 bool overrideIfDuplicate
48 );
49
50 /**
51 * \brief Gets the config value of the device
52 *
53 * \param network What network the device is on
54 * \param deviceHash The hash of the device
55 * \param timeoutSeconds How long to wait for the device to acknowledge in seconds
56 * \param serializedString Serialized configs to get
57 * \returns Status of the config set
58 */
60 char const *network,
61 int deviceHash,
62 double timeoutSeconds,
63 std::string &serializedString
64 );
65
66 /**
67 * \brief Reports an error.
68 *
69 * \param isError Whether this is an error (1) or warning (0)
70 * \param errorCode Error code
71 * \param details Error details
72 * \param location Error location
73 * \param getStackTrace Whether to include the stack trace
74 */
75 static void ReportError(
76 bool isError, int32_t errorCode, char const *details,
77 char const *location, bool getStackTrace = true
78 );
79
80 /**
81 * \brief Reports a status code.
82 *
83 * \param statusCode Status code
84 * \param location Location of the status
85 * \param getStackTrace Whether to include the stack trace
86 */
87 static void ReportStatusCode(
88 ctre::phoenix::StatusCode statusCode, char const *location, bool getStackTrace = true
89 );
90 };
91
92}
93}
94}
Definition Wrappers.hpp:19
static void ReportStatusCode(ctre::phoenix::StatusCode statusCode, char const *location, bool getStackTrace=true)
Reports a status code.
static ctre::phoenix::StatusCode Device_SetConfigValues(char const *network, int deviceHash, double timeoutSeconds, std::string_view serializedString, bool futureProofConfigs, bool overrideIfDuplicate)
Sets the config value of the device.
static ctre::phoenix::StatusCode Device_GetConfigValues(char const *network, int deviceHash, double timeoutSeconds, std::string &serializedString)
Gets the config value of the device.
static void ReportError(bool isError, int32_t errorCode, char const *details, char const *location, bool getStackTrace=true)
Reports an error.
static uint32_t CompileDeviceHash(int deviceID, char const *model, char const *canbus)
Creates the device hash from provided parameters.
Status codes reported by APIs, including OK, warnings, and errors.
Definition StatusCodes.h:28
Definition Wrappers.hpp:16
Definition ExternalFeedbackConfigs.hpp:16
Definition motor_constants.h:14