⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pco_view_framesupp.h

📁 是一个手机功能的模拟程序
💻 H
字号:
/*
+-------------------------------------------------------------------------+
| PROJECT: PCO2 ()                    $Workfile:: pco_view_framesupp.h   $|
| Author:: RK  CONDAT GmbH            $Revision: 1.1.1.1 $|
| CREATED: 05.09.01                   $Modtime:: 6.09.99 12:07           $|
| STATE  : code                                                           |
+-------------------------------------------------------------------------+

   MODULE  : PCO_VIEW_FRAMESUPP

   PURPOSE : This Modul contains a viewer class derived directly from the
             core.
             It supports decoding of frame SYST_MESSAGEs and of LTS-Header/
             TIF-ASCII-DATA-messages.
             It is still intended to be specialized and extended, e.g. in 
             GUI-server-applications.
             Some member functions are totally virtual without any 
             standard body and have to be provided by the child class !

   EXPORT  : class PCOView_frameSupp
*/

#ifndef _PCO_VIEW_FRAMESUPP_H_
#define _PCO_VIEW_FRAMESUPP_H_

/*==== INCLUDES ===================================================*/
#ifndef PCO_VIEW_FRAMESUPP_CPP_CCD
#include "pco_view_core.h"
#else
#include "view/pco_view_core.h"
#endif

#include <time.h>

/*==== DEFINES =====================================================*/
#define PCO_TRC_OPC 0x0000

#define PCO_STR2IND_NOT_LOADED 0
#define PCO_STR2IND_AUTO_LOADED 1
#define PCO_STR2IND_MAN_LOADED 2

/*==== PROTOTYPES ==================================================*/

/*==== CLASSES =====================================================*/
class PCOView_frameSupp : public PCOView_core
{
public:
  PCOView_frameSupp(const char* ini_file, int& err,
                    const char* primq_name="", 
                    const char* ctrlq_name="");
  virtual ~PCOView_frameSupp();

  /*
  +-------------------------------------------------------------------------------------+
  | PROJECT : PCO2                       MODULE  : PCO_VIEW_FRAMESUPP                   |
  | STATE   : code                       ROUTINE : PCOView_frameSupp::interpret_message |
  +-------------------------------------------------------------------------------------+

    PURPOSE : here interpretation of received raw data takes place
              (has to be implemented by derived classes !)

    PARAMS:   buffer  .. raw data to be interpretated
              bufsize .. size of buffer
              data    .. actual data
              size    .. size of data
              id      .. id of data message
              time    .. time stamp in seconds since 1970 or milliseconds since reset
              sender  .. name of sender
              receiver.. name of original receiver

    RETURNS:   0 .. success
              -1 .. interpretation was not possible

  */
  virtual int interpret_message(void* buffer, U16 bufsize, 
    void* &data, U16 &size, ULONG &id, U32 &time, char* &sender, char* &receiver);

  /*
  +--------------------------------------------------------------------------------+
  | PROJECT : PCO2                       MODULE  : PCO_VIEW_FRAMESUPP              |
  | STATE   : code                       ROUTINE : PCOView_frameSupp::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_FRAMESUPP                    |
  | STATE   : code                       ROUTINE : PCOView_frameSupp::decode_tracestring |
  +--------------------------------------------------------------------------------------+

    PURPOSE : tries to decode an OPC in the tracestring (e.g. $<OPC>)

    PARAMS:   instr  .. original tracestring
              size   .. max size for outstr

    RETURNS:   0 .. success (outstr contains new tracestring)
              -1 .. no success while decoding
              -2 .. no decoding necessary

              lastOPC .. in case of success contains last opc found in instr
            
  */
  int decode_tracestring(const char* instr, char* outstr, U16 size, ULONG &lastOPC);

  /*
  +-----------------------------------------------------------------------------------+
  | PROJECT : PCO2                       MODULE  : PCO_CTRL_FRAMESUPP                 |
  | STATE   : code                       ROUTINE : PCOView_frameSupp::check_version   |
  +-----------------------------------------------------------------------------------+

    PURPOSE : tries to request the version of a running stack via the server
              -> will result in a SYST-trace starting with '&'

    PARAMS:   

    RETURNS:  0 .. sucess
              -1 .. Server not found
              -2 .. error while contacting Server 
          
  */
  int check_version();

  /*
  +--------------------------------------------------------------------------------------+
  | PROJECT : PCO2                       MODULE  : PCO_CTRL_FRAMESUPP                    |
  | STATE   : code                       ROUTINE : PCOView_frameSupp::check_communication|
  +--------------------------------------------------------------------------------------+

    PURPOSE : tries to send a system primitive to the running stack via the server
              -> will result in SYST-traces if communication is ok

    PARAMS:   

    RETURNS:  0 .. sucess
              -1 .. Server not found
              -2 .. error while contacting Server 
          
  */
  int check_communication();

  /*
  +--------------------------------------------------------------------------------------+
  | PROJECT : PCO2                       MODULE  : PCO_VIEW_FRAMESUPP                    |
  | STATE   : code                       ROUTINE : PCOView_frameSupp::load_str2ind_table |
  +--------------------------------------------------------------------------------------+

    PURPOSE : tries to explicitely load a str2ind-table

    PARAMS:   tname ... name of .tab-file

    RETURNS:  0  .. sucess
              -1 .. error while loading
        
  */
  int load_str2ind_table(const char* tname);

  /*
  +--------------------------------------------------------------------------------+
  | PROJECT : PCO2                       MODULE  : PCO_VIEW_FRAMESUPP              |
  | STATE   : code                       ROUTINE : PCOView_frameSupp::on_inichange |
  +--------------------------------------------------------------------------------+

    PURPOSE : reloads important changes from ini-file

    PARAMS:   

  */
  virtual void on_inichange();

  const char* ind2str_dir() const { return m_ind2str_dir;}
  void set_ind2str_dir(const char* dir);

  int ind2str_loaded() const { return m_ind2str_loaded;}

protected:
	time_t  m_str2ind_time;
  bool    m_show_str2ind_errors;
	char    m_ind2str_dir[500];
  int     m_ind2str_loaded;
  char    m_tracestrBuf[DATA_MSG_MAX_SIZE];
};

#endif /* _PCO_VIEW_FRAMESUPP_H_ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -