reverted varianttype
[profile/ivi/automotive-message-broker.git] / plugins / common / canobserver.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 CANOBSERVER_H
26 #define CANOBSERVER_H
27
28 /**
29  *  \addtogroup libcanbus
30  *  @{
31  */
32
33 #include <linux/can.h>
34
35 /**
36 * \brief Interface. Receives notifications about the CAN bus traffic and errors.
37 *
38 * CANBus user has to derive from this interface.
39 * @class CANObserver
40 */
41
42 class CANObserver
43 {
44 public:
45     /**
46     * General CAN bus error. Currently only GENERAL_ERROR is specified.
47     * @enum CANError
48     * @public
49     */
50     enum CANError {
51         GENERAL_ERROR = 0
52     };
53
54     virtual ~CANObserver(){} /*LCOV_EXCL_LINE*/
55     /**
56     * Called when error occurred on the bus.
57     * @fn errorOccured
58     * @param error Bus error code
59     */
60     virtual void errorOccured(CANObserver::CANError error) = 0;             /* socket error */
61     /**
62     * Called when standard frame was is received from the bus.
63     * @fn standardFrameReceived
64     * @param frame Received frame
65     */
66     virtual void standardFrameReceived(const can_frame& frame) = 0;       /* SFF was present */
67     /**
68     * Called when extended frame was is received from the bus.
69     * @fn extendedFrameReceived
70     * @param frame Received frame
71     */
72     virtual void extendedFrameReceived(const can_frame& frame) = 0;       /* EFF was present */
73     /**
74     * Called when error frame was received from the bus.
75     * @fn errorFrameReceived
76     * @param frame Error frame
77     */
78     virtual void errorFrameReceived(const can_frame& frame) = 0;          /* error frame */
79     /**
80     * Called when remote transmission frame was received from the bus.
81     * @fn remoteTransmissionRequest
82     * @param frame RTR frame
83     */
84     virtual void remoteTransmissionRequest(const can_frame& frame) = 0;   /* remote transmission request (SFF/EFF is still present)*/
85
86 };
87
88 #endif // CANOBSERVER_H
89
90 /** @} */
91