WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
NetworkBooleanEvent.hpp
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 <memory>
8#include <string_view>
9
11
12namespace wpi::nt {
14class BooleanTopic;
15class NetworkTable;
17} // namespace wpi::nt
18
19namespace wpi {
20/**
21 * A Button that uses a NetworkTable boolean field.
22 *
23 * This class is provided by the NewCommands VendorDep
24 */
26 public:
27 /**
28 * Creates a new event with the given boolean topic determining whether it is
29 * active.
30 *
31 * @param loop the loop that polls this event
32 * @param topic The boolean topic that contains the value
33 */
35
36 /**
37 * Creates a new event with the given boolean subscriber determining whether
38 * it is active.
39 *
40 * @param loop the loop that polls this event
41 * @param sub The boolean subscriber that provides the value
42 */
44
45 /**
46 * Creates a new event with the given boolean topic determining whether it is
47 * active.
48 *
49 * @param loop the loop that polls this event
50 * @param table The NetworkTable that contains the topic
51 * @param topicName The topic name within the table that contains the value
52 */
54 std::shared_ptr<wpi::nt::NetworkTable> table,
55 std::string_view topicName);
56
57 /**
58 * Creates a new event with the given boolean topic determining whether it is
59 * active.
60 *
61 * @param loop the loop that polls this event
62 * @param tableName The NetworkTable name that contains the topic
63 * @param topicName The topic name within the table that contains the value
64 */
65 NetworkBooleanEvent(EventLoop* loop, std::string_view tableName,
66 std::string_view topicName);
67
68 /**
69 * Creates a new event with the given boolean topic determining whether it is
70 * active.
71 *
72 * @param loop the loop that polls this event
73 * @param inst The NetworkTable instance to use
74 * @param tableName The NetworkTable that contains the topic
75 * @param topicName The topic name within the table that contains the value
76 */
78 std::string_view tableName, std::string_view topicName);
79};
80} // namespace wpi
BooleanEvent(EventLoop *loop, std::function< bool()> signal)
Creates a new event that is active when the condition is true.
A declarative way to bind a set of actions to a loop and execute them when the loop is polled.
Definition EventLoop.hpp:15
NetworkBooleanEvent(EventLoop *loop, wpi::nt::NetworkTableInstance inst, std::string_view tableName, std::string_view topicName)
Creates a new event with the given boolean topic determining whether it is active.
NetworkBooleanEvent(EventLoop *loop, wpi::nt::BooleanSubscriber sub)
Creates a new event with the given boolean subscriber determining whether it is active.
NetworkBooleanEvent(EventLoop *loop, std::string_view tableName, std::string_view topicName)
Creates a new event with the given boolean topic determining whether it is active.
NetworkBooleanEvent(EventLoop *loop, wpi::nt::BooleanTopic topic)
Creates a new event with the given boolean topic determining whether it is active.
NetworkBooleanEvent(EventLoop *loop, std::shared_ptr< wpi::nt::NetworkTable > table, std::string_view topicName)
Creates a new event with the given boolean topic determining whether it is active.
NetworkTables Boolean subscriber.
Definition BooleanTopic.hpp:34
NetworkTables Boolean topic.
Definition BooleanTopic.hpp:235
A network table that knows its subtable path.
Definition NetworkTable.hpp:57
NetworkTables Instance.
Definition NetworkTableInstance.hpp:67
NetworkTables (ntcore) namespace.
Definition NTSendable.hpp:9
Definition CvSource.hpp:15