1 /*****************************************************************
3 * Copyright 2011 - 2013 Intel Corporation All Rights Reserved.
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.
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 *****************************************************************/
25 #ifndef CANSOCKETADAPTER_H
26 #define CANSOCKETADAPTER_H
29 * \addtogroup libcanbus
33 #include "canadapter.h"
37 class CANSocketReader;
40 * \brief Socket CAN device implementation based on <a href="http://developer.berlios.de/projects/socketcan">BerliOS Socket CAN</a> API.
42 * @class CANSocketAdapter
44 class CANSocketAdapter : public CANAdapter
48 * @param observer @link CANObserver Observer @endlink that will receives CAN bus frames
50 CANSocketAdapter(CANObserver& observer);
51 virtual ~CANSocketAdapter();
54 * Creates connection the specified network interface and starts listening on it.
56 * @param ifName Name of the CAN bus network interface
57 * @return True if no error occurs.
59 virtual bool start(const char* ifName);
61 * Closes socket connection and exits listening thread.
66 * Sends CAN frame over the socket CAN interface
68 * @param frame CAN frame to be sent
69 * @return True if frame was sent
71 virtual bool sendFrame(const can_frame& frame);
75 * Socket initialization and starts reading thread
83 * @link CANSocket CAN Socket wrapper @endlink instance reference
89 * @link CANSocketReader CANSocket reader @endlink instance reference
93 CANSocketReader* mReader;
96 #endif // CANSOCKETADAPTER_H