SlideShare a Scribd company logo
1 of 12
Download to read offline
Recipe to Build Open Splice DDS Ver 6.3.xxx Hello World Example Over Qt 5.2
1. This recipe is developed to help those who could face problem in deploying Open Splice
DDS Ver 6.3.xxx over Qt 5.2. This recipe would help them to develop GUI based applications over
LINUX.
2. Following are steps wise details :-
Pre-requisite: According to my station following is the configuration:-.
a. Ubuntu 13.10
b. Qt 5.2.0 based on (GCC 4.6.1, 32 bit)
c. GCC 4.8.1
d. autoconf
e. automake
f. build-essential
g. OpenSpliceDDSV6.3.130716OSS-HDE-x86.linux-gcc4.6-glibc2.15 for LINUX
kernel 3.0 and above. (Download from following link)
http://www.prismtech.com/opensplice/opensplice-dds-community/software-downloads )
Step No 1: Configure Environmental Settings
3. Create a folder opensplice in /home/xxxxx.xxx copy the above downloaded open splice api
folder and unzip. Or you can unzip anywhere else but for easy reference use /home folder.
4. Open a Terminal in Ubuntu and go inside the folder as mentioned below:-
>cd /home/xxxxx.xxxx/opensplice/HDE/x86.linux2.6
>ls -all {This command is use to check the directory. Check availability of file
release.com.}
>chmod 777 release.com Note: This command make release.com an executable
5. release.com contains environmental settings which are mandatory to build any application
based on open splice DDS. Open release.com in any text editor analyze it. As mentioned below:-
6. At line OSPL_HOME=”/home/..../opensplice/HDE/.... ” you can add your own address
where you had un-ziped the folder. Moreover, edit CPATH variable and replace with following
paths:-
CPATH=$OSPL_HOME/include/dcps/C++/CCPP:$OSPL_HOME/include/dcps/C++/isocpp:
$OSPL_HOME/include/dcps/C++/SACPP:$OSPL_HOME/include:
$OSPL_HOME/include/sys:${CPATH:=}
7. There are three ways to load these environmental setting:-
Option 1: Just write following line on the command prompt.
>. ./release.com
8. This suppose to work but if due to some reasons setting are not loaded then we have to load
each setting manually mentioned in option 2. but to check setting are loaded, write following lines
and check the response.
> echo $OSPL_HOME
> echo $OSPL_TARGET
> echo $PATH
> echo $LD_LIBRARY_PATH
> echo $CPATH
> echo $OSPL_URI
> echo $OSPL_TMPL_PATH
Option 2: Load each line over command prompt one by one and check
SPLICE_JDK=jdk
export SPLICE_JDK
export OSPL_HOME="/home/....../opensplice/HDE/x86.linux2.6"
echo $OSPL_HOME
export OSPL_TARGET=x86.linux2.6
echo $OSPL_TARGET
export PATH=$OSPL_HOME/bin:$PATH
echo $PATH
export LD_LIBRARY_PATH=$OSPL_HOME/lib${LD_LIBRARY_PATH:+:
$LD_LIBRARY_PATH
echo $LD_LIBRARY_PATH
export CPATH=$OSPL_HOME/include:$OSPL_HOME/include/sys:${CPATH:=}
echo $CPATH
export OSPL_URI=file://$OSPL_HOME/etc/config/ospl.xml
echo $OSPL_URI
export OSPL_TMPL_PATH=$OSPL_HOME/etc/idlpp
echo $OSPL_TMPL_PATH
$OSPL_HOME/etc/java/defs.$SPLICE_JDK
Option 3: Open the file /etc/environment as root and update. Add lines mentioned in
option # 2 (Note: load each setting manually on terminal and copy output of echo $xxxx command;
for reference setting are mentioned below):-
>sudo nano /etc/environment
9. nano is a text editor if it is not install use following command and connect to INTERNET.
>sudo apt-get update
>sudo apt-get install nano
10. update the environment file .
11. Add following lines as mentioned in above picture (../adilkhan/ would be replace with your
system folder address).
PATH=/home/xxx.xxxx/opensplice/HDE/x86.linux2.6/etc/idlpp:/home/xxx.xxxx/opensplice/HDE/x86.linux2
.6/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
OSPL_HOME=/home/xxx.xxxx/opensplice/HDE/x86.linux2.6
OSPL_TARGET=x86.linux2.6
LD_LIBRARY_PATH=/home/xxx.xxxx/opensplice/HDE/x86.linux2.6/lib
CPATH=/home/xxx.xxxx/opensplice/HDE/x86.linux2.6/include:/home/xxx.xxxx/opensplice/HDE/x86.linux
2.6/include/sys:/home/xxx.xxxx/opensplice/HDE/x86.linux2.6/include/dcps/C+
+/SACPP:/home/xxx.xxxx/opensplice/HDE/x86.linux2.6/include/dcps/C+
+/CCPP:/home/xxx.xxxx/opensplice/HDE/x86.linux2.6/include/dcps/C++/isocpp
OSPL_URI=file:///home/xxx.xxxx/opensplice/HDE/x86.linux2.6/etc/config/ospl.xml
OSPL_TMPL_PATH=/home/xxx.xxxx/opensplice/HDE/x86.linux2.6/etc/idlpp
QTDIR=/home/xxx.xxxx/Qt5.2.0/5.2.0/gcc
CLASSPATH=/home/xxx.xxxx/opensplice/HDE/x86.linux2.6/jar/dcpssaj.jar:/home/xxx.xxxx/opensplice/HD
E/x86.linux2.6/jar/dcpscj.jar:$CLASSPATH
12. Now, execute following line on terminal.
>source /etc/environment
10. Important Note : Always load these setting using any of the above options.
Step No 2: Starting Qt 5.2 Creator
11. Open terminal and load environmental setting as mentioned in Step No 1.
12. Using same terminal instance, navigate to Qt 5.2 folder. Note: If other terminal is use to
load Qt Creator, then environmental setting shall not be valid.
>cd /home/.../opensplice/HDE/x86.linux2.6
>. ./release.com
>cd /home/..../Qt5.2/Tools/QtCreator/bin
>./qtcreator
Step No 3: Hello World Publisher
13. This recipe takes you step by step to convert Hello World example into QT based GUI
application. However, this is not a tutorial to Qt but, I shall be using Qt terminologies directly:-
(a) Create two new projects using Qt Widget Application:-
(b) Add project name HelloWorldDDS_Publisher for first and
HelloWorldDDS_Subscriber for second.
(c) Copy Checkstatus.cpp & .h / DDSEntityManager.cpp & .h / HelloWorldData.idl
from opensplice HelloWorld (C++) example folder into project folder separately (copying
separately is just to keep it isolated). Open another terminal load environmental settings,
then go into project folder where HelloWorldData.idl file is copied and execute following
command. It would generate requisite file to configure topic and its type support:-
> idlpp -S -l cpp HelloWorldData.idl
(d) Add above generated files as existing files along with Checkstatus.cpp & .h /
DDSEntityManager.cpp & .h into the project.
(e) Go inside project build setting and edit build environment. Add all the Paths and
setting mentioned in Step # 1 : option # 3.
(f) Add library. Select external library then select LINUX as platform and browse. Go in
to a folder /home/..../opensplice/HDE/x86.linux2.6/lib and add each library one by one.
This will update HelloWorldDDS_Publisher.pro and HelloWorldDDS_Subscriber.pro as
shown in picture.
(g) Create user interface as shown below:-
-
(h) Edit mainwindow.cpp & .h files of both the projects as per attached Appendix A &
B. However, complete project folder is also available with this document.
(j) Build the application, If there is some error try to find out over INTERNET or
consult me over INTERNET for any query (adil53@pnec.nust.edu.pk)
14. Execute both projects on same or different computers and connect these computers over
LAN or WiFi and enjoy DDS communication . It is better to launch from terminal after loading
environmental settings.
16. Use this recipe and play with different idl files and multiple QoS (quality of service).
You are allowed to share this recipe with any body.
Regards
Adil Khan
Appendix “A”
Publisher mainwindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "QString"
#include <string>
#include <sstream>
#include <iostream>
#include "DDSEntityManager.h"
#include "ccpp_HelloWorldData.h"
#include "os.h"
#include "ccpp_dds_dcps.h"
//#include "subscriberthread.h"
#include <unistd.h>
#include "CheckStatus.h"
using namespace DDS;
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
//QObject::connect(subscriberthread, SIGNAL(receivedtext(QString)),
ui->plainTextEdit_Subscribe, SLOT(setPlainText(QString)));
DDSEntityManager mgr;
// create domain participant
mgr.createParticipant("HelloWorld example");
//create type
mt = new MsgTypeSupport();
mgr.registerType(mt.in());
//create Topic
char topic_name[] = "HelloWorldData_Msg";
mgr.createTopic(topic_name);
//create Publisher
mgr.createPublisher();
// create DataWriter :
// If autodispose_unregistered_instances is set to true (default value),
// you will have to start the subscriber before the publisher
bool autodispose_unregistered_instances = false;
mgr.createWriter(autodispose_unregistered_instances);
// Publish Events
DataWriter_var dwriter = mgr.getWriter();
MsgDataWriter_var HelloWorldWriter = MsgDataWriter::_narrow(dwriter.in());
Msg msgInstance; /* Example on Stack */
msgInstance.userID = 1;
msgInstance.message = DDS::string_dup("Hello World");
ui->plainTextEdit_Publish->setPlainText("Start Message:-");
ui->plainTextEdit_Publish->setPlainText( "userID : " +
QString(msgInstance.userID));
ui->plainTextEdit_Publish->setPlainText("Message : " +
QString( msgInstance.message));
ReturnCode_t status = HelloWorldWriter->write(msgInstance, DDS::HANDLE_NIL);
checkStatus(status, "MsgDataWriter::write");
//os_nanoSleep(delay_1s);
/* Remove the DataWriters */
mgr.deleteWriter();
/* Remove the Publisher. */
mgr.deletePublisher();
/* Remove the Topics. */
mgr.deleteTopic();
/* Remove Participant. */
mgr.deleteParticipant();
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_Create_Participants_clicked()
{
DDSEntityManager mgr;
// create domain participant
mgr.createParticipant("HelloWorld example");
//create type
mt = new MsgTypeSupport();
mgr.registerType(mt.in());
//create Topic
char topic_name[] = "HelloWorldData_Msg";
mgr.createTopic(topic_name);
//create Publisher
mgr.createPublisher();
// create DataWriter :
// If autodispose_unregistered_instances is set to true (default value),
// you will have to start the subscriber before the publisher
bool autodispose_unregistered_instances = false;
mgr.createWriter(autodispose_unregistered_instances);
// Publish Events
DataWriter_var dwriter = mgr.getWriter();
MsgDataWriter_var HelloWorldWriter = MsgDataWriter::_narrow(dwriter.in());
Msg msgInstance; /* Example on Stack */
QString message;
message = ui->transmit_text->toPlainText();
msgInstance.userID = 1;
msgInstance.message = message.toUtf8().constData();
ui->plainTextEdit_Publish->setPlainText("Start Message:-");
ui->plainTextEdit_Publish->setPlainText( "userID : " +
QString(msgInstance.userID));
ui->plainTextEdit_Publish->setPlainText("Message : " +
QString( msgInstance.message));
ReturnCode_t status = HelloWorldWriter->write(msgInstance, DDS::HANDLE_NIL);
checkStatus(status, "MsgDataWriter::write");
//os_nanoSleep(delay_1s);
/* Remove the DataWriters */
mgr.deleteWriter();
/* Remove the Publisher. */
mgr.deletePublisher();
/* Remove the Topics. */
mgr.deleteTopic();
/* Remove Participant. */
mgr.deleteParticipant();
}
void MainWindow::on_Quit_clicked()
{
QCoreApplication::exit();
}
/**************************************************************************/
mainwindow.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include "ccpp_HelloWorldData.h"
#include "ccpp_dds_dcps.h"
//#include "subscriberthread.h"
using namespace HelloWorldData; // Very important to declare this namespace
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
//subscriberthread* subs=new subscriberthread;
MsgTypeSupport_var mt;
Ui::MainWindow *ui;
private slots:
void on_Create_Participants_clicked();
void on_Quit_clicked();
private:
//MsgTypeSupport_var mt;
};
#endif // MAINWINDOW_H
Appendix “B” : Subscriber mainwindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "QString"
#include <string>
#include <sstream>
#include <iostream>
#include "DDSEntityManager.h"
#include "ccpp_HelloWorldData.h"
#include "os.h"
#include "ccpp_dds_dcps.h"
//#include "subscriberthread.h"
#include <unistd.h>
#include "CheckStatus.h"
#include <qthread.h>
using namespace DDS;
DDSEntityManager subs;
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_Subscribe_clicked()
{
MsgSeq msgList;
SampleInfoSeq infoSeq;
// create domain participants
subs.createParticipant("HelloWorld example");
//create type
MsgTypeSupport_var mt = new MsgTypeSupport();
subs.registerType(mt.in());
//create Topic
char topic_name[] = "HelloWorldData_Msg";
subs.createTopic(topic_name);
//create Subscriber
subs.createSubscriber();
// create DataReader
subs.createReader();
DataReader_var dreader = subs.getReader();
MsgDataReader_var HelloWorldReader = MsgDataReader::_narrow(dreader.in());
checkHandle(HelloWorldReader.in(), "MsgDataReader::_narrow");
ui->plainTextEdit_Subscribe->setPlainText("=== [Subscriber] Ready ...");
// Q_EMIT receivedtext("=== [Subscriber] Ready ...");
bool closed = false;
ReturnCode_t status = - 1;
int count = 0;
while (!closed && count < 1500) // We dont want the example to run
indefinitely
{
status = HelloWorldReader->take(msgList, infoSeq, LENGTH_UNLIMITED,
ANY_SAMPLE_STATE, ANY_VIEW_STATE, ANY_INSTANCE_STATE);
checkStatus(status, "msgDataReader::take");
for (DDS::ULong j = 0; j < msgList.length(); j++)
{
ui->plainTextEdit_Subscribe->setPlainText("=== [Subscriber] message
received :");
// cout << " userID : " << msgList[j].userID << endl;
// cout << " Message : "" << msgList[j].message << """ << endl;
ui->plainTextEdit_Subscribe->setPlainText(QString::number(msgList[j].userID));
ui->plainTextEdit_Subscribe->setPlainText(QString(msgList[j].message));
closed = true;
}
status = HelloWorldReader->return_loan(msgList, infoSeq);
checkStatus(status, "MsgDataReader::return_loan");
//QThread::msleep(8);
++count;
}
//cleanup
subs.deleteReader();
subs.deleteSubscriber();
subs.deleteTopic();
subs.deleteParticipant();
}
void MainWindow::on_Quit_clicked()
{
QCoreApplication::exit();
}
/**************************************************************************/
mainwindow.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include "ccpp_HelloWorldData.h"
#include "ccpp_dds_dcps.h"
//#include "subscriberthread.h"
using namespace HelloWorldData; // very important to declare this namespace
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
MsgTypeSupport_var mt;
Ui::MainWindow *ui;
private slots:
void on_Subscribe_clicked();
void on_Quit_clicked();
private:
};
#endif // MAINWINDOW_H

More Related Content

Similar to Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2

DPDK in Containers Hands-on Lab
DPDK in Containers Hands-on LabDPDK in Containers Hands-on Lab
DPDK in Containers Hands-on LabMichelle Holley
 
9 creating cent_os 7_mages_for_dpdk_training
9 creating cent_os 7_mages_for_dpdk_training9 creating cent_os 7_mages_for_dpdk_training
9 creating cent_os 7_mages_for_dpdk_trainingvideos
 
Os dev tool box
Os dev tool boxOs dev tool box
Os dev tool boxbpowell29a
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014biicode
 
Lean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushLean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushPantheon
 
Red Teaming macOS Environments with Hermes the Swift Messenger
Red Teaming macOS Environments with Hermes the Swift MessengerRed Teaming macOS Environments with Hermes the Swift Messenger
Red Teaming macOS Environments with Hermes the Swift MessengerJustin Bui
 
R server and spark
R server and sparkR server and spark
R server and sparkBAINIDA
 
IR Journal (itscholar.codegency.co.in).pdf
IR Journal (itscholar.codegency.co.in).pdfIR Journal (itscholar.codegency.co.in).pdf
IR Journal (itscholar.codegency.co.in).pdfRahulRoy130127
 
7 hands on
7 hands on7 hands on
7 hands onvideos
 
Install and configure linux
Install and configure linuxInstall and configure linux
Install and configure linuxVicent Selfa
 
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins Mando Stam
 
Install Oracle 12c Golden Gate On Oracle Linux
Install Oracle 12c Golden Gate On Oracle LinuxInstall Oracle 12c Golden Gate On Oracle Linux
Install Oracle 12c Golden Gate On Oracle LinuxArun Sharma
 

Similar to Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2 (20)

DPDK in Containers Hands-on Lab
DPDK in Containers Hands-on LabDPDK in Containers Hands-on Lab
DPDK in Containers Hands-on Lab
 
Readme
ReadmeReadme
Readme
 
ABCs of docker
ABCs of dockerABCs of docker
ABCs of docker
 
9 creating cent_os 7_mages_for_dpdk_training
9 creating cent_os 7_mages_for_dpdk_training9 creating cent_os 7_mages_for_dpdk_training
9 creating cent_os 7_mages_for_dpdk_training
 
Os dev tool box
Os dev tool boxOs dev tool box
Os dev tool box
 
Install guide
Install guideInstall guide
Install guide
 
Install guide
Install guideInstall guide
Install guide
 
Ddev workshop t3dd18
Ddev workshop t3dd18Ddev workshop t3dd18
Ddev workshop t3dd18
 
Docker Starter Pack
Docker Starter PackDocker Starter Pack
Docker Starter Pack
 
Open Dayligth usando SDN-NFV
Open Dayligth usando SDN-NFVOpen Dayligth usando SDN-NFV
Open Dayligth usando SDN-NFV
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 
Lean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushLean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and Drush
 
Red Teaming macOS Environments with Hermes the Swift Messenger
Red Teaming macOS Environments with Hermes the Swift MessengerRed Teaming macOS Environments with Hermes the Swift Messenger
Red Teaming macOS Environments with Hermes the Swift Messenger
 
R server and spark
R server and sparkR server and spark
R server and spark
 
IR Journal (itscholar.codegency.co.in).pdf
IR Journal (itscholar.codegency.co.in).pdfIR Journal (itscholar.codegency.co.in).pdf
IR Journal (itscholar.codegency.co.in).pdf
 
7 hands on
7 hands on7 hands on
7 hands on
 
Howto Pxeboot
Howto PxebootHowto Pxeboot
Howto Pxeboot
 
Install and configure linux
Install and configure linuxInstall and configure linux
Install and configure linux
 
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins
 
Install Oracle 12c Golden Gate On Oracle Linux
Install Oracle 12c Golden Gate On Oracle LinuxInstall Oracle 12c Golden Gate On Oracle Linux
Install Oracle 12c Golden Gate On Oracle Linux
 

Recently uploaded

Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).pptssuser5c9d4b1
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxhumanexperienceaaa
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...ranjana rawat
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 

Recently uploaded (20)

Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 

Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2

  • 1. Recipe to Build Open Splice DDS Ver 6.3.xxx Hello World Example Over Qt 5.2 1. This recipe is developed to help those who could face problem in deploying Open Splice DDS Ver 6.3.xxx over Qt 5.2. This recipe would help them to develop GUI based applications over LINUX. 2. Following are steps wise details :- Pre-requisite: According to my station following is the configuration:-. a. Ubuntu 13.10 b. Qt 5.2.0 based on (GCC 4.6.1, 32 bit) c. GCC 4.8.1 d. autoconf e. automake f. build-essential g. OpenSpliceDDSV6.3.130716OSS-HDE-x86.linux-gcc4.6-glibc2.15 for LINUX kernel 3.0 and above. (Download from following link) http://www.prismtech.com/opensplice/opensplice-dds-community/software-downloads ) Step No 1: Configure Environmental Settings 3. Create a folder opensplice in /home/xxxxx.xxx copy the above downloaded open splice api folder and unzip. Or you can unzip anywhere else but for easy reference use /home folder. 4. Open a Terminal in Ubuntu and go inside the folder as mentioned below:- >cd /home/xxxxx.xxxx/opensplice/HDE/x86.linux2.6 >ls -all {This command is use to check the directory. Check availability of file release.com.} >chmod 777 release.com Note: This command make release.com an executable 5. release.com contains environmental settings which are mandatory to build any application based on open splice DDS. Open release.com in any text editor analyze it. As mentioned below:-
  • 2. 6. At line OSPL_HOME=”/home/..../opensplice/HDE/.... ” you can add your own address where you had un-ziped the folder. Moreover, edit CPATH variable and replace with following paths:- CPATH=$OSPL_HOME/include/dcps/C++/CCPP:$OSPL_HOME/include/dcps/C++/isocpp: $OSPL_HOME/include/dcps/C++/SACPP:$OSPL_HOME/include: $OSPL_HOME/include/sys:${CPATH:=} 7. There are three ways to load these environmental setting:- Option 1: Just write following line on the command prompt. >. ./release.com 8. This suppose to work but if due to some reasons setting are not loaded then we have to load each setting manually mentioned in option 2. but to check setting are loaded, write following lines and check the response. > echo $OSPL_HOME > echo $OSPL_TARGET > echo $PATH > echo $LD_LIBRARY_PATH > echo $CPATH > echo $OSPL_URI > echo $OSPL_TMPL_PATH Option 2: Load each line over command prompt one by one and check SPLICE_JDK=jdk export SPLICE_JDK export OSPL_HOME="/home/....../opensplice/HDE/x86.linux2.6" echo $OSPL_HOME export OSPL_TARGET=x86.linux2.6 echo $OSPL_TARGET export PATH=$OSPL_HOME/bin:$PATH
  • 3. echo $PATH export LD_LIBRARY_PATH=$OSPL_HOME/lib${LD_LIBRARY_PATH:+: $LD_LIBRARY_PATH echo $LD_LIBRARY_PATH export CPATH=$OSPL_HOME/include:$OSPL_HOME/include/sys:${CPATH:=} echo $CPATH export OSPL_URI=file://$OSPL_HOME/etc/config/ospl.xml echo $OSPL_URI export OSPL_TMPL_PATH=$OSPL_HOME/etc/idlpp echo $OSPL_TMPL_PATH $OSPL_HOME/etc/java/defs.$SPLICE_JDK Option 3: Open the file /etc/environment as root and update. Add lines mentioned in option # 2 (Note: load each setting manually on terminal and copy output of echo $xxxx command; for reference setting are mentioned below):- >sudo nano /etc/environment 9. nano is a text editor if it is not install use following command and connect to INTERNET. >sudo apt-get update >sudo apt-get install nano 10. update the environment file . 11. Add following lines as mentioned in above picture (../adilkhan/ would be replace with your system folder address). PATH=/home/xxx.xxxx/opensplice/HDE/x86.linux2.6/etc/idlpp:/home/xxx.xxxx/opensplice/HDE/x86.linux2 .6/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games OSPL_HOME=/home/xxx.xxxx/opensplice/HDE/x86.linux2.6 OSPL_TARGET=x86.linux2.6 LD_LIBRARY_PATH=/home/xxx.xxxx/opensplice/HDE/x86.linux2.6/lib CPATH=/home/xxx.xxxx/opensplice/HDE/x86.linux2.6/include:/home/xxx.xxxx/opensplice/HDE/x86.linux 2.6/include/sys:/home/xxx.xxxx/opensplice/HDE/x86.linux2.6/include/dcps/C+ +/SACPP:/home/xxx.xxxx/opensplice/HDE/x86.linux2.6/include/dcps/C+ +/CCPP:/home/xxx.xxxx/opensplice/HDE/x86.linux2.6/include/dcps/C++/isocpp OSPL_URI=file:///home/xxx.xxxx/opensplice/HDE/x86.linux2.6/etc/config/ospl.xml
  • 4. OSPL_TMPL_PATH=/home/xxx.xxxx/opensplice/HDE/x86.linux2.6/etc/idlpp QTDIR=/home/xxx.xxxx/Qt5.2.0/5.2.0/gcc CLASSPATH=/home/xxx.xxxx/opensplice/HDE/x86.linux2.6/jar/dcpssaj.jar:/home/xxx.xxxx/opensplice/HD E/x86.linux2.6/jar/dcpscj.jar:$CLASSPATH 12. Now, execute following line on terminal. >source /etc/environment 10. Important Note : Always load these setting using any of the above options. Step No 2: Starting Qt 5.2 Creator 11. Open terminal and load environmental setting as mentioned in Step No 1. 12. Using same terminal instance, navigate to Qt 5.2 folder. Note: If other terminal is use to load Qt Creator, then environmental setting shall not be valid. >cd /home/.../opensplice/HDE/x86.linux2.6 >. ./release.com >cd /home/..../Qt5.2/Tools/QtCreator/bin >./qtcreator Step No 3: Hello World Publisher 13. This recipe takes you step by step to convert Hello World example into QT based GUI application. However, this is not a tutorial to Qt but, I shall be using Qt terminologies directly:- (a) Create two new projects using Qt Widget Application:-
  • 5. (b) Add project name HelloWorldDDS_Publisher for first and HelloWorldDDS_Subscriber for second. (c) Copy Checkstatus.cpp & .h / DDSEntityManager.cpp & .h / HelloWorldData.idl from opensplice HelloWorld (C++) example folder into project folder separately (copying separately is just to keep it isolated). Open another terminal load environmental settings, then go into project folder where HelloWorldData.idl file is copied and execute following command. It would generate requisite file to configure topic and its type support:- > idlpp -S -l cpp HelloWorldData.idl (d) Add above generated files as existing files along with Checkstatus.cpp & .h / DDSEntityManager.cpp & .h into the project. (e) Go inside project build setting and edit build environment. Add all the Paths and setting mentioned in Step # 1 : option # 3.
  • 6. (f) Add library. Select external library then select LINUX as platform and browse. Go in to a folder /home/..../opensplice/HDE/x86.linux2.6/lib and add each library one by one. This will update HelloWorldDDS_Publisher.pro and HelloWorldDDS_Subscriber.pro as shown in picture. (g) Create user interface as shown below:- - (h) Edit mainwindow.cpp & .h files of both the projects as per attached Appendix A & B. However, complete project folder is also available with this document. (j) Build the application, If there is some error try to find out over INTERNET or consult me over INTERNET for any query (adil53@pnec.nust.edu.pk) 14. Execute both projects on same or different computers and connect these computers over LAN or WiFi and enjoy DDS communication . It is better to launch from terminal after loading environmental settings. 16. Use this recipe and play with different idl files and multiple QoS (quality of service). You are allowed to share this recipe with any body. Regards Adil Khan
  • 7. Appendix “A” Publisher mainwindow.cpp #include "mainwindow.h" #include "ui_mainwindow.h" #include "QString" #include <string> #include <sstream> #include <iostream> #include "DDSEntityManager.h" #include "ccpp_HelloWorldData.h" #include "os.h" #include "ccpp_dds_dcps.h" //#include "subscriberthread.h" #include <unistd.h> #include "CheckStatus.h" using namespace DDS; MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); //QObject::connect(subscriberthread, SIGNAL(receivedtext(QString)), ui->plainTextEdit_Subscribe, SLOT(setPlainText(QString))); DDSEntityManager mgr; // create domain participant mgr.createParticipant("HelloWorld example"); //create type mt = new MsgTypeSupport(); mgr.registerType(mt.in()); //create Topic char topic_name[] = "HelloWorldData_Msg"; mgr.createTopic(topic_name); //create Publisher mgr.createPublisher(); // create DataWriter : // If autodispose_unregistered_instances is set to true (default value), // you will have to start the subscriber before the publisher bool autodispose_unregistered_instances = false; mgr.createWriter(autodispose_unregistered_instances); // Publish Events DataWriter_var dwriter = mgr.getWriter(); MsgDataWriter_var HelloWorldWriter = MsgDataWriter::_narrow(dwriter.in()); Msg msgInstance; /* Example on Stack */ msgInstance.userID = 1; msgInstance.message = DDS::string_dup("Hello World");
  • 8. ui->plainTextEdit_Publish->setPlainText("Start Message:-"); ui->plainTextEdit_Publish->setPlainText( "userID : " + QString(msgInstance.userID)); ui->plainTextEdit_Publish->setPlainText("Message : " + QString( msgInstance.message)); ReturnCode_t status = HelloWorldWriter->write(msgInstance, DDS::HANDLE_NIL); checkStatus(status, "MsgDataWriter::write"); //os_nanoSleep(delay_1s); /* Remove the DataWriters */ mgr.deleteWriter(); /* Remove the Publisher. */ mgr.deletePublisher(); /* Remove the Topics. */ mgr.deleteTopic(); /* Remove Participant. */ mgr.deleteParticipant(); } MainWindow::~MainWindow() { delete ui; } void MainWindow::on_Create_Participants_clicked() { DDSEntityManager mgr; // create domain participant mgr.createParticipant("HelloWorld example"); //create type mt = new MsgTypeSupport(); mgr.registerType(mt.in()); //create Topic char topic_name[] = "HelloWorldData_Msg"; mgr.createTopic(topic_name); //create Publisher mgr.createPublisher(); // create DataWriter : // If autodispose_unregistered_instances is set to true (default value), // you will have to start the subscriber before the publisher bool autodispose_unregistered_instances = false; mgr.createWriter(autodispose_unregistered_instances); // Publish Events DataWriter_var dwriter = mgr.getWriter(); MsgDataWriter_var HelloWorldWriter = MsgDataWriter::_narrow(dwriter.in()); Msg msgInstance; /* Example on Stack */ QString message; message = ui->transmit_text->toPlainText(); msgInstance.userID = 1; msgInstance.message = message.toUtf8().constData(); ui->plainTextEdit_Publish->setPlainText("Start Message:-"); ui->plainTextEdit_Publish->setPlainText( "userID : " + QString(msgInstance.userID));
  • 9. ui->plainTextEdit_Publish->setPlainText("Message : " + QString( msgInstance.message)); ReturnCode_t status = HelloWorldWriter->write(msgInstance, DDS::HANDLE_NIL); checkStatus(status, "MsgDataWriter::write"); //os_nanoSleep(delay_1s); /* Remove the DataWriters */ mgr.deleteWriter(); /* Remove the Publisher. */ mgr.deletePublisher(); /* Remove the Topics. */ mgr.deleteTopic(); /* Remove Participant. */ mgr.deleteParticipant(); } void MainWindow::on_Quit_clicked() { QCoreApplication::exit(); } /**************************************************************************/ mainwindow.h #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include "ccpp_HelloWorldData.h" #include "ccpp_dds_dcps.h" //#include "subscriberthread.h" using namespace HelloWorldData; // Very important to declare this namespace namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); //subscriberthread* subs=new subscriberthread; MsgTypeSupport_var mt; Ui::MainWindow *ui; private slots: void on_Create_Participants_clicked(); void on_Quit_clicked(); private: //MsgTypeSupport_var mt; }; #endif // MAINWINDOW_H
  • 10. Appendix “B” : Subscriber mainwindow.cpp #include "mainwindow.h" #include "ui_mainwindow.h" #include "QString" #include <string> #include <sstream> #include <iostream> #include "DDSEntityManager.h" #include "ccpp_HelloWorldData.h" #include "os.h" #include "ccpp_dds_dcps.h" //#include "subscriberthread.h" #include <unistd.h> #include "CheckStatus.h" #include <qthread.h> using namespace DDS; DDSEntityManager subs; MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); } MainWindow::~MainWindow() { delete ui; } void MainWindow::on_Subscribe_clicked() { MsgSeq msgList; SampleInfoSeq infoSeq; // create domain participants subs.createParticipant("HelloWorld example"); //create type MsgTypeSupport_var mt = new MsgTypeSupport(); subs.registerType(mt.in()); //create Topic char topic_name[] = "HelloWorldData_Msg"; subs.createTopic(topic_name); //create Subscriber subs.createSubscriber(); // create DataReader subs.createReader(); DataReader_var dreader = subs.getReader(); MsgDataReader_var HelloWorldReader = MsgDataReader::_narrow(dreader.in()); checkHandle(HelloWorldReader.in(), "MsgDataReader::_narrow");
  • 11. ui->plainTextEdit_Subscribe->setPlainText("=== [Subscriber] Ready ..."); // Q_EMIT receivedtext("=== [Subscriber] Ready ..."); bool closed = false; ReturnCode_t status = - 1; int count = 0; while (!closed && count < 1500) // We dont want the example to run indefinitely { status = HelloWorldReader->take(msgList, infoSeq, LENGTH_UNLIMITED, ANY_SAMPLE_STATE, ANY_VIEW_STATE, ANY_INSTANCE_STATE); checkStatus(status, "msgDataReader::take"); for (DDS::ULong j = 0; j < msgList.length(); j++) { ui->plainTextEdit_Subscribe->setPlainText("=== [Subscriber] message received :"); // cout << " userID : " << msgList[j].userID << endl; // cout << " Message : "" << msgList[j].message << """ << endl; ui->plainTextEdit_Subscribe->setPlainText(QString::number(msgList[j].userID)); ui->plainTextEdit_Subscribe->setPlainText(QString(msgList[j].message)); closed = true; } status = HelloWorldReader->return_loan(msgList, infoSeq); checkStatus(status, "MsgDataReader::return_loan"); //QThread::msleep(8); ++count; } //cleanup subs.deleteReader(); subs.deleteSubscriber(); subs.deleteTopic(); subs.deleteParticipant(); } void MainWindow::on_Quit_clicked() { QCoreApplication::exit(); } /**************************************************************************/ mainwindow.h #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include "ccpp_HelloWorldData.h" #include "ccpp_dds_dcps.h" //#include "subscriberthread.h" using namespace HelloWorldData; // very important to declare this namespace
  • 12. namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); MsgTypeSupport_var mt; Ui::MainWindow *ui; private slots: void on_Subscribe_clicked(); void on_Quit_clicked(); private: }; #endif // MAINWINDOW_H