Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
8a36f763
Commit
8a36f763
authored
Apr 05, 2007
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*** empty log message ***
parent
4d57af1b
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
1015 additions
and
456 deletions
+1015
-456
opc/exe/opc_provider/src/opc_provider.cpp
opc/exe/opc_provider/src/opc_provider.cpp
+201
-29
opc/exe/opc_server/src/opc_server.cpp
opc/exe/opc_server/src/opc_server.cpp
+538
-88
opc/lib/opc/src/opc_msg.h
opc/lib/opc/src/opc_msg.h
+6
-6
opc/lib/opc/src/opc_soap_C.cpp
opc/lib/opc/src/opc_soap_C.cpp
+105
-191
opc/lib/opc/src/opc_soap_Client.cpp
opc/lib/opc/src/opc_soap_Client.cpp
+1
-1
opc/lib/opc/src/opc_soap_H.h
opc/lib/opc/src/opc_soap_H.h
+82
-91
opc/lib/opc/src/opc_soap_Server.cpp
opc/lib/opc/src/opc_soap_Server.cpp
+1
-1
opc/lib/opc/src/opc_soap_Stub.h
opc/lib/opc/src/opc_soap_Stub.h
+21
-21
opc/lib/opc/src/opc_utl.cpp
opc/lib/opc/src/opc_utl.cpp
+57
-27
opc/lib/opc/src/opc_utl.h
opc/lib/opc/src/opc_utl.h
+3
-1
No files found.
opc/exe/opc_provider/src/opc_provider.cpp
View file @
8a36f763
/*
* Proview $Id: opc_provider.cpp,v 1.
9 2007-03-27 08:37:50
claes Exp $
* Proview $Id: opc_provider.cpp,v 1.
10 2007-04-05 13:32:03
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -583,10 +583,42 @@ void opc_provider::objectOid( co_procom *pcom, pwr_tOix oix)
}
#endif
vector
<
procom_obj
>
olist
;
if
(
oix
==
0
)
olist
.
push_back
(
m_list
[
0
]
->
po
);
else
{
int
plist_cnt
=
0
;
pwr_tOix
p
,
c
;
pwr_tOix
plist
[
100
];
// Get parents
for
(
p
=
m_list
[
oix
]
->
po
.
fthoix
;
;
p
=
m_list
[
p
]
->
po
.
fthoix
)
{
plist
[
plist_cnt
++
]
=
p
;
if
(
m_list
[
p
]
->
po
.
fthoix
==
0
)
break
;
}
// Add parents
for
(
int
i
=
plist_cnt
-
1
;
i
>=
0
;
i
--
)
olist
.
push_back
(
m_list
[
plist
[
i
]]
->
po
);
// Add siblings
for
(
c
=
m_list
[
plist
[
0
]]
->
po
.
fchoix
;
;
c
=
m_list
[
c
]
->
po
.
fwsoix
)
{
if
(
m_list
[
c
]
->
po
.
flags
&
procom_obj_mFlags_Loaded
)
olist
.
push_back
(
m_list
[
c
]
->
po
);
if
(
m_list
[
c
]
->
po
.
fwsoix
==
m_list
[
plist
[
0
]]
->
po
.
fchoix
)
break
;
}
}
#if 0
for ( int i = 0; i < (int) m_list.size(); i++) {
if ( m_list[i]->po.flags & procom_obj_mFlags_Loaded)
olist.push_back( m_list[i]->po);
}
#endif
printf
(
"*********************************************
\n
"
);
for
(
int
i
=
0
;
i
<
(
int
)
olist
.
size
();
i
++
)
{
printf
(
"oix %2d bws %2d fws %2d fth %2d fch %2d lch %2d flags %lu %s
\n
"
,
...
...
@@ -598,33 +630,85 @@ void opc_provider::objectOid( co_procom *pcom, pwr_tOix oix)
void
opc_provider
::
objectName
(
co_procom
*
pcom
,
char
*
name
,
pwr_tOix
poix
)
{
pwr_tOName
oname
;
pwr_tStatus
sts
=
GDH__SUCCESS
;
cdh_sParseName
pn
;
pwr_tOix
oix
,
coix
;
if
(
poix
)
{
if
(
poix
>=
m_list
.
size
())
{
pcom
->
provideStatus
(
GDH__NOSUCHOBJ
);
return
;
}
strcpy
(
oname
,
longname
(
poix
));
strcat
(
oname
,
"-"
);
strcat
(
oname
,
name
);
}
cdh_ParseName
(
&
sts
,
&
pn
,
pwr_cNOid
,
name
,
0
);
if
(
poix
)
oix
=
poix
;
else
strcpy
(
oname
,
name
)
;
oix
=
0
;
for
(
int
i
=
0
;
i
<
(
int
)
m_list
.
size
();
i
++
)
{
if
(
!
m_list
[
i
]
->
po
.
flags
&
procom_obj_mFlags_Deleted
)
{
if
(
cdh_NoCaseStrcmp
(
oname
,
longname
(
m_list
[
i
]
->
po
.
oix
))
==
0
)
{
objectOid
(
pcom
,
i
);
return
;
for
(
int
i
=
0
;
i
<
(
int
)
pn
.
nObject
;
i
++
)
{
bool
found
=
false
;
if
(
!
(
m_list
[
oix
]
->
po
.
flags
&
procom_obj_mFlags_Loaded
))
{
_s0__Browse
browse
;
_s0__BrowseResponse
browse_response
;
browse
.
ItemName
=
new
std
::
string
(
m_list
[
oix
]
->
item_name
);
opc_mask_to_propertynames
(
browse
.
PropertyNames
,
opc_mProperty_DataType
|
opc_mProperty_Description
|
opc_mProperty_EuType
);
if
(
soap_call___s0__Browse
(
&
soap
,
opc_endpoint
,
NULL
,
&
browse
,
&
browse_response
)
==
SOAP_OK
)
{
pwr_tOix
next_bws
;
pwr_tOix
bws
=
0
;
server_state
->
RequestCnt
++
;
if
(
browse_response
.
Errors
.
size
()
>
0
)
{
errlog
(
browse
.
ItemName
,
browse_response
.
Errors
);
}
for
(
int
i
=
0
;
i
<
(
int
)
browse_response
.
Elements
.
size
();
i
++
)
{
next_bws
=
next_oix
;
insert_object
(
oix
,
bws
,
browse_response
.
Elements
[
i
],
i
==
0
,
i
==
(
int
)
browse_response
.
Elements
.
size
()
-
1
,
0
,
0
);
bws
=
next_bws
;
}
m_list
[
oix
]
->
po
.
flags
|=
procom_obj_mFlags_Loaded
;
}
else
{
// Error returned from soap
server_state
->
RequestCnt
++
;
fault
();
sts
=
GDH__NOSUCHOBJ
;
break
;
}
}
for
(
coix
=
m_list
[
oix
]
->
po
.
fchoix
;
;
coix
=
m_list
[
coix
]
->
po
.
fwsoix
)
{
if
(
cdh_NoCaseStrcmp
(
m_list
[
coix
]
->
po
.
name
,
pn
.
object
[
i
].
name
.
norm
)
==
0
)
{
oix
=
coix
;
found
=
true
;
break
;
}
if
(
m_list
[
coix
]
->
po
.
fwsoix
==
m_list
[
oix
]
->
po
.
fchoix
)
// Last child
break
;
}
if
(
!
found
)
sts
=
GDH__NOSUCHOBJ
;
}
if
(
m_env
==
pvd_eEnv_Wb
)
pcom
->
provideObject
(
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
""
,
""
);
else
pcom
->
provideStatus
(
GDH__NOSUCHOBJ
);
if
(
ODD
(
sts
))
{
objectOid
(
pcom
,
oix
);
}
else
{
if
(
m_env
==
pvd_eEnv_Wb
)
pcom
->
provideObject
(
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
""
,
""
);
else
pcom
->
provideStatus
(
sts
);
}
}
// Wb only
...
...
@@ -908,6 +992,7 @@ void opc_provider::subDisassociateBuffer( co_procom *pcom, pwr_tSubid sid)
void
opc_provider
::
cyclic
(
co_procom
*
pcom
)
{
int
size
=
0
;
bool
reconnect
=
false
;
_s0__SubscriptionPolledRefresh
subpoll
;
_s0__SubscriptionPolledRefreshResponse
subpoll_response
;
...
...
@@ -928,23 +1013,110 @@ void opc_provider::cyclic( co_procom *pcom)
int
idx
=
0
;
for
(
sublist_iterator
it
=
m_sublist
.
begin
();
it
!=
m_sublist
.
end
();
it
++
)
{
if
(
subpoll_response
.
RItemList
[
idx
]
->
Items
.
size
())
{
opc_convert_opctype_to_pwrtype
(
(
void
*
)
((
pwr_sClass_Opc_String
*
)
m_list
[
it
->
second
.
oix
]
->
po
.
body
)
->
Value
,
m_list
[
it
->
second
.
oix
]
->
size
,
subpoll_response
.
RItemList
[
idx
]
->
Items
[
0
]
->
Value
,
(
pwr_eType
)
m_list
[
it
->
second
.
oix
]
->
type
);
#if 0
switch ( m_list[it->second.oix]->po.cid) {
case pwr_cClass_Opc_String:
strcpy( ((pwr_sClass_Opc_String *)m_list[it->second.oix]->po.body)->Value,
((xsd__string *)subpoll_response.RItemList[idx]->Items[0]->Value)->__item.c_str());
break;
default: ;
if
(
subpoll_response
.
RItemList
[
idx
]
->
Items
[
0
]
->
ResultID
)
{
int
code
;
if
(
opc_string_to_resultcode
(
(
char
*
)
subpoll_response
.
RItemList
[
idx
]
->
Items
[
0
]
->
ResultID
->
c_str
(),
&
code
))
{
if
(
code
==
opc_eResultCode_E_NOSUBSCRIPTION
)
{
// Subscription removed, add new subscription
reconnect
=
true
;
break
;
}
else
{
server_state
->
LastError
=
code
;
server_state
->
ErrorRequestCnt
=
server_state
->
RequestCnt
;
}
}
}
else
{
pwr_tOix
oix
=
it
->
second
.
oix
;
opc_convert_opctype_to_pwrtype
(
(
void
*
)
((
pwr_sClass_Opc_String
*
)
m_list
[
oix
]
->
po
.
body
)
->
Value
,
m_list
[
oix
]
->
size
,
subpoll_response
.
RItemList
[
idx
]
->
Items
[
0
]
->
Value
,
(
pwr_eType
)
m_list
[
oix
]
->
type
);
}
#endif
}
idx
++
;
}
if
(
reconnect
)
{
int
idx
=
0
;
map
<
pwr_tUInt32
,
opcprv_sub
>
sublist_add
;
map
<
pwr_tUInt32
,
opcprv_sub
>
sublist_erase
;
for
(
sublist_iterator
it
=
m_sublist
.
begin
();
it
!=
m_sublist
.
end
();
it
++
)
{
if
(
subpoll_response
.
RItemList
[
idx
]
->
Items
.
size
())
{
if
(
subpoll_response
.
RItemList
[
idx
]
->
Items
[
0
]
->
ResultID
)
{
int
code
;
if
(
opc_string_to_resultcode
(
(
char
*
)
subpoll_response
.
RItemList
[
idx
]
->
Items
[
0
]
->
ResultID
->
c_str
(),
&
code
))
{
if
(
code
==
opc_eResultCode_E_NOSUBSCRIPTION
)
{
// Subscription removed, add new subscription
server_state
->
LastError
=
code
;
server_state
->
ErrorRequestCnt
=
server_state
->
RequestCnt
;
_s0__Subscribe
subscribe
;
_s0__SubscribeResponse
subscribe_response
;
pwr_tOix
oix
=
it
->
second
.
oix
;
pwr_tUInt32
rix
=
it
->
first
;
subscribe
.
Options
=
new
s0__RequestOptions
();
subscribe
.
Options
->
ReturnItemTime
=
(
bool
*
)
malloc
(
sizeof
(
bool
));
*
subscribe
.
Options
->
ReturnItemTime
=
true
;
subscribe
.
ItemList
=
new
s0__SubscribeRequestItemList
();
s0__SubscribeRequestItem
*
ritem
=
new
s0__SubscribeRequestItem
();
ritem
->
ItemName
=
new
std
::
string
(
m_list
[
oix
]
->
item_name
);
ritem
->
ClientItemHandle
=
new
std
::
string
(
it
->
second
.
handle
);
ritem
->
RequestedSamplingRate
=
(
int
*
)
malloc
(
sizeof
(
int
));
*
ritem
->
RequestedSamplingRate
=
1000
;
subscribe
.
ItemList
->
Items
.
push_back
(
ritem
);
// Remove old subscription
//m_sublist.erase( it);
sublist_erase
[
it
->
first
]
=
it
->
second
;
printf
(
"Reconnect: %s
\n
"
,
m_list
[
oix
]
->
item_name
);
if
(
soap_call___s0__Subscribe
(
&
soap
,
opc_endpoint
,
NULL
,
&
subscribe
,
&
subscribe_response
)
==
SOAP_OK
)
{
opcprv_sub
sub
;
// Insert new subscription with new handle
sub
.
handle
=
*
subscribe_response
.
ServerSubHandle
;
sub
.
oix
=
oix
;
//m_sublist[rix] = sub;
sublist_add
[
rix
]
=
sub
;
server_state
->
RequestCnt
++
;
if
(
subscribe_response
.
RItemList
&&
subscribe_response
.
RItemList
->
Items
.
size
())
{
for
(
int
i
=
0
;
i
<
(
int
)
subscribe_response
.
RItemList
->
Items
.
size
();
i
++
)
{
// subscribe_response.RItemList->Items[i]->ItemValue...
}
}
}
else
{
// Error returned from soap
server_state
->
RequestCnt
++
;
fault
();
}
}
}
}
}
}
idx
++
;
// Remove old subscriptions to m_sublist
for
(
sublist_iterator
it
=
sublist_erase
.
begin
();
it
!=
sublist_erase
.
end
();
it
++
)
{
m_sublist
.
erase
(
it
->
first
);
}
// Add new subscriptions to m_sublist
for
(
sublist_iterator
it
=
sublist_add
.
begin
();
it
!=
sublist_add
.
end
();
it
++
)
{
m_sublist
[
it
->
first
]
=
it
->
second
;
}
}
}
else
{
// Error returned from soap
...
...
@@ -1025,8 +1197,8 @@ void opc_provider::get_server_state()
strcpy
(
server_state
->
VendorInfo
,
get_status_response
.
Status
->
VendorInfo
->
c_str
());
if
(
get_status_response
.
Status
->
ProductVersion
)
strcpy
(
server_state
->
ProductVersion
,
get_status_response
.
Status
->
ProductVersion
->
c_str
());
opc_
convert_opctype_to_pwrtype
(
&
server_state
->
StartTime
,
sizeof
(
server_state
->
StartTime
),
&
get_status_response
.
Status
->
StartTime
,
pwr_eType_
Time
);
opc_
time_OPCAsciiToA
(
(
char
*
)
get_status_response
.
Status
->
StartTime
.
c_str
(),
&
server_state
->
Start
Time
);
server_state
->
ServerState
=
get_status_response
.
GetStatusResult
->
ServerState
;
}
else
{
...
...
opc/exe/opc_server/src/opc_server.cpp
View file @
8a36f763
This diff is collapsed.
Click to expand it.
opc/lib/opc/src/opc_msg.h
View file @
8a36f763
...
...
@@ -418,9 +418,9 @@ class s0__browseFilter_ : public xsd__anyType
class
s0__ReplyBase
:
public
xsd__anyType
{
public
:
/// Attribute RcvTime of type xs:dateTime.
@
xsd__dateTime
RcvTime
1
;
///< Required attribute.
@
std
::
string
RcvTime
1
;
///< Required attribute.
/// Attribute ReplyTime of type xs:dateTime.
@
xsd__dateTime
ReplyTime
1
;
///< Required attribute.
@
std
::
string
ReplyTime
1
;
///< Required attribute.
/// Attribute ClientRequestHandle of type xs:string.
@
std
::
string
*
ClientRequestHandle
0
;
///< Optional attribute.
/// Attribute RevisedLocaleID of type xs:string.
...
...
@@ -441,7 +441,7 @@ class s0__ServerStatus : public xsd__anyType
/// Vector of enum s0__interfaceVersion with length 0..unbounded
std
::
vector
<
enum
s0__interfaceVersion
>
SupportedInterfaceVersions
0
;
/// Attribute StartTime of type xs:dateTime.
@
xsd__dateTime
StartTime
1
;
///< Required attribute.
@
std
::
string
StartTime
1
;
///< Required attribute.
/// Attribute ProductVersion of type xs:string.
@
std
::
string
*
ProductVersion
0
;
///< Optional attribute.
};
...
...
@@ -460,7 +460,7 @@ class s0__RequestOptions : public xsd__anyType
/// Attribute ReturnItemName of type xs:boolean.
@
bool
*
ReturnItemName
0
;
///< Optional attribute.
/// Attribute RequestDeadline of type xs:dateTime.
@
xsd__dateTime
*
RequestDeadline
0
;
///< Optional attribute.
@
std
::
string
*
RequestDeadline
0
;
///< Optional attribute.
/// Attribute ClientRequestHandle of type xs:string.
@
std
::
string
*
ClientRequestHandle
0
;
///< Optional attribute.
/// Attribute LocaleID of type xs:string.
...
...
@@ -522,7 +522,7 @@ class s0__ItemValue : public xsd__anyType
/// Attribute ClientItemHandle of type xs:string.
@
std
::
string
*
ClientItemHandle
0
;
///< Optional attribute.
/// Attribute Timestamp of type xs:dateTime.
@
xsd__dateTime
*
Timestamp
0
;
///< Optional attribute.
@
std
::
string
*
Timestamp
0
;
///< Optional attribute.
/// Attribute ResultID of type xs:QName.
@
xsd__QName
*
ResultID
0
;
///< Optional attribute.
};
...
...
@@ -918,7 +918,7 @@ class _s0__SubscriptionPolledRefresh
/// Vector of std::string with length 0..unbounded
std
::
vector
<
std
::
string
>
ServerSubHandles
0
;
/// Attribute HoldTime of type xs:dateTime.
@
xsd__dateTime
*
HoldTime
0
;
///< Optional attribute.
@
std
::
string
*
HoldTime
0
;
///< Optional attribute.
/// Attribute WaitTime of type xs:int.
@
int
*
WaitTime
0
;
///< Optional attribute.
/// Attribute ReturnAllItems of type xs:boolean.
...
...
opc/lib/opc/src/opc_soap_C.cpp
View file @
8a36f763
This diff is collapsed.
Click to expand it.
opc/lib/opc/src/opc_soap_Client.cpp
View file @
8a36f763
...
...
@@ -6,7 +6,7 @@
*/
#include "opc_soap_H.h"
SOAP_SOURCE_STAMP
(
"@(#) opc_soap_Client.cpp ver 2.7.9d 2007-03-
23 08:02:36
GMT"
)
SOAP_SOURCE_STAMP
(
"@(#) opc_soap_Client.cpp ver 2.7.9d 2007-03-
30 08:43:57
GMT"
)
SOAP_FMAC5
int
SOAP_FMAC6
soap_call___s0__GetStatus
(
struct
soap
*
soap
,
const
char
*
soap_endpoint
,
const
char
*
soap_action
,
_s0__GetStatus
*
s0__GetStatus
,
_s0__GetStatusResponse
*
s0__GetStatusResponse
)
...
...
opc/lib/opc/src/opc_soap_H.h
View file @
8a36f763
This diff is collapsed.
Click to expand it.
opc/lib/opc/src/opc_soap_Server.cpp
View file @
8a36f763
...
...
@@ -6,7 +6,7 @@
*/
#include "opc_soap_H.h"
SOAP_SOURCE_STAMP
(
"@(#) opc_soap_Server.cpp ver 2.7.9d 2007-03-
23 08:02:36
GMT"
)
SOAP_SOURCE_STAMP
(
"@(#) opc_soap_Server.cpp ver 2.7.9d 2007-03-
30 08:43:57
GMT"
)
SOAP_FMAC5
int
SOAP_FMAC6
soap_serve
(
struct
soap
*
soap
)
...
...
opc/lib/opc/src/opc_soap_Stub.h
View file @
8a36f763
...
...
@@ -503,12 +503,12 @@ public:
#ifndef SOAP_TYPE_s0__ReplyBase
#define SOAP_TYPE_s0__ReplyBase (38)
/*
s0:ReplyBase
*/
/*
Primitive s0:ReplyBase schema type:
*/
class
SOAP_CMAC
s0__ReplyBase
:
public
xsd__anyType
{
public:
xsd__dateTime
RcvTime
;
/* required element of type xsd:dateTim
e */
xsd__dateTime
ReplyTime
;
/* required element of type xsd:dateTim
e */
std
::
string
RcvTime
;
/* required attribut
e */
std
::
string
ReplyTime
;
/* required attribut
e */
std
::
string
*
ClientRequestHandle
;
/* optional attribute */
std
::
string
*
RevisedLocaleID
;
/* optional attribute */
enum
s0__serverState
ServerState
;
/* required attribute */
...
...
@@ -535,7 +535,7 @@ public:
std
::
string
*
VendorInfo
;
/* optional element of type xsd:string */
std
::
vector
<
std
::
string
>
SupportedLocaleIDs
;
/* optional element of type xsd:string */
std
::
vector
<
enum
s0__interfaceVersion
>
SupportedInterfaceVersions
;
/* optional element of type s0:interfaceVersion */
xsd__dateTime
StartTime
;
/* required element of type xsd:dateTim
e */
std
::
string
StartTime
;
/* required attribut
e */
std
::
string
*
ProductVersion
;
/* optional attribute */
public:
virtual
int
soap_type
()
const
{
return
39
;
}
/* = unique id SOAP_TYPE_s0__ServerStatus */
...
...
@@ -552,7 +552,7 @@ public:
#ifndef SOAP_TYPE_s0__RequestOptions
#define SOAP_TYPE_s0__RequestOptions (40)
/*
s0:RequestOptions
*/
/*
Primitive s0:RequestOptions schema type:
*/
class
SOAP_CMAC
s0__RequestOptions
:
public
xsd__anyType
{
public:
...
...
@@ -561,7 +561,7 @@ public:
bool
*
ReturnItemTime
;
/* optional attribute */
bool
*
ReturnItemPath
;
/* optional attribute */
bool
*
ReturnItemName
;
/* optional attribute */
xsd__dateTime
*
RequestDeadline
;
/* optional element of type xsd:dateTim
e */
std
::
string
*
RequestDeadline
;
/* optional attribut
e */
std
::
string
*
ClientRequestHandle
;
/* optional attribute */
std
::
string
*
LocaleID
;
/* optional attribute */
public:
...
...
@@ -658,7 +658,7 @@ public:
std
::
string
*
ItemPath
;
/* optional attribute */
std
::
string
*
ItemName
;
/* optional attribute */
std
::
string
*
ClientItemHandle
;
/* optional attribute */
xsd__dateTime
*
Timestamp
;
/* optional element of type xsd:dateTim
e */
std
::
string
*
Timestamp
;
/* optional attribut
e */
std
::
string
*
ResultID
;
/* optional attribute */
public:
virtual
int
soap_type
()
const
{
return
44
;
}
/* = unique id SOAP_TYPE_s0__ItemValue */
...
...
@@ -1436,7 +1436,7 @@ class SOAP_CMAC _s0__SubscriptionPolledRefresh
public:
s0__RequestOptions
*
Options
;
/* optional element of type s0:RequestOptions */
std
::
vector
<
std
::
string
>
ServerSubHandles
;
/* optional element of type xsd:string */
xsd__dateTime
*
HoldTime
;
/* optional element of type xsd:dateTim
e */
std
::
string
*
HoldTime
;
/* optional attribut
e */
int
*
WaitTime
;
/* optional attribute */
bool
*
ReturnAllItems
;
/* optional attribute */
struct
soap
*
soap
;
/* transient */
...
...
@@ -1631,7 +1631,7 @@ public:
#endif
#ifndef SOAP_TYPE___s0__GetStatus
#define SOAP_TYPE___s0__GetStatus (15
6
)
#define SOAP_TYPE___s0__GetStatus (15
5
)
/* Operation wrapper: */
struct
__s0__GetStatus
{
...
...
@@ -1641,7 +1641,7 @@ public:
#endif
#ifndef SOAP_TYPE___s0__Read
#define SOAP_TYPE___s0__Read (1
60
)
#define SOAP_TYPE___s0__Read (1
59
)
/* Operation wrapper: */
struct
__s0__Read
{
...
...
@@ -1651,7 +1651,7 @@ public:
#endif
#ifndef SOAP_TYPE___s0__Write
#define SOAP_TYPE___s0__Write (16
4
)
#define SOAP_TYPE___s0__Write (16
3
)
/* Operation wrapper: */
struct
__s0__Write
{
...
...
@@ -1661,7 +1661,7 @@ public:
#endif
#ifndef SOAP_TYPE___s0__Subscribe
#define SOAP_TYPE___s0__Subscribe (16
8
)
#define SOAP_TYPE___s0__Subscribe (16
7
)
/* Operation wrapper: */
struct
__s0__Subscribe
{
...
...
@@ -1671,7 +1671,7 @@ public:
#endif
#ifndef SOAP_TYPE___s0__SubscriptionPolledRefresh
#define SOAP_TYPE___s0__SubscriptionPolledRefresh (17
2
)
#define SOAP_TYPE___s0__SubscriptionPolledRefresh (17
1
)
/* Operation wrapper: */
struct
__s0__SubscriptionPolledRefresh
{
...
...
@@ -1681,7 +1681,7 @@ public:
#endif
#ifndef SOAP_TYPE___s0__SubscriptionCancel
#define SOAP_TYPE___s0__SubscriptionCancel (17
6
)
#define SOAP_TYPE___s0__SubscriptionCancel (17
5
)
/* Operation wrapper: */
struct
__s0__SubscriptionCancel
{
...
...
@@ -1691,7 +1691,7 @@ public:
#endif
#ifndef SOAP_TYPE___s0__Browse
#define SOAP_TYPE___s0__Browse (1
80
)
#define SOAP_TYPE___s0__Browse (1
79
)
/* Operation wrapper: */
struct
__s0__Browse
{
...
...
@@ -1701,7 +1701,7 @@ public:
#endif
#ifndef SOAP_TYPE___s0__GetProperties
#define SOAP_TYPE___s0__GetProperties (18
4
)
#define SOAP_TYPE___s0__GetProperties (18
3
)
/* Operation wrapper: */
struct
__s0__GetProperties
{
...
...
@@ -1711,7 +1711,7 @@ public:
#endif
#ifndef SOAP_TYPE_SOAP_ENV__Header
#define SOAP_TYPE_SOAP_ENV__Header (18
7
)
#define SOAP_TYPE_SOAP_ENV__Header (18
6
)
/* SOAP Header: */
struct
SOAP_ENV__Header
{
...
...
@@ -1721,7 +1721,7 @@ public:
#endif
#ifndef SOAP_TYPE_SOAP_ENV__Code
#define SOAP_TYPE_SOAP_ENV__Code (18
8
)
#define SOAP_TYPE_SOAP_ENV__Code (18
7
)
/* SOAP Fault Code: */
struct
SOAP_ENV__Code
{
...
...
@@ -1732,7 +1732,7 @@ public:
#endif
#ifndef SOAP_TYPE_SOAP_ENV__Detail
#define SOAP_TYPE_SOAP_ENV__Detail (1
90
)
#define SOAP_TYPE_SOAP_ENV__Detail (1
89
)
/* SOAP-ENV:Detail */
struct
SOAP_ENV__Detail
{
...
...
@@ -1744,7 +1744,7 @@ public:
#endif
#ifndef SOAP_TYPE_SOAP_ENV__Reason
#define SOAP_TYPE_SOAP_ENV__Reason (19
1
)
#define SOAP_TYPE_SOAP_ENV__Reason (19
0
)
/* SOAP-ENV:Reason */
struct
SOAP_ENV__Reason
{
...
...
@@ -1754,7 +1754,7 @@ public:
#endif
#ifndef SOAP_TYPE_SOAP_ENV__Fault
#define SOAP_TYPE_SOAP_ENV__Fault (19
2
)
#define SOAP_TYPE_SOAP_ENV__Fault (19
1
)
/* SOAP Fault: */
struct
SOAP_ENV__Fault
{
...
...
opc/lib/opc/src/opc_utl.cpp
View file @
8a36f763
/*
* Proview $Id: opc_utl.cpp,v 1.1
5 2007-03-23 08:19:45
claes Exp $
* Proview $Id: opc_utl.cpp,v 1.1
6 2007-04-05 13:32:03
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -18,6 +18,7 @@
*/
#include <float.h>
#include "pwr_class.h"
#include "co_time.h"
#include "co_time_msg.h"
...
...
@@ -65,29 +66,30 @@ static char opc_PropertyNames[17][20] = {"dataType",
"openLabel"
,
"timeZone"
};
static
char
opc_ResultCodes
[
23
][
32
]
=
{
"s:S_CLAMP"
,
"s:S_DATAQUEUEOVERFLOW"
,
"s:S_UNSUPPORTEDRATE"
,
"s:E_ACCESS_DENIED"
,
"s:E_BUSY"
,
"s:E_FAIL"
,
"s:E_INVALIDCONTINUATIONPOINT"
,
"s:E_INVALIDFILTER"
,
"s:E_INVALIDHOLDTIME"
,
"s:E_INVALIDITEMNAME"
,
"s:E_INVALIDITEMPATH"
,
"s:E_INVALIDPID"
,
"s:E_NOSUBSCRIPTION"
,
"s:E_NOTSUPPORTED"
,
"s:E_OUTOFMEMORY"
,
"s:E_RANGE"
,
"s:E_READONLY"
,
"s:E_SERVERSTATE"
,
"s:E_TIMEDOUT"
,
"s:E_UNKNOWNITEMNAME"
,
"s:E_UNKNOWNITEMPATH"
,
"s:E_WRITEONLY"
,
"s:E_BADTYPE"
};
static
char
opc_ResultCodes
[
24
][
32
]
=
{
""
,
"s0:S_CLAMP"
,
"s0:S_DATAQUEUEOVERFLOW"
,
"s0:S_UNSUPPORTEDRATE"
,
"s0:E_ACCESS_DENIED"
,
"s0:E_BUSY"
,
"s0:E_FAIL"
,
"s0:E_INVALIDCONTINUATIONPOINT"
,
"s0:E_INVALIDFILTER"
,
"s0:E_INVALIDHOLDTIME"
,
"s0:E_INVALIDITEMNAME"
,
"s0:E_INVALIDITEMPATH"
,
"s0:E_INVALIDPID"
,
"s0:E_NOSUBSCRIPTION"
,
"s0:E_NOTSUPPORTED"
,
"s0:E_OUTOFMEMORY"
,
"s0:E_RANGE"
,
"s0:E_READONLY"
,
"s0:E_SERVERSTATE"
,
"s0:E_TIMEDOUT"
,
"s0:E_UNKNOWNITEMNAME"
,
"s0:E_UNKNOWNITEMPATH"
,
"s0:E_WRITEONLY"
,
"s0:E_BADTYPE"
};
static
char
opc_ResultTexts
[
23
][
140
]
=
{
"The value written was accepted but the output was clamped."
,
...
...
@@ -245,6 +247,7 @@ pwr_tStatus time_AtoOPCAscii (pwr_tTime *tp, char *buf, int bufsize)
int
buflen
;
char
tmpStr
[
16
];
pwr_tTime
t
;
int
tzone
;
if
(
!
tp
)
{
clock_gettime
(
CLOCK_REALTIME
,
&
t
);
...
...
@@ -252,9 +255,10 @@ pwr_tStatus time_AtoOPCAscii (pwr_tTime *tp, char *buf, int bufsize)
}
tmpTm
=
localtime
(
&
tp
->
tv_sec
);
tzone
=
tmpTm
->
tm_gmtoff
/
3600
;
strftime
(
buf
,
bufsize
,
"%Y-%m-%dT%H:%M:%S"
,
tmpTm
);
sprintf
(
tmpStr
,
".%07d
"
,
(
int
)(
tp
->
tv_nsec
/
100
)
);
sprintf
(
tmpStr
,
".%07d
%s%02d:00"
,
(
int
)(
tp
->
tv_nsec
/
100
),
tzone
>=
0
?
"+"
:
""
,
tzone
);
buflen
=
strlen
(
buf
);
if
(
strlen
(
tmpStr
)
+
buflen
<
(
unsigned
int
)
bufsize
)
strcpy
(
&
buf
[
buflen
],
tmpStr
);
...
...
@@ -963,7 +967,7 @@ bool opc_convert_opctype_to_pwrtype(void *bufp, int size, xsd__anyType *value, p
bool
opc_convert_pwrtype_to_opctype
(
void
*
bufin
,
void
*
bufout
,
int
size
,
int
opc_type
,
int
pwr_type
)
{
if
(
!
bufout
)
buf
in
=
bufout
;
buf
out
=
bufin
;
switch
(
opc_type
)
{
case
opc_eDataType_string
:
switch
(
pwr_type
)
{
...
...
@@ -1633,7 +1637,7 @@ bool opc_get_property( std::vector<s0__ItemProperty *> properties, unsigned int
bool
opc_propertynames_to_mask
(
std
::
vector
<
std
::
string
>&
pnames
,
unsigned
int
*
mask
)
{
char
name
[
4
0
];
char
name
[
20
0
];
char
*
np
;
*
mask
=
0
;
...
...
@@ -1646,6 +1650,9 @@ bool opc_propertynames_to_mask( std::vector<std::string>& pnames, unsigned int *
np
=
name
;
switch
(
*
np
)
{
case
'a'
:
*
mask
|=
opc_mProperty_AccessRights
;
break
;
case
'd'
:
switch
(
*
(
np
+
1
))
{
case
'a'
:
...
...
@@ -1789,3 +1796,26 @@ bool opc_quality_to_string( int quality, char **str)
return
true
;
}
bool
opc_cmp_pwr
(
void
*
p1
,
void
*
p2
,
int
size
,
int
type
,
float
deadband
)
{
switch
(
type
)
{
case
pwr_eType_Boolean
:
case
pwr_eType_Int32
:
case
pwr_eType_UInt32
:
if
(
*
(
pwr_tUInt32
*
)
p1
==
*
(
pwr_tUInt32
*
)
p2
)
return
true
;
break
;
case
pwr_eType_Float32
:
if
(
deadband
==
0
)
{
if
(
fabs
(
*
(
pwr_tFloat32
*
)
p1
-
*
(
pwr_tFloat32
*
)
p2
)
<
FLT_EPSILON
)
return
true
;
}
else
{
if
(
fabs
(
*
(
pwr_tFloat32
*
)
p1
-
*
(
pwr_tFloat32
*
)
p2
)
<
deadband
)
return
true
;
}
break
;
default:
;
}
return
false
;
}
opc/lib/opc/src/opc_utl.h
View file @
8a36f763
/*
* Proview $Id: opc_utl.h,v 1.1
4 2007-03-27 08:37:50
claes Exp $
* Proview $Id: opc_utl.h,v 1.1
5 2007-04-05 13:32:03
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -131,3 +131,5 @@ void opc_mask_to_propertynames( std::vector<std::string>& pnames, unsigned int m
bool
opc_propertynames_to_mask
(
std
::
vector
<
std
::
string
>&
pnames
,
unsigned
int
*
mask
);
bool
opc_quality_to_string
(
int
quality
,
char
**
str
);
bool
opc_cmp_pwr
(
void
*
p1
,
void
*
p2
,
int
size
,
int
type
,
float
deadband
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment