www.pudn.com > otsms > ConnSender.hpp


// Borland C++ Builder 
// Copyright (c) 1995, 1999 by Borland International 
// All rights reserved 
 
// (DO NOT EDIT: machine generated header) 'ConnSender.pas' rev: 5.00 
 
#ifndef ConnSenderHPP 
#define ConnSenderHPP 
 
#pragma delphiheader begin 
#pragma option push -w- 
#pragma option push -Vx 
#include 	// Pascal unit 
#include 	// Pascal unit 
#include 	// Pascal unit 
#include 	// Pascal unit 
#include 	// Pascal unit 
#include 	// Pascal unit 
#include 	// Pascal unit 
 
//-- user supplied ----------------------------------------------------------- 
 
namespace Connsender 
{ 
//-- type declarations ------------------------------------------------------- 
struct LM_IRPARMS 
{ 
	unsigned nTXDataBytes; 
	unsigned nRXDataBytes; 
	unsigned nBaudRate; 
	unsigned thresholdTime; 
	unsigned discTime; 
	short nMSLinkTurn; 
	Byte nTXPackets; 
	Byte nRXPackets; 
} ; 
 
typedef LM_IRPARMS *PLM_IRPARMS; 
 
struct SOCKADDR_IRDA 
{ 
	short irdaAddressFamily; 
	Byte irdaDeviceID[4]; 
	char irdaServiceName[25]; 
} ; 
 
typedef SOCKADDR_IRDA *PSOCKADDR_IRDA; 
 
#pragma pack(push, 1) 
struct IRDA_DEVICE_INFO 
{ 
	Byte irdaDeviceID[4]; 
	char irdaDeviceName[22]; 
	Byte irdaDeviceHints1; 
	Byte irdaDeviceHints2; 
	Byte irdaCharSet; 
} ; 
#pragma pack(pop) 
 
typedef IRDA_DEVICE_INFO *PIRDA_DEVICE_INFO; 
 
struct DEVICELIST 
{ 
	unsigned numDevice; 
	IRDA_DEVICE_INFO Device[1]; 
} ; 
 
typedef DEVICELIST *PDEVICELIST; 
 
struct irdaAttribOctetSeq 
{ 
	short Len; 
	Byte OctetSeq[1024]; 
} ; 
 
#pragma pack(push, 1) 
struct irdaAttribUsrStr 
{ 
	Byte Len; 
	Byte CharSet; 
	Byte UsrStr[256]; 
} ; 
#pragma pack(pop) 
 
struct IAS_SET 
{ 
	char irdaClassName[64]; 
	char irdaAttribName[256]; 
	unsigned irdaAttribType; 
	int irdaAttribInt; 
} ; 
 
typedef IAS_SET *PIAS_SET; 
 
struct IAS_QUERY 
{ 
	Byte irdaDeviceID[4]; 
	char irdaClassName[64]; 
	char irdaAttribName[256]; 
	unsigned irdaAttribType; 
	int irdaAttribInt; 
} ; 
 
typedef IAS_QUERY *PIAS_QUERY; 
 
#pragma option push -b- 
enum TSendState { ssReady, ssBusy }; 
#pragma option pop 
 
#pragma option push -b- 
enum TConnectionMode { cmDAU9P, cmDLR3, cmIR }; 
#pragma option pop 
 
typedef void __fastcall (__closure *TMsgNotifyEvent)(Byte MsgType, AnsiString Msg); 
 
class DELPHICLASS TIrThread; 
class PASCALIMPLEMENTATION TIrThread : public Classes::TThread  
{ 
	typedef Classes::TThread inherited; 
	 
private: 
	int fSocket; 
	TMsgNotifyEvent Events; 
	 
protected: 
	virtual void __fastcall Execute(void); 
	bool __fastcall OpenIrDA(void); 
	bool __fastcall ConnectToIrDA(void); 
	 
public: 
	__fastcall TIrThread(TMsgNotifyEvent e); 
	__property int IrSocket = {read=fSocket, nodefault}; 
public: 
	#pragma option push -w-inl 
	/* TThread.Destroy */ inline __fastcall virtual ~TIrThread(void) { } 
	#pragma option pop 
	 
}; 
 
 
class DELPHICLASS TConnectionSender; 
class PASCALIMPLEMENTATION TConnectionSender : public System::TObject  
{ 
	typedef System::TObject inherited; 
	 
private: 
	bool fUse7110IrDa; 
	bool fIrConnected; 
	TIrThread* IrThread; 
	bool ThreadActive; 
	TSendState fSendState; 
	bool fSendingPacket; 
	Commp::TCustComPort* fComPort; 
	TConnectionMode fConnMode; 
	Byte fPre; 
	Byte fPost; 
	AnsiString fInPacket; 
	TMsgNotifyEvent fEvents; 
	bool fIn; 
	bool fOut; 
	TextFile InFile; 
	TextFile OutFile; 
	unsigned fInitLength; 
	bool fReallyOpen; 
	bool __fastcall IsFullMessage(AnsiString s); 
	bool __fastcall IsAck(AnsiString s); 
	void __fastcall SendAck(AnsiString s); 
	AnsiString __fastcall CheckSum(AnsiString s); 
	 
protected: 
	void __fastcall SendPacket(Byte MsgType, AnsiString Msg); 
	void __fastcall ProcessResponse(System::TObject* Sender, int InQue); 
	 
public: 
	__fastcall TConnectionSender(int ComNumber, TConnectionMode ConnMode, Byte Pre, Byte Post, AnsiString  
		InFileName, AnsiString OutFileName, bool Ir7110, TMsgNotifyEvent Packets); 
	__fastcall virtual ~TConnectionSender(void); 
	bool __fastcall SendFrames(Byte MsgType, AnsiString Msg); 
	__property TSendState SendState = {read=fSendState, nodefault}; 
	__property bool IrConnected = {read=fIrConnected, nodefault}; 
	__property bool ReallyOpen = {read=fReallyOpen, nodefault}; 
	 
__published: 
	__property bool Busy = {read=fSendingPacket, nodefault}; 
	__property unsigned InitLength = {read=fInitLength, write=fInitLength, nodefault}; 
	__property TMsgNotifyEvent OnMessage = {read=fEvents, write=fEvents}; 
}; 
 
 
//-- var, const, procedure --------------------------------------------------- 
static const Shortint DEVICE_LIST_LEN = 0xa; 
static const Shortint AF_IRDA = 0x1a; 
static const Byte SOL_IRLMP = 0xff; 
static const Shortint IRLMP_ENUMDEVICES = 0x10; 
static const Shortint IRLMP_IAS_SET = 0x11; 
static const Shortint IRLMP_IAS_QUERY = 0x12; 
static const Shortint IRLMP_SEND_PDU_LEN = 0x13; 
static const Shortint IRLMP_EXCLUSIVE_MODE = 0x14; 
static const Shortint IRLMP_IRLPT_MODE = 0x15; 
static const Shortint IRLMP_9WIRE_MODE = 0x16; 
static const Shortint IRLMP_TINYTP_MODE = 0x17; 
static const Shortint IRLMP_PARAMETERS = 0x18; 
static const Shortint IRLMP_DISCOVERY_MODE = 0x19; 
static const Shortint IRLMP_SHARP_MODE = 0x20; 
static const Shortint IAS_ATTRIB_NO_CLASS = 0x10; 
static const Shortint IAS_ATTRIB_NO_ATTRIB = 0x0; 
static const Shortint IAS_ATTRIB_INT = 0x1; 
static const Shortint IAS_ATTRIB_OCTETSEQ = 0x2; 
static const Shortint IAS_ATTRIB_STR = 0x3; 
static const Word IAS_MAX_USER_STRING = 0x100; 
static const Word IAS_MAX_OCTET_STRING = 0x400; 
static const Shortint IAS_MAX_CLASSNAME = 0x40; 
static const Word IAS_MAX_ATTRIBNAME = 0x100; 
static const Byte LM_HB_Extension = 0x80; 
static const Shortint LM_HB1_PnP = 0x1; 
static const Shortint LM_HB1_PDA_Palmtop = 0x2; 
static const Shortint LM_HB1_Computer = 0x4; 
static const Shortint LM_HB1_Printer = 0x8; 
static const Shortint LM_HB1_Modem = 0x10; 
static const Shortint LM_HB1_Fax = 0x20; 
static const Shortint LM_HB1_LANAccess = 0x40; 
static const Shortint LM_HB2_Telephony = 0x1; 
static const Shortint LM_HB2_FileServer = 0x2; 
static const Shortint LmCharSetASCII = 0x0; 
static const Shortint LmCharSetISO_8859_1 = 0x1; 
static const Shortint LmCharSetISO_8859_2 = 0x2; 
static const Shortint LmCharSetISO_8859_3 = 0x3; 
static const Shortint LmCharSetISO_8859_4 = 0x4; 
static const Shortint LmCharSetISO_8859_5 = 0x5; 
static const Shortint LmCharSetISO_8859_6 = 0x6; 
static const Shortint LmCharSetISO_8859_7 = 0x7; 
static const Shortint LmCharSetISO_8859_8 = 0x8; 
static const Shortint LmCharSetISO_8859_9 = 0x9; 
static const Byte LmCharSetUNICODE = 0xff; 
static const Word LM_BAUD_1200 = 0x4b0; 
static const Word LM_BAUD_2400 = 0x960; 
static const Word LM_BAUD_9600 = 0x2580; 
static const Word LM_BAUD_19200 = 0x4b00; 
static const Word LM_BAUD_38400 = 0x9600; 
static const Word LM_BAUD_57600 = 0xe100; 
static const int LM_BAUD_115200 = 0x1c200; 
static const int LM_BAUD_576K = 0x8ca00; 
static const int LM_BAUD_1152K = 0x119400; 
static const int LM_BAUD_4M = 0x3d0900; 
static const Shortint OUT_MSG_LEN = 0x78; 
#define RequestMsg "" 
#define AckMsg "\x1e" 
static const int CON_BASE_ERR = 0x10000; 
static const int perWinsock = 0x10700; 
static const int perEnumSockets = 0x10701; 
static const int perNoDevice = 0x10702; 
static const int perNoNokiaDevice = 0x10703; 
static const int perIASQuery = 0x10704; 
static const int perNokiaConnect = 0x10705; 
extern PACKAGE int SequenceNumber; 
extern PACKAGE int block; 
extern PACKAGE char *DevListBuff; 
extern PACKAGE char *IASQueryBuff; 
extern PACKAGE char P1[298]; 
extern PACKAGE char P2[1356]; 
extern PACKAGE char DataBuffer[257]; 
extern PACKAGE char szAddr[32]; 
extern PACKAGE char *szzAddr; 
extern PACKAGE bool ConnChecked; 
extern PACKAGE bool ConnOK; 
 
}	/* namespace Connsender */ 
#if !defined(NO_IMPLICIT_NAMESPACE_USE) 
using namespace Connsender; 
#endif 
#pragma option pop	// -w- 
#pragma option pop	// -Vx 
 
#pragma delphiheader end. 
//-- end unit ---------------------------------------------------------------- 
#endif	// ConnSender