WPILibC++  2018.4.1-20180729124724-1140-gcbb62fb
 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  bool GetEnabled() { return HALSIM_GetDriverStationEnabled(); }
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  bool GetAutonomous() { return HALSIM_GetDriverStationAutonomous(); }
42  void SetAutonomous(bool autonomous) {
43  HALSIM_SetDriverStationAutonomous(autonomous);
44  }
45 
46  std::unique_ptr<CallbackStore> RegisterTestCallback(NotifyCallback callback,
47  bool initialNotify) {
48  auto store = std::make_unique<CallbackStore>(
49  -1, callback, &HALSIM_CancelDriverStationTestCallback);
50  store->SetUid(HALSIM_RegisterDriverStationTestCallback(
51  &CallbackStoreThunk, store.get(), initialNotify));
52  return store;
53  }
54  bool GetTest() { return HALSIM_GetDriverStationTest(); }
55  void SetTest(bool test) { HALSIM_SetDriverStationTest(test); }
56 
57  std::unique_ptr<CallbackStore> RegisterEStopCallback(NotifyCallback callback,
58  bool initialNotify) {
59  auto store = std::make_unique<CallbackStore>(
60  -1, callback, &HALSIM_CancelDriverStationEStopCallback);
61  store->SetUid(HALSIM_RegisterDriverStationEStopCallback(
62  &CallbackStoreThunk, store.get(), initialNotify));
63  return store;
64  }
65  bool GetEStop() { return HALSIM_GetDriverStationEStop(); }
66  void SetEStop(bool eStop) { HALSIM_SetDriverStationEStop(eStop); }
67 
68  std::unique_ptr<CallbackStore> RegisterFmsAttachedCallback(
69  NotifyCallback callback, bool initialNotify) {
70  auto store = std::make_unique<CallbackStore>(
71  -1, callback, &HALSIM_CancelDriverStationFmsAttachedCallback);
72  store->SetUid(HALSIM_RegisterDriverStationFmsAttachedCallback(
73  &CallbackStoreThunk, store.get(), initialNotify));
74  return store;
75  }
76  bool GetFmsAttached() { return HALSIM_GetDriverStationFmsAttached(); }
77  void SetFmsAttached(bool fmsAttached) {
78  HALSIM_SetDriverStationFmsAttached(fmsAttached);
79  }
80 
81  std::unique_ptr<CallbackStore> RegisterDsAttachedCallback(
82  NotifyCallback callback, bool initialNotify) {
83  auto store = std::make_unique<CallbackStore>(
84  -1, callback, &HALSIM_CancelDriverStationDsAttachedCallback);
85  store->SetUid(HALSIM_RegisterDriverStationDsAttachedCallback(
86  &CallbackStoreThunk, store.get(), initialNotify));
87  return store;
88  }
89  bool GetDsAttached() { return HALSIM_GetDriverStationDsAttached(); }
90  void SetDsAttached(bool dsAttached) {
91  HALSIM_SetDriverStationDsAttached(dsAttached);
92  }
93 
94  void ResetData() { HALSIM_ResetDriverStationData(); }
95 };
96 } // namespace sim
97 } // namespace frc
98 #endif // __FRC_ROBORIO__
Definition: DriverStationSim.h:20
Definition: SPIAccelerometerSim.h:18