WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
NetComm.h
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#pragma once
6
7#include <stdint.h>
8
9#include <array>
10#include <bit>
11#include <limits>
12#include <span>
13#include <string>
14#include <string_view>
15#include <utility>
16
17#include "mrc/NtNetComm.h"
18
19namespace mrc {
20
21enum class RobotMode : uint8_t {
25 Test = 3
26};
27
28struct OpModeHash {
29 uint64_t Hash : 56 = 0;
30 uint64_t RobotMode : 2 = 0;
31 uint64_t IsEnabled : 1 = 0;
32 uint64_t Reserved : 5 = 0;
33
34 static constexpr uint64_t RobotModeMask = 0x0300000000000000;
35 static constexpr uint64_t EnabledMask = 0x0400000000000000;
36 static constexpr uint64_t HashMask = 0x00FFFFFFFFFFFFFF;
37 static constexpr int RobotModeShift = 56;
38
39 constexpr static OpModeHash MakeTest(uint64_t Hash, bool Enabled = false) {
40 OpModeHash FullHash;
41 FullHash.Hash = Hash & HashMask;
42 FullHash.RobotMode = static_cast<uint8_t>(RobotMode::Test);
43 FullHash.IsEnabled = Enabled ? 1 : 0;
44 return FullHash;
45 }
46
47 constexpr static OpModeHash MakeTele(uint64_t Hash, bool Enabled = false) {
48 OpModeHash FullHash;
49 FullHash.Hash = Hash & HashMask;
50 FullHash.RobotMode = static_cast<uint8_t>(RobotMode::Teleoperated);
51 FullHash.IsEnabled = Enabled ? 1 : 0;
52 return FullHash;
53 }
54
55 constexpr static OpModeHash MakeAuto(uint64_t Hash, bool Enabled = false) {
56 OpModeHash FullHash;
57 FullHash.Hash = Hash & HashMask;
58 FullHash.RobotMode = static_cast<uint8_t>(RobotMode::Autonomous);
59 FullHash.IsEnabled = Enabled ? 1 : 0;
60 return FullHash;
61 }
62
63 constexpr static OpModeHash FromValue(uint64_t Value) {
64 OpModeHash RetVal;
65 RetVal.Hash = Value & HashMask;
66 RetVal.RobotMode = (Value & RobotModeMask) >> RobotModeShift;
67 RetVal.IsEnabled = (Value & EnabledMask) != 0;
68 return RetVal;
69 }
70
71 constexpr uint64_t ToValue() const {
72 uint64_t RetVal = Hash & HashMask;
73 RetVal |= static_cast<uint64_t>(RobotMode) << RobotModeShift;
74 RetVal |= IsEnabled ? EnabledMask : 0;
75 return RetVal;
76 }
77};
78
80 uint32_t Enabled : 1 = 0;
81 uint32_t RobotMode : 2 = 0;
82 uint32_t EStop : 1 = 0;
83 uint32_t FmsConnected : 1 = 0;
84 uint32_t DsConnected : 1 = 0;
85 uint32_t WatchdogActive : 1 = 0;
86 uint32_t SupportsOpModes : 1 = 0;
87 uint32_t Alliance : 4 = 0;
88 uint32_t Reserved : 20 = 0;
89
90 constexpr bool operator==(const ControlFlags& Other) const {
91 return Enabled == Other.Enabled && RobotMode == Other.RobotMode &&
92 EStop == Other.EStop && FmsConnected == Other.FmsConnected &&
93 DsConnected == Other.DsConnected &&
96 Alliance == Other.Alliance;
97 }
98
99 constexpr bool operator!=(const ControlFlags& Other) const {
100 return !(*this == Other);
101 }
102
103 constexpr void Reset() {
104 Enabled = 0;
105 RobotMode = 0;
106 EStop = 0;
107 FmsConnected = 0;
108 DsConnected = 0;
109 WatchdogActive = 0;
110 SupportsOpModes = 0;
111 Alliance = 0;
112 Reserved = 0;
113 }
114};
115
117 public:
118 std::span<int16_t> Axes() {
119 return std::span{AxesStore.data(), GetMaxAvailableCount()};
120 }
121
122 std::span<const int16_t> Axes() const {
123 return std::span{AxesStore.data(), GetMaxAvailableCount()};
124 }
125
126 void SetAvailable(uint16_t Available) {
127 AvailableAxes = Available & ((1 << MRC_MAX_NUM_AXES) - 1);
128 Count = static_cast<uint8_t>(16 - std::countl_zero(AvailableAxes));
129 }
130
131 uint16_t GetAvailable() const { return AvailableAxes; }
132
133 void SetMaxAvailableCount(size_t _Count) {
134 if (_Count > MRC_MAX_NUM_AXES) {
135 _Count = MRC_MAX_NUM_AXES;
136 }
137 AvailableAxes = (1 << _Count) - 1;
138 Count = static_cast<uint8_t>(_Count);
139 }
140
141 size_t GetMaxAvailableCount() const { return Count; }
142
143 private:
144 std::array<int16_t, MRC_MAX_NUM_AXES> AxesStore{};
145 uint16_t AvailableAxes{0};
146 uint8_t Count{0};
147};
148
150 public:
151 std::span<uint8_t> Povs() { return std::span{PovsStore.data(), GetCount()}; }
152
153 std::span<const uint8_t> Povs() const {
154 return std::span{PovsStore.data(), GetCount()};
155 }
156
157 void SetCount(uint8_t NewCount) {
158 Count = (std::min)(NewCount, static_cast<uint8_t>(MRC_MAX_NUM_POVS));
159 }
160
161 size_t GetCount() const { return Count; }
162
163 private:
164 std::array<uint8_t, MRC_MAX_NUM_POVS> PovsStore{};
165 uint8_t Count{0};
166};
167
169 uint64_t Buttons{0};
170
171 void SetAvailable(uint64_t Available) {
172 AvailableButtons = Available;
173 Count = static_cast<uint8_t>(64 - std::countl_zero(Available));
174 }
175
176 uint64_t GetAvailable() const { return AvailableButtons; }
177
178 void SetMaxAvailableCount(size_t _Count) {
179 if (_Count > 63) {
180 AvailableButtons = (std::numeric_limits<uint64_t>::max)();
181 Count = MRC_MAX_NUM_BUTTONS;
182 return;
183 }
184 AvailableButtons = (1ULL << _Count) - 1;
185 Count = static_cast<uint8_t>(_Count);
186 }
187
188 size_t GetMaxAvailableCount() const { return Count; }
189
190 private:
191 uint64_t AvailableButtons{0};
192 uint8_t Count{0};
193};
194
196 bool Down{false};
197 uint16_t X{0};
198 uint16_t Y{0};
199};
200
201struct Touchpad {
202 std::span<TouchpadFinger> Fingers() {
203 return std::span{FingersStore.data(), GetFingerCount()};
204 }
205
206 std::span<const TouchpadFinger> Fingers() const {
207 return std::span{FingersStore.data(), GetFingerCount()};
208 }
209
210 size_t GetFingerCount() const { return FingerCount; }
211
212 void SetFingerCount(uint8_t NewCount) {
213 FingerCount =
214 (std::min)(NewCount,
215 static_cast<uint8_t>(MRC_MAX_NUM_TOUCHPAD_FINGERS));
216 }
217
218 private:
219 std::array<TouchpadFinger, MRC_MAX_NUM_TOUCHPAD_FINGERS> FingersStore{};
220 uint8_t FingerCount{0};
221};
222
224 std::span<Touchpad> Touchpads() {
225 return std::span{TouchpadsStore.data(), GetTouchpadCount()};
226 }
227
228 std::span<const Touchpad> Touchpads() const {
229 return std::span{TouchpadsStore.data(), GetTouchpadCount()};
230 }
231
232 size_t GetTouchpadCount() const { return TouchpadCount; }
233
234 void SetTouchpadCount(uint8_t NewCount) {
235 TouchpadCount =
236 (std::min)(NewCount, static_cast<uint8_t>(MRC_MAX_NUM_TOUCHPADS));
237 }
238
239 private:
240 std::array<Touchpad, MRC_MAX_NUM_TOUCHPADS> TouchpadsStore{};
241 uint8_t TouchpadCount{0};
242};
243
250
253 uint16_t MatchTime{0};
255
256 void SetGameData(std::string_view Data) {
257 if (Data.size() > MRC_MAX_GAME_DATA_LEN) {
258 Data = Data.substr(0, MRC_MAX_GAME_DATA_LEN);
259 }
260 GameData = Data;
261 }
262
263 void MoveGameData(std::string&& Data) {
264 GameData = std::move(Data);
265 if (GameData.size() > MRC_MAX_GAME_DATA_LEN) {
266 GameData.resize(MRC_MAX_GAME_DATA_LEN);
267 }
268 }
269
270 std::string_view GetGameData() const { return GameData; }
271
272 std::span<Joystick> Joysticks() {
273 return std::span{JoysticksStore.data(), GetJoystickCount()};
274 }
275
276 std::span<const Joystick> Joysticks() const {
277 return std::span{JoysticksStore.data(), GetJoystickCount()};
278 }
279
280 size_t GetJoystickCount() const { return JoystickCount; }
281
282 void SetJoystickCount(uint8_t NewCount) {
283 JoystickCount =
284 (std::min)(NewCount, static_cast<uint8_t>(MRC_MAX_NUM_JOYSTICKS));
285 }
286
287 private:
288 std::string GameData;
289 std::array<Joystick, MRC_MAX_NUM_JOYSTICKS> JoysticksStore;
290 uint8_t JoystickCount{0};
291};
292
294 public:
295 uint8_t R{0};
296 uint8_t G{0};
297 uint8_t B{0};
298 uint16_t LeftRumble{0};
299 uint16_t RightRumble{0};
300 uint16_t LeftTriggerRumble{0};
302
303 bool IsEmpty() const {
304 return R == 0 && G == 0 && B == 0 && LeftRumble == 0 && RightRumble == 0 &&
306 }
307};
308
310 std::span<JoystickOutput> Outputs() {
311 return std::span{OutputsStore.data(), GetOutputCount()};
312 }
313
314 std::span<const JoystickOutput> Outputs() const {
315 return std::span{OutputsStore.data(), GetOutputCount()};
316 }
317
318 size_t GetOutputCount() const { return OutputCount; }
319
320 void SetOutputCount(uint8_t NewCount) {
321 OutputCount =
322 (std::min)(NewCount, static_cast<uint8_t>(MRC_MAX_NUM_JOYSTICKS));
323 }
324
325 private:
326 std::array<JoystickOutput, MRC_MAX_NUM_JOYSTICKS> OutputsStore;
327 uint8_t OutputCount{0};
328};
329
330enum class MatchType : uint8_t {
331 None = 0,
335 Test = 4,
336};
337
338struct MatchInfo {
339 uint16_t MatchNumber{0};
340 uint8_t ReplayNumber{0};
342
343 void SetEventName(std::string_view Name) {
344 if (Name.size() > MRC_MAX_EVENT_NAME_LEN) {
345 Name = Name.substr(0, MRC_MAX_EVENT_NAME_LEN);
346 }
347 EventName = Name;
348 }
349
350 void MoveEventName(std::string&& Name) {
351 EventName = std::move(Name);
352 if (EventName.size() > MRC_MAX_EVENT_NAME_LEN) {
353 EventName.resize(MRC_MAX_EVENT_NAME_LEN);
354 }
355 }
356
357 std::string_view GetEventName() const { return EventName; }
358
359 std::span<uint8_t> WritableNameBuffer(size_t Len) {
360 if (Len > MRC_MAX_EVENT_NAME_LEN) {
362 }
363 EventName.resize(Len);
364 return std::span<uint8_t>{reinterpret_cast<uint8_t*>(EventName.data()),
365 EventName.size()};
366 }
367
368 bool operator==(const MatchInfo& Other) const {
369 return MatchNumber == Other.MatchNumber &&
370 ReplayNumber == Other.ReplayNumber && Type == Other.Type &&
371 EventName == Other.EventName;
372 }
373
374 private:
375 std::string EventName;
376};
377
379 public:
380 bool IsGamepad{false};
381 uint8_t GamepadType{0};
383
384 void SetName(std::string_view Name) {
385 if (Name.size() > MRC_MAX_JOYSTICK_NAME_LEN) {
386 Name = Name.substr(0, MRC_MAX_JOYSTICK_NAME_LEN);
387 }
388 JoystickName = Name;
389 }
390
391 void MoveName(std::string&& Name) {
392 JoystickName = std::move(Name);
393 if (JoystickName.size() > MRC_MAX_JOYSTICK_NAME_LEN) {
394 JoystickName.resize(MRC_MAX_JOYSTICK_NAME_LEN);
395 }
396 }
397
398 std::string_view GetName() const { return JoystickName; }
399
400 std::span<uint8_t> WritableNameBuffer(size_t Len) {
401 if (Len > MRC_MAX_JOYSTICK_NAME_LEN) {
403 }
404 JoystickName.resize(Len);
405 return std::span<uint8_t>{reinterpret_cast<uint8_t*>(JoystickName.data()),
406 JoystickName.size()};
407 }
408
409 private:
410 std::string JoystickName;
411};
412
414 std::span<JoystickDescriptor> Descriptors() {
415 return std::span{DescriptorsStore.data(), GetDescriptorCount()};
416 }
417
418 std::span<const JoystickDescriptor> Descriptors() const {
419 return std::span{DescriptorsStore.data(), GetDescriptorCount()};
420 }
421
422 size_t GetDescriptorCount() const { return DescriptorCount; }
423
424 void SetDescriptorCount(uint8_t NewCount) {
425 DescriptorCount =
426 (std::min)(NewCount, static_cast<uint8_t>(MRC_MAX_NUM_JOYSTICKS));
427 }
428
429 private:
430 std::array<JoystickDescriptor, MRC_MAX_NUM_JOYSTICKS> DescriptorsStore;
431 uint8_t DescriptorCount{0};
432};
433
434struct ErrorInfo {
435 bool IsError{false};
436 int32_t ErrorCode{0};
437
438 void SetDetails(std::string_view NewDetails) {
439 if (NewDetails.size() > MRC_MAX_ERROR_INFO_STR_LEN) {
440 NewDetails = NewDetails.substr(0, MRC_MAX_ERROR_INFO_STR_LEN);
441 }
442 Details = NewDetails;
443 }
444
445 void MoveDetails(std::string&& NewDetails) {
446 Details = std::move(NewDetails);
447 if (Details.size() > MRC_MAX_ERROR_INFO_STR_LEN) {
448 Details.resize(MRC_MAX_ERROR_INFO_STR_LEN);
449 }
450 }
451
452 std::string_view GetDetails() const { return Details; }
453
454 std::span<uint8_t> WritableDetailsBuffer(size_t Len) {
455 if (Len > MRC_MAX_ERROR_INFO_STR_LEN) {
457 }
458 Details.resize(Len);
459 return std::span<uint8_t>{reinterpret_cast<uint8_t*>(Details.data()),
460 Details.size()};
461 }
462
463 void SetLocation(std::string_view NewLocation) {
464 if (NewLocation.size() > MRC_MAX_ERROR_INFO_STR_LEN) {
465 NewLocation = NewLocation.substr(0, MRC_MAX_ERROR_INFO_STR_LEN);
466 }
467 Location = NewLocation;
468 }
469
470 void MoveLocation(std::string&& NewLocation) {
471 Location = std::move(NewLocation);
472 if (Location.size() > MRC_MAX_ERROR_INFO_STR_LEN) {
473 Location.resize(MRC_MAX_ERROR_INFO_STR_LEN);
474 }
475 }
476
477 std::string_view GetLocation() const { return Location; }
478
479 std::span<uint8_t> WritableLocationBuffer(size_t Len) {
480 if (Len > MRC_MAX_ERROR_INFO_STR_LEN) {
482 }
483 Location.resize(Len);
484 return std::span<uint8_t>{reinterpret_cast<uint8_t*>(Location.data()),
485 Location.size()};
486 }
487
488 void SetCallStack(std::string_view NewCallStack) {
489 if (NewCallStack.size() > MRC_MAX_ERROR_INFO_STR_LEN) {
490 NewCallStack = NewCallStack.substr(0, MRC_MAX_ERROR_INFO_STR_LEN);
491 }
492 CallStack = NewCallStack;
493 }
494
495 void MoveCallStack(std::string&& NewCallStack) {
496 CallStack = std::move(NewCallStack);
497 if (CallStack.size() > MRC_MAX_ERROR_INFO_STR_LEN) {
498 CallStack.resize(MRC_MAX_ERROR_INFO_STR_LEN);
499 }
500 }
501
502 std::string_view GetCallStack() const { return CallStack; }
503
504 std::span<uint8_t> WritableCallStackBuffer(size_t Len) {
505 if (Len > MRC_MAX_ERROR_INFO_STR_LEN) {
507 }
508 CallStack.resize(Len);
509 return std::span<uint8_t>{reinterpret_cast<uint8_t*>(CallStack.data()),
510 CallStack.size()};
511 }
512
513 private:
514 std::string Details;
515 std::string Location;
516 std::string CallStack;
517};
518
519struct OpMode {
520 OpMode(OpModeHash _Hash, std::string_view _Name, std::string_view _Group,
521 std::string_view _Description, int32_t _TextColor = -1,
522 int32_t _BackgroundColor = -1)
523 : Hash(_Hash), TextColor{_TextColor}, BackgroundColor{_BackgroundColor} {
524 SetName(_Name);
525 SetGroup(_Group);
526 SetDescription(_Description);
527 }
528
529 OpMode() = default;
530
532
533 void SetName(std::string_view NewName) {
534 if (NewName.size() > MRC_MAX_OPMODE_STRING_LEN) {
535 NewName = NewName.substr(0, MRC_MAX_OPMODE_STRING_LEN);
536 }
537 Name = NewName;
538 }
539
540 void MoveName(std::string&& NewName) {
541 Name = std::move(NewName);
542 if (Name.size() > MRC_MAX_OPMODE_STRING_LEN) {
543 Name.resize(MRC_MAX_OPMODE_STRING_LEN);
544 }
545 }
546
547 std::string_view GetName() const { return Name; }
548
549 std::span<uint8_t> WritableNameBuffer(size_t Len) {
550 if (Len > MRC_MAX_OPMODE_STRING_LEN) {
552 }
553 Name.resize(Len);
554 return std::span<uint8_t>{reinterpret_cast<uint8_t*>(Name.data()),
555 Name.size()};
556 }
557
558 void SetGroup(std::string_view NewGroup) {
559 if (NewGroup.size() > MRC_MAX_OPMODE_STRING_LEN) {
560 NewGroup = NewGroup.substr(0, MRC_MAX_OPMODE_STRING_LEN);
561 }
562 Group = NewGroup;
563 }
564
565 void MoveGroup(std::string&& NewGroup) {
566 Group = std::move(NewGroup);
567 if (Group.size() > MRC_MAX_OPMODE_STRING_LEN) {
568 Group.resize(MRC_MAX_OPMODE_STRING_LEN);
569 }
570 }
571
572 std::string_view GetGroup() const { return Group; }
573
574 std::span<uint8_t> WritableGroupBuffer(size_t Len) {
575 if (Len > MRC_MAX_OPMODE_STRING_LEN) {
577 }
578 Group.resize(Len);
579 return std::span<uint8_t>{reinterpret_cast<uint8_t*>(Group.data()),
580 Group.size()};
581 }
582
583 void SetDescription(std::string_view NewDescription) {
584 if (NewDescription.size() > MRC_MAX_OPMODE_STRING_LEN) {
585 NewDescription = NewDescription.substr(0, MRC_MAX_OPMODE_STRING_LEN);
586 }
587 Description = NewDescription;
588 }
589
590 void MoveDescription(std::string&& NewDescription) {
591 Description = std::move(NewDescription);
592 if (Description.size() > MRC_MAX_OPMODE_STRING_LEN) {
593 Description.resize(MRC_MAX_OPMODE_STRING_LEN);
594 }
595 }
596
597 std::string_view GetDescription() const { return Description; }
598
599 std::span<uint8_t> WritableDescriptionBuffer(size_t Len) {
600 if (Len > MRC_MAX_OPMODE_STRING_LEN) {
602 }
603 Description.resize(Len);
604 return std::span<uint8_t>{reinterpret_cast<uint8_t*>(Description.data()),
605 Description.size()};
606 }
607
608 void SetTextColor(int32_t NewTextColor) { TextColor = NewTextColor; }
609
610 int32_t GetTextColor() const { return TextColor; }
611
612 void SetBackgroundColor(int32_t NewBackgroundColor) {
613 BackgroundColor = NewBackgroundColor;
614 }
615
616 int32_t GetBackgroundColor() const { return BackgroundColor; }
617
618 private:
619 std::string Name;
620 std::string Group;
621 std::string Description;
622 int32_t TextColor{-1};
623 int32_t BackgroundColor{-1};
624};
625
626} // namespace mrc
#define MRC_MAX_NUM_TOUCHPADS
Definition NtNetComm.h:66
#define MRC_MAX_NUM_BUTTONS
Definition NtNetComm.h:58
#define MRC_MAX_ERROR_INFO_STR_LEN
Definition NtNetComm.h:64
#define MRC_MAX_NUM_POVS
Definition NtNetComm.h:57
#define MRC_MAX_NUM_AXES
Definition NtNetComm.h:56
#define MRC_MAX_OPMODE_STRING_LEN
Definition NtNetComm.h:59
#define MRC_MAX_NUM_TOUCHPAD_FINGERS
Definition NtNetComm.h:65
#define MRC_MAX_GAME_DATA_LEN
Definition NtNetComm.h:60
#define MRC_MAX_JOYSTICK_NAME_LEN
Definition NtNetComm.h:62
#define MRC_MAX_NUM_JOYSTICKS
Definition NtNetComm.h:55
#define MRC_MAX_EVENT_NAME_LEN
Definition NtNetComm.h:61
Definition NetComm.h:19
MatchType
Definition NetComm.h:330
@ Qualification
Definition NetComm.h:333
@ None
Definition NetComm.h:331
@ Playoff
Definition NetComm.h:334
@ Practice
Definition NetComm.h:332
RobotMode
Definition NetComm.h:21
@ Test
Definition NetComm.h:25
@ Autonomous
Definition NetComm.h:23
@ Unknown
Definition NetComm.h:22
@ Teleoperated
Definition NetComm.h:24
Definition NetComm.h:251
void MoveGameData(std::string &&Data)
Definition NetComm.h:263
OpModeHash CurrentOpMode
Definition NetComm.h:254
uint16_t MatchTime
Definition NetComm.h:253
std::span< const Joystick > Joysticks() const
Definition NetComm.h:276
std::span< Joystick > Joysticks()
Definition NetComm.h:272
void SetJoystickCount(uint8_t NewCount)
Definition NetComm.h:282
size_t GetJoystickCount() const
Definition NetComm.h:280
std::string_view GetGameData() const
Definition NetComm.h:270
ControlFlags ControlWord
Definition NetComm.h:252
void SetGameData(std::string_view Data)
Definition NetComm.h:256
Definition NetComm.h:79
uint32_t Alliance
Definition NetComm.h:87
uint32_t FmsConnected
Definition NetComm.h:83
uint32_t SupportsOpModes
Definition NetComm.h:86
uint32_t Reserved
Definition NetComm.h:88
uint32_t RobotMode
Definition NetComm.h:81
uint32_t EStop
Definition NetComm.h:82
constexpr bool operator==(const ControlFlags &Other) const
Definition NetComm.h:90
constexpr bool operator!=(const ControlFlags &Other) const
Definition NetComm.h:99
uint32_t Enabled
Definition NetComm.h:80
uint32_t WatchdogActive
Definition NetComm.h:85
constexpr void Reset()
Definition NetComm.h:103
uint32_t DsConnected
Definition NetComm.h:84
Definition NetComm.h:434
std::string_view GetCallStack() const
Definition NetComm.h:502
bool IsError
Definition NetComm.h:435
std::span< uint8_t > WritableDetailsBuffer(size_t Len)
Definition NetComm.h:454
void MoveCallStack(std::string &&NewCallStack)
Definition NetComm.h:495
int32_t ErrorCode
Definition NetComm.h:436
std::string_view GetDetails() const
Definition NetComm.h:452
void MoveLocation(std::string &&NewLocation)
Definition NetComm.h:470
void MoveDetails(std::string &&NewDetails)
Definition NetComm.h:445
std::span< uint8_t > WritableCallStackBuffer(size_t Len)
Definition NetComm.h:504
std::span< uint8_t > WritableLocationBuffer(size_t Len)
Definition NetComm.h:479
void SetDetails(std::string_view NewDetails)
Definition NetComm.h:438
void SetLocation(std::string_view NewLocation)
Definition NetComm.h:463
void SetCallStack(std::string_view NewCallStack)
Definition NetComm.h:488
std::string_view GetLocation() const
Definition NetComm.h:477
Definition NetComm.h:116
uint16_t GetAvailable() const
Definition NetComm.h:131
size_t GetMaxAvailableCount() const
Definition NetComm.h:141
std::span< int16_t > Axes()
Definition NetComm.h:118
void SetAvailable(uint16_t Available)
Definition NetComm.h:126
void SetMaxAvailableCount(size_t _Count)
Definition NetComm.h:133
std::span< const int16_t > Axes() const
Definition NetComm.h:122
Definition NetComm.h:168
void SetAvailable(uint64_t Available)
Definition NetComm.h:171
size_t GetMaxAvailableCount() const
Definition NetComm.h:188
void SetMaxAvailableCount(size_t _Count)
Definition NetComm.h:178
uint64_t GetAvailable() const
Definition NetComm.h:176
uint64_t Buttons
Definition NetComm.h:169
Definition NetComm.h:378
std::string_view GetName() const
Definition NetComm.h:398
void MoveName(std::string &&Name)
Definition NetComm.h:391
uint8_t GamepadType
Definition NetComm.h:381
void SetName(std::string_view Name)
Definition NetComm.h:384
std::span< uint8_t > WritableNameBuffer(size_t Len)
Definition NetComm.h:400
bool IsGamepad
Definition NetComm.h:380
uint8_t SupportedOutputs
Definition NetComm.h:382
Definition NetComm.h:413
void SetDescriptorCount(uint8_t NewCount)
Definition NetComm.h:424
std::span< const JoystickDescriptor > Descriptors() const
Definition NetComm.h:418
std::span< JoystickDescriptor > Descriptors()
Definition NetComm.h:414
size_t GetDescriptorCount() const
Definition NetComm.h:422
Definition NetComm.h:244
JoystickButtons Buttons
Definition NetComm.h:247
JoystickTouchpads Touchpads
Definition NetComm.h:248
JoystickAxes Axes
Definition NetComm.h:245
JoystickPovs Povs
Definition NetComm.h:246
Definition NetComm.h:293
uint16_t LeftRumble
Definition NetComm.h:298
uint16_t RightRumble
Definition NetComm.h:299
uint16_t LeftTriggerRumble
Definition NetComm.h:300
uint8_t G
Definition NetComm.h:296
uint8_t B
Definition NetComm.h:297
bool IsEmpty() const
Definition NetComm.h:303
uint8_t R
Definition NetComm.h:295
uint16_t RightTriggerRumble
Definition NetComm.h:301
Definition NetComm.h:309
std::span< JoystickOutput > Outputs()
Definition NetComm.h:310
std::span< const JoystickOutput > Outputs() const
Definition NetComm.h:314
size_t GetOutputCount() const
Definition NetComm.h:318
void SetOutputCount(uint8_t NewCount)
Definition NetComm.h:320
Definition NetComm.h:149
std::span< uint8_t > Povs()
Definition NetComm.h:151
size_t GetCount() const
Definition NetComm.h:161
void SetCount(uint8_t NewCount)
Definition NetComm.h:157
std::span< const uint8_t > Povs() const
Definition NetComm.h:153
Definition NetComm.h:223
void SetTouchpadCount(uint8_t NewCount)
Definition NetComm.h:234
size_t GetTouchpadCount() const
Definition NetComm.h:232
std::span< const Touchpad > Touchpads() const
Definition NetComm.h:228
std::span< Touchpad > Touchpads()
Definition NetComm.h:224
Definition NetComm.h:338
MatchType Type
Definition NetComm.h:341
uint8_t ReplayNumber
Definition NetComm.h:340
void SetEventName(std::string_view Name)
Definition NetComm.h:343
void MoveEventName(std::string &&Name)
Definition NetComm.h:350
std::string_view GetEventName() const
Definition NetComm.h:357
uint16_t MatchNumber
Definition NetComm.h:339
std::span< uint8_t > WritableNameBuffer(size_t Len)
Definition NetComm.h:359
bool operator==(const MatchInfo &Other) const
Definition NetComm.h:368
Definition NetComm.h:28
static constexpr OpModeHash MakeTest(uint64_t Hash, bool Enabled=false)
Definition NetComm.h:39
static constexpr OpModeHash FromValue(uint64_t Value)
Definition NetComm.h:63
static constexpr int RobotModeShift
Definition NetComm.h:37
static constexpr uint64_t EnabledMask
Definition NetComm.h:35
uint64_t RobotMode
Definition NetComm.h:30
constexpr uint64_t ToValue() const
Definition NetComm.h:71
static constexpr uint64_t HashMask
Definition NetComm.h:36
uint64_t Hash
Definition NetComm.h:29
uint64_t IsEnabled
Definition NetComm.h:31
uint64_t Reserved
Definition NetComm.h:32
static constexpr uint64_t RobotModeMask
Definition NetComm.h:34
static constexpr OpModeHash MakeAuto(uint64_t Hash, bool Enabled=false)
Definition NetComm.h:55
static constexpr OpModeHash MakeTele(uint64_t Hash, bool Enabled=false)
Definition NetComm.h:47
int32_t GetTextColor() const
Definition NetComm.h:610
void SetTextColor(int32_t NewTextColor)
Definition NetComm.h:608
std::string_view GetGroup() const
Definition NetComm.h:572
void MoveDescription(std::string &&NewDescription)
Definition NetComm.h:590
void MoveName(std::string &&NewName)
Definition NetComm.h:540
std::string_view GetDescription() const
Definition NetComm.h:597
OpMode()=default
void MoveGroup(std::string &&NewGroup)
Definition NetComm.h:565
OpMode(OpModeHash _Hash, std::string_view _Name, std::string_view _Group, std::string_view _Description, int32_t _TextColor=-1, int32_t _BackgroundColor=-1)
Definition NetComm.h:520
void SetGroup(std::string_view NewGroup)
Definition NetComm.h:558
OpModeHash Hash
Definition NetComm.h:531
std::span< uint8_t > WritableNameBuffer(size_t Len)
Definition NetComm.h:549
void SetBackgroundColor(int32_t NewBackgroundColor)
Definition NetComm.h:612
std::string_view GetName() const
Definition NetComm.h:547
void SetName(std::string_view NewName)
Definition NetComm.h:533
void SetDescription(std::string_view NewDescription)
Definition NetComm.h:583
int32_t GetBackgroundColor() const
Definition NetComm.h:616
std::span< uint8_t > WritableDescriptionBuffer(size_t Len)
Definition NetComm.h:599
std::span< uint8_t > WritableGroupBuffer(size_t Len)
Definition NetComm.h:574
Definition NetComm.h:195
bool Down
Definition NetComm.h:196
uint16_t Y
Definition NetComm.h:198
uint16_t X
Definition NetComm.h:197
Definition NetComm.h:201
std::span< const TouchpadFinger > Fingers() const
Definition NetComm.h:206
size_t GetFingerCount() const
Definition NetComm.h:210
void SetFingerCount(uint8_t NewCount)
Definition NetComm.h:212
std::span< TouchpadFinger > Fingers()
Definition NetComm.h:202