Você está na página 1de 20

Application description 06/2014

Qt/C++
Example of a client-server
application

http://support.automation.siemens.com/WW/view/en/90278134

Warranty and liability

Warranty and liability


Note

The application examples are non-binding and do not claim to be complete in


terms of configuration and equipment or to take account of any other
contingencies. The application examples do not represent specific customer
solutions; they are intended only as support for typical tasks. The user has sole
responsibility for ensuring correct operation of the products described. These
application examples do not exempt the user from their due diligence obligation
with regard to application, installation, operation and maintenance. By using
these application examples, you agree that Siemens cannot be made liable for
possible damage beyond the mentioned liability clause. We reserve the right to
make changes to these application examples at any time and without prior
notice. If there are any differences between the suggestions made in these
application examples and other Siemens publications such as catalogs, the
contents of the other document(s) take priority.
We do not provide a warranty for any of the information contained in this document.

Siemens AG 2014 All rights reserved

We accept no liability for any damage or loss caused by the examples, information,
programs, planning data or performance data described in this application
example, irrespective of the legal basis for claims arising from such damage or
loss, unless liability is mandatory. For example, according to the product liability
law, in cases of malfeasance, gross negligence, due to endangerment of life, body
or health, due to assumption of a guarantee for a product's characteristics of state,
due to malicious concealment of a defect or due to violation of basic contractual
obligations. Any compensation for violation of basic contractual obligations,
however, shall be limited to the foreseeable damage or loss which is typically
envisaged in contracts unless there has been gross negligence or unless liability is
mandatory due to endangerment of life, body, or health. Any change to the burden
of proof to your disadvantage is not covered hereby.

Copyright

Any form of duplication of these application examples or excerpts hereof is not


permitted without the express consent of Siemens Industry Sector.

Caution
The functions and solutions described in this article are restricted primarily to the
implementation of the automation task. Please also observe that in case of
networking your plant/system with other plant units, the company network or the
Internet, appropriate protective measures within the framework of industrial security
must be adopted. For more information, see the Article ID 50203404.
http://support.automation.siemens.com/WW/view/de/50203404

Qt/C++ Client Server Application


Entry ID: 90278134, V1.0, 06/2014

Table of contents

Table of contents
Warranty and liability................................................................................................... 2
1

Client-server structure ...................................................................................... 4


1.1
1.2
1.3
1.3.1

Project engineering of the server application ................................................ 7


2.1
2.2
2.3
2.4

Project settings ..................................................................................... 7


NcPlcServer ......................................................................................... 9
Hotlink................................................................................................. 13
Output of the file and creation of library ............................................. 16

Integrating the server application into a client ............................................. 17


3.1
3.1.1
3.1.2
3.1.3
3.1.4
3.2
3.2.1
3.2.2
3.2.3
3.2.4

Preparation ......................................................................................... 17
Creating a project ............................................................................... 17
Copy server files into the project folder .............................................. 17
Insert NcPlcServer.h into a project ..................................................... 17
Linking the header file of the form with NcPlcServer.h and
NCPlcServer.lib .................................................................................. 17
Execution ............................................................................................ 19
Set up hotlink to variable in constructor ............................................. 19
Address hotlink ................................................................................... 19
Disconnect client from server and disconnect hotlink ........................ 19
Result ................................................................................................. 19

Contact persons .............................................................................................. 20

History............................................................................................................... 20

Copyright

Siemens AG 2014 All rights reserved

Tasks and possible applications .......................................................... 4


Example for a Client-server architecture .............................................. 4
Software components........................................................................... 6
Used components ................................................................................ 6

Qt/C++ Client Server Application


Entry ID: 90278134, V1.0, 06/2014

1 Client-server structure

Client-server structure

1.1

Tasks and possible applications


A client-server architecture is used to manage and edit requests from the input of
the HMI (client) in an orderly fashion via a server application.
Several clients appear for multi-channel machines, for example. One channel
(HMI) is used to process a workpiece. The second channel controls a background
magazine for tool sorting on a separate HMI
The reasons for a client-server application are as follows:
The server controls the communication between clients and NC, PLC and drive
and machine data.
An orderly structure facilitates the HMI service (especially if there are different
machine series).
If several clients access one data unit, the processing is done in successive
order. This prevents failed access attempts.
Due to the installation of certain functions, such as a log service, the server
can give conclusions about software malfunctions.

Copyright

Siemens AG 2014 All rights reserved

The server could be started upon HMI ramp up and already provide valuable
information for its clients in advance.
The server can be configured in such a way that the machine design and
series can be detected by the server. Relevant HMI data can also be provided
by the server, assuming that the OEM has installed an HMI project on the
server. The benefit is reduced complexity.
Complex machines, with robotic loading for example, have a client-server
application. This allows the server to control the communication with the robots
and to coordinate the loading of the machine tools.

1.2

Example for a Client-server architecture


The layout of a client-server structure should be explained in the following. Calling
up a hotlink to an NC variable is limited for this. Mirroring this structure, additional
functions such as a log service can be integrated. The program can run on the
SINUMERIK PCU solution.
Project engineering in Visual Studio 2008 requires that a unique .dll file (dynamic
library) be written for the server application. In the solution listed below, the
creation, management and deletion of one or more hotlinks and the adding and
deleting of clients are controlled in this .dll file in a targeted manner. The library of
the server application must also be integrated in the respective client project so
that communication can take place.
The more tasks an individual HMI must fulfill, the more important the server
application is, because higher-level functions and management become more
important. The querying of an NC variable takes place in the current example (Fig.
2-1). This takes place starting with Client_1 via the server application by means of
a Qt-proprietary signal/slot process (yellow arrow). The server application
maintains a connection to the SlQCap service via a hotlink. If the value of the NC
variable changes, Client_1 receives a feedback message about the changed value
by means of signal/slot. This also applies to all additional clients.

Qt/C++ Client Server Application


Entry ID: 90278134, V1.0, 06/2014

1 Client-server structure

Schematic diagram
The following figure shows the principle of a client-server architecture as an
example for the data handling of the SINUMERIK.

Copyright

Siemens AG 2014 All rights reserved

Fig. 2-1 Principle of client-server architecture

Required knowledge
The following knowledge is required:
Programming language C++
Programming Manual for SINUMERIK 840D sl
SINUMERIK Operate programming package for Qt/C++
Development environment Qt

Qt/C++ Client Server Application


Entry ID: 90278134, V1.0, 06/2014

1 Client-server structure

1.3

Software components

1.3.1

Used components
The application was created using the following components:

Sample files and projects


The list below contains all the files and projects used in this example.

Copyright

Siemens AG 2014 All rights reserved

Table 1-1

Component

Number

Order number

Note

Visual Studio 2008


Version
9.0.21022.8 RTM

External

Qt license from
digia

External

SINUMERIK 840D
SL SINUMERIK
INTEGRATE
CREATE MYHMI
/3GL SOFTWARE
VERSION 4.5 SP1

6FC5861-1YC411YA0

Creation license

SINUMERIK 840D
SL SINUMERIK
INTEGRATE RUN
MYHMI / 3GL

6FC5800-0AP600YB0

Runtime License

Qt/C++ Client Server Application


Entry ID: 90278134, V1.0, 06/2014

2 Project engineering of the server application

Project engineering of the server


application
First, the server application code must be written. Since a hotlink with Service
SlQCap is used in the current example, two source files are recommended:
"NcPlcServer.cpp"

The connection to the client is controlled

Preparations are made for a hotlink access

"Hotlink.cpp"

2.1

Automatic creation and counting up of the hotlinks

Project settings
When the Win32 project is opened, the application type "Windows application" and
the additional option "Empty project" must be observed. The Win32 project is
opened with Visual Studio 2008. The project properties have the following settings:
Configuration properties

General

Output directory

General

Intermediate directory

Copyright

Siemens AG 2014 All rights reserved

.\Debug\output
Configuration properties
.\Debug
Configuration properties

Project standards

Configuration type

Dynamic library (.dll)


Configuration properties

Debugging

Command

(leave blank)
Configuration properties
directories

Linker

General

Additional library

"$(HMI_SL_PP_SUBST)$(HMI_SL_PP_CONFIGTYPE_DEBUG)\siemen
s\sinumerik\hmi\osal\ace\lib";"$(HMI_SL_PP_SUBST)$(HMI_SL_PP_C
ONFIGTYPE_DEBUG)\siemens\sinumerik\hmi\osal\qt\lib";"$(HMI_SL_
PP_SUBST)$(HMI_SL_PP_CONFIGTYPE_DEBUG)\lib"
Configuration properties

Linker

Input

Additional dependencies

$(LIBQT_CORE_RELEASE) $(LIBQT_GUI_RELEASE)
$(LIBQT_XML_RELEASE) slgfw.lib slgfwwidget.lib slcap.lib sltrc.lib
slmd.lib sltrp.lib slhmiutilitieslib.lib slaesvcadapter.lib
slfsfilesvcadapter.lib sltraceadapter.lib slarchiveadapter.lib
Configuration properties

Linker

Extended

Import library

.\Debug\output\$(ProjectName).lib
Configuration properties
directories:

C/C++

General

Additional Include

"$(HMI_SL_PP_SUBST)include";"$(HMI_SL_PP_SUBST)gui\include";
"$(HMI_SL_PP_SUBST)$(HMI_SL_PP_CONFIGTYPE_DEBUG)\siemen
s\sinumerik\hmi\osal\qt\include";"$(HMI_SL_PP_SUBST)$(HMI_SL_P
P_CONFIGTYPE_DEBUG)\siemens\sinumerik\hmi\osal\qt\include\qt";
"$(HMI_SL_PP_SUBST)$(HMI_SL_PP_CONFIGTYPE_DEBUG)\siemen
s\sinumerik\hmi\osal\ace";"$(HMI_SL_PP_SUBST)$(HMI_SL_PP_CON
FIGTYPE_DEBUG)\siemens\sinumerik\hmi\osal\ace\TAO";.\generatedf
iles

Qt/C++ Client Server Application


Entry ID: 90278134, V1.0, 06/2014

2 Project engineering of the server application

Configuration properties

C/C++

General

Preprocessor

WIN32;_DEBUG;_WINDOWS;_USRDLL;NCPLCSERVER_EXPORTS
After the header files are added, the following configuration properties must be set:
Configuration properties
line

User-def. build step

General

Command

"$(HMI_SL_PP_SUBST)$(HMI_SL_PP_CONFIGTYPE_DEBUG)\siemen
s\sinumerik\hmi\osal\qt\bin\moc.exe" "$(InputPath)" -o
"$(InputDir)generatedfiles/moc_$(InputName).cpp"
Configuration properties

User-def. build step

General

Description

General

Outputs

MOCing $(InputFileName)...
Configuration properties

User-def. build step

Copyright

Siemens AG 2014 All rights reserved

".\GeneratedFiles\moc_$(InputName).cpp"

Qt/C++ Client Server Application


Entry ID: 90278134, V1.0, 06/2014

2 Project engineering of the server application

2.2

NcPlcServer
The tasks of the NcPlcServer are:
Add clients to server upon request
Count the number of clients
Establish client connection to server object:

Creation of server object if none is available yet

Disconnect if no more clients exist

Management of hotlink requests


The header file of the NcPlcServer and the implementation file are described
below.
//__________________________________________________________________
// NcPlcServer.h --> Description of the header file
//__________________________________________________________________

Copyright

Siemens AG 2014 All rights reserved

#ifndef _H_NCPLCSERVER_INCLUDED
#define _H_NCPLCSERVER_INCLUDED
#include
#include
#include
#include
#include

<QtCore/QObject>
<QtCore/QMap>
"qlist.h"
"slqcap.h"
"Hotlink.h" // Integrate later own class of hotlink

// Creation of a .dll for later, easier integration in client.


#ifdef NCPLCSERVER_EXPORTS
#define NCPLCSERVER_API __declspec(dllexport)
#else
#define NCPLCSERVER_API __declspec(dllimport)
#endif
class NCPLCSERVER_API NcPlcServer : public QObject
{
Q_OBJECT
public:
// The following declarations are for client/server
//______________________________________________________________
//Create/close connection to server
static NcPlcServer* connectToServer(QString sClientName);
static void disconnectFromServer(QString sClientName);
// The following declarations are for dynamic hotlinks
//______________________________________________________________
//Functions for connecting/creating a hotlink
Hotlink* attachToHotlink(QString sAddress);
void detachFromHotlink(Hotlink* p_hotlink);
//List of all hotlink objects
QList<Hotlink*> listHotlinkObjects;
// The following declarations are for client/server
//______________________________________________________________

Qt/C++ Client Server Application


Entry ID: 90278134, V1.0, 06/2014

2 Project engineering of the server application

private:
// Methods for removing and adding clients
void addClient(QString sClient);
void removeClient(QString sClient);
// Variables
static NcPlcServer* p_serverObject;
static long clientReferenceCounter;
// List of all clients
QList<QString> listClients;
};
#endif _H_NCPLCSERVER_INCLUDED
//____________________________________________________________________________
//____________________________________________________________________________
//____________________________________________________________________________

Copyright

Siemens AG 2014 All rights reserved

//__________________________________________________________________
// NcPlcServer.cpp --> Description of the implementation file
//__________________________________________________________________
#include "NcPlcServer.h"
// Pointer to the server object
NcPlcServer* NcPlcServer::p_serverObject = 0;
// Count connections of clients
long NcPlcServer::clientReferenceCounter = 0;
// Create client connection to server object
// or create server object if none is available.
//__________________________________________________
NcPlcServer* NcPlcServer::connectToServer(QString sClientName)
{
// If there is no server object yet
if ( 0 == p_serverObject )
{
// Create new server object
p_serverObject = new NcPlcServer();
}
// If server object exists
if ( p_serverObject )
{
// Add name of the new client
p_serverObject->addClient(sClientName);
}
// Increment reference of the clients
clientReferenceCounter++;
return p_serverObject;
}
// Disconnect from server
//__________________________________________________
void NcPlcServer::disconnectFromServer(QString sClientName)
{
// If clients are still connected to the server
if ( 0 < clientReferenceCounter )
{
// If server object still exists, disconnect client

Qt/C++ Client Server Application


Entry ID: 90278134, V1.0, 06/2014

10

2 Project engineering of the server application

if ( p_serverObject )
p_serverObject->removeClient(sClientName);
// Decrement reference of the clients
clientReferenceCounter--;
// If no more clients exist
if ( 0 == clientReferenceCounter )
{
// Destroy server object
delete p_serverObject;
}
}
}

Copyright

Siemens AG 2014 All rights reserved

// Insert new client in the list


//__________________________________________________
void NcPlcServer::addClient(QString sClient)
{
// Append new client at end of the list
listClients.append(sClient);
}
// Remove client from list
//__________________________________________________
void NcPlcServer::removeClient(QString sClient)
{
// Search for index of client and remove from list
listClients.removeAt(listClients.indexOf(sClient));
}
// Create hotlink or attach to hotlink
//__________________________________________________
Hotlink* NcPlcServer::attachToHotlink(QString sAddress)
{
// Status of the connection is returned
bool bStatus = false;
// Auxiliary variables, whether hotlink already exists
bool bAlreadyAttached = false;
// Iterator via the list of hotlinks
QList<Hotlink*>::iterator it;
// Iterate via the list of hotlinks
for (it = listHotlinkObjects.begin();
it != listHotlinkObjects.end(); it++)
{
// If path already exists, the following instruction exists
if ( 0 == QString::compare((*it)->getAddress(),
sAddress.toUpper()) )
{
// Set auxiliary variables
bAlreadyAttached = true;
bStatus = true;
// Increment reference
(*it)->incrementReferenceCounter();
// Exit loop
break;
}
}
// If hotlink does not yet exist
if ( !bAlreadyAttached )
{

Qt/C++ Client Server Application


Entry ID: 90278134, V1.0, 06/2014

11

2 Project engineering of the server application

// New hotlink object


Hotlink* p_hotlink = new Hotlink();
// Create hotlink to path
bStatus = p_hotlink->createHotlink(sAddress);
// Increment reference
p_hotlink->incrementReferenceCounter();
// Append new hotlink object to list
listHotlinkObjects.append(p_hotlink);
// Return reference to new hotlink object
return p_hotlink;
}
// Return reference to existing hotlink object
return *it;
// Destroy hotlink or detach from hotlink
//__________________________________________________
void NcPlcServer::detachFromHotlink(Hotlink* p_hotlink)
{
// Decrement reference if 0...
if ( (p_hotlink)->decrementReferenceCounter() )
{
//...then remove hotlink
listHotlinkObjects.removeAt
(listHotlinkObjects.indexOf(p_hotlink));
}
}

Copyright

Siemens AG 2014 All rights reserved

Qt/C++ Client Server Application


Entry ID: 90278134, V1.0, 06/2014

12

2 Project engineering of the server application

2.3

Hotlink
The tasks of the hotlink are:
Creation of a hotlink connection via SlQCap service
Counting up of the hotlinks
Forwarding the results to interested parties
The header file and the implementation file are described below.
//__________________________________________________________________
// Hotlink.h --> Description of the header file
//__________________________________________________________________
#ifndef _H_HOTLINK_INCLUDED
#define _H_HOTLINK_INCLUDED

Copyright

Siemens AG 2014 All rights reserved

#include
#include
#include
#include

<QtCore/QObject>
<QtCore/QMap>
"qlist.h"
"slqcap.h"

class Hotlink : public QObject


{
Q_OBJECT
public:
// c'tor & d'tor
Hotlink(void);
~Hotlink(void);
// Method for creating hotlink
bool createHotlink(QString sAddress);
// Getter for path of the machine data
QString getAddress();
// Methods for editing the reference
void incrementReferenceCounter();
bool decrementReferenceCounter();
private:
// Cap server objects for communication
SlQCap m_capServerHotlink;
SlQCapHandle m_capHandleHotlink;
// Name of the object, or the path
// e.g. /Channel/Parameter/R[U1,1]
QString m_sAddress;
// Variable in order to count the accesses
int m_iReferenceCounter;
signals:
// Forward data to clients
void hotlinkSignal(QVariant vValue);
private slots:

Qt/C++ Client Server Application


Entry ID: 90278134, V1.0, 06/2014

13

2 Project engineering of the server application

// Data from cap server


void receiveCapDataSlot(SlCapErrorEnum, const QVariant&, const
SlCapSupplementInfoType&);
};
#endif //_H_HOTLINK_INCLUDED

//__________________________________________________________________
// Hotlink.h --> Description of the implementation file
//__________________________________________________________________
#include "Hotlink.h"

// Destructor
//__________________________________________________
Hotlink::~Hotlink(void)
{
}
// Create hotlink to cap server
//__________________________________________________
bool Hotlink::createHotlink(QString sAddress)
{
// Save path to address
m_sAddress = sAddress.toUpper();
// Status variable
bool bStatus = false;

Copyright

Siemens AG 2014 All rights reserved

// Constructor
//__________________________________________________
Hotlink::Hotlink(void)
{
// Reference is set to zero
m_iReferenceCounter= 0;
}

// Create signal/slot connection to cap server


bStatus = QObject::connect(&m_capServerHotlink,
SIGNAL(adviseData(SlCapErrorEnum, const QVariant&, const
SlCapSupplementInfoType&)),
this,
SLOT(receiveCapDataSlot(SlCapErrorEnum, const QVariant&,
const SlCapSupplementInfoType&)));
//If connection successful...
if(true == bStatus)
{
//...assign handler and path
SlCapErrorEnum eError = m_capServerHotlink.advise(sAddress,
m_capHandleHotlink);
// If Hotlink fails, connection not successful
if(SL_CAP_OK != eError)
bStatus = false;
}
// Return status of the hotlink connection
return bStatus;
}
// Getter for path of the machine data
//__________________________________________________

Qt/C++ Client Server Application


Entry ID: 90278134, V1.0, 06/2014

14

2 Project engineering of the server application

QString Hotlink::getAddress(void)
{
return m_sAddress;
}
// Increment access reference
//__________________________________________________
void Hotlink::incrementReferenceCounter(void)
{
m_iReferenceCounter++;
}
// Decrement access reference
//__________________________________________________
bool Hotlink::decrementReferenceCounter(void)
{

Copyright

Siemens AG 2014 All rights reserved

m_iReferenceCounter--;
// Reference must never be less than zero
if(0 >= m_iReferenceCounter)
m_iReferenceCounter = 0;
// If reference <= 0 then delete hotlink object
if(m_iReferenceCounter == 0)
// return = true -> delete object
return true;
// return = false -> do NOT delete object
return false;
}
// Slot for machine data from cap server
//__________________________________________________
void Hotlink::receiveCapDataSlot(SlCapErrorEnum cError, const
QVariant& vData, const SlCapSupplementInfoType& cSuplInfo)
{
if(SL_CAP_OK == cError)
//Data is forwarded to all interested parties via hotlink
signal
emit hotlinkSignal(vData);
}

Qt/C++ Client Server Application


Entry ID: 90278134, V1.0, 06/2014

15

2 Project engineering of the server application

2.4

Output of the file and creation of library


The following steps must be carried out in order to receive the output files,
including the library:
1. Project

Create new. The moc files are created.

2. Add a new "GeneratedFiles" filter in the project and insert moc files as the
existing item.
3. Project

Create new.

Copyright

Siemens AG 2014 All rights reserved

The library and the .dll file of the project are now located in the "Debug" folder and
the "output" subfolder in the project folder.

Qt/C++ Client Server Application


Entry ID: 90278134, V1.0, 06/2014

16

3 Integrating the server application into a client

Integrating the server application into a


client

3.1

Preparation

3.1.1

Creating a project
A new HMI project is created in the following. The settings to be made are identical
to the settings in the documentation for the programming packet
"SINUMERIK_Operate_Schnelleinstieg_neuesProjekt.pdf". In addition, a
SlGfwLabel must be set up in the constructor of the form for the display of the
hotlink. The class of the SlGfwLabel must be called up and a variable must be
generated in the header file of the form.

Header file:
#include "SlGfwLabel.h

Constructor source code file:


// Create a new SlGfwLabel
SlGfwLabel* pItemLabel = new SlGfwLabel(QString::null, this);
// Move to a suitable position in the form
pItemLabel->setGeometry(100,100,50,20);

3.1.2

Copy server files into the project folder


The following files from the server project must be copied into the project folder:
Hotlink.h

Copyright

Siemens AG 2014 All rights reserved

private:
SlGfwLabel* pItemLabel;

NcPlcServer.h
NcPlcServer.lib
The NcPlcServer.dll file must be copied to the controller in the subfolder "appl"
during the implementation.

3.1.3

Insert NcPlcServer.h into a project


The NcPlcServer.h files must be inserted into the project:
Project folder
Header Files
same project folder).

3.1.4

Add

Existing item

NcPlcServer.h (from the

Linking the header file of the form with NcPlcServer.h and


NCPlcServer.lib
NcPlcServer.h and NcPlcServer.lib must be linked in the header file of the form. To
do this, the following must be added in the definition of the header file:
#include "NcPlcServer.h
//Name of the lib bears the project name of the server application
#pragma comment (lib, NcPlcServer.lib")

Create slot for hotlink, pointer to NcPlcServer and hotlink, and client name.

Qt/C++ Client Server Application


Entry ID: 90278134, V1.0, 06/2014

17

3 Integrating the server application into a client

Preparations for a server call must be made in the header file.


private:
NcPlcServer* m_myServer; //Pointer to NcPlcServer
QString m_myName; //Variable for name of the client
Hotlink* m_myHotlink; // Pointer to hotlink in NcPlcServer

Copyright

Siemens AG 2014 All rights reserved

private slots:
void hotlinkSlot(QVariant vData); //Slot for hotlink

Qt/C++ Client Server Application


Entry ID: 90278134, V1.0, 06/2014

18

3 Integrating the server application into a client

3.2

Execution

3.2.1

Set up hotlink to variable in constructor


The following code must be added in the constructor. First, the name of the form is
saved as a client name.
// Save the name of the form
m_myName = rszName;

Then the connection to the server is created.


// Connection to server is created
m_myServer = Server::connectToServer(m_myName);

Then the hotlink is set up.


// Currently, hotlink to R-parameter 1 in channel 1
m_myHotlink = m_myServer->
attachToHotlink(channel/parameter/r[u1,1])

Copyright

Siemens AG 2014 All rights reserved

// Establish the signal/slot connection


bool bResult = QObject::connect(m_myHotlink,
SIGNAL(hotlinkSignal(QVariant)),
this,
SLOT(hotlinkSlot(QVariant)));

3.2.2

Address hotlink
Get the results from the server in the hotlinkSlot.

//Slot for receiving data


/* NameOfForm must correspond to the name of the created form, in
this case
only as an example */
void NameOfForm::hotlinkSlot(QVariant vData)
{
pItemLabel->setValue(vData.toString());

3.2.3

Disconnect client from server and disconnect hotlink


Write the following code in the destructor of the form.
// Disconnect client from server
NcPlcServer::disconnectFromServer(m_myName);
// Detach hotlink of server
m_myServer->detachFromHotlink(m_myHotlink);
// Disconnect hotlink of the form
bool bResult = QObject::disconnect(m_myHotlink,
SIGNAL(hotlinkSignal(QVariant)),
this,
SLOT(hotlinkSlot(QVariant)));

3.2.4

Result
After the project folder is created and implementation in the SINUMERIK
environment, the SlGfwLabel pItemLabel also gets a change of the R1 parameter
and displays the value.
This example is simplified and only represents the basic architecture of a possible
client-server application.

Qt/C++ Client Server Application


Entry ID: 90278134, V1.0, 06/2014

19

4 Contact persons

Contact persons
Siemens AG
Industry Sector
I DT MC MTS APC2
Frauenauracher Strasse 80
D - 91056 Erlangen, Germany
E-mail: MC-MTS-APC-Tech-Team.i-dt@siemens.com

History
Table 5-1
Date

V1.0

06/2014

Revision
First Edition

Copyright

Siemens AG 2014 All rights reserved

Version

Qt/C++ Client Server Application


Entry ID: 90278134, V1.0, 06/2014

20

Você também pode gostar