HardwareCanSourcePeak.h
Go to the documentation of this file.
00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
00002 
00003 // -- BEGIN LICENSE BLOCK ----------------------------------------------
00004 // This file is part of FZIs ic_workspace.
00005 //
00006 // This program is free software licensed under the LGPL
00007 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
00008 // You can find a copy of this license in LICENSE folder in the top
00009 // directory of the source code.
00010 //
00011 // © Copyright 2016 FZI Forschungszentrum Informatik, Karlsruhe, Germany
00012 //
00013 // -- END LICENSE BLOCK ------------------------------------------------
00014 
00015 //----------------------------------------------------------------------
00022 //----------------------------------------------------------------------
00023 #ifndef ICL_HARDWARE_CAN_SOURCE_HARDWARE_CAN_SOURCE_PEAK_H_INCLUDED
00024 #define ICL_HARDWARE_CAN_SOURCE_HARDWARE_CAN_SOURCE_PEAK_H_INCLUDED
00025 
00026 #include <icl_hardware_can/source/ImportExport.h>
00027 #include <icl_hardware_can/source/HardwareCanSource.h>
00028 
00029 #include <icl_hardware_can/tCanDevice.h>
00030 #include <icl_hardware_can/tCanMatrixParser.h>
00031 
00032 #include <vector>
00033 
00034 namespace icl_hardware {
00035 namespace can {
00036 
00040 class ICL_HARDWARE_CAN_SOURCE_IMPORT_EXPORT HardwareCanSourcePeak : public HardwareCanSource
00041 {
00042 private:
00046   class WorkerThread;
00047 
00048 public:
00050   typedef boost::shared_ptr<HardwareCanSourcePeak> Ptr;
00052   typedef boost::shared_ptr<const HardwareCanSourcePeak> ConstPtr;
00053 
00055   static icl_sourcesink::URISchemeMap supportedURISchemes()
00056   {
00057     using namespace icl_sourcesink;
00058     URISchemeMap schemes;
00059     schemes.insert(
00060       std::make_pair(
00061         "can+live",
00062         URISchemeInfo(
00063           "Reads CAN message data via a Peak CAN device.",
00064           "can+live://<path>[?baudrate=<baudrate>][&can_mask=<can_mask>|can_id=<can_id>][&buffer_size=<buffer_size>]",
00065           "<path>         Path to CAN device (default: /dev/pcan0)\n"
00066           "<baudrate>     CAN baudrate [kbps] (default: 500).\n"
00067           "<can_mask>     Path to CAN mask file\n"
00068           "               (default: from config option /icl_hardware_can/can_mask)\n"
00069           "<can_id>       Specific CAN ID to extract while ignoring all others\n"
00070           "<buffer_size>  Internal buffer size (default: 256 messages)")));
00071     return schemes;
00072   }
00073 
00074   virtual CanMessageStamped::Ptr get() const
00075   {
00076     return m_buffer;
00077   }
00078 
00079   virtual bool isSeekable() const { return false; }
00080 
00081   ~HardwareCanSourcePeak();
00082 
00083 protected:
00085   HardwareCanSourcePeak(const std::string& uri = "",
00086                         const std::string& name = "HardwareCanSourcePeak");
00087 
00089   friend class icl_sourcesink::SourceSinkManager;
00090 
00092   friend class icl_sourcesink::DataSourceFactory<HardwareCanSourcePeak>;
00093 
00095   bool advance();
00096 
00097 private:
00099   CanMessageStamped::Ptr m_buffer;
00100 
00105   uint32_t m_sleep_time;
00106 
00110   boost::scoped_ptr<WorkerThread> m_worker_thread;
00111 };
00112 
00113 SOURCESINK_DECLARE_GENERIC_SOURCE_FACTORY(HardwareCanSourcePeak)
00114 
00115 }
00116 }
00117 
00118 #endif


fzi_icl_can
Author(s):
autogenerated on Thu Jun 6 2019 20:26:01