00001 #ifndef _RDSMODULE_H
00002 #define _RDSMODULE_H
00003
00004 #include <OpenTracker/OpenTracker.h>
00005 #include <OpenTracker/dllinclude.h>
00006 #include "RDSSource.h"
00007
00008 #include <ace/SOCK_Stream.h>
00009 #include <ace/SOCK_Connector.h>
00010
00011 #include "rds.h"
00012 #include <string>
00013 #include <vector>
00014
00015 #define OP_RDS_RAW_READY 1
00016 #define OP_RDS_PREPPED 3
00017
00018 #define byte char
00019
00020 namespace ot {
00021
00022 typedef struct
00023 {
00024 short I;
00025 short R;
00026 } COMPLEX;
00027
00028 typedef struct
00029 {
00030 RDS_MSG_HDR rds_msg_hdr;
00031 RDS_INIT_PKT rds_init_pkt;
00032 } INIT_MSG;
00033
00034
00035 typedef struct
00036 {
00037 unsigned int timestamp;
00038 int unused;
00039 } RDS_PREPPED_PKT;
00040
00041
00042
00043
00044
00045
00046 class OPENTRACKER_API RDSModule : public ThreadModule, public NodeFactory
00047 {
00048
00049 protected:
00050
00051 int stop;
00052 ACE_INET_Addr address;
00053 ACE_SOCK_Stream socket;
00054 ACE_SOCK_Connector connector;
00055
00056 NodeVector sources;
00057 NodeVector sinks;
00058
00059 int connect();
00060
00061
00062 protected:
00063 void run();
00064
00065 public:
00067 RDSModule();
00068
00070 virtual ~RDSModule();
00076 virtual void init(StringTable& attributes, ConfigNode * localTree);
00084 virtual Node * createNode( const std::string& name, StringTable& attributes);
00088 virtual void start();
00092 virtual void close();
00098 virtual void pushEvent();
00099 void onEventGenerated( Event& event, Node& generator);
00100 private:
00101 int validateData(RDS_RAW_READY_PKT * rdsRawReadyPkt);
00102 byte *pByteArray;
00103 void send_data();
00104 short **real_data;
00105 short **imag_data;
00106 short **raw_data;
00107 int channels;
00108 bool validate;
00109 bool bigendian;
00110 std::string data_order;
00111 int xsize;
00112 int ysize;
00113
00114 friend class RDSSource;
00115 };
00116 OT_MODULE(RDSModule);
00117 }
00118
00119 #endif