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
fd1ccabf
Commit
fd1ccabf
authored
Jun 01, 2007
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
utf8 conversion and memory leakage fixed
parent
38cb5150
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
327 additions
and
252 deletions
+327
-252
opc/exe/opc_provider/src/opc_provider.cpp
opc/exe/opc_provider/src/opc_provider.cpp
+28
-2
opc/exe/opc_server/src/opc_server.cpp
opc/exe/opc_server/src/opc_server.cpp
+261
-217
opc/lib/opc/src/opc_utl.cpp
opc/lib/opc/src/opc_utl.cpp
+33
-29
opc/lib/opc/src/opc_utl.h
opc/lib/opc/src/opc_utl.h
+5
-4
No files found.
opc/exe/opc_provider/src/opc_provider.cpp
View file @
fd1ccabf
/*
* Proview $Id: opc_provider.cpp,v 1.1
4 2007-05-30 12:00:25
claes Exp $
* Proview $Id: opc_provider.cpp,v 1.1
5 2007-06-01 11:07:06
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -445,6 +445,9 @@ void opc_provider::insert_object( pwr_tOix fth, pwr_tOix bws, s0__BrowseElement
server_state
->
RequestCnt
++
;
fault
();
}
free
(
(
char
*
)
get_properties
.
ReturnPropertyValues
);
delete
id
.
ItemName
;
}
...
...
@@ -476,6 +479,7 @@ void opc_provider::insert_object( pwr_tOix fth, pwr_tOix bws, s0__BrowseElement
server_state
->
RequestCnt
++
;
fault
();
}
delete
browse
.
ItemName
;
}
}
...
...
@@ -570,6 +574,7 @@ void opc_provider::objectOid( co_procom *pcom, pwr_tOix oix)
server_state
->
RequestCnt
++
;
fault
();
}
delete
browse
.
ItemName
;
}
}
...
...
@@ -687,6 +692,7 @@ void opc_provider::objectName( co_procom *pcom, char *name, pwr_tOix poix)
sts
=
GDH__NOSUCHOBJ
;
break
;
}
delete
browse
.
ItemName
;
}
for
(
coix
=
m_list
[
oix
]
->
po
.
fchoix
;
;
...
...
@@ -803,7 +809,7 @@ void opc_provider::writeAttribute( co_procom *pcom, pwr_tOix oix, unsigned int o
opc_pwrtype_to_opctype
(
m_list
[
oix
]
->
type
,
&
opc_type
);
opc_convert_pwrtype_to_opctype
(
buffer
,
opc_buffer
,
sizeof
(
opc_buffer
),
opc_type
,
m_list
[
oix
]
->
type
);
item
->
Value
=
opc_opctype_to_value
(
opc_buffer
,
sizeof
(
opc_buffer
),
opc_type
);
item
->
Value
=
opc_opctype_to_value
(
&
soap
,
opc_buffer
,
sizeof
(
opc_buffer
),
opc_type
);
write
.
ItemList
=
new
s0__WriteRequestItemList
;
write
.
ItemList
->
Items
.
push_back
(
item
);
...
...
@@ -817,6 +823,9 @@ void opc_provider::writeAttribute( co_procom *pcom, pwr_tOix oix, unsigned int o
server_state
->
RequestCnt
++
;
fault
();
}
delete
write
.
ItemList
;
delete
item
->
Value
;
delete
item
;
}
break
;
}
...
...
@@ -884,6 +893,9 @@ void opc_provider::readAttribute( co_procom *pcom, pwr_tOix oix, unsigned int of
server_state
->
RequestCnt
++
;
fault
();
}
delete
read
.
ItemList
;
delete
item
->
ItemName
;
delete
item
;
}
break
;
}
...
...
@@ -964,6 +976,11 @@ void opc_provider::subAssociateBuffer( co_procom *pcom, void **buff, int oix, in
server_state
->
RequestCnt
++
;
fault
();
}
free
(
(
char
*
)
subscribe
.
Options
->
ReturnItemTime
);
delete
subscribe
.
ItemList
;
delete
ritem
->
ItemName
;
free
(
(
char
*
)
ritem
->
RequestedSamplingRate
);
delete
ritem
;
}
break
;
default:
;
...
...
@@ -992,6 +1009,7 @@ void opc_provider::subDisassociateBuffer( co_procom *pcom, pwr_tSubid sid)
}
m_sublist
.
erase
(
it
);
delete
subcancel
.
ServerSubHandle
;
}
}
...
...
@@ -1109,6 +1127,13 @@ void opc_provider::cyclic( co_procom *pcom)
server_state
->
RequestCnt
++
;
fault
();
}
free
(
(
char
*
)
subscribe
.
Options
->
ReturnItemTime
);
delete
subscribe
.
Options
;
delete
subscribe
.
ItemList
;
delete
ritem
->
ItemName
;
delete
ritem
->
ClientItemHandle
;
free
(
(
char
*
)
ritem
->
RequestedSamplingRate
);
delete
ritem
;
}
}
}
...
...
@@ -1214,6 +1239,7 @@ void opc_provider::get_server_state()
server_state
->
ServerState
=
s0__serverState__commFault
;
fault
();
}
delete
get_status
.
ClientRequestHandle
;
}
//
...
...
opc/exe/opc_server/src/opc_server.cpp
View file @
fd1ccabf
This diff is collapsed.
Click to expand it.
opc/lib/opc/src/opc_utl.cpp
View file @
fd1ccabf
/*
* Proview $Id: opc_utl.cpp,v 1.1
8 2007-05-30 12:00:25
claes Exp $
* Proview $Id: opc_utl.cpp,v 1.1
9 2007-06-01 11:07:06
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -25,6 +25,7 @@
#include "co_time_msg.h"
#include "opc_utl.h"
#include "opc_soap_Stub.h"
#include "opc_soap_H.h"
const
char
nullstr
[]
=
""
;
...
...
@@ -117,14 +118,17 @@ static char opc_ResultTexts[23][140] = {
"The value is write-only and may not be read from or returned as part of a write response."
,
"The type is not valid."
};
void
opcsrv_returnerror
(
std
::
vector
<
s0__OPCError
*>&
errors
,
std
::
string
**
rc
,
int
err_code
,
unsigned
int
options
)
void
opcsrv_returnerror
(
struct
soap
*
soap
,
std
::
vector
<
s0__OPCError
*>&
errors
,
std
::
string
**
rc
,
int
err_code
,
unsigned
int
options
)
{
int
ii
;
bool
exists
=
false
;
if
(
rc
)
*
rc
=
new
std
::
string
(
opc_resultcode_to_string
(
err_code
));
if
(
rc
)
{
*
rc
=
soap_new_std__string
(
soap
,
-
1
);
(
*
rc
)
->
assign
(
opc_resultcode_to_string
(
err_code
));
}
for
(
ii
=
0
;
ii
<
(
int
)
errors
.
size
();
ii
++
)
{
if
(
strcmp
(
errors
[
ii
]
->
ID
.
c_str
(),
opc_resultcode_to_string
(
err_code
))
==
0
)
{
...
...
@@ -133,11 +137,12 @@ void opcsrv_returnerror(std::vector<s0__OPCError *>& errors, std::string **rc, i
}
if
(
!
exists
)
{
s0__OPCError
*
oe
=
new
s0__OPCError
(
);
oe
->
ID
=
std
::
string
(
opc_resultcode_to_string
(
err_code
));
s0__OPCError
*
oe
=
soap_new_s0__OPCError
(
soap
,
-
1
);
oe
->
ID
.
assign
(
opc_resultcode_to_string
(
err_code
));
if
(
options
&
opc_mRequestOption_ReturnErrorText
)
{
oe
->
Text
=
new
std
::
string
(
opc_resultcode_to_text
(
err_code
));
oe
->
Text
=
soap_new_std__string
(
soap
,
-
1
);
oe
->
Text
->
assign
(
opc_resultcode_to_text
(
err_code
));
}
errors
.
push_back
(
oe
);
...
...
@@ -204,14 +209,12 @@ bool opc_string_to_resultcode(char *str, int *code)
// Return the corresponding opc type string for a pwr_eType
//
std
::
string
&
opc_datetime
(
pwr_tTime
*
tp
)
char
*
opc_datetime
(
pwr_tTime
*
tp
)
{
static
std
::
string
timstr
;
char
str
[
40
];
static
char
str
[
40
];
time_AtoOPCAscii
(
tp
,
str
,
sizeof
(
str
));
timstr
=
std
::
string
(
str
);
return
timstr
;
return
str
;
}
pwr_tStatus
opc_time_OPCAsciiToA
(
char
*
tstr
,
pwr_tTime
*
ts
)
...
...
@@ -270,90 +273,91 @@ pwr_tStatus time_AtoOPCAscii (pwr_tTime *tp, char *buf, int bufsize)
//
// Return the corresponding opc type for a opc type string
//
xsd__anyType
*
opc_opctype_to_value
(
void
*
bufp
,
int
size
,
int
opc_type
)
xsd__anyType
*
opc_opctype_to_value
(
struct
soap
*
soap
,
void
*
bufp
,
int
size
,
int
opc_type
)
{
switch
(
opc_type
)
{
case
opc_eDataType_string
:
{
xsd__string
*
val
=
new
xsd__string
(
);
xsd__string
*
val
=
soap_new_xsd__string
(
soap
,
-
1
);
val
->
__item
=
std
::
string
(
(
char
*
)
bufp
);
return
val
;
break
;
}
case
opc_eDataType_boolean
:
{
xsd__boolean
*
val
=
new
xsd__boolean
(
);
val
->
__item
=
bool
(
*
(
char
*
)
bufp
);
xsd__boolean
*
val
=
soap_new_xsd__boolean
(
soap
,
-
1
);
val
->
__item
=
(
bool
)
(
*
(
char
*
)
bufp
);
return
val
;
break
;
}
case
opc_eDataType_float
:
{
xsd__float
*
val
=
new
xsd__float
(
);
xsd__float
*
val
=
soap_new_xsd__float
(
soap
,
-
1
);
val
->
__item
=
*
(
pwr_tFloat32
*
)
bufp
;
return
val
;
break
;
}
case
opc_eDataType_decimal
:
{
xsd__decimal_
*
val
=
new
xsd__decimal_
(
);
xsd__decimal_
*
val
=
soap_new_xsd__decimal_
(
soap
,
-
1
);
sprintf
((
char
*
)
bufp
,
"%f"
,
*
(
pwr_tFloat64
*
)
bufp
);
val
->
__item
=
std
::
string
((
char
*
)
bufp
);
return
val
;
break
;
}
case
opc_eDataType_double
:
{
xsd__double
*
val
=
new
xsd__double
(
);
xsd__double
*
val
=
soap_new_xsd__double
(
soap
,
-
1
);
val
->
__item
=
*
(
pwr_tFloat64
*
)
bufp
;
return
val
;
break
;
}
case
opc_eDataType_long
:
{
xsd__long
*
val
=
new
xsd__long
(
);
xsd__long
*
val
=
soap_new_xsd__long
(
soap
,
-
1
);
val
->
__item
=
*
(
pwr_tInt64
*
)
bufp
;
return
val
;
break
;
}
case
opc_eDataType_int
:
{
xsd__int
*
val
=
new
xsd__int
(
);
xsd__int
*
val
=
soap_new_xsd__int
(
soap
,
-
1
);
val
->
__item
=
*
(
pwr_tInt32
*
)
bufp
;
return
val
;
break
;
}
case
opc_eDataType_short
:
{
xsd__short
*
val
=
new
xsd__short
(
);
xsd__short
*
val
=
soap_new_xsd__short
(
soap
,
-
1
);
val
->
__item
=
*
(
pwr_tInt16
*
)
bufp
;
return
val
;
break
;
}
case
opc_eDataType_byte
:
{
xsd__byte
*
val
=
new
xsd__byte
(
);
xsd__byte
*
val
=
soap_new_xsd__byte
(
soap
,
-
1
);
val
->
__item
=
*
(
pwr_tChar
*
)
bufp
;
return
val
;
break
;
}
case
opc_eDataType_unsignedLong
:
{
xsd__unsignedLong
*
val
=
new
xsd__unsignedLong
(
);
xsd__unsignedLong
*
val
=
soap_new_xsd__unsignedLong
(
soap
,
-
1
);
val
->
__item
=
*
(
pwr_tUInt64
*
)
bufp
;
return
val
;
break
;
}
case
opc_eDataType_unsignedInt
:
{
xsd__unsignedInt
*
val
=
new
xsd__unsignedInt
(
);
xsd__unsignedInt
*
val
=
soap_new_xsd__unsignedInt
(
soap
,
-
1
);
val
->
__item
=
*
(
pwr_tInt32
*
)
bufp
;
return
val
;
break
;
}
case
opc_eDataType_unsignedShort
:
{
xsd__unsignedShort
*
val
=
new
xsd__unsignedShort
(
);
xsd__unsignedShort
*
val
=
soap_new_xsd__unsignedShort
(
soap
,
-
1
);
val
->
__item
=
*
(
pwr_tUInt16
*
)
bufp
;
return
val
;
break
;
}
case
opc_eDataType_unsignedByte
:
{
xsd__unsignedByte
*
val
=
new
xsd__unsignedByte
(
);
xsd__unsignedByte
*
val
=
soap_new_xsd__unsignedByte
(
soap
,
-
1
);
val
->
__item
=
*
(
pwr_tUInt8
*
)
bufp
;
return
val
;
break
;
}
case
opc_eDataType_dateTime
:
{
xsd__dateTime
*
val
=
new
xsd__dateTime
(
);
xsd__dateTime
*
val
=
soap_new_xsd__dateTime
(
soap
,
-
1
);
char
timstr
[
40
];
time_AtoOPCAscii
(
(
pwr_tTime
*
)
bufp
,
timstr
,
sizeof
(
timstr
));
...
...
@@ -362,7 +366,7 @@ xsd__anyType* opc_opctype_to_value(void *bufp, int size, int opc_type)
break
;
}
case
opc_eDataType_duration
:
{
xsd__duration
*
val
=
new
xsd__duration
(
);
xsd__duration
*
val
=
soap_new_xsd__duration
(
soap
,
-
1
);
// TODO
// char timstr[40];
...
...
opc/lib/opc/src/opc_utl.h
View file @
fd1ccabf
/*
* Proview $Id: opc_utl.h,v 1.1
6 2007-05-30 12:00:25
claes Exp $
* Proview $Id: opc_utl.h,v 1.1
7 2007-06-01 11:07:06
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -106,15 +106,16 @@ typedef enum {
opc_eResultCode__
}
opc_eResultCode
;
void
opcsrv_returnerror
(
std
::
vector
<
s0__OPCError
*>&
errors
,
std
::
string
**
rc
,
int
err_code
,
unsigned
int
options
);
void
opcsrv_returnerror
(
struct
soap
*
soap
,
std
::
vector
<
s0__OPCError
*>&
errors
,
std
::
string
**
rc
,
int
err_code
,
unsigned
int
options
);
bool
opc_requestoptions_to_mask
(
s0__RequestOptions
*
options
,
unsigned
int
*
mask
);
std
::
string
&
opc_datetime
(
pwr_tTime
*
tp
);
char
*
opc_datetime
(
pwr_tTime
*
tp
);
pwr_tStatus
time_AtoOPCAscii
(
pwr_tTime
*
tp
,
char
*
buf
,
int
bufsize
);
pwr_tStatus
opc_time_OPCAsciiToA
(
char
*
tstr
,
pwr_tTime
*
ts
);
const
char
*
opc_resultcode_to_string
(
int
code
);
const
char
*
opc_resultcode_to_text
(
int
code
);
bool
opc_string_to_resultcode
(
char
*
str
,
int
*
code
);
xsd__anyType
*
opc_opctype_to_value
(
void
*
bufp
,
int
size
,
int
opc_type
);
xsd__anyType
*
opc_opctype_to_value
(
struct
soap
*
soap
,
void
*
bufp
,
int
size
,
int
opc_type
);
bool
opc_convert_pwrtype_to_opctype
(
void
*
bufin
,
void
*
bufout
,
int
size
,
int
opc_type
,
int
pwr_type
);
bool
opc_convert_opctype_to_pwrtype
(
void
*
bufp
,
int
size
,
xsd__anyType
*
value
,
pwr_eType
pwr_type
);
bool
opc_string_to_opctype
(
const
char
*
str
,
int
*
type
);
...
...
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