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
834e377e
Commit
834e377e
authored
Mar 16, 2007
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*** empty log message ***
parent
77e352db
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
131 additions
and
102 deletions
+131
-102
opc/exe/opc_server/src/opc_server.cpp
opc/exe/opc_server/src/opc_server.cpp
+34
-1
opc/lib/opc/src/opc_utl.cpp
opc/lib/opc/src/opc_utl.cpp
+69
-73
opc/lib/opc/src/opc_utl.h
opc/lib/opc/src/opc_utl.h
+28
-28
No files found.
opc/exe/opc_server/src/opc_server.cpp
View file @
834e377e
/*
/*
* Proview $Id: opc_server.cpp,v 1.
9 2007-03-15 15:25:36
claes Exp $
* Proview $Id: opc_server.cpp,v 1.
10 2007-03-16 10:19:45
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
* Copyright (C) 2005 SSAB Oxelsund AB.
*
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
...
@@ -60,6 +60,8 @@ class opc_server {
...
@@ -60,6 +60,8 @@ class opc_server {
opcsrv_client
*
find_client
(
int
sid
);
opcsrv_client
*
find_client
(
int
sid
);
opcsrv_client
*
new_client
(
int
sid
);
opcsrv_client
*
new_client
(
int
sid
);
int
fault
(
struct
soap
*
soap
,
int
code
);
};
};
static
opc_server
*
opcsrv
;
static
opc_server
*
opcsrv
;
...
@@ -69,6 +71,37 @@ static opc_sClientAccess opc_client_access[20];
...
@@ -69,6 +71,37 @@ static opc_sClientAccess opc_client_access[20];
static
int
opc_client_access_cnt
=
0
;
static
int
opc_client_access_cnt
=
0
;
static
int
opc_current_access
;
static
int
opc_current_access
;
static
int
opcsrv_set_error
(
struct
soap
*
soap
,
const
char
*
faultcode
,
const
char
*
faultsubcode
,
const
char
*
faultstring
,
const
char
*
faultdetail
,
int
soaperror
)
{
*
soap_faultcode
(
soap
)
=
faultcode
;
if
(
faultsubcode
)
*
soap_faultsubcode
(
soap
)
=
faultsubcode
;
*
soap_faultstring
(
soap
)
=
faultstring
;
if
(
faultdetail
&&
*
faultdetail
)
{
register
const
char
**
s
=
soap_faultdetail
(
soap
);
if
(
s
)
*
s
=
faultdetail
;
}
return
soap
->
error
=
soaperror
;
}
static
int
opcsrv_fault
(
struct
soap
*
soap
,
const
char
*
faultcode
,
const
char
*
faultsubcode
,
const
char
*
faultstring
,
const
char
*
faultdetail
)
{
char
*
r
=
NULL
,
*
s
=
NULL
,
*
t
=
NULL
;
if
(
faultsubcode
)
r
=
soap_strdup
(
soap
,
faultsubcode
);
if
(
faultstring
)
s
=
soap_strdup
(
soap
,
faultstring
);
if
(
faultdetail
)
t
=
soap_strdup
(
soap
,
faultdetail
);
return
opcsrv_set_error
(
soap
,
faultcode
,
r
,
s
,
t
,
SOAP_FAULT
);
}
int
opc_server
::
fault
(
struct
soap
*
soap
,
int
code
)
{
return
opcsrv_fault
(
soap
,
opc_resultcode_to_string
(
code
),
0
,
opc_resultcode_to_text
(
code
),
0
);
}
opcsrv_client
*
opc_server
::
find_client
(
int
sid
)
opcsrv_client
*
opc_server
::
find_client
(
int
sid
)
{
{
client_iterator
it
=
opcsrv
->
m_client
.
find
(
sid
);
client_iterator
it
=
opcsrv
->
m_client
.
find
(
sid
);
...
...
opc/lib/opc/src/opc_utl.cpp
View file @
834e377e
/*
/*
* Proview $Id: opc_utl.cpp,v 1.1
0 2007-03-15 15:25:36
claes Exp $
* Proview $Id: opc_utl.cpp,v 1.1
1 2007-03-16 10:19:45
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
* Copyright (C) 2005 SSAB Oxelsund AB.
*
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
...
@@ -24,6 +24,8 @@
...
@@ -24,6 +24,8 @@
#include "opc_utl.h"
#include "opc_utl.h"
#include "opc_soap_Stub.h"
#include "opc_soap_Stub.h"
const
char
nullstr
[]
=
""
;
static
pwr_tString32
str_dt
[
20
]
=
{
"xsd:string"
,
static
pwr_tString32
str_dt
[
20
]
=
{
"xsd:string"
,
"xsd:boolean"
,
"xsd:boolean"
,
"xsd:float"
,
"xsd:float"
,
...
@@ -63,79 +65,76 @@ static char opc_PropertyNames[17][20] = {"dataType",
...
@@ -63,79 +65,76 @@ static char opc_PropertyNames[17][20] = {"dataType",
"openLabel"
,
"openLabel"
,
"timeZone"
};
"timeZone"
};
static
char
opc_ResultCodes
[
23
][
32
]
=
{
"xsd:S_CLAMP"
,
static
char
opc_ResultCodes
[
23
][
32
]
=
{
"s:S_CLAMP"
,
"xsd:S_DATAQUEUEOVERFLOW"
,
"s:S_DATAQUEUEOVERFLOW"
,
"xsd:S_UNSUPPORTEDRATE"
,
"s:S_UNSUPPORTEDRATE"
,
"xsd:E_ACCESS_DENIED"
,
"s:E_ACCESS_DENIED"
,
"xsd:E_BUSY"
,
"s:E_BUSY"
,
"xsd:E_FAIL"
,
"s:E_FAIL"
,
"xsd:E_INVALIDCONTINUATIONPOINT"
,
"s:E_INVALIDCONTINUATIONPOINT"
,
"xsd:E_INVALIDFILTER"
,
"s:E_INVALIDFILTER"
,
"xsd:E_INVALIDHOLDTIME"
,
"s:E_INVALIDHOLDTIME"
,
"xsd:E_INVALIDITEMNAME"
,
"s:E_INVALIDITEMNAME"
,
"xsd:E_INVALIDITEMPATH"
,
"s:E_INVALIDITEMPATH"
,
"xsd:E_INVALIDPID"
,
"s:E_INVALIDPID"
,
"xsd:E_NOSUBSCRIPTION"
,
"s:E_NOSUBSCRIPTION"
,
"xsd:E_NOTSUPPORTED"
,
"s:E_NOTSUPPORTED"
,
"xsd:E_OUTOFMEMORY"
,
"s:E_OUTOFMEMORY"
,
"xsd:E_RANGE"
,
"s:E_RANGE"
,
"xsd:E_READONLY"
,
"s:E_READONLY"
,
"xsd:E_SERVERSTATE"
,
"s:E_SERVERSTATE"
,
"xsd:E_TIMEDOUT"
,
"s:E_TIMEDOUT"
,
"xsd:E_UNKNOWNITEMNAME"
,
"s:E_UNKNOWNITEMNAME"
,
"xsd:E_UNKNOWNITEMPATH"
,
"s:E_UNKNOWNITEMPATH"
,
"xsd:E_WRITEONLY"
,
"s:E_WRITEONLY"
,
"xsd:E_BADTYPE"
};
"s:E_BADTYPE"
};
static
char
opc_ResultTexts
[
23
][
20
]
=
{
"edgar o was here"
,
static
char
opc_ResultTexts
[
23
][
140
]
=
{
"edgar o was here"
,
"The value written was accepted but the output was clamped."
,
"edgar o was here"
,
"Not every detected change has been returned since the server's buffer reached its limit and had to purge out the oldest data."
,
"edgar o was here"
,
"The server does not support the requested rate but will use the closest available rate."
,
"edgar o was here"
,
"The server deines access (read and/or write) to the specified item."
,
"edgar o was here"
,
"The server is currently processing another polled refresh for one or more of the subscriptions."
,
"edgar o was here"
,
"Unspecified error."
,
"edgar o was here"
,
"The continuation point is not valid."
,
"edgar o was here"
,
"The filter string is not valid."
,
"edgar o was here"
,
"The hold time is too long (determined by the server)."
,
"edgar o was here"
,
"The item name does not conform the server's syntax."
,
"edgar o was here"
,
"The item path does not conform the server's syntax."
,
"edgar o was here"
,
"The property id is not valid for the item."
,
"edgar o was here"
,
"An invalid set of subscription handles was passed to the request."
,
"edgar o was here"
,
"The server does not support writing to the quality and/or timestamp."
,
"edgar o was here"
,
"Ran out of memory."
,
"edgar o was here"
,
"The value was out of range."
,
"edgar o was here"
,
"The value is read only and may not be written to."
,
"edgar o was here"
,
"The operation could not complete due to an abnormal server state."
,
"edgar o was here"
,
"The operation took too long to complete (determined by the server)."
,
"edgar o was here"
,
"The item name is no longer available in the server address space."
,
"edgar o was here"
,
"The item path is no longer available in the server address space."
,
"edgar o was here"
};
"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
(
std
::
vector
<
s0__OPCError
*>&
errors
,
std
::
string
**
rc
,
int
err_code
,
unsigned
int
options
)
{
{
pwr_tString32
str
;
int
ii
;
int
ii
;
bool
exists
=
false
;
bool
exists
=
false
;
opc_resultcode_to_string
(
err_code
,
str
);
if
(
rc
)
if
(
rc
)
*
rc
=
new
std
::
string
(
str
);
*
rc
=
new
std
::
string
(
opc_resultcode_to_string
(
err_code
)
);
for
(
ii
=
0
;
ii
<
(
int
)
errors
.
size
();
ii
++
)
{
for
(
ii
=
0
;
ii
<
(
int
)
errors
.
size
();
ii
++
)
{
if
(
str
ncmp
(
errors
[
ii
]
->
ID
.
c_str
(),
str
,
sizeof
(
str
))
==
0
)
{
if
(
str
cmp
(
errors
[
ii
]
->
ID
.
c_str
(),
opc_resultcode_to_string
(
err_code
))
==
0
)
{
exists
=
true
;
exists
=
true
;
}
}
}
}
if
(
!
exists
)
{
if
(
!
exists
)
{
s0__OPCError
*
oe
=
new
s0__OPCError
();
s0__OPCError
*
oe
=
new
s0__OPCError
();
oe
->
ID
=
std
::
string
(
str
);
oe
->
ID
=
std
::
string
(
opc_resultcode_to_string
(
err_code
)
);
if
(
options
&
opc_mRequestOption_ReturnErrorText
)
{
if
(
options
&
opc_mRequestOption_ReturnErrorText
)
{
opc_resultcode_to_text
(
err_code
,
str
);
oe
->
Text
=
new
std
::
string
(
opc_resultcode_to_text
(
err_code
));
oe
->
Text
=
new
std
::
string
(
str
);
}
}
errors
.
push_back
(
oe
);
errors
.
push_back
(
oe
);
...
@@ -169,30 +168,27 @@ bool opc_requestoptions_to_mask( s0__RequestOptions *options, unsigned int *mask
...
@@ -169,30 +168,27 @@ bool opc_requestoptions_to_mask( s0__RequestOptions *options, unsigned int *mask
return
true
;
return
true
;
}
}
bool
opc_resultcode_to_string
(
int
type
,
char
*
str
)
const
char
*
opc_resultcode_to_string
(
int
code
)
{
{
str
=
opc_ResultCodes
[
type
];
if
(
code
>=
opc_eResultCode__
)
return
nullstr
;
return
true
;
return
opc_ResultCodes
[
code
];
}
}
bool
opc_resultcode_to_text
(
int
type
,
char
*
str
)
const
char
*
opc_resultcode_to_text
(
int
code
)
{
{
if
(
code
>=
opc_eResultCode__
)
return
nullstr
;
str
=
opc_ResultTexts
[
type
];
return
opc_ResultTexts
[
code
];
return
true
;
}
}
bool
opc_string_to_resultcode
(
char
*
str
,
int
*
typ
e
)
bool
opc_string_to_resultcode
(
char
*
str
,
int
*
cod
e
)
{
{
int
ii
;
for
(
int
ii
=
0
;
ii
<
opc_eResultCode__
;
ii
++
)
{
if
(
strcmp
(
opc_ResultCodes
[
ii
],
str
)
==
0
)
{
for
(
ii
=
0
;
ii
<
opc_cResultCodesSize
;
ii
++
)
{
*
code
=
ii
;
if
(
strncmp
(
opc_ResultCodes
[
ii
],
str
,
sizeof
(
opc_ResultCodes
[
ii
]))
==
0
)
{
*
type
=
ii
;
return
true
;
return
true
;
}
}
}
}
...
...
opc/lib/opc/src/opc_utl.h
View file @
834e377e
/*
/*
* Proview $Id: opc_utl.h,v 1.
8 2007-03-15 15:25:36
claes Exp $
* Proview $Id: opc_utl.h,v 1.
9 2007-03-16 10:19:45
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
* Copyright (C) 2005 SSAB Oxelsund AB.
*
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
...
@@ -78,40 +78,40 @@ typedef enum {
...
@@ -78,40 +78,40 @@ typedef enum {
opc_eDataType_
opc_eDataType_
}
opc_eDataType
;
}
opc_eDataType
;
const
int
opc_cResultCodesSize
=
20
;
typedef
enum
{
typedef
enum
{
opc_eResultCode_S_CLAMP
,
opc_eResultCode_S_CLAMP
,
opc_eResultCode_S_DATAQUEUEOVERFLOW
,
opc_eResultCode_S_DATAQUEUEOVERFLOW
,
opc_eResultCode_S_UNSUPPORTEDRATE
,
opc_eResultCode_S_UNSUPPORTEDRATE
,
opc_eResultCode_E_ACCESS_DENIED
,
opc_eResultCode_E_ACCESS_DENIED
,
opc_eResultCode_E_BUSY
,
opc_eResultCode_E_BUSY
,
opc_eResultCode_E_FAIL
,
opc_eResultCode_E_FAIL
,
opc_eResultCode_E_INVALIDCONTINUATIONPOINT
,
opc_eResultCode_E_INVALIDCONTINUATIONPOINT
,
opc_eResultCode_E_INVALIDFILTER
,
opc_eResultCode_E_INVALIDFILTER
,
opc_eResultCode_E_INVALIDHOLDTIME
,
opc_eResultCode_E_INVALIDHOLDTIME
,
opc_eResultCode_E_INVALIDITEMNAME
,
opc_eResultCode_E_INVALIDITEMNAME
,
opc_eResultCode_E_INVALIDITEMPATH
,
opc_eResultCode_E_INVALIDITEMPATH
,
opc_eResultCode_E_INVALIDPID
,
opc_eResultCode_E_INVALIDPID
,
opc_eResultCode_E_NOSUBSCRIPTION
,
opc_eResultCode_E_NOSUBSCRIPTION
,
opc_eResultCode_E_NOTSUPPORTED
,
opc_eResultCode_E_NOTSUPPORTED
,
opc_eResultCode_E_OUTOFMEMORY
,
opc_eResultCode_E_OUTOFMEMORY
,
opc_eResultCode_E_RANGE
,
opc_eResultCode_E_RANGE
,
opc_eResultCode_E_READONLY
,
opc_eResultCode_E_READONLY
,
opc_eResultCode_E_SERVERSTATE
,
opc_eResultCode_E_SERVERSTATE
,
opc_eResultCode_E_TIMEDOUT
,
opc_eResultCode_E_TIMEDOUT
,
opc_eResultCode_E_UNKNOWNITEMNAME
,
opc_eResultCode_E_UNKNOWNITEMNAME
,
opc_eResultCode_E_UNKNOWNITEMPATH
,
opc_eResultCode_E_UNKNOWNITEMPATH
,
opc_eResultCode_E_WRITEONLY
,
opc_eResultCode_E_WRITEONLY
,
opc_eResultCode_E_BADTYPE
,
opc_eResultCode_E_BADTYPE
,
opc_eResultCode__
}
opc_eResultCode
;
}
opc_eResultCode
;
void
opcsrv_returnerror
(
std
::
vector
<
s0__OPCError
*>&
errors
,
std
::
string
**
rc
,
int
err_code
,
unsigned
int
options
);
void
opcsrv_returnerror
(
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
);
bool
opc_requestoptions_to_mask
(
s0__RequestOptions
*
options
,
unsigned
int
*
mask
);
std
::
string
&
opc_datetime
(
pwr_tTime
*
tp
);
std
::
string
&
opc_datetime
(
pwr_tTime
*
tp
);
pwr_tStatus
time_AtoOPCAscii
(
pwr_tTime
*
tp
,
char
*
buf
,
int
bufsize
);
pwr_tStatus
time_AtoOPCAscii
(
pwr_tTime
*
tp
,
char
*
buf
,
int
bufsize
);
bool
opc_resultcode_to_string
(
int
type
,
char
*
str
);
const
char
*
opc_resultcode_to_string
(
int
code
);
bool
opc_resultcode_to_text
(
int
type
,
char
*
str
);
const
char
*
opc_resultcode_to_text
(
int
code
);
bool
opc_string_to_resultcode
(
char
*
str
,
int
*
code
);
bool
opc_opctype_to_value
(
void
*
bufp
,
int
size
,
int
opc_type
);
bool
opc_opctype_to_value
(
void
*
bufp
,
int
size
,
int
opc_type
);
bool
opc_convert_pwrtype_to_opctype
(
void
*
bufp
,
int
size
,
int
opc_type
,
int
pwr_type
);
bool
opc_convert_pwrtype_to_opctype
(
void
*
bufp
,
int
size
,
int
opc_type
,
int
pwr_type
);
bool
opc_string_to_opctype
(
const
char
*
str
,
int
*
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