WPILibC++  2020.3.2-60-g3011ebe
DriverStationSim.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2018-2019 FIRST. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in the root directory of */
5 /* the project. */
6 /*----------------------------------------------------------------------------*/
7 
8 #pragma once
9 
10 #include <memory>
11 #include <utility>
12 
13 #include "CallbackStore.h"
14 #include "mockdata/DriverStationData.h"
15 
16 namespace frc {
17 namespace sim {
19  public:
20  std::unique_ptr<CallbackStore> RegisterEnabledCallback(
21  NotifyCallback callback, bool initialNotify) {
22  auto store = std::make_unique<CallbackStore>(
23  -1, callback, &HALSIM_CancelDriverStationEnabledCallback);
24  store->SetUid(HALSIM_RegisterDriverStationEnabledCallback(
25  &CallbackStoreThunk, store.get(), initialNotify));
26  return store;
27  }
28 
29  bool GetEnabled() const { return HALSIM_GetDriverStationEnabled(); }
30 
31  void SetEnabled(bool enabled) { HALSIM_SetDriverStationEnabled(enabled); }
32 
33  std::unique_ptr<CallbackStore> RegisterAutonomousCallback(
34  NotifyCallback callback, bool initialNotify) {
35  auto store = std::make_unique<CallbackStore>(
36  -1, callback, &HALSIM_CancelDriverStationAutonomousCallback);
37  store->SetUid(HALSIM_RegisterDriverStationAutonomousCallback(
38  &CallbackStoreThunk, store.get(), initialNotify));
39  return store;
40  }
41 
42  bool GetAutonomous() const { return HALSIM_GetDriverStationAutonomous(); }
43 
44  void SetAutonomous(bool autonomous) {
45  HALSIM_SetDriverStationAutonomous(autonomous);
46  }
47 
48  std::unique_ptr<CallbackStore> RegisterTestCallback(NotifyCallback callback,
49  bool initialNotify) {
50  auto store = std::make_unique<CallbackStore>(
51  -1, callback, &HALSIM_CancelDriverStationTestCallback);
52  store->SetUid(HALSIM_RegisterDriverStationTestCallback(
53  &CallbackStoreThunk, store.get(), initialNotify));
54  return store;
55  }
56 
57  bool GetTest() const { return HALSIM_GetDriverStationTest(); }
58 
59  void SetTest(bool test) { HALSIM_SetDriverStationTest(test); }
60 
61  std::unique_ptr<CallbackStore> RegisterEStopCallback(NotifyCallback callback,
62  bool initialNotify) {
63  auto store = std::make_unique<CallbackStore>(
64  -1, callback, &HALSIM_CancelDriverStationEStopCallback);
65  store->SetUid(HALSIM_RegisterDriverStationEStopCallback(
66  &CallbackStoreThunk, store.get(), initialNotify));
67  return store;
68  }
69 
70  bool GetEStop() const { return HALSIM_GetDriverStationEStop(); }
71 
72  void SetEStop(bool eStop) { HALSIM_SetDriverStationEStop(eStop); }
73 
74  std::unique_ptr<CallbackStore> RegisterFmsAttachedCallback(
75  NotifyCallback callback, bool initialNotify) {
76  auto store = std::make_unique<CallbackStore>(
77  -1, callback, &HALSIM_CancelDriverStationFmsAttachedCallback);
78  store->SetUid(HALSIM_RegisterDriverStationFmsAttachedCallback(
79  &CallbackStoreThunk, store.get(), initialNotify));
80  return store;
81  }
82 
83  bool GetFmsAttached() const { return HALSIM_GetDriverStationFmsAttached(); }
84 
85  void SetFmsAttached(bool fmsAttached) {
86  HALSIM_SetDriverStationFmsAttached(fmsAttached);
87  }
88 
89  std::unique_ptr<CallbackStore> RegisterDsAttachedCallback(
90  NotifyCallback callback, bool initialNotify) {
91  auto store = std::make_unique<CallbackStore>(
92  -1, callback, &HALSIM_CancelDriverStationDsAttachedCallback);
93  store->SetUid(HALSIM_RegisterDriverStationDsAttachedCallback(
94  &CallbackStoreThunk, store.get(), initialNotify));
95  return store;
96  }
97 
98  bool GetDsAttached() const { return HALSIM_GetDriverStationDsAttached(); }
99 
100  void SetDsAttached(bool dsAttached) {
101  HALSIM_SetDriverStationDsAttached(dsAttached);
102  }
103 
104  void NotifyNewData() { HALSIM_NotifyDriverStationNewData(); }
105 
106  void ResetData() { HALSIM_ResetDriverStationData(); }
107 };
108 } // namespace sim
109 } // namespace frc
frc::sim::DriverStationSim
Definition: DriverStationSim.h:18
frc
A class that enforces constraints on the differential drive kinematics.
Definition: PDPSim.h:16