08.02.2010 - version 0.1.2

This commit is contained in:
peri4
2012-02-08 19:39:21 +04:00
parent 8bb8287dcb
commit 5558add03e
10 changed files with 169 additions and 156 deletions

View File

@@ -38,12 +38,12 @@
#define BUFFER_SIZE 4096
typedef bool (*EthernetFunc)(void * , char * , int );
typedef bool (*EthernetFunc)(void * , uchar * , int );
class PIEthernet: public PIThread
{
public:
// slot is any function format "bool <func>(void*, char*, int)"
// slot is any function format "bool <func>(void*, uchar*, int)"
PIEthernet(PIString ip = "", int port = 0, void * data = 0, EthernetFunc slot = 0);
~PIEthernet();
@@ -53,13 +53,13 @@ public:
void setSendAddress(PIString ip, int port) {ip_s = ip; port_s = port;}
bool send(PIString ip, int port, char * data, int size);
bool send(char * data, int size);
bool send(uchar * data, int size);
bool init();
bool initSend();
bool receiverInitialized() const {return sock != -1;}
bool senderInitialized() const {return sock_s != -1;}
void terminate();
const char * buffer() const {return buffer_;}
const uchar * buffer() const {return buffer_;}
private:
void begin();
@@ -71,7 +71,7 @@ private:
PIString ip_, ip_s;
EthernetFunc ret_func;
void * data;
char buffer_[BUFFER_SIZE];
uchar buffer_[BUFFER_SIZE];
};