[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Moss-devel] CVS: moss/colpatik/include API_ApplicationsInterface.h,NONE
From: |
Manfred Morgner <address@hidden> |
Subject: |
[Moss-devel] CVS: moss/colpatik/include API_ApplicationsInterface.h,NONE,1.1 API_DeviceInterface.h,NONE,1.1 |
Date: |
Sun, 14 Jul 2002 17:48:18 -0400 |
Update of /cvsroot/moss//moss/colpatik/include
In directory subversions:/tmp/cvs-serv13341
Added Files:
API_ApplicationsInterface.h API_DeviceInterface.h
Log Message:
Added Colpatik API-Specifications for Applications and Drivers
--- NEW FILE ---
/***************************************************************************
API_ApplicationsInterface.h - description
-------------------
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. *
* *
***************************************************************************/
namespace dsia
{
// the data type for any entity
typedef
struct tagEntity
{
time_t tLocalTime;
long nId;
} TEntity, *PEntity;
// the appropiate class definition
class CEntity : public TEntity
{
}; // 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;
} TMessage, *PMessage;
// the appropiate class definition
class CMessage : public TMessage
{
}; // CMessage
// calls a message from the message queue
// for use in the application
CMessage MessageGet();
// sends a message to the message queue
// for use anywhere other than in the application
CMessage MessagePut(const CMessage& roMessage);
} // namespace dsia
--- 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. *
* *
***************************************************************************/
#include <string>
namespace dsia {
// load a driver
// returns: 0 for success, any other value for error
long DriverLoad(const string& crsDriver, long& rnResult);
// return: the version of the loaded module
long DriverGetVersion();
// 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();
// returns the shortest polling intervall in microsoconds
double DriverGetPollingIntervall();
// 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();
// 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();
// return all values of the previouse funcitons at ones
void DriverGetInfo(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
{
public:
CDeviceData();
CDeviceData(const CDeviceData& croSrc);
CDeviceData(const TDeviceData& crstSrc);
CDeviceData(const PDeviceData cpstSrc);
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 CColpatikDeviceData
// calls the data from the driver
// returns the state of the execution
// 0 - success
// not 0 - no success
long DriverDataGet(TDeviceData& rstData);
// returns the last error drom the driver
long DriverErrorLastGet();
// gets an error text for an error number, if "nError" == 0,
// the function returns the text for the last error
long DriverErrorTextGet(std::string& rsError, long nError = 0);
// callback type definition (for interrupting devices))
typedef long (*pfnCallback)(const void* pData);
// calback type declaration
#define CB_STATUS 'S'
#define CB_DATA 'D'
// register the callback in the driver
bool DriverCallbackRegister(const pfnCallback fnCallback, char cType =
CB_DATA);
// inform the driver, that the given callback is dead now
void DriverCallbackFree (const pfnCallback fnCallback);
// callback prototypes
long DriverCallback4Data (const void* pData);
long DriverCallback4Status(const TDeviceData* pstData);
} // namespace dsia
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Moss-devel] CVS: moss/colpatik/include API_ApplicationsInterface.h,NONE,1.1 API_DeviceInterface.h,NONE,1.1,
Manfred Morgner <address@hidden> <=