CTRE Phoenix 6 C++ 25.0.0-beta-4
Loading...
Searching...
No Matches
DeviceIdentifier.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 <cstdint>
11#include <sstream>
12#include <string>
13
14namespace ctre {
15namespace phoenix6 {
16namespace hardware {
17
19 {
20 public:
21 std::string network;
22 std::string model;
24 uint32_t deviceHash;
25
26 DeviceIdentifier() = default;
27 DeviceIdentifier(int deviceID, std::string model, std::string canbus) : network{std::move(canbus)},
28 model{std::move(model)},
30 deviceHash{networking::Wrappers::CompileDeviceHash(deviceID, this->model.c_str(), this->network.c_str())}
31 {
32 }
33
34 std::string ToString() const
35 {
36 std::stringstream ss;
37 ss << model << " " << deviceID << " (\"" << network << "\")";
38 return ss.str();
39 }
40 };
41
42}
43}
44}
Definition DeviceIdentifier.hpp:19
std::string model
Definition DeviceIdentifier.hpp:22
std::string ToString() const
Definition DeviceIdentifier.hpp:34
int deviceID
Definition DeviceIdentifier.hpp:23
uint32_t deviceHash
Definition DeviceIdentifier.hpp:24
std::string network
Definition DeviceIdentifier.hpp:21
DeviceIdentifier(int deviceID, std::string model, std::string canbus)
Definition DeviceIdentifier.hpp:27
Definition StatusCodes.h:18
Definition span.hpp:401