www.pudn.com > SendMsgOCX.rar > WMsgSent.h


// WMsgSent.h: interface for the CWMsgSent class. 
// 
////////////////////////////////////////////////////////////////////// 
 
#if !defined(AFX_WMSGSENT_H__2952F726_D08D_4C3D_AF35_C7F76B5264A1__INCLUDED_) 
#define AFX_WMSGSENT_H__2952F726_D08D_4C3D_AF35_C7F76B5264A1__INCLUDED_ 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
 
#include "WMsgPacket.h" 
 
typedef CTime MsgSaveTimeType;			// save time type 
typedef CTimeSpan MsgTimeOutType;		// time out type 
 
class CWMsgSent 
{ 
public: 
 
	CWMsgSent(); 
	~CWMsgSent(); 
 
	void GetMsgPacket(int packetIndex, CWMsgPacket& msgPacket) const; 
	int GetPacketCount() const;			// for sent 
 
	int operator == (const CWMsgSent& toCmp) const; 
	int operator > ( const CWMsgSent& toCmp) const; 
	int operator < ( const CWMsgSent& toCmp) const; 
 
	void SetMessage(BYTE msgType, const BYTE* lpMsgData, DWORD dwMsgSize); 
	void SetFrameNo(BYTE toSet); 
	BYTE GetFrameNo() const; 
	BYTE& GetFrameNoRef(); 
 
	void SetSaveTime(const MsgSaveTimeType& toSet); 
	MsgSaveTimeType GetSaveTime() const; 
 
	LPCSTR GetPhoneNumber() const; 
	void SetPhoneNumber(LPCSTR lpcszPhoneNumber); 
 
	enum MsgMatchType 
	{ 
		PhoneNumberOnly, 
		PhoneNumberAndFrameNo, 
		PhoneNumberAndSaveTime, 
		MatchTypeNotDefined 
	}; 
 
	static 	enum MsgMatchType SetMatchType(enum MsgMatchType matchType); 
	static  enum MsgMatchType GetMatchType(); 
 
private: 
 
	int Compare(const CWMsgSent& toCmp) const; 
 
	// if lastPacketSize > MAX_BIN_MSG_BODY_LEN_OF_LASTPACKET then send last packet with content size == 0 
	int GetPacketCount(int& lastPacketSize) const; 
	 
	// bUseAdditional : [out] use an additional packet 
	int GetPacketCountForSent(BOOL& bUseAdditional) const; 
 
	// generate middle packet 
	void GenMidPacket(int packetIndex, CWMsgPacket& msgFrame) const; 
 
	// generate additional end packet 
	void GenAdditionalEndPacket(CWMsgPacket& msgFrame) const; 
 
	// generate end packet  
	void GenEndPacket(CWMsgPacket& msgFrame) const; 
 
	char  m_szPhoneNumber[MAX_PHONE_NUMBER_LEN+1];	// to where 
	BYTE  m_frameNo;								// 0X20 to 0X7B 
	BYTE  m_msgType;								// type of message	 
	 
	MsgSaveTimeType m_saveTime;						// when send out and save 
 
	BYTE  m_binMsgData[MAX_BIN_MSG_LEN_PER_FRAME];	// what to send / binary 
	int   m_dataSize;								// size of m_binMsgData 
 
	static enum MsgMatchType s_matchType;			//  
}; 
 
 
#endif // !defined(AFX_WMSGSENT_H__2952F726_D08D_4C3D_AF35_C7F76B5264A1__INCLUDED_)