summaryrefslogtreecommitdiff
path: root/client/networksender.cc
diff options
context:
space:
mode:
Diffstat (limited to 'client/networksender.cc')
-rw-r--r--client/networksender.cc36
1 files changed, 27 insertions, 9 deletions
diff --git a/client/networksender.cc b/client/networksender.cc
index 21c107c..675bdb9 100644
--- a/client/networksender.cc
+++ b/client/networksender.cc
@@ -28,28 +28,46 @@
#include "info.h"
-NetworkSender::NetworkSender()
+NetworkSender::NetworkSender(QString cpr)
{
ip = "192.168.0.10";
port = 6666;
+
+ // Connect
}
NetworkSender::~NetworkSender()
-{}
-
-void NetworkSender::newConnection(char *cpr)
{
+ // Disconnect
}
-void NetworkSender::pushFrame(char* frame, bool freeze, bool snapshot)
+void NetworkSender::pushFrame(char* framedata, bool freeze, bool snapshot)
{
-}
+ Frame *frame = new Frame((unsigned char*)framedata);
+ frame->freeze = freeze;
+ frame->shoot = snapshot;
-void NetworkSender::endConnection()
-{
+ mutex.lock();
+ framelist.push_back(frame);
+ mutex.unlock();
+
+ semaphore.release();
}
void NetworkSender::run()
{
- // MIaV::info->info("The NetworkSender thread is running.");
+ while(running) {
+ semaphore.acquire();
+
+ Frame *frame = NULL;
+ mutex.lock();
+ if(framelist.isEmpty() == false) frame = framelist.takeLast();
+ mutex.unlock();
+
+ if(frame) {
+ // TODO: Send it over the network
+
+ delete frame;
+ }
+ }
}