reverted varianttype
[profile/ivi/automotive-message-broker.git] / plugins / common / canbus.h
1 /*****************************************************************
2  * INTEL CONFIDENTIAL
3  * Copyright 2011 - 2013 Intel Corporation All Rights Reserved.
4  * 
5  * The source code contained or described herein and all documents related to the
6  * source code("Material") are owned by Intel Corporation or its suppliers or
7  * licensors.Title to the Material remains with Intel Corporation or its
8  * suppliers and licensors.The Material may contain trade secrets and proprietary
9  * and confidential information of Intel Corporation and its suppliers and
10  * licensors, and is protected by worldwide copyright and trade secret laws and
11  * treaty provisions.No part of the Material may be used, copied, reproduced,
12  * modified, published, uploaded, posted, transmitted, distributed, or disclosed
13  * in any way without Intels prior express written permission.
14  * No license under any patent, copyright, trade secret or other intellectual
15  * property right is granted to or conferred upon you by disclosure or delivery
16  * of the Materials, either expressly, by implication, inducement, estoppel or
17  * otherwise.Any license under such intellectual property rights must be
18  * express and approved by Intel in writing. 
19  * 
20  * Unless otherwise agreed by Intel in writing, you may not remove or alter this
21  * notice or any other notice embedded in Materials by Intel or Intels suppliers
22  * or licensors in any way.
23  *****************************************************************/
24
25 #ifndef CANBUS_H
26 #define CANBUS_H
27
28 /**
29  *  @defgroup libcanbus libcanbus static library
30  *  \brief SocketCAN based CAN bus library.
31  *  @{
32  */
33
34 #include "canobserver.h"
35
36 /**
37 * \brief Encapsulation of the raw CAN bus.
38 *
39 * @class CANBus
40 */
41 class CANBus
42 {
43 public:
44     /**
45     * @param observer Object derived from #CANObserver that will receive CAN bus frames
46     */
47     CANBus(CANObserver& observer);
48     virtual ~CANBus();
49
50     /**
51     * Starts the CAN bus instance on the specified interface
52     * @fn start
53     * @param name Name of the CAN bus network interface
54     * @return True if no error occurs.
55     */
56     virtual bool start(const char* name);
57     /**
58     * Stops the CAN bus instance
59     * @fn stop
60     */
61     virtual void stop();
62     /**
63     * Sends standard(11bit) CAN frame over the bus
64     * @fn sendStandardFrame
65     * @param frame CAN frame to be sent
66     * @return True if frame was sent
67     */
68     virtual bool sendStandardFrame(const can_frame& frame);
69     /**
70     * Sends extended(29bit) CAN frame over the bus
71     * @fn sendExtendedFrame
72     * @param frame CAN frame to be sent
73     * @return True if frame was sent
74     */
75     virtual bool sendExtendedFrame(const can_frame& frame);
76
77     class Impl;
78 protected:
79     /**
80     * CANBus class private implementation
81     * @property d
82     * @protected
83     */
84     Impl* d;
85 };
86
87 #endif // CANBUS_H
88
89 /** @} */