00001
00002
00003
00004 #ifndef RECEIVER_H
00005 #define RECEIVER_H
00006
00007 #include "dllexport.h"
00008
00009 #include <map>
00010 #include <boost/function.hpp>
00011
00012 #include "canaerometadata.h"
00013 #include "datareference.h"
00014 #include "canaerobusconnector.h"
00015 #include "canaerodatamanager.h"
00016
00017 namespace SCS {
00018
00045 class DLL_PUBLIC Receiver : public CanAeroDataManager
00046 {
00047 public:
00048
00055 Receiver(uint8_t required_software_revision,
00056 uint8_t own_node_id = 255,
00057 const std::string& host_addr = "239.40.41.42");
00058
00059
00066 Receiver(uint8_t required_software_revision,
00067 NetworkConnector<can_t>* connector,
00068 uint8_t own_node_id = 255);
00069
00070
00074 virtual ~Receiver();
00075
00076
00085 void requestData(can_Id_t can_id, TypelessDataReference* dataref);
00086
00087
00094 void requestData(can_Id_t can_id, int32_t* t);
00095
00102 void requestData(can_Id_t can_id, float* t);
00103
00110 void requestData(can_Id_t can_id, double* t);
00111
00118 void requestData(can_Id_t can_id, bool* t);
00119
00126 void requestData(can_Id_t can_id, char4* t);
00127
00134 void requestData(can_Id_t can_id, std::string* t);
00135
00142 void requestData(can_Id_t can_id, std::vector<float>* t);
00143
00144
00152 void requestData(can_Id_t can_id, boost::function<void (int32_t)> f, int32_t* t);
00153
00161 void requestData(can_Id_t can_id, boost::function<void (float)> f, float* t);
00162
00170 void requestData(can_Id_t can_id, boost::function<void (double)> f, double* t);
00171
00179 void requestData(can_Id_t can_id, boost::function<void (bool)> f, bool* t);
00180
00188 void requestData(can_Id_t can_id, boost::function<void (char4)> f, char4* t);
00189
00197 void requestData(can_Id_t can_id, boost::function<void (const std::string&)> f, std::string* t);
00198
00206 void requestData(can_Id_t can_id, boost::function<void (const std::vector<float>&)> f, std::vector<float>* t);
00207
00208
00215 void requestData(can_Id_t can_id, boost::function<void (int32_t)> f);
00216
00223 void requestData(can_Id_t can_id, boost::function<void (float)> f);
00224
00231 void requestData(can_Id_t can_id, boost::function<void (double)> f);
00232
00239 void requestData(can_Id_t can_id, boost::function<void (bool)> f);
00240
00247 void requestData(can_Id_t can_id, boost::function<void (char4)> f);
00248
00255 void requestData(can_Id_t can_id, boost::function<void (const std::string&)> f);
00256
00263 void requestData(can_Id_t can_id, boost::function<void (const std::vector<float>&)> f);
00264
00265
00272 void sendData(can_Id_t can_id, int32_t t);
00273
00280 void sendData(can_Id_t can_id, float t);
00281
00288 void sendData(can_Id_t can_id, double t);
00289
00296 void sendData(can_Id_t can_id, bool t);
00297
00304 void sendData(can_Id_t can_id, char4 t);
00305
00312 void sendData(can_Id_t can_id, const std::string& t);
00313
00320 void sendData(can_Id_t can_id, const std::vector<float>& t);
00321
00322
00329 void sendData(can_Id_t can_id);
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00353 void run(bool do_log_output = true);
00354
00355
00365 void requestModule(uint8_t node_id, uint16_t module, uint16_t mode = 1);
00366
00367
00374 TypelessDataReference* get(can_Id_t can_id);
00375
00376
00377 protected:
00378
00385 virtual void handleSTS();
00386
00393 virtual void handleMCS(uint16_t module, uint16_t mode);
00394
00399 virtual uint32_t handleMIS();
00400
00407 virtual bool handleDRS(uint32_t) ;
00408
00409
00410 private:
00415 void incomingData(const can_t&);
00416
00420 void changeNodeId(uint8_t node_id);
00421
00422 private:
00423 class ReceiverImpl;
00424 ReceiverImpl* m_pimpl;
00425 friend class CanAeroBusConnector;
00426 };
00427
00428 }
00429
00430 #endif // RECEIVER_H