view src/gpf2/inc/pco_view_core.h @ 600:8f50b202e81f

board preprocessor conditionals: prep for more FC hw in the future This change eliminates the CONFIG_TARGET_FCDEV3B preprocessor symbol and all preprocessor conditionals throughout the code base that tested for it, replacing them with CONFIG_TARGET_FCFAM or CONFIG_TARGET_FCMODEM. These new symbols are specified as follows: CONFIG_TARGET_FCFAM is intended to cover all hardware designs created by Mother Mychaela under the FreeCalypso trademark. This family will include modem products (repackagings of the FCDEV3B, possibly with RFFE or even RF transceiver changes), and also my desired FreeCalypso handset product. CONFIG_TARGET_FCMODEM is intended to cover all FreeCalypso modem products (which will be firmware-compatible with the FCDEV3B if they use TI Rita transceiver, or will require a different fw build if we switch to one of Silabs Aero transceivers), but not the handset product. Right now this CONFIG_TARGET_FCMODEM preprocessor symbol is used to conditionalize everything dealing with MCSI. At the present moment the future of FC hardware evolution is still unknown: it is not known whether we will ever have any beyond-FCDEV3B hardware at all (contingent on uncertain funding), and if we do produce further FC hardware designs, it is not known whether they will retain the same FIC modem core (triband), if we are going to have a quadband design that still retains the classic Rita transceiver, or if we are going to switch to Silabs Aero II or some other transceiver. If we produce a quadband modem that still uses Rita, it will run exactly the same fw as the FCDEV3B thanks to the way we define TSPACT signals for the RF_FAM=12 && CONFIG_TARGET_FCFAM combination, and the current fcdev3b build target will be renamed to fcmodem. OTOH, if that putative quadband modem will be Aero-based, then it will require a different fw build target, the fcdev3b target will stay as it is, and the two targets will both define CONFIG_TARGET_FCFAM and CONFIG_TARGET_FCMODEM, but will have different RF_FAM numbers. But no matter which way we are going to evolve, it is not right to have conditionals on CONFIG_TARGET_FCDEV3B in places like ACI, and the present change clears the way for future evolution.
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 01 Apr 2019 01:05:24 +0000
parents 864b8cc0cf63
children
line wrap: on
line source

/* 
+----------------------------------------------------------------------------- 
|  Project :  PCO2
|  Modul   :  PCO_VIEW_CORE
+----------------------------------------------------------------------------- 
|  Copyright 2002 Texas Instruments Berlin, AG 
|                 All rights reserved. 
| 
|                 This file is confidential and a trade secret of Texas 
|                 Instruments Berlin, AG 
|                 The receipt of or possession of this file does not convey 
|                 any rights to reproduce or disclose its contents or to 
|                 manufacture, use, or sell anything it may describe, in 
|                 whole, or in part, without the specific written consent of 
|                 Texas Instruments Berlin, AG. 
+----------------------------------------------------------------------------- 
|  Purpose :  This Modul contains the core viewer class
|             with basic functions and handlers for several PCO control 
|             messages.
|             It is 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 !
+----------------------------------------------------------------------------- 
*/ 

#ifndef _PCO_VIEW_CORE_H_
#define _PCO_VIEW_CORE_H_

/*==== INCLUDES ===================================================*/
#ifndef PCO_VIEW_CORE_CPP
#include "pco_view_templ.h"
#else
#include "view/pco_view_templ.h"
#endif
#include "pco_inifile.h"

/*==== DEFINES =====================================================*/

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

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

  /*
  +-------------------------------------------------------------------------------+
  | PROJECT : PCO2                       MODULE  : PCO_CTRL_CORE                  |
  | STATE   : code                       ROUTINE : PCOView_core::dispatch_message           |
  +-------------------------------------------------------------------------------+

    PURPOSE : parses a PCO control message
    PARAMS:   buf   ... the data
              size   .. size of buf
              id    ... id of the message
              sender .. queue name of sender

    RETURNS:   0 .. if message has been handled
              -1 .. otherwise

  */
  virtual int dispatch_message(void* buf, U16 size, U16 id, const char* sender);

  
  /*
  +-------------------------------------------------------------------------------+
  | PROJECT : PCO2                       MODULE  : PCO_CTRL_CORE                  |
  | STATE   : code                       ROUTINE : PCOView_core::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
              index   .. index of data message (e.g. in logfile) ... 0 means no index!!
              ttype   .. type of time stamp - see PCO_TTYPE_XXX constants
              time    .. time stamp 
              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, ULONG& index, ULONG& ttype, U32 &time, 
    char* &sender, char* &receiver) {return -1;}

  /*
  +-------------------------------------------------------------------------------+
  | PROJECT : PCO2                       MODULE  : PCO_VIEW_CORE                  |
  | STATE   : code                       ROUTINE : PCOView_core::on_data          |
  +-------------------------------------------------------------------------------+

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

    PARAMS:   data   .. the data
              size   .. size of data
              id     .. id of data message
              index  .. index of data message (e.g. in logfile) ... 0 means no index!!
              ttype  .. type of time stamp - see PCO_TTYPE_XXX constants
              time   .. time stamp 
              sender .. name of sender
              receiver.. name of original receiver

  */
  virtual void on_data(void* data, U16 size, ULONG id, ULONG index,
    ULONG ttype, U32 time, const char* sender, char* receiver) {}

  /*
  +-------------------------------------------------------------------------------+
  | PROJECT : PCO2                       MODULE  : PCO_VIEW_CORE                  |
  | STATE   : code                       ROUTINE : PCOView_core::on_raw_data      |
  +-------------------------------------------------------------------------------+

    PURPOSE : here reaction to the raw data just as received from server takes place
              (may be implemented by derived classes)
              if interpretation succeeded it will be called AFTER on_data(), otherwise
              only on_raw_data() is called

    PARAMS:   rawdata  .. the data
              rawsize  .. size of data

  */
  virtual void on_raw_data(void* rawdata, U16 rawsize) {}

  /*
  +-------------------------------------------------------------------------------+
  | PROJECT : PCO2                       MODULE  : PCO_VIEW_CORE                  |
  | STATE   : code                       ROUTINE : PCOView_core::on_corrupt_data  |
  +-------------------------------------------------------------------------------+

    PURPOSE : this function is called if corrupt data has been received
              deriving viewers may, e.g., release semaphores

    PARAMS:   
  */
  virtual void on_corrupt_data() {}

  /*
  +----------------------------------------------------------------------------------+
  | PROJECT : PCO2                       MODULE  : PCO_VIEW_CORE                     |
  | STATE   : code                       ROUTINE : PCOView_core::propagate_inichange |
  +----------------------------------------------------------------------------------+

    PURPOSE : saves ini-file and sends an information about important ini-file changes
              to the server, which will propagate it to all connected viewers

    PARAMS:   

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

  /*
  +--------------------------------------------------------------------------------+
  | PROJECT : PCO2                       MODULE  : PCO_VIEW_CORE                   |
  | STATE   : code                       ROUTINE : PCOView_core::self_trace        |
  +--------------------------------------------------------------------------------+

    PURPOSE : adds a new trace string to the queue of this viewer
              (has to be implemented by derived classes !)

    PARAMS:   

  */
  virtual void self_trace(const char* trace)=0;

  /*
  +-------------------------------------------------------------------------------+
  | PROJECT : PCO2                       MODULE  : PCO_VIEW_CORE                  |
  | STATE   : code                       ROUTINE : PCOView_core::on_inichange     |
  +-------------------------------------------------------------------------------+

    PURPOSE : reloads important changes from ini-file

    PARAMS:   

  */
  virtual void on_inichange();

  bool  running() const {return m_running;}

  int dsize() const { return m_dsize;}
  int qsize() const { return m_qsize;}

  /*
  +-------------------------------------------------------------------------------+
  | PROJECT : PCO2                       MODULE  : PCO_VIEW_CORE                  |
  | STATE   : code                       ROUTINE : PCOView_core::shutdown         |
  +-------------------------------------------------------------------------------+

    PURPOSE : exits the viewer threads

    PARAMS:   

  */
  void shutdown();

  virtual IniFile&	inifile() { return m_inifile;}
  virtual const IniFile&	inifile() const { return m_inifile;}

protected:
  CMS_HANDLE	m_prim_handle,m_ctrl_handle;
  bool  m_running;

  IniFile         m_inifile;
  int             m_qsize, m_dsize;

  static  void cms_prim_proc(long view);
  static  void cms_ctrl_proc(long view);
};

#endif /* _PCO_VIEW_CORE_H_ */