HardFOC Core
API reference
Loading...
Searching...
No Matches
CanOpenBaseCanLink.hpp
Go to the documentation of this file.
1
7#pragma once
8
10#include "CanFrame.h"
11
16public:
17 explicit CanOpenBaseCanLink(BaseCan& can) noexcept : transport_(can) {}
18
19 bool Open() noexcept { return transport_.can().EnsureInitialized(); }
20
21 void Close() noexcept { (void)transport_.can().EnsureDeinitialized(); }
22
23 bool Write(const CanOpen::CanFrame& f) noexcept { return transport_.send(f); }
24
25 bool Read(CanOpen::CanFrame& f, int timeoutMs) noexcept {
26 return transport_.receive(f, static_cast<hf_u32_t>(timeoutMs < 0 ? 0 : timeoutMs));
27 }
28
29private:
31};
Send/receive CanOpen::CanFrame on a BaseCan instance.
Definition HfUtilsCanOpenTransport.hpp:12
bool receive(CanOpen::CanFrame &f, hf_u32_t timeout_ms) noexcept
Definition HfUtilsCanOpenTransport.hpp:24
bool send(const CanOpen::CanFrame &f, hf_u32_t timeout_ms=50U) noexcept
Definition HfUtilsCanOpenTransport.hpp:18
BaseCan & can() noexcept
Definition HfUtilsCanOpenTransport.hpp:16