2 Copyright (C) 2012 Intel Corporation
3 Copyright (C) 2015 Cogent Embedded Inc.
4 Copyright (C) 2015 Renesas Electronics Corporation
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25 * \addtogroup libcanbus
35 * \brief CANBus class implementation
40 class CANBusImpl : public CANBus
44 * @param observer \link #CANObserver Observer \endlink that will receive CAN bus frames
46 CANBusImpl(CANObserver& observer);
47 virtual ~CANBusImpl();
50 * Starts the CAN bus instance on the specified interface
52 * @param name Name of the CAN bus network interface
53 * @return True if no error occurs.
55 bool start(const char*name);
57 * Stops the CAN bus instance
62 * Sends standard(11bit) CAN frame over the bus
63 * @fn sendStandardFrame
64 * @param frame CAN frame to be sent
65 * @return True if frame was sent
67 bool sendStandardFrame(const can_frame& frame);
69 * Sends extended(29bit) CAN frame over the bus
70 * @fn sendExtendedFrame
71 * @param frame CAN frame to be sent
72 * @return True if frame was sent
74 bool sendExtendedFrame(const can_frame& frame);
76 * Registers CAN ID of a cyclic message for receiving
77 * @fn registerCyclicMessageForReceive
78 * @param canId CAN ID of the message.
79 * @param minCycleTime Minimal interval between messages in seconds. Set to 0 if not used.
80 * @param maxCycleTime Maximum interval between messages for timeout detection in seconds. Set to 0 if no timeout detection is necessary.
81 * @return True if registration succeeds.
83 virtual bool registerCyclicMessageForReceive(int canId, double minCycleTime, double maxCycleTime);
85 * Un-registers CAN ID of a message used of receiving. Valid for cyclic and sporadic messages.
86 * @fn unregisterMessageForReceive
87 * @param canId CAN ID of the message.
88 * @return True if de-registration succeeds.
90 virtual bool unregisterMessageForReceive(int canId);
94 * CAN bus initialization
101 * #CANObserver instance reference
102 * @property mObserver
105 CANObserver& mObserver;
107 * Pointer to #CANAdapter - CAN hardware object representation
111 CANAdapter* mAdapter;
114 #endif // CANBUSIMPL_H