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
735ac15e
Commit
735ac15e
authored
Oct 06, 2010
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dbcd for commond DbCallback functions added
parent
69090372
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
134 additions
and
0 deletions
+134
-0
wb/lib/wb/src/wb_dbcb.cpp
wb/lib/wb/src/wb_dbcb.cpp
+109
-0
wb/lib/wb/src/wb_dbcb.h
wb/lib/wb/src/wb_dbcb.h
+25
-0
No files found.
wb/lib/wb/src/wb_dbcb.cpp
0 → 100644
View file @
735ac15e
/*
* Proview $Id$
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
#include <string.h>
#include "pwr.h"
#include "wb_pwrb_msg.h"
#include "pwr_baseclasses.h"
#include "wb_ldh.h"
#include "wb_session.h"
#include "wb_dbcb.h"
#include "co_dcli.h"
pwr_tStatus
dbcb_InsertPlcThreadObject
(
ldh_tSesContext
ldhses
,
pwr_tOid
object
)
{
pwr_tMask
process
;
int
process_found
=
0
;
pwr_tOid
thread_oid
;
int
thread_found
=
0
;
pwr_tOid
min_toid
;
int
min_toid_found
=
0
;
pwr_tFloat32
scantime
;
pwr_tFloat32
min_scantime
=
1e37
;
wb_session
*
sp
=
(
wb_session
*
)
ldhses
;
wb_object
o
=
sp
->
object
(
object
);
// Get Process and PlcThreadObject from parent
wb_object
parent
=
o
.
parent
();
if
(
parent
)
{
wb_attribute
a
=
sp
->
attribute
(
parent
.
oid
(),
"RtBody"
,
"Process"
);
if
(
a
)
{
a
.
value
(
&
process
);
if
(
a
)
process_found
=
1
;
}
if
(
process_found
&&
(
process
&
pwr_mIoProcessMask_Plc
))
{
a
=
sp
->
attribute
(
parent
.
oid
(),
"RtBody"
,
"ThreadObject"
);
if
(
a
)
{
a
.
value
(
&
thread_oid
);
if
(
a
)
thread_found
=
1
;
}
}
}
if
(
process_found
)
{
wb_attribute
a
=
sp
->
attribute
(
o
.
oid
(),
"RtBody"
,
"Process"
);
if
(
a
)
{
sp
->
writeAttribute
(
a
,
&
process
,
sizeof
(
process
));
}
}
if
(
thread_found
)
{
wb_attribute
a
=
sp
->
attribute
(
o
.
oid
(),
"RtBody"
,
"ThreadObject"
);
if
(
a
)
{
sp
->
writeAttribute
(
a
,
&
thread_oid
,
sizeof
(
thread_oid
));
}
}
if
(
!
process_found
&&
!
thread_found
)
{
wb_attribute
a
=
sp
->
attribute
(
o
.
oid
(),
"RtBody"
,
"Process"
);
if
(
a
)
{
a
.
value
(
&
process
);
if
(
a
)
process_found
=
1
;
}
if
(
process_found
&&
(
process
&
pwr_mIoProcessMask_Plc
))
{
for
(
wb_object
to
=
sp
->
object
(
pwr_cClass_PlcThread
);
to
;
to
=
to
.
next
())
{
wb_attribute
at
=
sp
->
attribute
(
to
.
oid
(),
"RtBody"
,
"ScanTime"
);
if
(
at
)
{
at
.
value
(
&
scantime
);
if
(
scantime
<
min_scantime
)
{
min_scantime
=
scantime
;
min_toid
=
to
.
oid
();
min_toid_found
=
1
;
}
}
}
if
(
min_toid_found
)
{
wb_attribute
a
=
sp
->
attribute
(
o
.
oid
(),
"RtBody"
,
"ThreadObject"
);
if
(
a
)
{
sp
->
writeAttribute
(
a
,
&
min_toid
,
sizeof
(
min_toid
));
}
}
}
}
return
PWRB__SUCCESS
;
}
wb/lib/wb/src/wb_dbcb.h
0 → 100644
View file @
735ac15e
/*
* Proview $Id$
* Copyright (C) 2005 SSAB Oxelösund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
#ifndef wb_dbcb_h
#define wb_dbcb_h
pwr_tStatus
dbcb_InsertPlcThreadObject
(
ldh_tSesContext
ldhses
,
pwr_tOid
o
);
#endif
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