Changeset 86 in flair-src for branches/mavlink/tools


Ignore:
Timestamp:
Sep 28, 2016, 8:36:04 AM (8 years ago)
Author:
Thomas Fuhrmann
Message:

FlairSockets are working and used

Location:
branches/mavlink/tools/Controller/Mavlink/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/mavlink/tools/Controller/Mavlink/src/Forwarder.cpp

    r71 r86  
    3838  // cout << "MavPlanner Forwarder output address : " << tmpOutput << endl;
    3939
    40   cout << "input socket : " << inputAddress + ":" + to_string(inputPort) << endl;
    41   cout << "output socket : " << outputAddress + ":" + to_string(outputPort) << endl;
     40  // cout << "input socket : " << inputAddress + ":" + to_string(inputPort) << endl;
     41  // cout << "output socket : " << outputAddress + ":" + to_string(outputPort) << endl;
    4242
    43   inputSocket = new Socket((Thread *)this, "input socket", inputAddress + ":" + to_string(inputPort));
     43  inputSocket = new Socket((Thread *)this, "input socket", inputPort);
    4444  outputSocket = new Socket((Thread *)this, "output socket", outputAddress + ":" + to_string(outputPort));
    4545}
     
    5555  }
    5656  int recvDataSize = 0;
    57   char* srcBuffer;
    58   size_t srcSize;
     57  char inputBuffer[200];
    5958  while (!ToBeStopped()) {
    60     // Thread::SleepMS(2000);
    61     // TIME_NONBLOCK
    62     recvDataSize = inputSocket->RecvMessage(inputBuffer, 200, 5000000000, srcBuffer, &srcSize);
    63     cout << "Forwarder message received, size="<< recvDataSize << endl;
    64         outputSocket->SendMessage(inputBuffer, recvDataSize);
     59    recvDataSize = inputSocket->RecvMessage(inputBuffer, 200, 1000000000);
     60          outputSocket->SendMessage(inputBuffer, recvDataSize);
    6561  }
    6662}
  • branches/mavlink/tools/Controller/Mavlink/src/GuiFlair.cpp

    r85 r86  
    3535        cout << "MavPlanner GuiFlair constructor" << endl;
    3636
    37         // outputSocket = new Socket((Thread *)this, "output socket", "127.0.0.1:5036");
     37        outputSocket = new Socket((Thread *)this, "output socket", "127.0.0.1:5036");
    3838
    3939        // outputSocket = new Socket(parent, "output socket", "127.255.255.255:9001", true);
    40         outputSocket = new Socket(parent, "output socket", 9001);
     40        inputSocket = new Socket((Thread *)this, "input socket", 9001);
    4141}
    4242
     
    4949
    5050        int received = 0;
    51         char receiveFrameBuffer[50];
     51        char receiveFrameBuffer[200];
    5252
    5353        std::string message_to_send("Test of sending a message");
     
    5757
    5858        do {
    59                 received=outputSocket->RecvMessage(receiveFrameBuffer,50, TIME_NONBLOCK);
     59                // cout << "." << endl;
     60                received=inputSocket->RecvMessage(receiveFrameBuffer,200, TIME_NONBLOCK);
     61                // cout << "." << endl;
    6062                if (received > 0) {
    61                    cout << "MavPlanner GuiFlair MissionStart data received !!!" << endl;
     63                   cout << "MavPlanner GuiFlair MissionStart data received : " << receiveFrameBuffer << endl;
     64                   outputSocket->SendMessage(receiveFrameBuffer, received);
    6265                }
    63         } while (received == 0);
     66        } while (received != 0);
    6467}
    6568
  • branches/mavlink/tools/Controller/Mavlink/src/GuiFlair.h

    r85 r86  
    4545
    4646private:
     47  flair::core::Socket *inputSocket;
    4748  flair::core::Socket *outputSocket;
    4849  std::string outputAddress;
Note: See TracChangeset for help on using the changeset viewer.