moss-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Moss-devel] CVS: moss/colpatik/include API_Applications.h,NONE,1.1 API_


From: Manfred Morgner <address@hidden>
Subject: [Moss-devel] CVS: moss/colpatik/include API_Applications.h,NONE,1.1 API_Device.h,NONE,1.1 Makefile.am,1.2,1.3
Date: Mon, 28 Oct 2002 17:42:31 -0500

Update of /cvsroot/moss//moss/colpatik/include
In directory subversions:/tmp/cvs-serv5659/include

Modified Files:
        Makefile.am 
Added Files:
        API_Applications.h API_Device.h 
Log Message:
New classes for input and filter processing. Old files have to be deleted 
(later).


--- NEW FILE ---
/***************************************************************************
                       API_ApplicationsInterface.h
                       ---------------------------
    begin                : Tue Apr 30 2002
    copyright            : (C) 2002 by Manfred Morgner
    email                : address@hidden

  Applications Interface for Colpatik

 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *                                                                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place Suite 330,                                            *
 *   Boston, MA  02111-1307, USA.                                          *
 *                                                                         *
 ***************************************************************************/

#ifndef __API_APPLICATIONS_INTERFACE_H
#define __API_APPLICATIONS_INTERFACE_H

#if _MSC_VER >= 1000
#pragma once
#pragma warning (disable : 4786)
#endif // _MSC_VER >= 1000

#if __GNU__ >= 2
#  pragma interface
#endif // #if __GNU__ >= 2


namespace colpatik
  {
  // the data type for any entity
  typedef
    struct tagEntity
      {
      time_t tLocalTime;
      long   nId;
      } TEntity, *PEntity;
  
  // the appropiate class definition
  class CEntity : public TEntity
    {
    private:
      typedef TEntity inherited;

    public:
               CEntity();
      virtual ~CEntity();
    }; // class CEntity
  
  // calls an entity from the server
  CEntity  EntityGet(long nId);
  
  // send an new entity to the server
  CEntity& EntityAdd(const TEntity& rstEntity);
  
  // removes an exisiting entity from the server
  long EntityRemove(const TEntity& rstEntity);
  
  
  // the data type for any message
  typedef
    struct tagMessage
      {
      time_t      tLocalTime;
      long        nData;
      long        nInfo;
      PDeviceData pData;
      } TMessage, *PMessage;

  // the appropiate class definition
  class CMessage : public TMessage
    {
    private:
      typedef TMessage inherited;

    public:
               CMessage();
      virtual ~CMessage();
    }; // CMessage
  
  // calls a message from the message queue
  // removes the message from the queue
  CMessage* MessageGet();
  // sends a message to the message queue
  CMessage* MessagePut(CMessage* poMessage);
  
  } // namespace colpatik

#endif // __API_APPLICATIONS_INTERFACE_H

--- NEW FILE ---
/***************************************************************************
                    API_DeviceInterface.h  -  description
                             -------------------
    begin                : Tue Apr 30 2002
    copyright            : (C) 2002 by Manfred Morgner
    email                : address@hidden

  Device Interface for Colpatik

 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *                                                                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place Suite 330,                                            *
 *   Boston, MA  02111-1307, USA.                                          *
 *                                                                         *
 ***************************************************************************/

#ifndef __API_DEVICE_INTERFACE_H
#define __API_DEVICE_INTERFACE_H

#if _MSC_VER >= 1000
#pragma once
#pragma warning (disable : 4786)
#endif // _MSC_VER >= 1000

#if __GNU__ >= 2
#  pragma interface
#endif // #if __GNU__ >= 2


#include <string>

namespace colpatik
  {
  typedef long HDriver;

  // loads a driver
  // returns: 0 for error or other value for success
  //          rnResult contains the error code if the functions returns with 
error
  HDriver DriverLoad(const std::string& rsDriver, long& rnResult);

  // return: the version of the loaded module
  long DriverGetVersion(const HDriver& rhDriver);


  // the driver has a Query-Interface
  #define DT_QUERY     0x00000001
  // the driver has a Interrupt-Interface
  #define DT_INTERRUPT 0x00000002
  // the driver has a Polling-Interface
  #define DT_POLL      0x00000004
  // returns: a bitfield, dependend on the interface(s)
  //          the driver has
  long DriverGetType(const HDriver& rhDriver);


  // returns the shortest polling intervall in microseconds
  double DriverGetPollingIntervall(const HDriver& rhDriver);

  // driver capabilities
  // device has data
  #define DC_DATA                0x00000001
  // device has status information (like trigger or keyboard)
  #define DC_STATUS              0x00000002
  // driver/device can give info text (like "USB devices")
  #define DC_INFO_TEXT           0x00000004
  // driver can translate error numbers to text
  #define DC_ERROR_TEXT          0x00000008
  // device/driver contains watchdog functionality
  #define DC_WATCHDOG            0x00000010
  // device/driver is able to auto-wakeup
  #define DC_WATCHDOG_AUTOWAKEUP 0x00000020
  // returns the capabilities of the driver
  long DriverGetCapabilities(const HDriver& rhDriver);


  // driver has Query-Interface
  #define FN_QUERY        0x00000000
  // driver can give Query answer as string
  #define FN_QUERY_STRING 0x00000000
  // driver has changing info text
  #define FN_INFO         0x00000000
  // driver wishes to call the colpatik API
  #define FN_SET_CALLBACK 0x00000000
  // returns the functions of the driver as bit array
  long DriverGetFunctions(const HDriver& rhDriver);


  // return all values of the previouse funcitons at ones
  void DriverGetInfo(const HDriver& rhDriver,
                           long&    rnVersion,
                           long&    rnType,
                           long&    rnCapabilities,
                           long&    rnFunctions);
  typedef
    struct tagDeviceData
      {
      time_t tLocalTime;
      long   nPriority;
      long   nClass;
      long   nState;
      long   nDataSize;
      char*  pData;
      } TDeviceData, *PDeviceData;

  class CDeviceData : protected TDeviceData
    {
    private:
      typedef TDeviceData inherited;

    public:
               CDeviceData();
               CDeviceData(const CDeviceData& roSrc);
               CDeviceData(const TDeviceData& rstSrc);
               CDeviceData(const PDeviceData  pstSrc);
      virtual ~CDeviceData();

    protected:
      virtual bool Grab(      char* pData, long nSize);
      virtual bool Copy(const char* pData, long nSize);

      virtual            long    operator = (           long     nData);
      virtual            double  operator = (           double   dData);
      virtual const std::string& operator = (const std::string& rsData);

      void InitBasics();
    }; // class CDeviceData

  // calls the data from the driver
  // returns the state of the execution
  //   0 - success
  //   not 0 - no success
  long DriverDataGet(const HDriver&     rhDriver,
                           TDeviceData& rstData);

  // returns the last error drom the driver
  long DriverErrorLastGet(const HDriver& rhDriver);

  // gets an error text for an error number, if "nError" == 0,
  // the function returns the text for the last error
  long DriverErrorTextGet(const HDriver&     rhDriver,
                                std::string& rsError,
                                long         nError = 0);


  // callback type definition (for interrupting devices))
  typedef long (*pfnDeviceCallback)(const void* pData);

  // calback type declaration
  #define CB_STATUS 'S'
  #define CB_DATA   'D'

  // register the callback in the driver
  bool DriverCallbackRegister(const HDriver&    rhDriver,
                              const pfnDeviceCallback fnCallback,
                                    char        cType = CB_DATA);

  // inform the driver, that the given callback is dead now
  void DriverCallbackFree    (const HDriver&    rhDriver,
                              const pfnDeviceCallback fnCallback);

  // callback prototypes
  long DriverCallback4Data  (const TDeviceData* pstData);
  long DriverCallback4Status(const long*        pnStatus);

  } // namespace colpatik

#endif // __API_DEVICE_INTERFACE_H

Index: Makefile.am
===================================================================
RCS file: /cvsroot/moss//moss/colpatik/include/Makefile.am,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** Makefile.am 13 Jul 2002 14:07:38 -0000      1.2
--- Makefile.am 28 Oct 2002 22:42:28 -0000      1.3
***************
*** 1,11 ****
! SUBDIRS = modules
  
! EXTRA_DIST = RmcClient.h RmcServer.h generic.h rmc.h
  
  install-data-local:
        $(mkinstalldirs) $(prefix)/include/3Dsia/
!       $(INSTALL_DATA) Device.h $(prefix)/include/3Dsia/Device.h
!       $(INSTALL_DATA) DeviceInterrupt.h 
$(prefix)/include/3Dsia/DeviceInterrupt.h
!       $(INSTALL_DATA) DevicePoll.h $(prefix)/include/3Dsia/DevicePoll.h
!       $(INSTALL_DATA) DeviceQuery.h $(prefix)/include/3Dsia/DeviceQuery.h
! 
--- 1,8 ----
! SUBDIRS = 
  
! EXTRA_DIST = ColpatikDevice.h ColpatikInput.h Event.h Queue.h Device.h 
DeviceQuery.h DevicePoll.h DeviceInterrupt.h
  
  install-data-local:
        $(mkinstalldirs) $(prefix)/include/3Dsia/
!       $(INSTALL_DATA) API_Applications.h 
$(prefix)/include/3Dsia/API_Applications.h
!       $(INSTALL_DATA) API_Device.h $(prefix)/include/3Dsia/API_Device.h





reply via email to

[Prev in Thread] Current Thread [Next in Thread]