Barst  2.0
A server that controls lab hardware.
Public Member Functions | Public Attributes | Protected Attributes | List of all members
CDevice Class Referenceabstract

#include <base classses.h>

Inheritance diagram for CDevice:
CChannelFTDI CChannelMCDAQ CChannelRTV CChannelSerial CMainManager CManager CPeriphFTDI CManagerFTDI CManagerMCDAQ CManagerRTV CManagerSerial CADCPeriph CMultiRPeriph CMultiWPeriph CPinRPeriph CPinWPeriph

Public Member Functions

 CDevice (const TCHAR szName[])
 
virtual void ProcessData (const void *pHead, DWORD dwSize, __int64 llId)=0
 
virtual void Result (void *pHead, bool bPass)=0
 
virtual DWORD GetInfo (void *pHead, DWORD dwSize)=0
 

Public Attributes

const std::tstring m_csName
 

Protected Attributes

CCommm_pcComm
 
CLogBufferm_pcLogBuffer
 
CMemPoolm_pcMemPool
 
bool m_bError
 

Detailed Description

This defines a general device. Each channel type object is inherited from this device. A device can recieve notifications from a user through a comm through the ProcessData() function. When a device writes to a user through a comm using the SendData() function, the comm notifies the user of success or failure using the Result() function.

In additon, each type of device has a unique name (defined at compile time) that identifies it.

Definition at line 77 of file base classses.h.

Constructor & Destructor Documentation

◆ CDevice()

CDevice::CDevice ( const TCHAR  szName[])
inline

szName is the device's unique name.

Definition at line 81 of file base classses.h.

Member Function Documentation

◆ GetInfo()

virtual DWORD CDevice::GetInfo ( void *  pHead,
DWORD  dwSize 
)
pure virtual

This function copies chennel specific info into pHead which could then be sent to the user in response to a query request. If phead is NULL, the function returns the required size of pHead. If non NULL, dwSize if the sise of pHead and the function returns the total size of the data copied into pHead. This funcion followes the rules where every sub-struct is proceeded by an SBase. Typically, it returns an SBaseOut sturct which holds the name of the device followed by channels specific structs.

Implemented in CPinRPeriph, CPinWPeriph, CMultiRPeriph, CMultiWPeriph, CADCPeriph, CManager, CPeriphFTDI, CMainManager, CChannelFTDI, CChannelMCDAQ, CChannelSerial, CChannelRTV, CManagerFTDI, CManagerMCDAQ, CManagerRTV, and CManagerSerial.

◆ ProcessData()

virtual void CDevice::ProcessData ( const void *  pHead,
DWORD  dwSize,
__int64  llId 
)
pure virtual

◆ Result()

virtual void CDevice::Result ( void *  pHead,
bool  bPass 
)
pure virtual

Comm calls this function when it finished writing data to user sent by this device. phead is the pHead parameter in the SData struct that was sent with SendData() bPass is true if successfull and false otherwise.

Implemented in CPinRPeriph, CPinWPeriph, CMultiRPeriph, CMultiWPeriph, CADCPeriph, CManager, CPeriphFTDI, CMainManager, CChannelFTDI, CChannelMCDAQ, CChannelSerial, CChannelRTV, CManagerFTDI, CManagerMCDAQ, CManagerRTV, and CManagerSerial.

Member Data Documentation

◆ m_csName

const std::tstring CDevice::m_csName

The unique name that identifies this device.

Definition at line 98 of file base classses.h.