Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Zepeng Liu
OPC UA PubSub
Commits
052e9e58
Commit
052e9e58
authored
Jun 10, 2018
by
Patrick Bellot
Browse files
EDP
parent
2d851b5e
Changes
22
Expand all
Hide whitespace changes
Inline
Side-by-side
opcua-client/client/Client_01_Subscription/Client_01.h
View file @
052e9e58
...
...
@@ -43,9 +43,9 @@ public:
void
run
()
{
int
nbExt
=
3
;
// Number of total loops from CreateSession to CloseSession
int
nbInt
=
5
;
// Number of internal loops
int
nbPub
=
20
;
// Number of publish inside internal loops
int
nbExt
=
1
;
// Number of total loops from CreateSession to CloseSession
int
nbInt
=
5
0
;
// Number of internal loops
int
nbPub
=
20
00
;
// Number of publish inside internal loops
SOPC_StatusCode
status
=
STATUS_OK
;
...
...
@@ -82,10 +82,12 @@ public:
&
revisedPublishingInterval
,
&
revisedLifetimeCount
,
&
revisedMaxKeepAliveCount
)
;
if
(
status
!=
STATUS_OK
)
{
debug_i
(
COM_ERR
,
"Client_01"
,
"Cannot CreateSubscription: status=0x%08x"
,
status
)
;
break
;
}
debug
(
MAIN_LIFE_DBG
,
"Client_01"
,
"CreateSubscription succeeds"
)
;
// INTERNAL LOOP
...
...
@@ -108,10 +110,12 @@ public:
&
monitoredItemId0
,
&
revisedSamplingInterval0
,
&
revisedQueueSize0
)
;
if
(
status
!=
STATUS_OK
)
{
debug_i
(
COM_ERR
,
"Client_01"
,
"Cannot CreateMonitoredItems(0): status=0x%08x"
,
status
)
;
break
;
}
debug
(
MAIN_LIFE_DBG
,
"Client_01"
,
"CreateMonitoredItems (0) succeeds"
)
;
// CREATE MONITORED ITEMS (1)
...
...
@@ -122,10 +126,12 @@ public:
&
monitoredItemId1
,
&
revisedSamplingInterval1
,
&
revisedQueueSize1
)
;
if
(
status
!=
STATUS_OK
)
{
debug_i
(
COM_ERR
,
"Client_01"
,
"Cannot CreateMonitoredItems (1): status=0x%08x"
,
status
)
;
break
;
}
debug
(
MAIN_LIFE_DBG
,
"Client_01"
,
"CreateMonitoredItems (1) succeeds"
)
;
// BEGINNING PUBLISH SEQUENCE
...
...
@@ -149,7 +155,7 @@ public:
}
// END PUBLISH SEQUENCE
if
(
(
sequenceNumber
)
)
if
(
sequenceNumber
!=
NULL
)
sequenceNumber
->
release
()
;
// DELETE MONITORED ITEMS
...
...
@@ -162,6 +168,7 @@ public:
debug_i
(
COM_ERR
,
"Client_01"
,
"Cannot DeleteMonitoredItems: status=0x%08x"
,
status
)
;
break
;
}
debug
(
MAIN_LIFE_DBG
,
"Client_01"
,
"DeleteMonitoredItems succeeds"
)
;
// DELETE CREATE MONITORED ITEMS (0) DATA
...
...
@@ -196,30 +203,8 @@ public:
public:
Client_01
(
SOPC_Channel
_hChannel
,
const
char
*
_sEndpointUrl
,
SOPC_String
*
_stEndpointUrl
,
String
*
_endPointUrl
,
Certificate
*
_crt_cli
,
AsymmetricKey
*
_priv_cli
,
Certificate
*
_crt_srv
,
PKIProvider
*
_pki
,
char
*
_pRequestedSecurityPolicyUri
,
OpcUa_MessageSecurityMode
_messageSecurityMode
)
:
BaseClient
(
_hChannel
,
_sEndpointUrl
,
_stEndpointUrl
,
_endPointUrl
,
_crt_cli
,
_priv_cli
,
_crt_srv
,
_pki
,
_pRequestedSecurityPolicyUri
,
_messageSecurityMode
)
Client_01
(
int
num
,
SOPC_SecureChannel_Config
*
pScConfig
,
uint32_t
channel_config_idx
,
String
*
endpointUrl
)
:
BaseClient
(
num
,
pScConfig
,
channel_config_idx
,
endpointUrl
)
{}
virtual
~
Client_01
()
...
...
@@ -251,7 +236,7 @@ private:
new
RequestHeader
(
SessionAuthenticationToken
::
nullNodeId
,
UtcTime
::
now
(),
new
IntegerId
(
sequence
),
new
IntegerId
(
sequence
<<
8
|
num
),
UInt32
::
zero
,
// ReturnDiagnostics
String
::
empty
,
// auditEntryId
UInt32
::
zero
// TimeoutHint
...
...
@@ -368,7 +353,7 @@ private:
new
RequestHeader
(
new
SessionAuthenticationToken
(
authenticationTokenNum
),
UtcTime
::
now
(),
new
IntegerId
(
sequence
),
new
IntegerId
(
sequence
<<
8
|
num
),
UInt32
::
zero
,
// ReturnDiagnostics
String
::
empty
,
// auditEntryId
new
UInt32
(
5000
)
// TimeoutHint
...
...
@@ -411,7 +396,7 @@ private:
new
RequestHeader
(
new
SessionAuthenticationToken
(
authenticationTokenNum
),
UtcTime
::
now
(),
new
IntegerId
(
sequence
),
new
IntegerId
(
sequence
<<
8
|
num
),
UInt32
::
zero
,
// ReturnDiagnostics
String
::
empty
,
// auditEntryId
new
UInt32
(
5000
)
// TimeoutHint
...
...
@@ -480,7 +465,7 @@ private:
new
RequestHeader
(
new
SessionAuthenticationToken
(
authenticationTokenNum
),
UtcTime
::
now
(),
new
IntegerId
(
sequence
),
new
IntegerId
(
sequence
<<
8
|
num
),
UInt32
::
zero
,
// ReturnDiagnostics
String
::
empty
,
// auditEntryId
UInt32
::
zero
// TimeoutHint
...
...
@@ -533,7 +518,7 @@ private:
new
RequestHeader
(
new
SessionAuthenticationToken
(
authenticationTokenNum
),
UtcTime
::
now
(),
new
IntegerId
(
sequence
),
new
IntegerId
(
sequence
<<
8
|
num
),
UInt32
::
zero
,
// ReturnDiagnostics
String
::
empty
,
// auditEntryId
UInt32
::
zero
// TimeoutHint
...
...
@@ -601,7 +586,7 @@ private:
QualifiedName
::
defaultBinary
)
;
MonitoringParameters
*
requestedParameters
=
new
MonitoringParameters
(
new
IntegerId
(
sequence
),
new
IntegerId
(
sequence
<<
8
|
num
),
new
Duration
(
200.0
),
DataChangeFilter
::
nullFilter
,
new
Counter
(
64
),
...
...
@@ -622,7 +607,7 @@ private:
new
RequestHeader
(
new
SessionAuthenticationToken
(
authenticationTokenNum
),
UtcTime
::
now
(),
new
IntegerId
(
sequence
),
new
IntegerId
(
sequence
<<
8
|
num
),
UInt32
::
zero
,
// ReturnDiagnostics
String
::
empty
,
// auditEntryId
UInt32
::
zero
// TimeoutHint
...
...
@@ -695,7 +680,7 @@ private:
new
RequestHeader
(
new
SessionAuthenticationToken
(
authenticationTokenNum
),
UtcTime
::
now
(),
new
IntegerId
(
sequence
),
new
IntegerId
(
sequence
<<
8
|
num
),
UInt32
::
zero
,
// ReturnDiagnostics
String
::
empty
,
// auditEntryId
UInt32
::
zero
// TimeoutHint
...
...
@@ -766,7 +751,7 @@ private:
new
RequestHeader
(
new
SessionAuthenticationToken
(
authenticationTokenNum
),
UtcTime
::
now
(),
new
IntegerId
(
sequence
),
new
IntegerId
(
sequence
<<
8
|
num
),
UInt32
::
zero
,
// ReturnDiagnostics
String
::
empty
,
// auditEntryId
UInt32
::
zero
// TimeoutHint
...
...
opcua-client/client/Client_01_Subscription/StartClients_01.h
View file @
052e9e58
...
...
@@ -21,8 +21,17 @@
#define STARTCLIENTS_01_H_
#include "lib/Stacks/All.h"
#include "Client_01.h"
#include "../OpcUa_BaseClient.h"
#include "../Client_01_Subscription/Client_01.h"
#include <sopc_toolkit_config.h>
extern
"C"
{
extern
opcua
::
BaseClient
**
the_clients
;
extern
int
the_nbClient
;
}
#if (WITH_SUBSCRIPTION == 1)
...
...
@@ -33,54 +42,42 @@ class StartClients_01
public:
static
SOPC_StatusCode
startClients
(
const
char
*
sEndpointUrl
,
SOPC_String
*
stEndpointUrl
,
String
*
endpointUrl
,
Certificate
*
crt_cli
,
AsymmetricKey
*
priv_cli
,
Certificate
*
crt_srv
,
PKIProvider
*
pki
,
const
char
*
pRequestedSecurityPolicyUri
,
OpcUa_MessageSecurityMode
messageSecurityMode
SOPC_SecureChannel_Config
*
pScConfig
)
{
int
nbClient
=
5
;
// Number of client threads
int
nbTry
=
2
;
// Number of total loops from OpenSecureChannel to CloseSecureChannel
int
nbClient
=
3
;
// Number of client threads
int
nbTry
=
1
;
// Number of total loops from OpenSecureChannel to CloseSecureChannel
SOPC_Channel
hC
hannel
=
NULL
;
uint32_t
c
hannel
_config_idx
=
0
;
Client_01
**
clients
=
NULL
;
SOPC_StatusCode
status
=
STATUS_OK
;
// EXTERNAL LOOP
while
(
--
nbTry
>=
0
)
{
// CREATING CHANNEL CONFIGURATION
channel_config_idx
=
SOPC_ToolkitClient_AddSecureChannelConfig
(
pScConfig
);
if
(
channel_config_idx
==
0
)
{
debug
(
COM_ERR
,
"StartClientss_02"
,
"Cannot add secure channel config"
)
;
goto
error
;
}
else
{
debug_i
(
IPCS_DBG
,
"StartClients_02"
,
"channel_config_idx=%d"
,
channel_config_idx
)
;
}
SOPC_Toolkit_Configured
()
;
debug
(
MAIN_LIFE_DBG
,
"StartClients_02"
,
"Open Secure Channels config succeeds"
)
;
// CREATING CHANNEL
debug
(
MAIN_LIFE_DBG
,
"StartClients_01"
,
"Create channel"
)
;
status
=
SOPC_Channel_Create
(
&
hChannel
,
SOPC_ChannelSerializer_Binary
);
if
(
STATUS_OK
!=
status
)
{
debug_i
(
COM_ERR
,
"StartClients_01"
,
"Create channel failed: status=0x%08x"
,
status
)
;
goto
error
;
}
// EXTERNAL LOOP
while
(
--
nbTry
>=
0
)
{
// CREATING CLIENT
debug
(
MAIN_LIFE_DBG
,
"StartClients_0
1
"
,
"Building clients"
)
;
// CREATING CLIENT
S
debug
(
MAIN_LIFE_DBG
,
"StartClients_0
2
"
,
"Building clients"
)
;
clients
=
new
Client_01
*
[
nbClient
]
;
for
(
int
i
=
0
;
i
<
nbClient
;
i
++
)
clients
[
i
]
=
new
Client_01
(
hChannel
,
sEndpointUrl
,
stEndpointUrl
,
endpointUrl
,
crt_cli
,
priv_cli
,
crt_srv
,
pki
,
(
char
*
)
pRequestedSecurityPolicyUri
,
messageSecurityMode
)
;
clients
[
i
]
=
new
Client_01
(
i
,
pScConfig
,
channel_config_idx
,
endpointUrl
)
;
the_clients
=
(
BaseClient
**
)
clients
;
the_nbClient
=
nbClient
;
// OPEN SECURE CHANNEL
...
...
@@ -117,17 +114,6 @@ public:
debug
(
MAIN_LIFE_DBG
,
"StartClients_01"
,
"Close Secure Channel succeeds"
)
;
// DELETING CHANNEL
debug
(
MAIN_LIFE_DBG
,
"StartClients_01"
,
"Delete channel"
)
;
status
=
SOPC_Channel_Delete
(
&
hChannel
);
hChannel
=
NULL
;
if
(
STATUS_OK
!=
status
)
{
debug_i
(
COM_ERR
,
"StartClients_01"
,
"Delete channel failed: status=0x%08x"
,
status
)
;
goto
error
;
}
debug
(
MAIN_LIFE_DBG
,
"StartClients_01"
,
"Delete channel succeeds"
)
;
// DELETING CLIENTS
debug
(
MAIN_LIFE_DBG
,
"StartClients_01"
,
"Deleting clients"
)
;
for
(
int
i
=
0
;
i
<
nbClient
;
i
++
)
...
...
@@ -139,6 +125,8 @@ public:
}
// while (--nbTry >= 0)
SOPC_Toolkit_Clear
();
debug_i
(
MAIN_LIFE_DBG
,
"StartClients_01"
,
"Stopping with status=0x%08x"
,
STATUS_OK
)
;
return
STATUS_OK
;
...
...
@@ -146,15 +134,14 @@ public:
error:
debug
(
MAIN_LIFE_DBG
,
"StartClients_01"
,
"Releasing memory with error"
)
;
if
(
hChannel
!=
NULL
)
SOPC_Channel_Delete
(
&
hChannel
);
if
(
clients
!=
NULL
)
{
for
(
int
i
=
0
;
i
<
nbClient
;
i
++
)
delete
clients
[
i
]
;
delete
[]
clients
;
}
SOPC_Toolkit_Clear
();
debug_i
(
MAIN_LIFE_DBG
,
"StartClients_01"
,
"Stopping with error, status=0x%08x"
,
status
)
;
return
status
;
}
...
...
opcua-client/client/Client_02_Call/StartClients_02.h
View file @
052e9e58
...
...
@@ -121,12 +121,12 @@ public:
delete
[]
clients
;
clients
=
NULL
;
SOPC_Toolkit_Clear
();
debug_i
(
MAIN_LIFE_DBG
,
"StartClients_02"
,
"End of Loop (%d)"
,
nbTry
)
;
}
// while (--nbTry >= 0)
SOPC_Toolkit_Clear
();
debug_i
(
MAIN_LIFE_DBG
,
"StartClients_02"
,
"Stopping with status=0x%08x"
,
STATUS_OK
)
;
return
STATUS_OK
;
...
...
@@ -134,14 +134,14 @@ public:
error:
debug
(
MAIN_LIFE_DBG
,
"StartClients_02"
,
"Releasing memory with error"
)
;
SOPC_Toolkit_Clear
();
if
(
clients
!=
NULL
)
{
for
(
int
i
=
0
;
i
<
nbClient
;
i
++
)
delete
clients
[
i
]
;
delete
[]
clients
;
}
SOPC_Toolkit_Clear
();
debug_i
(
MAIN_LIFE_DBG
,
"StartClients_02"
,
"Stopping with error, status=0x%08x"
,
status
)
;
return
status
;
}
...
...
opcua-client/client/Client_03_Read_Write/Client_03.h
View file @
052e9e58
...
...
@@ -38,8 +38,8 @@ public:
void
run
()
{
int
nbExt
=
1
;
// Number of total loops from CreateSession to CloseSession
int
nbInt
=
1
;
// Number of internal loops (after ActivateSession and before CloseSession)
int
nbExt
=
1
000
;
// Number of total loops from CreateSession to CloseSession
int
nbInt
=
1
0000
;
// Number of internal loops (after ActivateSession and before CloseSession)
SOPC_StatusCode
status
=
STATUS_OK
;
...
...
@@ -287,7 +287,7 @@ public:
Nonce
*
distantNonce
=
session
->
getDistantNonce
()
;
if
(
distantNonce
==
NULL
)
{
debug
(
COM_ERR
,
"Client_03"
,
"activateSession(): distantNonce == NULL"
);
return
0x00000003
;
PCS_DBG
+
return
0x00000003
;
}
ApplicationInstanceCertificate
*
distantCertificate
=
session
->
getDistantCertificate
()
;
...
...
opcua-client/client/Client_03_Read_Write/StartClients_03.h
View file @
052e9e58
...
...
@@ -47,7 +47,7 @@ public:
)
{
int
nbClient
=
3
;
// Number of client threads (max is 256)
int
nbTry
=
1
;
// Number of total loops from OpenSecureChannel to CloseSecureChannel
int
nbTry
=
100
;
// Number of total loops from OpenSecureChannel to CloseSecureChannel
uint32_t
channel_config_idx
=
0
;
Client_03
**
clients
=
NULL
;
...
...
@@ -120,23 +120,27 @@ public:
delete
[]
clients
;
clients
=
NULL
;
SOPC_Toolkit_Clear
();
debug_i
(
MAIN_LIFE_DBG
,
"StartClients_03"
,
"End of Loop (%d)"
,
nbTry
)
;
}
// while (--nbTry >= 0)
SOPC_Toolkit_Clear
();
debug_i
(
MAIN_LIFE_DBG
,
"StartClients_01"
,
"Stopping with status=0x%08x"
,
STATUS_OK
)
;
return
STATUS_OK
;
error:
debug
(
MAIN_LIFE_DBG
,
"StartClients_03"
,
"Releasing memory with error"
)
;
SOPC_Toolkit_Clear
();
if
(
clients
!=
NULL
)
{
for
(
int
i
=
0
;
i
<
nbClient
;
i
++
)
delete
clients
[
i
]
;
delete
[]
clients
;
}
SOPC_Toolkit_Clear
();
debug_i
(
MAIN_LIFE_DBG
,
"StartClients_03"
,
"Stopping with status=0x%08x"
,
status
)
;
return
status
;
}
...
...
opcua-client/client/Client_04_Register_Unregister/Client_04.h
View file @
052e9e58
...
...
@@ -38,8 +38,8 @@ public:
void
run
()
{
int
nbExt
=
3
;
// Number of total loops from CreateSession to CloseSession
int
nbInt
=
1
0
;
// Number of internal loops (after ActivateSession and before CloseSession)
int
nbExt
=
1
;
// Number of total loops from CreateSession to CloseSession
int
nbInt
=
1
;
// Number of internal loops (after ActivateSession and before CloseSession)
SOPC_StatusCode
status
=
STATUS_OK
;
...
...
@@ -47,67 +47,67 @@ public:
while
(
--
nbExt
>=
0
)
{
// CREATE SESSION
debug
(
MAIN_LIFE_DBG
,
"Client_04"
,
"Create Session begin
"
)
;
debug
_i
(
MAIN_LIFE_DBG
,
"Client_04"
,
"Create Session begin
for client=%d"
,
num
)
;
status
=
createSession
()
;
if
(
status
!=
STATUS_OK
)
{
debug_i
(
COM_ERR
,
"Client_04"
,
"Cannot Create Session: status=0x%08x"
,
status
)
;
debug_i
i
(
COM_ERR
,
"Client_04"
,
"Cannot Create Session:
client=%d &
status=0x%08x"
,
num
,
status
)
;
return
;
}
debug
(
MAIN_LIFE_DBG
,
"Client_04"
,
"Create Session succeeds
"
)
;
debug
_i
(
MAIN_LIFE_DBG
,
"Client_04"
,
"Create Session succeeds
for cleint=%d"
,
num
)
;
// ACTIVATE SESSION
debug
(
MAIN_LIFE_DBG
,
"Client_04"
,
"Activate Session begin
"
)
;
debug
_i
(
MAIN_LIFE_DBG
,
"Client_04"
,
"Activate Session begin
for client=%d"
,
num
)
;
status
=
activateSession
()
;
if
(
status
!=
STATUS_OK
)
{
debug_i
(
COM_ERR
,
"Client_04"
,
"Cannot Activate Session: status=0x%08x"
,
status
)
;
debug_i
i
(
COM_ERR
,
"Client_04"
,
"Cannot Activate Session:
client=%d &
status=0x%08x"
,
num
,
status
)
;
return
;
}
debug
(
MAIN_LIFE_DBG
,
"Client_04"
,
"Activate Session succeeds
"
)
;
debug
_i
(
MAIN_LIFE_DBG
,
"Client_04"
,
"Activate Session succeeds
for client=%d"
,
num
)
;
// INTERNAL LOOP
int
_nbInt
=
nbInt
;
while
(
--
_nbInt
>=
0
)
{
// REGISTER WITH GOOD NODES
debug
(
MAIN_LIFE_DBG
,
"Client_04"
,
"Register Good begin
"
)
;
debug
_i
(
MAIN_LIFE_DBG
,
"Client_04"
,
"Register Good begin
for client=%d"
,
num
)
;
status
=
doRegisterNodesGood
()
;
if
(
status
!=
STATUS_OK
)
{
debug_i
(
COM_ERR
,
"Client_04"
,
"Cannot Register Good: status=0x%08x"
,
status
)
;
debug_i
i
(
COM_ERR
,
"Client_04"
,
"Cannot Register Good:
client=%d &
status=0x%08x"
,
num
,
status
)
;
break
;
}
debug
(
MAIN_LIFE_DBG
,
"Client_04"
,
"Register Good succeeds
"
)
;
debug
_i
(
MAIN_LIFE_DBG
,
"Client_04"
,
"Register Good succeeds
for client=%d"
,
num
)
;
// REGISTER WITH NOT GOOD NODES
debug
(
MAIN_LIFE_DBG
,
"Client_04"
,
"Register Not Good begin
"
)
;
debug
_i
(
MAIN_LIFE_DBG
,
"Client_04"
,
"Register Not Good begin
for client=%d"
,
num
)
;
status
=
doRegisterNodesNotGood
()
;
if
(
status
!=
STATUS_OK
)
{
debug_i
(
COM_ERR
,
"Client_04"
,
"Cannot Register Not Good: status=0x%08x (this is the good result)"
,
status
)
;
debug_i
i
(
COM_ERR
,
"Client_04"
,
"Cannot Register Not Good:
client=%d &
status=0x%08x (this is the good result)"
,
num
,
status
)
;
}
else
{
debug
(
MAIN_LIFE_DBG
,
"Client_04"
,
"Register Not Good succeeds
"
)
;
debug
_i
(
MAIN_LIFE_DBG
,
"Client_04"
,
"Register Not Good succeeds
for client=%d"
,
num
)
;
}
// UNREGISTER WITH GOOD NODES
debug
(
MAIN_LIFE_DBG
,
"Client_04"
,
"Unregister Good begin
"
)
;
debug
_i
(
MAIN_LIFE_DBG
,
"Client_04"
,
"Unregister Good begin
for client=%d"
,
num
)
;
status
=
doUnregisterNodesGood
()
;
if
(
status
!=
STATUS_OK
)
{
debug_i
(
COM_ERR
,
"Client_04"
,
"Cannot Unregister Good: status=0x%08x"
,
status
)
;
debug_i
i
(
COM_ERR
,
"Client_04"
,
"Cannot Unregister Good:
client=%d &
status=0x%08x"
,
num
,
status
)
;
break
;
}
debug
(
MAIN_LIFE_DBG
,
"Client_04"
,
"Unregister Good succeeds
"
)
;
debug
_i
(
MAIN_LIFE_DBG
,
"Client_04"
,
"Unregister Good succeeds
for client=%d"
,
num
)
;
}
// nbInt
// CLOSE SESSION
debug
(
MAIN_LIFE_DBG
,
"Client_04"
,
"Close Session begin
"
)
;
debug
_i
(
MAIN_LIFE_DBG
,
"Client_04"
,
"Close Session begin
for client=%d"
,
num
)
;
status
=
closeSession
()
;
if
(
status
!=
STATUS_OK
)
{
debug_i
(
COM_ERR
,
"Client_04"
,
"Cannot Close Session: status=0x%08x"
,
status
)
;
debug_i
i
(
COM_ERR
,
"Client_04"
,
"Cannot Close Session:
client=%d &
status=0x%08x"
,
num
,
status
)
;
return
;
}
debug
(
MAIN_LIFE_DBG
,
"Client_04"
,
"Close Session succeeds
"
)
;
debug
_i
(
MAIN_LIFE_DBG
,
"Client_04"
,
"Close Session succeeds
for client=%d"
,
num
)
;
}
// nbExt
debug
(
MAIN_LIFE_DBG
,
"Client_04"
,
"Ending thread
"
)
;
debug
_i
(
MAIN_LIFE_DBG
,
"Client_04"
,
"Ending thread
for client=%d"
,
num
)
;
}
// run()
public:
...
...
@@ -476,7 +476,7 @@ public:
NodeId
*
nodeToRegister0
=
new
NodeId
(
UInt16
::
zero
,
new
String
(
"XMouse"
))
;
NodeId
*
nodeToRegister1
=
new
NodeId
(
UInt16
::
zero
,
new
String
(
"ZZZ YMouse"
))
;
TableNodeId
*
nodesToRegister
=
new
TableNodeId
(
2
)
;
TableNodeId
*
nodesToRegister
=
new
TableNodeId
(
2
)
;
nodesToRegister
->
set
(
0
,
nodeToRegister0
)
;
nodesToRegister
->
set
(
1
,
nodeToRegister1
)
;
...
...
@@ -552,7 +552,8 @@ public:
UInt32
::
zero
,
// ReturnDiagnostics
String
::
empty
,
// auditEntryId
UInt32
::
zero
// TimeoutHint
),
nodesToUnregister
);
),
nodesToUnregister
);
UnregisterNodesResponse
*
unRegisterNodesResponse
=
NULL
;
...
...
opcua-client/client/Client_04_Register_Unregister/StartClients_04.h
View file @
052e9e58
...
...
@@ -46,8 +46,8 @@ public:
SOPC_SecureChannel_Config
*
pScConfig
)
{
int
nbClient
=
5
;
// Number of client threads
int
nbTry
=
5
;
// Number of total loops from OpenSecureChannel to CloseSecureChannel
int
nbClient
=
2
;
// Number of client threads
int
nbTry
=
1
;
// Number of total loops from OpenSecureChannel to CloseSecureChannel
uint32_t
channel_config_idx
=
0
;
Client_04
**
clients
=
NULL
;
...
...
@@ -119,12 +119,12 @@ public:
delete
[]
clients
;
clients
=
NULL
;
SOPC_Toolkit_Clear
();
debug_i
(
MAIN_LIFE_DBG
,
"StartClients_04"
,
"End of Loop (%d)"
,
nbTry
)
;
}
// while (--nbTry >= 0)
SOPC_Toolkit_Clear
();
debug_i
(
MAIN_LIFE_DBG
,
"StartClients_04"
,
"Stopping with status=0x%08x"
,
STATUS_OK
)
;
return
STATUS_OK
;
...
...
@@ -132,14 +132,14 @@ public:
error:
debug
(
MAIN_LIFE_DBG
,
"StartClients_04"
,
"Releasing memory with error"
)
;
SOPC_Toolkit_Clear
();
if
(
clients
!=
NULL
)
{
for
(
int
i
=
0
;
i
<
nbClient
;
i
++
)
delete
clients
[
i
]
;
delete
[]
clients
;
}
SOPC_Toolkit_Clear
();
debug_i
(
MAIN_LIFE_DBG
,
"StartClients_04"
,
"Stopping with error, status=0x%08x"
,
status
)
;
return
status
;
}
...
...
opcua-client/client/Client_05_Browse/StartClients_05.h
View file @
052e9e58
...
...
@@ -120,12 +120,12 @@ public:
delete
[]
clients
;
clients
=
NULL
;
SOPC_Toolkit_Clear
();
debug_i
(
MAIN_LIFE_DBG
,
"StartClients_05"
,
"End of Loop (%d)"
,
nbTry
)
;
}
// while (--nbTry >= 0)
SOPC_Toolkit_Clear
();
debug_i
(
MAIN_LIFE_DBG
,
"StartClients_05"
,
"Stopping with status=0x%08x"
,
STATUS_OK
)
;
return
STATUS_OK
;
...
...
@@ -133,14 +133,14 @@ public:
error:
debug
(
MAIN_LIFE_DBG
,
"StartClients_05"
,
"Releasing memory with error"
)
;
SOPC_Toolkit_Clear
();
if
(
clients
!=
NULL
)
{
for
(
int
i
=
0
;
i
<
nbClient
;
i
++
)
delete
clients
[
i
]
;
delete
[]
clients
;
}