⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 modlink.hpp

📁 ModLink VCL component 组件以及代码。版本是shareware edition of ModLink 2.10
💻 HPP
📖 第 1 页 / 共 3 页
字号:
// Borland C++ Builder
// Copyright (c) 1995, 2005 by Borland Software Corporation
// All rights reserved

// (DO NOT EDIT: machine generated header) 'Modlink.pas' rev: 10.00

#ifndef ModlinkHPP
#define ModlinkHPP

#pragma delphiheader begin
#pragma option push
#pragma option -w-      // All warnings off
#pragma option -Vx      // Zero-length empty class member functions
#pragma pack(push,8)
#include <System.hpp>	// Pascal unit
#include <Sysinit.hpp>	// Pascal unit
#include <Windows.hpp>	// Pascal unit
#include <Messages.hpp>	// Pascal unit
#include <Sysutils.hpp>	// Pascal unit
#include <Classes.hpp>	// Pascal unit

//-- user supplied -----------------------------------------------------------

namespace Modlink
{
//-- type declarations -------------------------------------------------------
class DELPHICLASS EModLinkError;
class PASCALIMPLEMENTATION EModLinkError : public Sysutils::Exception 
{
	typedef Sysutils::Exception inherited;
	
public:
	#pragma option push -w-inl
	/* Exception.Create */ inline __fastcall EModLinkError(const AnsiString Msg) : Sysutils::Exception(Msg) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateFmt */ inline __fastcall EModLinkError(const AnsiString Msg, System::TVarRec const * Args, const int Args_Size) : Sysutils::Exception(Msg, Args, Args_Size) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateRes */ inline __fastcall EModLinkError(int Ident)/* overload */ : Sysutils::Exception(Ident) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateResFmt */ inline __fastcall EModLinkError(int Ident, System::TVarRec const * Args, const int Args_Size)/* overload */ : Sysutils::Exception(Ident, Args, Args_Size) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateHelp */ inline __fastcall EModLinkError(const AnsiString Msg, int AHelpContext) : Sysutils::Exception(Msg, AHelpContext) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateFmtHelp */ inline __fastcall EModLinkError(const AnsiString Msg, System::TVarRec const * Args, const int Args_Size, int AHelpContext) : Sysutils::Exception(Msg, Args, Args_Size, AHelpContext) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateResHelp */ inline __fastcall EModLinkError(int Ident, int AHelpContext)/* overload */ : Sysutils::Exception(Ident, AHelpContext) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateResFmtHelp */ inline __fastcall EModLinkError(System::PResStringRec ResStringRec, System::TVarRec const * Args, const int Args_Size, int AHelpContext)/* overload */ : Sysutils::Exception(ResStringRec, Args, Args_Size, AHelpContext) { }
	#pragma option pop
	
public:
	#pragma option push -w-inl
	/* TObject.Destroy */ inline __fastcall virtual ~EModLinkError(void) { }
	#pragma option pop
	
};


#pragma option push -b-
enum TSeekMode { smBufStart, smBufEnd, smPriorByte, smNextByte, smPriorWord, smNextWord };
#pragma option pop

class DELPHICLASS TModbusBuffer;
class PASCALIMPLEMENTATION TModbusBuffer : public System::TObject 
{
	typedef System::TObject inherited;
	
private:
	int FCapacity;
	char *FCurPtr;
	char *FPeakPtr;
	char *FStartPtr;
	void __fastcall CheckAvailableSpace(int SizeOfData);
	int __fastcall GetSize(void);
	int __fastcall GetPosition(void);
	void __fastcall SetPosition(int Value);
	void __fastcall SetSize(int Value);
	
public:
	__fastcall TModbusBuffer(int ACapacity);
	__fastcall virtual ~TModbusBuffer(void);
	Word __fastcall CRC16(void);
	void __fastcall CutLeadingBytesOff(void);
	void __fastcall GetBlock(void *Buffer, int BlockSize);
	Byte __fastcall GetByte(void);
	Word __fastcall GetWordHiLo(void);
	Word __fastcall GetWordLoHi(void);
	Byte __fastcall LRC8(void);
	void __fastcall PutBlock(const void *Buffer, int BlockSize);
	void __fastcall PutByte(Byte Data);
	void __fastcall PutWordHiLo(Word Data);
	void __fastcall PutWordLoHi(Word Data);
	void __fastcall Seek(TSeekMode Mode);
	__property int Capacity = {read=FCapacity, nodefault};
	__property int Position = {read=GetPosition, write=SetPosition, nodefault};
	__property int Size = {read=GetSize, write=SetSize, nodefault};
	__property char * StartPtr = {read=FStartPtr};
};


#pragma option push -b-
enum TServerReply { srNone, srInvalidFrame, srUnexpectedReply, srUnmatchedReply, srExceptionReply, srNormalReply };
#pragma option pop

#pragma option push -b-
enum TServerException { seUnknown, seIllegalCommand, seIllegalDataAddress, seIllegalDataValue, seServerFailure, seAcknowledge, seServerBusy, seNegativeAcknowledge, seMemoryParityError };
#pragma option pop

struct TTransactionInfo
{
	
public:
	unsigned ID;
	Byte Address;
	void *UserData;
	unsigned Retries;
	TServerReply Reply;
	TServerException Exception;
	Byte ExceptionCode;
} ;

class DELPHICLASS TModbusTransaction;
class DELPHICLASS TModbusClient;
class DELPHICLASS TModbusConnection;
#pragma option push -b-
enum TBaudRate { br110, br300, br600, br1200, br2400, br4800, br9600, br14400, br19200, br38400, br56000, br57600, br115200, br128000, br256000, brCustom };
#pragma option pop

#pragma option push -b-
enum TConnectionMode { cmClient, cmServer };
#pragma option pop

#pragma option push -b-
enum TDataBits { db7, db8 };
#pragma option pop

#pragma option push -b-
enum TFlowControl { fcNone, fcRtsToggle, fcRtsCts, fcDtrDsr };
#pragma option pop

typedef unsigned TMaxRetries;

typedef DynamicArray<Byte >  TFrameData;

typedef void __fastcall (__closure *TFrameDataEvent)(TModbusConnection* Sender, const TFrameData Data);

typedef void __fastcall (__closure *TGetHookedPortHandleEvent)(TModbusConnection* Sender, unsigned &HookHandle);

#pragma option push -b-
enum TParityScheme { psNone, psOdd, psEven };
#pragma option pop

typedef AnsiString TSerialPort;

#pragma option push -b-
enum TStopBits { sb1, sb2 };
#pragma option pop

#pragma option push -b-
enum TTransmissionMode { tmRTU, tmASCII };
#pragma option pop

class DELPHICLASS TModbusServer;
typedef Set<TFlowControl, fcNone, fcDtrDsr>  TFlowControls;

class PASCALIMPLEMENTATION TModbusConnection : public Classes::TComponent 
{
	typedef Classes::TComponent inherited;
	
private:
	bool FActive;
	TBaudRate FBaudRate;
	unsigned FBreakEvent;
	Classes::TList* FClientList;
	TConnectionMode FConnectionMode;
	unsigned FCustomBaudRate;
	TDataBits FDataBits;
	unsigned FDeviceHandle;
	bool FDTREnabled;
	bool FEchoQueryBeforeReply;
	TFlowControl FFlowControl;
	bool FHookExistingPort;
	int FInputBufferSize;
	HWND FInternalWindow;
	Sysutils::TMultiReadExclusiveWriteSynchronizer* FLock;
	TMaxRetries FMaxRetries;
	unsigned FNextUniqueID;
	Classes::TNotifyEvent FOnAfterClose;
	Classes::TNotifyEvent FOnAfterFrameSendAsync;
	Classes::TNotifyEvent FOnAfterOpen;
	Classes::TNotifyEvent FOnBeforeClose;
	Classes::TNotifyEvent FOnBeforeFrameSendAsync;
	Classes::TNotifyEvent FOnBeforeOpen;
	TFrameDataEvent FOnFrameReceive;
	TFrameDataEvent FOnFrameSend;
	TGetHookedPortHandleEvent FOnGetHookedPortHandle;
	int FOutputBufferSize;
	unsigned FOverlappedEvent;
	TParityScheme FParity;
	AnsiString FPort;
	unsigned FRealSilentInterval;
	unsigned FReceiveTimeout;
	unsigned FRefetchDelay;
	bool FRTSEnabled;
	Classes::TList* FServerList;
	unsigned FSilentInterval;
	TStopBits FStopBits;
	bool FStreamedActive;
	Classes::TThread* FThread;
	Classes::TThreadPriority FThreadPriority;
	TTransmissionMode FTransmissionMode;
	unsigned FSendTimeout;
	unsigned FTurnaroundDelay;
	void __fastcall CancelIO(void);
	TModbusClient* __fastcall GetClient(int Index);
	int __fastcall GetClientCount(void);
	TMaxRetries __fastcall GetMaxRetries(void);
	unsigned __fastcall GetRealSilentInterval(void);
	unsigned __fastcall GetReceiveTimeout(void);
	unsigned __fastcall GetRefetchDelay(void);
	unsigned __fastcall GetSendTimeout(void);
	TModbusServer* __fastcall GetServer(int Index);
	int __fastcall GetServerCount(void);
	unsigned __fastcall GetTurnaroundDelay(void);
	void __fastcall InternalWndProc(Messages::TMessage &Message);
	bool __fastcall IsPortStored(void);
	int __fastcall ReceiveFrameASCII(void *Buffer, int Capacity, unsigned &Timeout, unsigned Silence);
	int __fastcall ReceiveFrameRTU(void *Buffer, int Capacity, unsigned &Timeout, unsigned Silence);
	void __fastcall SetActive(bool Value);
	void __fastcall SetBaudRate(TBaudRate Value);
	void __fastcall SetConnectionMode(TConnectionMode Value);
	void __fastcall SetCustomBaudRate(unsigned Value);
	void __fastcall SetDataBits(TDataBits Value);
	void __fastcall SetDTREnabled(bool Value);
	void __fastcall SetEchoQueryBeforeReply(bool Value);
	void __fastcall SetFlowControl(TFlowControl Value);
	void __fastcall SetHookExistingPort(bool Value);
	void __fastcall SetInputBufferSize(int Value);
	void __fastcall SetMaxRetries(TMaxRetries Value);
	void __fastcall SetOutputBufferSize(int Value);
	void __fastcall SetParity(TParityScheme Value);
	void __fastcall SetPort(AnsiString Value);
	void __fastcall SetRefetchDelay(unsigned Value);
	void __fastcall SetReceiveTimeout(unsigned Value);
	void __fastcall SetRTSEnabled(bool Value);
	void __fastcall SetSendTimeout(unsigned Value);
	void __fastcall SetSilentInterval(unsigned Value);
	void __fastcall SetStopBits(TStopBits Value);
	void __fastcall SetThreadPriority(Classes::TThreadPriority Value);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -