You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
85 lines
2.2 KiB
85 lines
2.2 KiB
//----------------------------------------------------------------------------
|
|
// Laser Guard Ltd.
|
|
// Copyright © 2000-2002. All Rights Reserved.
|
|
// Version 1.0 01/01/2000
|
|
// Last modification: 08/10/2003
|
|
// PROJECT:
|
|
// SUBSYSTEM:
|
|
// FILE: LgNetMessage.h
|
|
// AUTHOR: Sergey Chizhevskiy
|
|
// OVERVIEW
|
|
// ~~~~~~~~
|
|
// Header file of LgNetMessage.h
|
|
//----------------------------------------------------------------------------
|
|
#ifndef __LG__MESSAGE__H__INCLUDED__
|
|
#define __LG__MESSAGE__H__INCLUDED__
|
|
|
|
#if _MSC_VER > 1000
|
|
#pragma once
|
|
#endif
|
|
|
|
#include "..\Device\LgDevice.h"
|
|
|
|
class CLgNetMessage
|
|
{
|
|
public:
|
|
// default constructor
|
|
CLgNetMessage();
|
|
// default constructor with IDs initialization
|
|
CLgNetMessage( DWORD dwSenderID, DWORD dwDistinationID );
|
|
// copy constructor
|
|
CLgNetMessage( const CLgNetMessage& );
|
|
// virtual destructor
|
|
~CLgNetMessage();
|
|
|
|
public:
|
|
// operator copy
|
|
CLgNetMessage& operator = ( const CLgNetMessage& );
|
|
|
|
public:
|
|
// attributes
|
|
void SetDistinationID( DWORD dwDistinationID ) { m_dwDistinationID = dwDistinationID; }
|
|
void SetSenderID( DWORD dwSenderID ) { m_dwSenderID = dwSenderID; }
|
|
DWORD GetDistinationID() const { return m_dwDistinationID; }
|
|
DWORD GetSenderID() const { return m_dwSenderID; }
|
|
|
|
public:
|
|
BOOL GetCommand( PBYTE pCommand ) { return (m_pData && m_nData) ? ( *pCommand = *(PBYTE)m_pData, TRUE ) : FALSE; }
|
|
|
|
protected:
|
|
// data
|
|
BOOL SetData( PVOID pData, INT nCount, BOOL bCopy = TRUE );
|
|
PVOID GetData() { return m_pData; }
|
|
INT GetDataCount() { return m_nData; }
|
|
BOOL GetData( PVOID pBuffer, INT nSize );
|
|
|
|
protected:
|
|
BOOL Build( BYTE nCommand, PVOID pData = NULL, INT nCount = 0, BOOL bCopy = TRUE );
|
|
const INT GetHeaderSize() const { return sizeof(BYTE); }
|
|
|
|
public:
|
|
// command error
|
|
BOOL BuildEvtCommandError( INT nCommand, LPCTSTR pFormat, va_list marker );
|
|
BOOL GetEvtCommandError( CLgDevice::PDEVICE_CMD_ERROR pError );
|
|
|
|
protected:
|
|
BOOL AllocData( INT nCount );
|
|
/*
|
|
public:
|
|
enum
|
|
{
|
|
CMD_DEVICE = 0x01,
|
|
|
|
EVT_COMMAND_ERROR = 0x80,
|
|
EVT_DEVICE = 0x81,
|
|
};
|
|
*/
|
|
private:
|
|
DWORD m_dwDistinationID;
|
|
DWORD m_dwSenderID;
|
|
|
|
PVOID m_pData;
|
|
INT m_nData;
|
|
};
|
|
|
|
#endif
|