Fang-Robotics-MCB
Fang Robotics Team Codebase
Loading...
Searching...
No Matches
can_rx_handler.hpp
Go to the documentation of this file.
1/*****************************************************************************/
2/********** !!! WARNING: CODE GENERATED BY TAPROOT. DO NOT EDIT !!! **********/
3/*****************************************************************************/
4
5/*
6 * Copyright (c) 2020-2021 Advanced Robotics at the University of Washington <robomstr@uw.edu>
7 *
8 * This file is part of Taproot.
9 *
10 * Taproot is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * Taproot is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with Taproot. If not, see <https://www.gnu.org/licenses/>.
22 */
23
24#ifndef TAPROOT_CAN_RX_HANDLER_HPP_
25#define TAPROOT_CAN_RX_HANDLER_HPP_
26
27#include <cstdint>
28
29#include "tap/util_macros.hpp"
30
31#include "can_bus.hpp"
32
33namespace modm::can
34{
35class Message;
36}
37
38namespace tap
39{
40class Drivers;
41}
42
43namespace tap::can
44{
45class CanRxListener;
46
79{
80public:
87 static constexpr uint8_t CAN_BINS = 8;
88
92
93
96 static inline uint16_t binIndexForCanId(uint16_t canId) { return canId % CAN_BINS; }
97
113 mockable void attachReceiveHandler(CanRxListener* const listener);
114
124 mockable void pollCanData();
125
133 mockable void removeReceiveHandler(const CanRxListener& rxListener);
134
135protected:
137
143
149
150#if defined(PLATFORM_HOSTED) && defined(ENV_UNIT_TESTS)
151public:
152#endif
153
155 CanRxListener* const canRxListener,
156 CanRxListener** messageHandlerStore);
157
159 const modm::can::Message& rxMessage,
160 CanRxListener* const* messageHandlerStore);
161
163 const CanRxListener& canRxListener,
164 CanRxListener** messageHandlerStore);
165
170}; // class CanRxHandler
171
172} // namespace tap::can
173
174#endif // TAPROOT_CAN_RX_HANDLER_HPP_
Definition drivers.hpp:70
Definition can_rx_handler.hpp:79
CanRxListener ** getHandlerStore(CanBus bus)
Definition can_rx_handler.hpp:166
CanRxListener * messageHandlerStoreCan1[CAN_BINS]
Definition can_rx_handler.hpp:142
mockable void pollCanData()
Definition can_rx_handler.cpp:85
CanRxListener * messageHandlerStoreCan2[CAN_BINS]
Definition can_rx_handler.hpp:148
Drivers * drivers
Definition can_rx_handler.hpp:136
static constexpr uint8_t CAN_BINS
Definition can_rx_handler.hpp:87
void processReceivedCanData(const modm::can::Message &rxMessage, CanRxListener *const *messageHandlerStore)
Definition can_rx_handler.cpp:102
mockable void attachReceiveHandler(CanRxListener *const listener)
Definition can_rx_handler.cpp:43
mockable ~CanRxHandler()=default
static uint16_t binIndexForCanId(uint16_t canId)
Definition can_rx_handler.hpp:96
mockable void removeReceiveHandler(const CanRxListener &rxListener)
Definition can_rx_handler.cpp:120
Definition can_rx_listener.hpp:91
Definition can.hpp:32
Definition can.hpp:39
CanBus
Definition can_bus.hpp:30
Definition ballistics.cpp:29
tap::Drivers Drivers
Definition drivers.hpp:11
#define mockable
Wrap class functions that are not already virtual in this function if you wish to mock them.
Definition util_macros.hpp:38
#define DISALLOW_COPY_AND_ASSIGN(Typename)
Definition util_macros.hpp:27