Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef KVASER_INTERFACE_HPP
00012 #define KVASER_INTERFACE_HPP
00013
00014
00015 #include <iostream>
00016
00017
00018 #include <unistd.h>
00019
00020 namespace AS
00021 {
00022 namespace CAN
00023 {
00024 enum return_statuses
00025 {
00026 OK = 0,
00027 INIT_FAILED = -1,
00028 BAD_PARAM = -2,
00029 NO_CHANNELS_FOUND = -3,
00030 CHANNEL_CLOSED = -4,
00031 NO_MESSAGES_RECEIVED = -5,
00032 READ_FAILED = -6,
00033 WRITE_FAILED = -7,
00034 CLOSE_FAILED = -8
00035 };
00036
00037 class KvaserCan
00038 {
00039 public:
00040 KvaserCan();
00041
00042 ~KvaserCan();
00043
00044
00045 return_statuses open(const int& hardware_id,
00046 const int& circuit_id,
00047 const int& bitrate,
00048 const bool& echo_on = true);
00049
00050
00051 return_statuses close();
00052
00053
00054 bool is_open();
00055
00056
00057 return_statuses read(long *id,
00058 unsigned char *msg,
00059 unsigned int *size,
00060 bool *extended,
00061 unsigned long *time);
00062
00063
00064 return_statuses write(const long& id,
00065 unsigned char *msg,
00066 const unsigned int& size,
00067 const bool& extended);
00068
00069 private:
00070 void *handle;
00071 bool on_bus;
00072 };
00073
00074
00075 std::string return_status_desc(const return_statuses& ret);
00076 }
00077 }
00078 #endif