source: flair-src/trunk/tools/Controller/Mavlink/src/GuiFlair.cpp@ 111

Last change on this file since 111 was 88, checked in by Sanahuja Guillaume, 8 years ago

m

File size: 2.0 KB
Line 
1// %flair:license{
2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
4// %flair:license}
5// created: 2016/09/02
6// filename: GuiFlair.cpp
7//
8// authors: Thomas Fuhrmann
9// Copyright Heudiasyc UMR UTC/CNRS 7253
10//
11// version: $Id: $
12//
13// purpose: Implementation of GuiInterface using Flair
14// communication mechanism
15//
16//
17/*********************************************************************/
18
19#include "GuiFlair.h"
20#include "GuiInterface.h"
21
22#include <FrameworkManager.h>
23#include <Socket.h>
24
25//todo remove for tests
26#include <iostream>
27
28
29using namespace std;
30using namespace flair::core;
31using namespace flair::gui;
32
33GuiFlair::GuiFlair(const FrameworkManager *parent, string name):
34 GuiInterface(parent, name) {
35 cout << "MavPlanner GuiFlair constructor" << endl;
36
37 outputSocket = new Socket((Thread *)this, "output socket", "127.0.0.1:5036");
38
39 // outputSocket = new Socket(parent, "output socket", "127.255.255.255:9001", true);
40 inputSocket = new Socket((Thread *)this, "input socket", 9001);
41}
42
43GuiFlair::~GuiFlair() {
44
45}
46
47void GuiFlair::MissionStart() {
48 cout << "MavPlanner GuiFlair MissionStart" << endl;
49
50 int received = 0;
51 char receiveFrameBuffer[200];
52
53 std::string message_to_send("Test of sending a message");
54
55 //fonctionne en récéption si on prend un broadcast pour la création du socket
56 // outputSocket->SendMessage(message_to_send);
57
58 do {
59 // cout << "." << endl;
60 received=inputSocket->RecvMessage(receiveFrameBuffer,200, TIME_NONBLOCK);
61 // cout << "." << endl;
62 if (received > 0) {
63 cout << "MavPlanner GuiFlair MissionStart data received : " << receiveFrameBuffer << endl;
64 outputSocket->SendMessage(receiveFrameBuffer, received);
65 }
66 } while (received != 0);
67}
68
69void GuiFlair::MissionStop() {
70 cout << "MavPlanner GuiFlair MissionStop" << endl;
71}
72
73void GuiFlair::MissionPause() {
74 cout << "MavPlanner GuiFlair MissionResume" << endl;
75}
76
77void GuiFlair::MissionSend() {
78 cout << "MavPlanner GuiFlair MissionSend" << endl;
79}
Note: See TracBrowser for help on using the repository browser.