Update CubeNetwork.cpp

Remove Poco
This commit is contained in:
workinghard
2015-06-30 09:22:58 -07:00
parent 10f9926cf4
commit f5454f3462

View File

@@ -27,16 +27,11 @@
#include <unistd.h>
#endif // win32
//using Poco::Net::DialogSocket;
//using Poco::Net::SocketAddress;
//using Poco::Exception;
unsigned char buffer3D[64];
unsigned char receiveBuffer[32];
int bytesReceived;
int i,x;
unsigned char color;
//DialogSocket ds;
int frameChange = 0;
int streamMode = 0; // 0 = off, 1 = frameStream, 2 = writeStream
TCPStream* stream;
@@ -100,8 +95,6 @@ bool frame1[3][64] = { {1,0,0,1,
1,0,0,1,
0,0,0,0}};
bool connectionEstablished = false;
void byte2uint32(unsigned char* bytes, u_int32_t msgLength) {
unsigned char *vp = (unsigned char *)&msgLength;
bytes[0] = vp[0]; // int32 to byte array conversion
@@ -229,13 +222,13 @@ void CubeNetwork::sendBytes(const unsigned char* byteBuffer, unsigned int byteLe
// let arduino knows what to expect
msgStartWrite(byteLength);
unsigned char myBuffer[4];
int ret = stream->receive(myBuffer,4);
long ret = stream->receive(myBuffer,4);
printf("received Length:\n");
printf("0: %u\n", myBuffer[0]);
printf("1: %u\n", myBuffer[1]);
printf("2: %u\n", myBuffer[2]);
printf("3: %u\n", myBuffer[3]);
printf("ret: %u\n", ret);
printf("ret: %lu\n", ret);
// send bytes to write
stream->send(byteBuffer, byteLength);
@@ -265,7 +258,7 @@ void CubeNetwork::updateFrame(const unsigned char * frameSequence, unsigned int
}
bool CubeNetwork::openConnection(const char* ipAddr, unsigned int port) {
connectionEstablished = false;
bool connectionEstablished = false;
printf("Try to open the connection\n");
//std::string ipAddr_str(reinterpret_cast<const char*>(ipAddr));
//Poco::UInt16 portNr = port;
@@ -281,7 +274,6 @@ bool CubeNetwork::openConnection(const char* ipAddr, unsigned int port) {
}
void CubeNetwork::closeConnection() {
connectionEstablished = false;
msgCloseFrameStream();
delete stream;
streamMode = 0;
@@ -289,9 +281,8 @@ void CubeNetwork::closeConnection() {
bool CubeNetwork::connected() {
if (stream) {
connectionEstablished = true;
return true;
}else{
connectionEstablished = false;
return false;
}
return connectionEstablished;
}