Autoware.Auto
socket_can_common.hpp
Go to the documentation of this file.
1 // Copyright 2019 the Autoware Foundation
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //    http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 //
15 // Co-developed by Tier IV, Inc. and Apex.AI, Inc.
16 
17 #ifndef SOCKET_CAN_COMMON_HPP_
18 #define SOCKET_CAN_COMMON_HPP_
19 
20 #include <sys/select.h>
21 #include <sys/time.h>
22 
23 #include <chrono>
24 #include <string>
25 
26 namespace autoware
27 {
28 namespace drivers
29 {
30 namespace socketcan
31 {
32 
38 int32_t bind_can_socket(const std::string & interface);
40 struct timeval to_timeval(const std::chrono::nanoseconds timeout) noexcept;
42 fd_set single_set(int32_t file_descriptor) noexcept;
43 
44 } // namespace socketcan
45 } // namespace drivers
46 } // namespace autoware
47 
48 #endif // SOCKET_CAN_COMMON_HPP_
autoware::drivers::socketcan::single_set
fd_set single_set(int32_t file_descriptor) noexcept
Create a fd_set for use with select() that only contains the specified file descriptor.
Definition: socket_can_common.cpp:93
autoware::drivers::socketcan::to_timeval
struct timeval to_timeval(const std::chrono::nanoseconds timeout) noexcept
Convert std::chrono duration to timeval (with microsecond resolution)
Definition: socket_can_common.cpp:81
autoware
This file defines the lanelet2_map_provider_node class.
Definition: quick_sort.hpp:24
autoware::drivers::socketcan::bind_can_socket
int32_t bind_can_socket(const std::string &interface)
Definition: socket_can_common.cpp:41