Commit 7962453d authored by Claes Sjofors's avatar Claes Sjofors

PRM update with pdf output

parent 19879b4c
......@@ -263,26 +263,28 @@ static pwr_tStatus nmpsappl_cell_init(
}
/**
*@brief Initierar spegling.
*@brief Initialize mirroring.
*
* Med nmpsappl_MirrorInit initierar man en spegling genom att ange de celler som ska speglas.
* Man fr till baka en context som anvnds fr att skilja olika speglingar t.
* Efter initieringen anropas nmpsappl_Mirror cykliskt fr att f information om cellinnehllet.
* nmpsappl_MirrorInit initiates a mirroring by specifying the cells that should
* be mirrored.
*
*
*@return pwr_tStatus
* Use nmpsappl_Mirror to fetch the mirrored data structure.
*
* The option argument is a bitmask where the bits specifies different functions
* in nmpsappl_mirror:
* - nmpsappl_mOption_Remove Dataobject that is removed since the last call of
* nmpsappl_Mirror is added to the dataobject list with the remove flags set.
* - nmpsappl_mOption_NamePath The name field for a dataobject in the datastructure
* returned by nmpsappl_Mirror contains the path.
*
* @see nmpsappl_Mirror
* @return pwr_tStatus
*/
pwr_tStatus
nmpsappl_MirrorInit(
pwr_tString80 *cell_array, /**< En vektor som innehller namnet p de celler som ska speglas.
De speglade dataobjekten ordnas i den ordning cellerna anges i vektorn.
En NULL-string markerar sista cellnamnet. */
unsigned long options, /**< Options r en bitmask. Bitarna anger olika funktioner fr nmpsappl_mirror:
nmpsappl_mOption_Remove - Dataobjekt som har frsvunnit frn de angivna cellerna sedan senaste
anropet lggs med i dataobjektlistan med remove-flaggan satt.
nmpsappl_mOption_NamePath - Namnfltet i den datastruktur som returneras fr ett dataobjekt
p dataobjektet innehller hierarkinamnet. */
nmpsappl_t_ctx *ctx /**< En kontext-pekare som skickas med till nmpsappl_mirror rutinen. */
pwr_tString80 *cell_array, /**< A string array with the names of the cells that should be mirrored. The element after the last cellname should be a NULL string. */
unsigned long options, /**< Bitmask specifying options for the mirroring.*/
nmpsappl_t_ctx *ctx /**< Context pointer. */
)
{
pwr_tString80 *cellname;
......@@ -422,64 +424,58 @@ nmpsappl_MirrorInit(
}
/**
*@brief Anropas cykliskt fr att uppdatera speglingen.
*@brief Update mirroring.
*
* Rutinen fyller i en lista p samtliga dataobjekt som finns i cellerna.
* Listan r av typen nmpsappl_t_datainfo. (lnk till structdef?)
* nmpsappl_Mirror mirrors the content of one or several cells into an application
* program.
*
* nmpsappl_mirror speglar innehllet i en eller flera celler till ett applikationsprogram.
* Funktionen hanterar direktlnkning av celler och dataobjekt och returnerar ej lista p dataobjekt till applikationen,
* tillsammans med information om bakkant, framkant, utval, vilka objekt som r nya eller har frsvunnit, vilken cell ett objekt tillhr.
* Applikationen frses ven med pekare till dataobjekten.
*
* Man initierar en spegling genom att anropar rutinen nmpsappl_MirrorInit.
* Som argument skickar man med en lista p de celler som ska speglas.
* Sedan anropas nmpsappl_Mirror cykliskt fr att f information om vilka dataobjekt som ligger i cellerna.
* Alla dataobjekt som finns i den angivna cellerna bakas ihop i en vektor,
* och ordningen bestmms av den ordning man angivit cellerna till nmpsappl_MirrorInit.
*
* Flera speglingar (max 32 st) kan hanteras i samma program, och varje spegling omfattar maximalt 32 celler.
* Samma cell kan tillhra flera speglingar.
* Man kan t ex spegla samtliga celler i systemet i en array, samtidigt som man speglar enstaka celler, eller urval av celler i andra arrayer.
*
*
* Exempel
* The function handles direct link of cells and dataobjects, and returns a list of
* data objects to the application together with information about front, back, select
* properties, and which data objects are new or has disappeard. The application also
* receives a pointer to each data object.
*
* The mirroring is initiated by calling nmpsappl_MirrorInit. The cells are
* mirrored are specified in this call. Then nmpsappl_Mirror is called cyclic
* to recieve the current content of the cells. All the dataobjects found in the
* cells are placed in an array, and the order the cells was specified in
* nmpsappl_MirrorInit determines the order in the dataobject array.
*
* Several mirroring can be handled in the same application (max 32), and each
* mirroring can handle maximum 32 cells.
*
* Exempel
* @code
* #include "pwr_inc:pwr.h"
* #include "ssab_inc:rs_nmps_appl.h"
* #include "pwrp_inc:pwr_cvolvkvendclasses.h"
*
* main()
* {
* nmpsappl_t_ctx ctx;
* int i;
* int plate_count;
* nmpsappl_t_datainfo *plate_info;
* pwr_tStatus sts;
* pwr_sClass_Plate *plate_ptr;
* pwr_tString80 cellnames[] = {
* "VKV-END-PF-Pltfljning-W-Svb15",
* "VKV-END-PF-Pltfljning-W-R30A",
* nmpsappl_t_ctx ctx;
* int i;
* int plate_count;
* nmpsappl_t_datainfo *plate_info;
* pwr_tStatus sts;
* pwr_sClass_Plate *plate_ptr;
* pwr_tString80 cellnames[] = {
* "VKV-END-PF-Plc-W-Svb15",
* "VKV-END-PF-Plc-W-R30A",
* ""};
*
* // Init pams and gdh
* sts = gdh_Init( 0, NULL);
* if (EVEN(sts)) LogAndExit( sts);
* // Init Proview runtime
* sts = gdh_Init( "rs_nmps);
* if (EVEN(sts)) LogAndExit( sts);
*
* // Init the mirroring
* sts = nmpsappl_MirrorInit( cellnames,
* nmpsappl_mOption_Remove, &ctx);
* if (EVEN(sts)) exit(sts);
* // Init the mirroring
* sts = nmpsappl_MirrorInit( cellnames, nmpsappl_mOption_Remove, &ctx);
* if (EVEN(sts)) exit(sts);
*
* for (;;)
* {
* sts = nmpsappl_Mirror( ctx, &plate_count,
* &plate_info);
* for (;;) {
* sts = nmpsappl_Mirror( ctx, &plate_count, &plate_info);
*
* for ( i = 0; i < plate_count; i++)
* {
* plate_ptr = plate_info[i].object_ptr;
* printf( "%20s %1d %1d %1d %1d %1d %4d %5.1f\n",
* for ( i = 0; i < plate_count; i++) {
* plate_ptr = plate_info[i].object_ptr;
* printf( "%20s %1d %1d %1d %1d %1d %4d %5.1f\n",
* plate_info[i].name,
* plate_info[i].front,
* plate_info[i].back,
......@@ -488,18 +484,18 @@ nmpsappl_MirrorInit(
* plate_info[i].removed,
* plate_info[i].cell_mask,
* plate_ptr->Tjocklek);
* }
* sleep( 1);
* }
* }
* sleep( 1);
* }
* }
*
*@endcode
*@return pwr_tStatus
*/
pwr_tStatus
nmpsappl_Mirror(
nmpsappl_t_ctx applctx, /**< En kontext-pekare som erhlls vid anrop till nmpsappl_mirror_init. */
int *data_count, /**< Antal dataobjekt i dataobjekts-listan. */
nmpsappl_t_datainfo **datainfo /**<Lista p dataobjekten i cellerna. */
nmpsappl_t_ctx applctx, /**< Context for nmpsappl mirror. */
int *data_count, /**< Number or data object in the array. */
nmpsappl_t_datainfo **datainfo /**< Data strucure with dataobjects found in the cells. */
)
{
int i, j, k;
......@@ -752,15 +748,15 @@ nmpsappl_Mirror(
}
/**
*@brief Tar bort ett dataobjekt ur de celler som speglas.
*
*@brief Removes a dataobject from one of the cells that are mirrored.
*
*@see nmpsappl_RemoveAndDeleteData
*@return pwr_tStatus
*/
pwr_tStatus
nmpsappl_RemoveData(
nmpsappl_t_ctx applctx, /**< Kontext-pekare som erhlls vid anrop till nmpsappl_mirror_init. */
pwr_tObjid objid /**< Objid fr dataobjekt som ska tas bort. */
nmpsappl_t_ctx applctx, /**< Context for nmpsappl mirror. */
pwr_tObjid objid /**< Objid for dataobject that is to be removed. */
)
{
int k;
......@@ -791,16 +787,15 @@ nmpsappl_RemoveData(
/**
*@brief Tar bort ett dataobjekt ur de celler som speglas.
*
* Tar bort ett dataobjekt ur de celler som speglas. Dessutom tas objektet bort ur databasen.
*@brief Removes and deletes a dataobject from one of the cells that are mirrored.
*
*@see nmpsappl_RemoveData
*@return pwr_tStatus
*/
pwr_tStatus
nmpsappl_RemoveAndDeleteData(
nmpsappl_t_ctx applctx, /**< Kontext-pekare som erhlls vid anrop till nmpsappl_mirror_init. */
pwr_tObjid objid /**< Objid fr dataobjekt som ska tas bort. */
nmpsappl_t_ctx applctx, /**< nmpsappl mirror context. */
pwr_tObjid objid /**< Objid for the data object that is to be removed. */
)
{
int sts, k;
......
......@@ -28,7 +28,7 @@
This include file contains the Proview NMps type definitions.
*/
/** @addtogroup NMps */
/** @addtogroup NMpsAppl */
/*@{*/
#if defined __cplusplus
......@@ -46,7 +46,7 @@ extern "C" {
#define nmpsappl_mOption_ReverseOrder (1 << 2)
/** @defgroup NMPS_DS Data Structures
/** @defgroup NMPS_DS NMpsAppl Data Structures
* @ingroup NMps
* @{
*/
......@@ -65,15 +65,31 @@ typedef struct nmpsappl_s_cellist {
} nmpsappl_t_cellist;
typedef struct {
pwr_tObjid objid; /**< Dataobjektets objid */
pwr_tString80 name; /**< Dataobjektet namn (sista namnledet) */
pwr_tAddress object_ptr; /**< Pekare till dataobjektet */
pwr_tBoolean select; /**< Select-attributet fr dataobjektet i cell-objektet. Om ett dataobjekt ligger i flera celler, stts select om objektet r utvalt i minst en av cellerna. */
pwr_tBoolean front; /**< Front-attributet fr dataobjektet i cell-objektet. Om ett dataobjekt ligger i flera celler, stts front om front-flaggen r satt i en av cellerna. */
pwr_tBoolean back; /**< Back-attributet fr dataobjektet i cell-objektet. Om ett dataobjekt ligger i flera celler, stts back om back-flaggen r satt i en av cellerna. */
pwr_tBoolean newdata; /**< Markerar att ett dataobjekt r nytt sedan senaste speglingen.*/
pwr_tBoolean removed; /**< Markerar att dataobjektet har frsvunnit sedan senaste speglingen. Krver att nmpsappl_mOption_Remove har angetts i options. */
unsigned long cell_mask; /**< Anger vilken eller vilka celler dataobjektet befinner sig i. cell_mask r en bitmask dr frsta biten anger frsta cellen (dvs den som angivits frst i listan till nmpsappl_mirror_init), osv. */
pwr_tObjid objid; /**< Dataobject objid */
pwr_tString80 name; /**< Dataobject name (last segment) */
pwr_tAddress object_ptr; /**< Pointer to data object */
pwr_tBoolean select; /**< The select attribute for the dataobject in the
cell object. If the dataobject is present in several
cells, select is set if the dataobject is selected
in at least one of the cells. */
pwr_tBoolean front; /**< The Front attribute for the dataobject in the cell
object. If the dataobject is present in several
cells, front is set if the Front flag is set in one
of the cells. */
pwr_tBoolean back; /**< The Back attribute for the dataobject in the cell
object. If the dataobject is present in several
cells, back is set if the Back flag is set in one
of the cells. */
pwr_tBoolean newdata; /**< Marks that a data object is new since the last
mirror. */
pwr_tBoolean removed; /**< Marks that the dataobject has disappeard since
the last mirror. Requires the the option
nmpsappl_mOption_Remove is selected. */
unsigned long cell_mask; /**< Mask that specifies in which cell or which
cells the dataobject resides. The first bit
corresponds to the first cell, i.e. the first
cell in cell list supplied to nmpsappl_MirrorInit,
etc. */
} nmpsappl_t_datainfo;
typedef struct nmpsappl_s_ctx {
......@@ -90,7 +106,7 @@ typedef struct nmpsappl_s_ctx {
/** @} */
/**
* @defgroup NMPS_FC Function Calls
* @defgroup NMPS_FC NMpsAppl Functions
* @ingroup NMps
* @{
*/
......
This diff is collapsed.
This diff is collapsed.
......@@ -41,7 +41,18 @@ $(clean_html) : clean_%.html : %.html
$(doc_dir)/prm/index.html : ../../doxygen.dx
@ echo "doxygen documentation $(source) $(target)"
@ doxygen
@ if [ -e latex ]; then \
./repl.sh latex/*.tex; \
cd latex; \
make pdf; \
cp refman.pdf $(pwr_doc)/en_us/man_prm.pdf; \
cp classra__appl.pdf $(pwr_doc)/en_us/; \
cp classrt__appl.pdf $(pwr_doc)/en_us/; \
cd ..; \
rm -r -f latex; \
rm -f repl.sed; \
rm -f repl.tmp; \
fi
......
......@@ -7,8 +7,8 @@
/*@{*/
/** @defgroup rt_ex Example applications
* @ingroup NMps
/** @defgroup rt_ex Application examples
* @ingroup applex
* @{
*/
#include "pwr.h"
......@@ -18,6 +18,8 @@
//! A simple c++ application example
/*! ra_appl is a subclass to rt_appl and implements the virtual
* functions open(), close(), and scan().
*
* @see ra_appl.cpp
*/
class ra_appl : public rt_appl {
public:
......@@ -53,159 +55,6 @@ int main()
appl.mainloop();
}
#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"
//! Advanced c++ application example
/*! Example of a proview application program
*/
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;
}
}
/** @} */
/** @} */
......@@ -24,7 +24,9 @@
<h2 id="mainmenu">Reference Manuals</h2>
<table id="mainmenu" border="1" cellspacing="0" width="100%">
<tr><td id="mainmenu"><a id="mainmenu" href="orm_f.html" target="_top">Object Reference Manual</a></td></tr>
<tr><td id="mainmenu"><a id="mainmenu" href="prm_f.html" target="_top">API Reference</a></td></tr>
<tr><td id="mainmenu"><a id="mainmenu" href="prm_f.html" target="_top">Programmer's Reference Manual</a>
<a id="mainmenulink" href="prm_f.html" target="top"><br>(html),</a>
<a id="mainmenulink" href="man_prm.pdf" target="right">(pdf)</a></td></tr>
</table>
<h2 id="mainmenu">Guides</h2>
<table id="mainmenu" border="1" cellspacing="0" width="100%">
......
......@@ -24,7 +24,9 @@
<h2 id="mainmenu">Referens</h2>
<table id="mainmenu" border="1" cellspacing="0" width="100%">
<tr><td id="mainmenu"><a id="mainmenu" href="orm_f.html" target="_top">Objekthandbok (ORM)</a></td></tr>
<tr><td id="mainmenu"><a id="mainmenu" href="../en_us/prm_f.html" target="_top">API-handbok (PRM)</a></td></tr>
<tr><td id="mainmenu"><a id="mainmenu" href="../en_us/prm_f.html" target="_top">API-handbok</a>
<a id="mainmenulink" href="../en_us/prm_f.html" target="top"><br>(html),</a>
<a id="mainmenulink" href="../en_us/man_prm.pdf" target="right">(pdf)</a></td></tr>
</table>
<h2 id="mainmenu">Guider</h2>
<table id="mainmenu" border="1" cellspacing="0" width="100%">
......
......@@ -45,7 +45,7 @@ extern "C" {
needed to use CDH.
*/
/*! \defgroup Cdh_DS Data Structures
/*! \defgroup Cdh_DS Cdh Data Structures
\ingroup Cdh
*/
......@@ -444,6 +444,15 @@ typedef union {
//! Name string format description.
/*!
Bitmask that denotes an object or attriubte name string, i.e. which components of the
name that is included in the string.<br>
Some common examples are
<b>cdh_mName_object</b> Object.<br>
<b>cdh_mName_object | cdh_mName_attribute</b> Object and attribute.<br>
<b>cdh_mName_pathStrict</b> Path, object and attribute<br>
<b>cdh_mName_volumeStrict</b> Volume, path, object and attribute.
Let us assume we have an object of class Ai.
The object has an attribute called FilterAttribute.
......@@ -663,7 +672,12 @@ typedef struct {
} cdh_sParseName;
/*@}*/
/*! \addtogroup Cdh */
/*! \defgroup Cdh_FC Cdh Functions
\ingroup Cdh
*/
/*! \addtogroup Cdh_FC */
/*@{*/
/* Function prototypes to exported functions. */
......
......@@ -56,9 +56,15 @@ typedef unsigned int time_tClock;
This include file contains definitions and function prototypes
needed to use time functions.
*/
/*! \addtogroup Time */
/*! \defgroup Time_DS Time Data Structures
\ingroup Time
*/
/*! \addtogroup Time_DS */
/*@{*/
//! Time string format
typedef enum {
time_eFormat_DateAndTime = 0, //!< Display date and time, 01-JAN-1970 01:00:00.00
......@@ -92,6 +98,15 @@ typedef enum {
);
#endif
/*@}*/
/*! \defgroup Time_FC Time Functions
\ingroup Time
*/
/*! \addtogroup Time_FC */
/*@{*/
int time_IsNull (pwr_tTime *t1);
pwr_tTime * time_Aabs (pwr_tTime*, pwr_tTime*);
pwr_tTime * time_Aadd (pwr_tTime*, pwr_tTime*, pwr_tDeltaTime*);
......
......@@ -36,20 +36,43 @@
*/
class rt_appl {
public:
rt_appl( char *name, errh_eAnix anix,
double scantime = 1.0, qcom_sQid qid = qcom_cNQid) :
m_anix(anix), m_scantime(scantime), m_qid(qid)
//! Constructor.
rt_appl(
char *name, //< Process name.
errh_eAnix anix, //< Application index.
double scantime = 1.0, //< Scantime for call of the scan() function.
qcom_sQid qid = qcom_cNQid //< Qcom queue identity.
) : m_anix(anix), m_scantime(scantime), m_qid(qid)
{ strcpy( m_name, name); }
void init();
virtual void open() {};
virtual void close() {};
virtual void scan() {};
void register_appl( char *name);
void mainloop();
double scantime() { return m_scantime;}
void set_scantime( double time) { m_scantime = time;}
pwr_tOid& apploid() { return m_apploid;}
//! Initialize the application.
/*! The open() function is called after initialization, and may contain setup of
direct links to objects and attributes in the realtime database.
The open() function is also called after a soft restart.
*/
virtual void open() {};
//! Closes the application.
/*! the close() is called when a restart or stop event is received. It should
unlink to all direct links.
*/
virtual void close() {};
//! Cyclic function.
/*! The scan() function is called cyclic with the scantime specified in the constructor.
In this function all the control and supervision work of the application is placed.
*/
virtual void scan() {};
virtual ~rt_appl() {}
private:
......
This diff is collapsed.
This diff is collapsed.
......@@ -46,7 +46,7 @@ extern "C" {
#endif
/** @defgroup MSGH_DS Data Structures
/** @defgroup MSGH_DS MhAppl Data Structures
* @ingroup MSGH
* @{
*/
......@@ -117,14 +117,10 @@ struct mhs_ApplMessage {
/**@}*/
/** @defgroup MSGH_FC Function Calls
/** @defgroup MSGH_FC MhAppl Functions
* @ingroup MSGH
* @{
*/
/** @defgroup MSG_AR Application routines
* @ingroup MSGH_FC
* @{
*/
pwr_tStatus mh_ApplCancel (
pwr_tUInt32 id,
......@@ -175,7 +171,6 @@ pwr_tStatus mh_ApplGetMsgInfo (
mh_sApplMessage *Message
);
/**@}*/
/**@}*/
/**@}*/
......
......@@ -82,7 +82,7 @@ extern "C"
#define qcom_cInacp (1<<31 | 106)
#define qcom_cIini (1<<31 | 107)
/** @defgroup QCOM_DS Data Structures
/** @defgroup QCOM_DS Qcom Data Structures
* @ingroup QCOM
* @{
*/
......@@ -244,7 +244,7 @@ typedef struct {
/** @} */
/** @defgroup QCOM_FC Function Calls
/** @defgroup QCOM_FC Qcom Functions
* @ingroup QCOM
* @{
*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment