📄 pco_view_templ.h
字号:
/*
+--------------------------------------------------------------------+
| PROJECT: PCO2 () $Workfile:: pco_view_templ.h $|
| Author:: RK CONDAT GmbH $Revision: 1.1.1.1 $|
| CREATED: 22.02.01 $Modtime:: 6.09.99 12:07 $|
| STATE : code |
+--------------------------------------------------------------------+
MODULE : PCO_VIEW_TEMPLATE
PURPOSE : This Modul contains a template of a PCO viewer class
with basic functions for several PCO control messages.
It can either be used just to connect to a PCO server or
can be specialized and extended like in PCOView_templ.
EXPORT : class PCOView_templ
*/
#ifndef _PCO_VIEW_TEMPL_H_
#define _PCO_VIEW_TEMPL_H_
/*==== INCLUDES ===================================================*/
#include "pco_const.h"
/*==== DEFINES =====================================================*/
/*==== PROTOTYPES ==================================================*/
/*==== CLASSES =====================================================*/
class PCOView_templ
{
public:
/*
+-------------------------------------------------------------------------------+
| PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL |
| STATE : code ROUTINE : PCOView_templ::PCOView_templ |
+-------------------------------------------------------------------------------+
PURPOSE : initilizes viewer process
PARAMS: primq .. name of primitive queue
ctrlq .. name of control queue
RETURNS:
*/
PCOView_templ(const char* primq_name="", const char* ctrlq_name="");
virtual ~PCOView_templ();
/*
+-------------------------------------------------------------------------------+
| PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL |
| STATE : code ROUTINE : PCOView_templ::connect |
+-------------------------------------------------------------------------------+
PURPOSE : tries to connect with server
PARAMS:
RETURNS: 0 .. sucess
-1 .. Server not found
-2 .. error while contacting Server
*/
int connect(void);
/*
+-------------------------------------------------------------------------------+
| PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL |
| STATE : code ROUTINE : PCOView_templ::subscribe |
+-------------------------------------------------------------------------------+
PURPOSE : tries to subscribe for live data from server
PARAMS: mobileId .. name of mobile to receive live data from (may be empty)
RETURNS: 0 .. sucess
-1 .. Server not found
-2 .. error while contacting Server
*/
int subscribe(const char* mobileId);
/*
+-------------------------------------------------------------------------------+
| PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL |
| STATE : code ROUTINE : PCOView_templ::send2srv |
+-------------------------------------------------------------------------------+
PURPOSE : tries to send a data buffer to the server
PARAMS: buf ... pointer to buffer
size .. size of buffer
id ... message id
RETURNS: 0 .. sucess
-1 .. Server not found
-2 .. error while contacting Server
*/
int send2srv(void* buf, U16 size, U16 id);
/*
+-------------------------------------------------------------------------------+
| PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL |
| STATE : code ROUTINE : PCOView_templ::disconnect |
+-------------------------------------------------------------------------------+
PURPOSE : tries to disconnect from server
PARAMS:
RETURNS: 0 .. sucess
-1 .. Server not found
-2 .. error while contacting Server
*/
int disconnect(void);
/*
+-------------------------------------------------------------------------------+
| PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL |
| STATE : code ROUTINE : PCOView_templ::unsubscribe |
+-------------------------------------------------------------------------------+
PURPOSE : tries to unsubscribe from livedata stream from server
PARAMS:
RETURNS: 0 .. sucess
-1 .. Server not found
-2 .. error while contacting Server
*/
int unsubscribe(void);
/*
+-------------------------------------------------------------------------------+
| PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL |
| STATE : code ROUTINE : PCOView_templ::on_connected |
+-------------------------------------------------------------------------------+
PURPOSE : reaction to PCO_CONNECTED from server
PARAMS: buf .. data containing server type
sender .. server queue name
RETURNS: 0 .. server type supported
-1 .. server type not supported
*/
virtual int on_connected(const void *buf,const char* sender);
/*
+-------------------------------------------------------------------------------+
| PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL |
| STATE : code ROUTINE : PCOView_templ::get_logdata |
+-------------------------------------------------------------------------------+
PURPOSE : contacts server to request logged data
PARAMS: begin, end .. time area requested (in ms)
RETURNS: 0 .. sucess
-1 .. Server not found
-2 .. error while contacting Server
*/
int get_logdata(ULONG begin, ULONG end);
/*
+-------------------------------------------------------------------------------+
| PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL |
| STATE : code ROUTINE : PCOView_templ::open_logfile |
+-------------------------------------------------------------------------------+
PURPOSE : contacts server to request logged data from a specified logfile
PARAMS: fname .. name of logfile (full path)
RETURNS: 0 .. sucess
-1 .. Server not found
-2 .. error while contacting Server
*/
int open_logfile(const char* fname);
/*
+-------------------------------------------------------------------------------+
| PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL |
| STATE : code ROUTINE : PCOView_templ::set_filter |
+-------------------------------------------------------------------------------+
PURPOSE : contacts server to change filter settings
PARAMS: list .. '\0'-separated list of names of entitities
(terminated by "\0\0")
primitives/traces from entities in -list-
should not be forwarded
prim_trace
.. parameter to disable/enable general forwarding of
primitives/traces:
0 .. fowarding of everything (default)
1 .. no primitives
2 .. no traces
RETURNS: 0 .. sucess
-1 .. Server not found
-2 .. error while contacting Server
*/
int set_filter(const char* list, char prim_trace=0);
const char *primq_name() { return m_primq_name;}
const char *ctrlq_name() { return m_ctrlq_name;}
/*
+-------------------------------------------------------------------------------+
| PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL |
| STATE : code ROUTINE : PCOView_templ::set_srv_name |
+-------------------------------------------------------------------------------+
PURPOSE : change the name of the server queue
PARAMS: sname ... new name of server queue
*/
void set_srv_name(const char* sname);
U8 srv_type() const { return m_srv_type;}
protected:
char m_primq_name[MAX_QNAME_LEN+1],m_ctrlq_name[MAX_QNAME_LEN+1];
char m_srvq_name[MAX_QNAME_LEN+1];
U8 m_srv_type;
};
#endif /* _PCO_VIEW_TEMPL_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -