reverted varianttype
[profile/ivi/automotive-message-broker.git] / plugins / common / canbusimpl.h
1 /*
2 Copyright (C) 2012 Intel Corporation
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with this library; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
17 */
18
19 #ifndef CANBUSIMPL_H
20 #define CANBUSIMPL_H
21
22 /**
23  *  \addtogroup libcanbus
24  *  @{
25  */
26
27 #include "canbus.h"
28
29 class CANObserver;
30 class CANAdapter;
31
32 /**
33 * \brief CANBus class implementation
34 *
35 * @class CANBus::Impl
36 */
37
38 class CANBus::Impl
39 {
40 public:
41     /**
42     * @param observer \link #CANObserver Observer \endlink that will receives CAN bus frames
43     */
44     Impl(CANObserver& observer);
45     virtual ~Impl();
46
47     /**
48     * Starts the CAN bus instance on the specified interface
49     * @fn start
50     * @param name Name of the CAN bus network interface
51     * @return True if no error occurs.
52     */
53     bool start(const char*name);
54     /**
55     * Stops the CAN bus instance
56     * @fn stop
57     */
58     void stop();
59     /**
60     * Sends standard(11bit) CAN frame over the bus
61     * @fn sendStandardFrame
62     * @param frame CAN frame to be sent
63     * @return True if frame was sent
64     */
65     bool sendStandardFrame(const can_frame& frame);
66     /**
67     * Sends extended(29bit) CAN frame over the bus
68     * @fn sendExtendedFrame
69     * @param frame CAN frame to be sent
70     * @return True if frame was sent
71     */
72     bool sendExtendedFrame(const can_frame& frame);
73
74 protected:
75     /**
76     * CAN bus initialization
77     * @fn init
78     */
79     virtual void init();
80
81 private:
82     /**
83     * #CANObserver instance reference
84     * @property mObserver
85     * @protected
86     */
87     CANObserver& mObserver;
88     /**
89     * Pointer to #CANAdapter -  CAN hardware object representation
90     * @property mAdapter
91     * @protected
92     */
93     CANAdapter* mAdapter;
94 };
95
96 #endif // CANBUSIMPL_H
97
98 /** @} */