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

What's hot

Introduction to the OMG Systems Modeling Language (SysML), Version 2
Introduction to the OMG Systems Modeling Language (SysML), Version 2Introduction to the OMG Systems Modeling Language (SysML), Version 2
Introduction to the OMG Systems Modeling Language (SysML), Version 2Ed Seidewitz
 
Developer Student Clubs NUK - Flutter for Beginners
Developer Student Clubs NUK - Flutter for BeginnersDeveloper Student Clubs NUK - Flutter for Beginners
Developer Student Clubs NUK - Flutter for BeginnersJiaxuan Lin
 
Seminar presentation on OpenGL
Seminar presentation on OpenGLSeminar presentation on OpenGL
Seminar presentation on OpenGLMegha V
 
What is flutter and why should i care?
What is flutter and why should i care?What is flutter and why should i care?
What is flutter and why should i care?Sergi Martínez
 
How to cross compile ROS2 distro by taken VxWorks RTOS as an example
How to cross compile ROS2 distro by taken VxWorks RTOS as an exampleHow to cross compile ROS2 distro by taken VxWorks RTOS as an example
How to cross compile ROS2 distro by taken VxWorks RTOS as an exampleAndrei Kholodnyi
 
Hexagonal Architecture: The Standard for Qt Embedded Applications
Hexagonal Architecture: The Standard for Qt Embedded ApplicationsHexagonal Architecture: The Standard for Qt Embedded Applications
Hexagonal Architecture: The Standard for Qt Embedded ApplicationsBurkhard Stubert
 
Introduction to Multimedia Design and Development
Introduction to Multimedia Design and DevelopmentIntroduction to Multimedia Design and Development
Introduction to Multimedia Design and DevelopmentNana Kofi Annan PhD
 
Rust Embedded Development on ESP32 and basics of Async with Embassy
Rust Embedded Development on ESP32 and basics of Async with EmbassyRust Embedded Development on ESP32 and basics of Async with Embassy
Rust Embedded Development on ESP32 and basics of Async with EmbassyJuraj Michálek
 
Cross platform app development with flutter
Cross platform app development with flutterCross platform app development with flutter
Cross platform app development with flutterHwan Jo
 
08 android multimedia_framework_overview
08 android multimedia_framework_overview08 android multimedia_framework_overview
08 android multimedia_framework_overviewArjun Reddy
 
Mobile DevOps pipeline using Google Flutter
Mobile DevOps pipeline using Google FlutterMobile DevOps pipeline using Google Flutter
Mobile DevOps pipeline using Google FlutterAhmed Abu Eldahab
 
DPDK & Layer 4 Packet Processing
DPDK & Layer 4 Packet ProcessingDPDK & Layer 4 Packet Processing
DPDK & Layer 4 Packet ProcessingMichelle Holley
 

What's hot (20)

Om net++
Om net++Om net++
Om net++
 
Introduction to the OMG Systems Modeling Language (SysML), Version 2
Introduction to the OMG Systems Modeling Language (SysML), Version 2Introduction to the OMG Systems Modeling Language (SysML), Version 2
Introduction to the OMG Systems Modeling Language (SysML), Version 2
 
Developer Student Clubs NUK - Flutter for Beginners
Developer Student Clubs NUK - Flutter for BeginnersDeveloper Student Clubs NUK - Flutter for Beginners
Developer Student Clubs NUK - Flutter for Beginners
 
Flutter
FlutterFlutter
Flutter
 
Seminar presentation on OpenGL
Seminar presentation on OpenGLSeminar presentation on OpenGL
Seminar presentation on OpenGL
 
What is flutter and why should i care?
What is flutter and why should i care?What is flutter and why should i care?
What is flutter and why should i care?
 
Flutter workshop
Flutter workshopFlutter workshop
Flutter workshop
 
Flutter
FlutterFlutter
Flutter
 
How to cross compile ROS2 distro by taken VxWorks RTOS as an example
How to cross compile ROS2 distro by taken VxWorks RTOS as an exampleHow to cross compile ROS2 distro by taken VxWorks RTOS as an example
How to cross compile ROS2 distro by taken VxWorks RTOS as an example
 
Hexagonal Architecture: The Standard for Qt Embedded Applications
Hexagonal Architecture: The Standard for Qt Embedded ApplicationsHexagonal Architecture: The Standard for Qt Embedded Applications
Hexagonal Architecture: The Standard for Qt Embedded Applications
 
Introduction to Flutter
Introduction to FlutterIntroduction to Flutter
Introduction to Flutter
 
Introduction to Multimedia Design and Development
Introduction to Multimedia Design and DevelopmentIntroduction to Multimedia Design and Development
Introduction to Multimedia Design and Development
 
Rust Embedded Development on ESP32 and basics of Async with Embassy
Rust Embedded Development on ESP32 and basics of Async with EmbassyRust Embedded Development on ESP32 and basics of Async with Embassy
Rust Embedded Development on ESP32 and basics of Async with Embassy
 
Cross platform app development with flutter
Cross platform app development with flutterCross platform app development with flutter
Cross platform app development with flutter
 
08 android multimedia_framework_overview
08 android multimedia_framework_overview08 android multimedia_framework_overview
08 android multimedia_framework_overview
 
Mobile DevOps pipeline using Google Flutter
Mobile DevOps pipeline using Google FlutterMobile DevOps pipeline using Google Flutter
Mobile DevOps pipeline using Google Flutter
 
DPDK & Layer 4 Packet Processing
DPDK & Layer 4 Packet ProcessingDPDK & Layer 4 Packet Processing
DPDK & Layer 4 Packet Processing
 
C programming first_session
C programming first_sessionC programming first_session
C programming first_session
 
Understanding open max il
Understanding open max ilUnderstanding open max il
Understanding open max il
 
Design and Concepts of Android Graphics
Design and Concepts of Android GraphicsDesign and Concepts of Android Graphics
Design and Concepts of Android Graphics
 

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

[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis OverviewLeo Lorieri
 
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
 

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

Native Hadoop with prebuilt spark
Native Hadoop with prebuilt sparkNative Hadoop with prebuilt spark
Native Hadoop with prebuilt spark
 
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
 
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
 

Recently uploaded

Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHC Sai Kiran
 
Piping Basic stress analysis by engineering
Piping Basic stress analysis by engineeringPiping Basic stress analysis by engineering
Piping Basic stress analysis by engineeringJuanCarlosMorales19600
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfROCENODodongVILLACER
 
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgUnit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgsaravananr517913
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvLewisJB
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleAlluxio, Inc.
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catcherssdickerson1
 
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncWhy does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncssuser2ae721
 
Indian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptIndian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptMadan Karki
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
welding defects observed during the welding
welding defects observed during the weldingwelding defects observed during the welding
welding defects observed during the weldingMuhammadUzairLiaqat
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 

Recently uploaded (20)

Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECH
 
Piping Basic stress analysis by engineering
Piping Basic stress analysis by engineeringPiping Basic stress analysis by engineering
Piping Basic stress analysis by engineering
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdf
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgUnit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvv
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at Scale
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
 
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncWhy does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
 
Indian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptIndian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.ppt
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
welding defects observed during the welding
welding defects observed during the weldingwelding defects observed during the welding
welding defects observed during the welding
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 

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