1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
|
class Udp_Receiver_t : public UDP_NC_Application_t
{
public:
Udp_Receiver_t
( unsigned long _hostIPAddress = ntohl(inet_addr("127.0.0.1"))
,const char * qxInterfaceName = "UDP Transeiver"
,unsigned short destUdpPortNumber = 20002
,unsigned short hostUdpPortNumber = 20003
,unsigned long destIpAddress = ntohl(inet_addr("127.0.0.1"))
,int retryTimes = 1
,int retryTimeout = 1
,short int addressFamily = AF_INET
)
: UDP_NC_Application_t( destIpAddress
,hostIPAddress
,hostUdpPortNumber
,destUdpPortNumber
,qxInterfaceName
,retryTimes
,retryTimeout
,addressFamily
),msdestIpAddress(destIpAddress)
{
temp=0;
};
~Udp_Receiver_t(){};
static float getData1(){return msg.measuredValue[0];}; //ERREUR1 !!
static float getData2(){return msg.measuredValue[1];}; //ERREUR2 !!
static float getData3(){return msg.measuredValue[2];}; //ERREUR3 !!
static float getData4(){return msg.measuredValue[3];}; //ERREUR4 !!
static float getData5(){return msg.measuredValue[4];}; //ERREUR5 !!
void processingData();
void sendReport();
unsigned long getDestId()const{ return msdestIpAddress; };
private:
unsigned long msdestIpAddress;
float temp;
union
{
double measuredValue[5];
unsigned char measuredBuffer[64*5];
} msgToSend;
union
{
double *measuredValue[5];
unsigned char measuredBuffer[64*5];
} msg;
};
class PFD_UDP_RX_Singleton_t
{
private:
// Constructeur/destructeur
PFD_UDP_RX_Singleton_t (){ };
~PFD_UDP_RX_Singleton_t () { };
public:
static float getData1(){ return Udp_Receiver_t::getData1(); };
static float getData2(){ return Udp_Receiver_t::getData2(); };
static float getData3(){ return Udp_Receiver_t::getData3(); };
static float getData4(){ return Udp_Receiver_t::getData4(); };
static float getData5(){ return Udp_Receiver_t::getData5(); };
Udp_Receiver_t * get_udp_receiver () { return _udp_receiver; };
UDP_Message_Server_t * get_server () { return _server; };
void set_Udp_Receiver_t (Udp_Receiver_t *udp_receiver) { _udp_receiver = udp_receiver; };
void set_UDP_Message_Server_t (UDP_Message_Server_t * server) { _server = server; };
// Fonctions de création et destruction du singleton
static PFD_UDP_RX_Singleton_t *getInstance ()
{
if (NULL == _singleton)
{
_singleton = new PFD_UDP_RX_Singleton_t;
}
return _singleton;
};
static void kill ()
{
if (NULL != _singleton)
{
delete _singleton;
_singleton = NULL;
}
}; // ;
private:
static PFD_UDP_RX_Singleton_t* _singleton; //ERREUR6 !!
Udp_Receiver_t * _udp_receiver;
UDP_Message_Server_t * _server;
};
PFD_UDP_RX_Singleton_t *PFD_UDP_RX_Singleton_t::_singleton = NULL; //ERREUR7 !!
#endif |
Partager