This commit is contained in:
workinghard
2015-06-30 07:43:39 -07:00
parent 10f9926cf4
commit 44041e9818
3 changed files with 16 additions and 16 deletions

View File

@@ -31,6 +31,8 @@
//using Poco::Net::SocketAddress;
//using Poco::Exception;
TCPConnector* connector;
unsigned char buffer3D[64];
unsigned char receiveBuffer[32];
int bytesReceived;
@@ -114,7 +116,7 @@ void msgCloseFrameStream() {
if (stream) {
buffer3D[0] = 's';
buffer3D[1] = 'S';
stream->send(buffer3D, 2); // End the stream mode
stream->send(reinterpret_cast<const char*>(buffer3D), 2); // End the stream mode
}
}
@@ -129,7 +131,7 @@ void msgOpenFrameStream() {
buffer3D[6] = 'S';
buffer3D[7] = 's';
buffer3D[8] = ' ';
stream->send(buffer3D, 9);
stream->send(reinterpret_cast<const char*>(buffer3D), 9);
}
}
@@ -157,7 +159,7 @@ void msgStartWrite(u_int32_t msgLength) {
printf("2: %u\n", myBuffer[2]);
printf("3: %u\n", myBuffer[3]);
stream->send(buffer3D, 13);
stream->send(reinterpret_cast<const char*>(buffer3D), 13);
}
}
@@ -190,7 +192,7 @@ void testFrame() {
buffer3D[60]=254;
buffer3D[63]=254;
}
stream->send(buffer3D, 64);
stream->send(reinterpret_cast<const char*>(buffer3D), 64);
}
@@ -206,7 +208,7 @@ void testStream2() {
buffer3D[i] = 255; // Aus
}
}
stream->send(buffer3D, 64);
stream->send(reinterpret_cast<const char*>(buffer3D), 64);
sleepcp(1000); // 20 FPS
if ( frameChange < 2 ) {
frameChange++;
@@ -228,7 +230,7 @@ void CubeNetwork::sendBytes(const unsigned char* byteBuffer, unsigned int byteLe
if ( byteBuffer != NULL ) {
// let arduino knows what to expect
msgStartWrite(byteLength);
unsigned char myBuffer[4];
char myBuffer[4];
int ret = stream->receive(myBuffer,4);
printf("received Length:\n");
printf("0: %u\n", myBuffer[0]);
@@ -238,7 +240,7 @@ void CubeNetwork::sendBytes(const unsigned char* byteBuffer, unsigned int byteLe
printf("ret: %u\n", ret);
// send bytes to write
stream->send(byteBuffer, byteLength);
stream->send(reinterpret_cast<const char*>(byteBuffer), byteLength);
// Reset to the frameStream mode
if ( streamMode == 2 ) {
msgOpenFrameStream();
@@ -258,7 +260,7 @@ void CubeNetwork::updateFrame(const unsigned char * frameSequence, unsigned int
buffer3D[i] = frameSequence[i+((frameCount-1)*64)];
}
// Send the frame
stream->send(buffer3D, 64);
stream->send(reinterpret_cast<const char*>(buffer3D), 64);
}
}

View File

@@ -22,11 +22,11 @@
#define __Cube4Fun__CubeNetwork__
#include <iostream>
#include "Poco/Foundation.h"
#include "Poco/Net/SocketAddress.h"
#include "Poco/Net/DialogSocket.h"
#include "Poco/Net/NetException.h"
#include "Poco/Exception.h"
//#include "Poco/Foundation.h"
//#include "Poco/Net/SocketAddress.h"
//#include "Poco/Net/DialogSocket.h"
//#include "Poco/Net/NetException.h"
//#include "Poco/Exception.h"
#include <stdlib.h> /* srand, rand */
#include <time.h> /* time */
#include <chrono>
@@ -43,8 +43,6 @@ public:
static bool openConnection(const char* ipAddr, unsigned int port);
//static void openConnection();
static void closeConnection();
private:
static TCPConnector* connector;
};
#endif /* defined(__Cube4Fun__CubeNetwork__) */

View File

@@ -26,4 +26,4 @@
+ (bool) openConnection: (const char *) ipAddress port: (UInt32) port;
+ (void) closeConnection;
+ (bool) connected;
@end
@end