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
19879b4c
Commit
19879b4c
authored
Dec 15, 2008
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PRM update with pdf output
parent
b54fff6b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
189 additions
and
0 deletions
+189
-0
src/doc/prm/src/os_linux/hw_x86/repl.sh
src/doc/prm/src/os_linux/hw_x86/repl.sh
+13
-0
src/doc/prm/src/ra_advappl.cpp
src/doc/prm/src/ra_advappl.cpp
+176
-0
No files found.
src/doc/prm/src/os_linux/hw_x86/repl.sh
0 → 100755
View file @
19879b4c
# Replace all in Oxelsund
#set -o xtrace
files
=
$@
from
=
""
to
=
"o"
for
file
in
$files
;
do
cp
$file
$file
.1
echo
"s/
$from
/
$to
/"
>
repl.sed
sed
-f
repl.sed
$file
>
repl.tmp
cp
repl.tmp
$file
done
src/doc/prm/src/ra_advappl.cpp
0 → 100644
View file @
19879b4c
/*! \file ra_appl.cpp
\brief Example application subclasses of rt_appl
This file is an example file, containing to example applications.
*/
/** @addtogroup rt */
/*@{*/
/** @defgroup rt_ex Application examples
* @ingroup applex
* @{
*/
#include "pwr.h"
//! Advanced c++ application example
/*! Example of a proview application program
This application does not subclass the rt_app class. It handles all
interaction to the Proview runtime environment on it's own.
@see ra_advappl.cpp
*/
#include "pwr.h"
#include "rt_gdh.h"
#include "rt_errh.h"
#include "rt_aproc.h"
#include "rt_pwr_msg.h"
#include "rt_qcom_msg.h"
#include "rt_ini_event.h"
#include "co_error.h"
class
MyAppl
{
public:
MyAppl
()
{}
void
init
(
qcom_sQid
*
qid
);
void
open
();
void
close
();
void
scan
();
float
scantime
()
{
return
1.0
;}
};
void
MyAppl
::
init
(
qcom_sQid
*
qid
)
{
qcom_sQid
qini
;
qcom_sQattr
qAttr
;
pwr_tStatus
sts
;
// Init error and status logger with a unic application index per node.
errh_Init
(
"rs_appl"
,
errh_eAnix_appl1
);
errh_SetStatus
(
PWR__APPLSTARTUP
);
// Init database
sts
=
gdh_Init
(
"rs_appl"
);
if
(
EVEN
(
sts
))
{
errh_Fatal
(
"gdh_Init, %m"
,
sts
);
errh_SetStatus
(
PWR__APPLTERM
);
exit
(
sts
);
}
// Create a queue to receive stop and restart events
if
(
!
qcom_Init
(
&
amp
;
sts
,
0
,
"rs_appl"
))
{
errh_Fatal
(
"qcom_Init, %m"
,
sts
);
errh_SetStatus
(
PWR__APPLTERM
);
exit
(
sts
);
}
qAttr
.
type
=
qcom_eQtype_private
;
qAttr
.
quota
=
100
;
if
(
!
qcom_CreateQ
(
&
amp
;
sts
,
qid
,
&
amp
;
qAttr
,
"events"
))
{
errh_Fatal
(
"qcom_CreateQ, %m"
,
sts
);
errh_SetStatus
(
PWR__APPLTERM
);
exit
(
sts
);
}
qini
=
qcom_cQini
;
if
(
!
qcom_Bind
(
&
amp
;
sts
,
qid
,
&
amp
;
qini
))
{
errh_Fatal
(
"qcom_Bind(Qini), %m"
,
sts
);
errh_SetStatus
(
PWR__APPLTERM
);
exit
(
-
1
);
}
}
void
MyAppl
::
open
()
{
pwr_tOid
oid
;
pwr_tStatus
sts
;
// Get configuration object
sts
=
gdh_NameToObjid
(
"Noder-Node-MyAppl"
,
&
amp
;
oid
);
if
(
EVEN
(
sts
))
throw
co_error
(
sts
);
aproc_RegisterObject
(
oid
);
// Link to database objects
}
void
MyAppl
::
close
()
{
// Unlink to database objects
}
void
MyAppl
::
scan
()
{
aproc_TimeStamp
();
// Do something
}
int
main
()
{
pwr_tStatus
sts
;
MyAppl
appl
;
int
tmo
;
char
mp
[
2000
];
qcom_sQid
qid
=
qcom_cNQid
;
qcom_sGet
get
;
int
swap
=
0
;
bool
first_scan
=
true
;
appl
.
init
(
&
amp
;
qid
);
try
{
appl
.
open
();
}
catch
(
co_error
&
amp
;
e
)
{
errh_Error
(
(
char
*
)
e
.
what
().
c_str
());
errh_Fatal
(
"rs_appl aborting"
);
errh_SetStatus
(
PWR__APPLTERM
);
exit
(
0
);
}
aproc_TimeStamp
();
errh_SetStatus
(
PWR__ARUN
);
first_scan
=
true
;
for
(;;)
{
if
(
first_scan
)
{
tmo
=
(
int
)
(
appl
.
scantime
()
*
1000
-
1
);
}
get
.
maxSize
=
sizeof
(
mp
);
get
.
data
=
mp
;
qcom_Get
(
&
amp
;
sts
,
&
amp
;
qid
,
&
amp
;
get
,
tmo
);
if
(
sts
==
QCOM__TMO
||
sts
==
QCOM__QEMPTY
)
{
if
(
!
swap
)
appl
.
scan
();
}
else
{
ini_mEvent
new_event
;
qcom_sEvent
*
ep
=
(
qcom_sEvent
*
)
get
.
data
;
new_event
.
m
=
ep
-&
gt
;
mask
;
if
(
new_event
.
b
.
oldPlcStop
&
amp
;
&
amp
;
!
swap
)
{
errh_SetStatus
(
PWR__APPLRESTART
);
swap
=
1
;
appl
.
close
();
}
else
if
(
new_event
.
b
.
swapDone
&
amp
;
&
amp
;
swap
)
{
swap
=
0
;
appl
.
open
();
errh_SetStatus
(
PWR__ARUN
);
}
else
if
(
new_event
.
b
.
terminate
)
{
exit
(
0
);
}
}
first_scan
=
false
;
}
}
/** @} */
/** @} */
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