Commit a6782def authored by Joshua Supra's avatar Joshua Supra
Browse files

test

parent 71bffb95
...@@ -28,7 +28,8 @@ int main (int argc, char *argv[]){ ...@@ -28,7 +28,8 @@ int main (int argc, char *argv[]){
initContCounterDone = 0; initContCounterDone = 0;
zmq_data *zmq_recive_data[2]; zmq_data *zmq_recive_data[2];
int NrOfBytesReceived[2];
//NrOfBytesReceived[0] = -1;
pilcIOGpioStruct PilcIoGpios; pilcIOGpioStruct PilcIoGpios;
STOP = false; STOP = false;
...@@ -63,18 +64,15 @@ int main (int argc, char *argv[]){ ...@@ -63,18 +64,15 @@ int main (int argc, char *argv[]){
while (1) { while (1) {
zmq_recive_data[0]->NrOfBytes = zmq_recv (client_responder, NrOfBytesReceived[0] = zmq_recv (client_responder,
zmq_recive_data[0]->data, 255, ZMQ_DONTWAIT); zmq_recive_data[0]->data, 255, ZMQ_DONTWAIT);
zmq_recive_data[0]->socket = client_responder; zmq_recive_data[0]->socket = client_responder;
if (zmq_recive_data[0]->NrOfBytes != -1) { if ( NrOfBytesReceived[0] != -1) {
//printf("1\n"); zmq_recive_data[0]->NrOfBytes = NrOfBytesReceived[0];
printf("%i\n", &zmq_recive_data[0]->NrOfBytes);
printf("%i\n", zmq_recive_data[0]->NrOfBytes);
pthread_mutex_lock(&lock); pthread_mutex_lock(&lock);
pthread_create(&thread_network[0], NULL, network, (void *)zmq_recive_data[0]); pthread_create(&thread_network[0], NULL, network, (void *)zmq_recive_data[0]);
pthread_mutex_unlock(&lock); pthread_mutex_unlock(&lock);
} }
else { else {
break; break;
...@@ -82,18 +80,17 @@ int main (int argc, char *argv[]){ ...@@ -82,18 +80,17 @@ int main (int argc, char *argv[]){
} }
while (1) { while (1) {
// NrOfBytesReceived[0] = -1;
zmq_recive_data[1]->NrOfBytes = zmq_recv (gui_responder, NrOfBytesReceived[1] = zmq_recv (gui_responder,
zmq_recive_data[1]->data, 255, ZMQ_DONTWAIT); zmq_recive_data[1]->data, 255, ZMQ_DONTWAIT);
printf("bla\n");
zmq_recive_data[1]->socket = gui_responder; zmq_recive_data[1]->socket = gui_responder;
if (zmq_recive_data[1]->NrOfBytes != -1) { if (NrOfBytesReceived[1] != -1) {
//printf("2\n"); //printf("2\n");
zmq_recive_data[1]->NrOfBytes = NrOfBytesReceived[1];
pthread_mutex_lock(&lock); pthread_mutex_lock(&lock);
pthread_create(&thread_network[1], NULL, network, (void *)zmq_recive_data[1]); pthread_create(&thread_network[1], NULL, network, (void *)zmq_recive_data[1]);
//pthread_detach(thread_network[1]);
pthread_mutex_unlock(&lock); pthread_mutex_unlock(&lock);
} }
...@@ -105,10 +102,11 @@ int main (int argc, char *argv[]){ ...@@ -105,10 +102,11 @@ int main (int argc, char *argv[]){
if (front_LED_update_ctr == 0) { if (front_LED_update_ctr == 0) {
pthread_create(&thread_led_update, NULL, updateIOLeds, (void *)IOCards); pthread_create(&thread_led_update, NULL, updateIOLeds, (void *)IOCards);
//pthread_detach(thread_led_update);
front_LED_update_ctr = 20; front_LED_update_ctr = 20;
} }
pthread_join(thread_network[0], NULL); pthread_join(thread_network[0], NULL);
pthread_join(thread_network[1], NULL); pthread_join(thread_network[1], NULL);
pthread_join(thread_led_update, NULL); pthread_join(thread_led_update, NULL);
...@@ -152,7 +150,7 @@ void *network(void *args){ ...@@ -152,7 +150,7 @@ void *network(void *args){
command = zmq_rec_data->data[0]; command = zmq_rec_data->data[0];
//printf("command: %.8x\n", command); //printf("command: %.8x\n", command);
nbytes = zmq_rec_data->NrOfBytes; nbytes = zmq_rec_data->NrOfBytes;
printf("%i\n", &zmq_rec_data->NrOfBytes); //printf("%i\n", &zmq_rec_data->NrOfBytes);
switch (command){ switch (command){
case 0x0: status = RegtoNetwork(zmq_rec_data);break; case 0x0: status = RegtoNetwork(zmq_rec_data);break;
case 0x1: status = NetworktoReg(zmq_rec_data);break; case 0x1: status = NetworktoReg(zmq_rec_data);break;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment