ReduxLib C++ 2025.0.0-beta2
Loading...
Searching...
No Matches
CanandEventLoop.h
1// Copyright (c) Redux Robotics and other contributors.
2// This is open source and can be modified and shared under the 3-clause BSD license.
3
4#pragma once
5#include "CanandDevice.h"
6
7namespace redux::canand {
8 /** Adds a CanandDevice to the Canand packet event loop, allowing it to receive and process CAN packets.
9 *
10 * This will start the Redux CANLink server if not started already.
11 * @param device pointer to a CanandDevice to listen for packets.
12 */
14
15 /** Removes a CanandDevice to the Canand packet event loop. It is the responsibility of CanandDevice subclasses
16 * to call this in a deconstructor.
17 * @param device pointer to a CanandDevice to remove from the event loop.
18 */
20
21 /**
22 * Starts the Redux CANLink server if not started, otherwise does nothing.
23 *
24 * Generally does not need to be called manually if robot code instantiates a CanandDevice subclass as it will be started through AddCANListener.
25 */
27
28 /**
29 * Set whether to enable device presence warnings to the driver station globally (defaults to true).
30 *
31 * @param enabled true to enable, false to suppress
32 */
34
35 /**
36 * Set whether to enable device presence warnings to the driver station for a single device (defaults to true).
37 *
38 * @param device the CanandDevice to consider
39 * @param enabled true to enable, false to suppress
40 */
41 void SetDevicePresenceWarnings(const CanandDevice& device, bool enabled);
42
43 /**
44 * Sets the device presence threshold of how many seconds must pass without a message for the
45 * device checker to consider them disconnected from bus.
46 *
47 * @param device the CanandDevice to act on
48 * @param threshold the new threshold, in seconds.
49 */
50 void SetDevicePresenceThreshold(const CanandDevice& device, units::second_t threshold);
51}
Definition: CanandDevice.h:35
Definition: CanandMessage.h:10
void SetDevicePresenceThreshold(const CanandDevice &device, units::second_t threshold)
void SetDevicePresenceWarnings(const CanandDevice &device, bool enabled)
void AddCANListener(CanandDevice *device)
void RemoveCANListener(CanandDevice *device)
void EnsureCANLinkServer()
void SetGlobalDevicePresenceWarnings(bool enabled)