Commit f9b279ee authored by Claes Sjofors's avatar Claes Sjofors

Programmer's referense manual, sevcli API added

parent 5770ee7d
......@@ -23,6 +23,7 @@ This manual will give a description of the following API's
- Time Functions to convert and compare time values.
- Cdh Convert and compare object attributes.
- Errh Print messages on system log.
- Sevcli Storage environment client interface.
- NMps Interface to NMps Cell objects.
- rt_appl A base class for applications i c++.
*/
......@@ -318,6 +319,12 @@ This manual will give a description of the following API's
This module contains functions for logging error messages.
*/
/*! \defgroup SEVCLI Sevcli SEV Client interface
\ingroup PRM
This module contains for the SEV cilent and is used to fetch historical
data from the database.
*/
/*! \defgroup NMpsAppl NMpsAppl NMps API
\ingroup PRM
This module contains interface functions for application access to NMps.
......
......@@ -589,6 +589,7 @@ INPUT = $(pwre_sroot)/doc/prm/src/doxygen.dx \
$(pwre_sroot)/lib/rt/src/rt_errh.h \
$(pwre_sroot)/lib/rt/src/rt_mh_appl.h \
$(pwre_sroot)/lib/rt/src/rt_qcom.h \
$(pwre_sroot)/lib/rt/src/rt_sevcli.h \
$(pwre_croot)/nmps/lib/nmps/src/nmps_appl.h \
$(pwre_sroot)/lib/rt/src/rt_appl.h \
$(pwre_sroot)/lib/rt/src/rt_appl.cpp \
......@@ -598,6 +599,7 @@ INPUT = $(pwre_sroot)/doc/prm/src/doxygen.dx \
$(pwre_sroot)/lib/rt/src/rt_errh.c \
$(pwre_sroot)/lib/rt/src/rt_mh_appl.c \
$(pwre_sroot)/lib/rt/src/rt_qcom.c \
$(pwre_sroot)/lib/rt/src/rt_sevcli.c \
$(pwre_croot)/nmps/lib/nmps/src/nmps_appl.c \
$(pwre_sroot)/doc/prm/src/ra_appl.cpp \
$(pwre_sroot)/doc/prm/src/ra_advappl.cpp \
......
......@@ -45,6 +45,13 @@
#include "rt_sev_net.h"
/**
* @brief Initialization of the client. Creates a context and opens a Qcom queue for
* the communication. The function returns a context that is used in all subsequent
* sevcli calls.
*
* @return pwr_tStatus
*/
int sevcli_init( pwr_tStatus *sts, sevcli_tCtx *ctx)
{
// Create a queue to server
......@@ -64,6 +71,11 @@ int sevcli_init( pwr_tStatus *sts, sevcli_tCtx *ctx)
return 1;
}
/**
* @brief Close the communication. Removes the Qcom queue and frees the context.
*
* @return pwr_tStatus
*/
int sevcli_close( pwr_tStatus *sts, sevcli_tCtx ctx)
{
// Delete queue
......@@ -75,11 +87,25 @@ int sevcli_close( pwr_tStatus *sts, sevcli_tCtx ctx)
return 1;
}
/**
* @brief Set server from node id.
* This function is called to state which server node you want to communicate with.
* The server is stated with node identity.
*
* @return pwr_tStatus
*/
void sevcli_set_servernid( sevcli_tCtx ctx, pwr_tNid nid)
{
ctx->server = nid;
}
/**
* @brief Set server from node name.
* This function is called to state which server node you want to communicate with.
* The server is stated with node name.
*
* @return pwr_tStatus
*/
int sevcli_set_servernode( pwr_tStatus *sts, sevcli_tCtx ctx, char *nodename)
{
qcom_sNode node;
......@@ -114,6 +140,10 @@ int sevcli_set_servernode( pwr_tStatus *sts, sevcli_tCtx ctx, char *nodename)
return 0;
}
/**
* @brief Fetches a list with the stored attributes of the server.
* @return pwr_tStatus
*/
int sevcli_get_itemlist( pwr_tStatus *sts, sevcli_tCtx ctx, sevcli_sHistItem **list,
unsigned int *cnt)
{
......@@ -296,6 +326,11 @@ int sevcli_get_itemlist( pwr_tStatus *sts, sevcli_tCtx ctx, sevcli_sHistItem **l
}
*/
/**
* @brief Fetch stored historical data for an attribute.
*
* @return pwr_tStatus
*/
int sevcli_get_itemdata( pwr_tStatus *sts, sevcli_tCtx ctx, pwr_tOid oid,
char *aname, pwr_tTime starttime, pwr_tTime endtime, int numpoints,
pwr_tTime **tbuf, void **vbuf, int *rows,
......@@ -387,6 +422,11 @@ int sevcli_get_itemdata( pwr_tStatus *sts, sevcli_tCtx ctx, pwr_tOid oid,
}
/**
* @brief Fetch stored historical data for an object item.
*
* @return pwr_tStatus
*/
int sevcli_get_objectitemdata( pwr_tStatus *sts, sevcli_tCtx ctx, pwr_tOid oid, char *aname,
pwr_tTime starttime, pwr_tTime endtime, int numpoints,
pwr_tTime **tbuf, void **vbuf, int *rows,
......@@ -498,7 +538,11 @@ int sevcli_get_objectitemdata( pwr_tStatus *sts, sevcli_tCtx ctx, pwr_tOid oid,
return 1;
}
/**
* @brief Removes all data for a stored attribute in the storage database.
*
* @return pwr_tStatus
*/
int sevcli_delete_item( pwr_tStatus *sts, sevcli_tCtx ctx, pwr_tOid oid, char *aname)
{
sev_sMsgHistItemDelete *msg;
......
......@@ -39,6 +39,9 @@
/* rt_sevcli.h -- Storage client */
/** @addtogroup SEVCLI */
/*@{*/
#ifndef pwr_h
# include "pwr.h"
#endif
......@@ -52,33 +55,42 @@ extern "C"
{
#endif
/**
* Sevcli context
*/
typedef struct {
qcom_sQid qid;
pwr_tNid server;
unsigned int msg_id;
qcom_sQid qid; /**< QCOM queue id */
pwr_tNid server; /**< Server node id */
unsigned int msg_id; /**< Counter for message id */
} sevcli_sCtx, *sevcli_tCtx;
/**
* Sevcli attribute data
*/
typedef struct {
pwr_tAName aname;
pwr_eType type;
unsigned int size;
unsigned int elem;
pwr_tString16 unit;
pwr_tAName aname; /**< Attribute name */
pwr_eType type; /**< Attribute type */
unsigned int size; /**< Attribute size */
unsigned int elem; /**< Number of elements */
pwr_tString16 unit; /**< Attribute unit */
}
sevcli_sHistAttr;
/**
* Sevcli item data
*/
typedef struct {
pwr_tOid oid;
pwr_tAName oname;
pwr_tDeltaTime storagetime;
pwr_tTime creatime;
pwr_tTime modtime;
pwr_tString80 description;
pwr_tFloat32 scantime;
pwr_tFloat32 deadband;
pwr_tMask options;
unsigned int attrnum;
sevcli_sHistAttr attr[1];
pwr_tOid oid; /**< Object identity */
pwr_tAName oname; /**< Object name */
pwr_tDeltaTime storagetime; /**< Storage time from SevHist object */
pwr_tTime creatime; /**< Creation time */
pwr_tTime modtime; /**< Modification time */
pwr_tString80 description; /**< Description from SevHist object */
pwr_tFloat32 scantime; /**< Scantime from SevHist object */
pwr_tFloat32 deadband; /**< Deadband from SevHist object */
pwr_tMask options; /**< Options from SevHist object */
unsigned int attrnum; /**< Number of attributes */
sevcli_sHistAttr attr[1]; /**< Array of attribute data */
} sevcli_sHistItem;
......@@ -98,6 +110,8 @@ int sevcli_get_objectitemdata( pwr_tStatus *sts, sevcli_tCtx ctx, pwr_tOid oid,
pwr_tTime **tbuf, void **vbuf, int *rows,
sevcli_sHistAttr **histattr, int *numattributes);
/** @} */
#ifdef __cplusplus
}
#endif
......
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