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

Last change on this file since 433 was 178, checked in by Bayard Gildas, 8 years ago

Change Udp socket object name (from "Socket" to "UdpSocket")

File size: 1.9 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 <UdpSocket.h>
23
24//todo remove for tests
25#include <iostream>
26
27
28using namespace std;
29using namespace flair::core;
30using namespace flair::gui;
31
32GuiFlair::GuiFlair(string name):
33 GuiInterface(name) {
34 cout << "MavPlanner GuiFlair constructor" << endl;
35
36 outputSocket = new UdpSocket((Thread *)this, "output socket", "127.0.0.1:5036");
37
38 // outputSocket = new Socket(parent, "output socket", "127.255.255.255:9001", true);
39 inputSocket = new UdpSocket((Thread *)this, "input socket", 9001);
40}
41
42GuiFlair::~GuiFlair() {
43
44}
45
46void GuiFlair::MissionStart() {
47 cout << "MavPlanner GuiFlair MissionStart" << endl;
48
49 int received = 0;
50 char receiveFrameBuffer[200];
51
52 std::string message_to_send("Test of sending a message");
53
54 //fonctionne en récéption si on prend un broadcast pour la création du socket
55 // outputSocket->SendMessage(message_to_send);
56
57 do {
58 // cout << "." << endl;
59 received=inputSocket->RecvMessage(receiveFrameBuffer,200, TIME_NONBLOCK);
60 // cout << "." << endl;
61 if (received > 0) {
62 cout << "MavPlanner GuiFlair MissionStart data received : " << receiveFrameBuffer << endl;
63 outputSocket->SendMessage(receiveFrameBuffer, received);
64 }
65 } while (received != 0);
66}
67
68void GuiFlair::MissionStop() {
69 cout << "MavPlanner GuiFlair MissionStop" << endl;
70}
71
72void GuiFlair::MissionPause() {
73 cout << "MavPlanner GuiFlair MissionResume" << endl;
74}
75
76void GuiFlair::MissionSend() {
77 cout << "MavPlanner GuiFlair MissionSend" << endl;
78}
Note: See TracBrowser for help on using the repository browser.