WPILibC++  2019.2.1-1-g453a904
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
DriverStationSim.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2018 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 #ifndef __FRC_ROBORIO__
11 
12 #include <memory>
13 #include <utility>
14 
15 #include "CallbackStore.h"
16 #include "mockdata/DriverStationData.h"
17 
18 namespace frc {
19 namespace sim {
21  public:
22  std::unique_ptr<CallbackStore> RegisterEnabledCallback(
23  NotifyCallback callback, bool initialNotify) {
24  auto store = std::make_unique<CallbackStore>(
25  -1, callback, &HALSIM_CancelDriverStationEnabledCallback);
26  store->SetUid(HALSIM_RegisterDriverStationEnabledCallback(
27  &CallbackStoreThunk, store.get(), initialNotify));
28  return store;
29  }
30 
31  bool GetEnabled() const { return HALSIM_GetDriverStationEnabled(); }
32 
33  void SetEnabled(bool enabled) { HALSIM_SetDriverStationEnabled(enabled); }
34 
35  std::unique_ptr<CallbackStore> RegisterAutonomousCallback(
36  NotifyCallback callback, bool initialNotify) {
37  auto store = std::make_unique<CallbackStore>(
38  -1, callback, &HALSIM_CancelDriverStationAutonomousCallback);
39  store->SetUid(HALSIM_RegisterDriverStationAutonomousCallback(
40  &CallbackStoreThunk, store.get(), initialNotify));
41  return store;
42  }
43 
44  bool GetAutonomous() const { return HALSIM_GetDriverStationAutonomous(); }
45 
46  void SetAutonomous(bool autonomous) {
47  HALSIM_SetDriverStationAutonomous(autonomous);
48  }
49 
50  std::unique_ptr<CallbackStore> RegisterTestCallback(NotifyCallback callback,
51  bool initialNotify) {
52  auto store = std::make_unique<CallbackStore>(
53  -1, callback, &HALSIM_CancelDriverStationTestCallback);
54  store->SetUid(HALSIM_RegisterDriverStationTestCallback(
55  &CallbackStoreThunk, store.get(), initialNotify));
56  return store;
57  }
58 
59  bool GetTest() const { return HALSIM_GetDriverStationTest(); }
60 
61  void SetTest(bool test) { HALSIM_SetDriverStationTest(test); }
62 
63  std::unique_ptr<CallbackStore> RegisterEStopCallback(NotifyCallback callback,
64  bool initialNotify) {
65  auto store = std::make_unique<CallbackStore>(
66  -1, callback, &HALSIM_CancelDriverStationEStopCallback);
67  store->SetUid(HALSIM_RegisterDriverStationEStopCallback(
68  &CallbackStoreThunk, store.get(), initialNotify));
69  return store;
70  }
71 
72  bool GetEStop() const { return HALSIM_GetDriverStationEStop(); }
73 
74  void SetEStop(bool eStop) { HALSIM_SetDriverStationEStop(eStop); }
75 
76  std::unique_ptr<CallbackStore> RegisterFmsAttachedCallback(
77  NotifyCallback callback, bool initialNotify) {
78  auto store = std::make_unique<CallbackStore>(
79  -1, callback, &HALSIM_CancelDriverStationFmsAttachedCallback);
80  store->SetUid(HALSIM_RegisterDriverStationFmsAttachedCallback(
81  &CallbackStoreThunk, store.get(), initialNotify));
82  return store;
83  }
84 
85  bool GetFmsAttached() const { return HALSIM_GetDriverStationFmsAttached(); }
86 
87  void SetFmsAttached(bool fmsAttached) {
88  HALSIM_SetDriverStationFmsAttached(fmsAttached);
89  }
90 
91  std::unique_ptr<CallbackStore> RegisterDsAttachedCallback(
92  NotifyCallback callback, bool initialNotify) {
93  auto store = std::make_unique<CallbackStore>(
94  -1, callback, &HALSIM_CancelDriverStationDsAttachedCallback);
95  store->SetUid(HALSIM_RegisterDriverStationDsAttachedCallback(
96  &CallbackStoreThunk, store.get(), initialNotify));
97  return store;
98  }
99 
100  bool GetDsAttached() const { return HALSIM_GetDriverStationDsAttached(); }
101 
102  void SetDsAttached(bool dsAttached) {
103  HALSIM_SetDriverStationDsAttached(dsAttached);
104  }
105 
106  void NotifyNewData() { HALSIM_NotifyDriverStationNewData(); }
107 
108  void ResetData() { HALSIM_ResetDriverStationData(); }
109 };
110 } // namespace sim
111 } // namespace frc
112 #endif // __FRC_ROBORIO__
Definition: DriverStationSim.h:20
WPILib FRC namespace.
Definition: SPIAccelerometerSim.h:18