// Tx.h: interface for the CTx class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_TX_H__1C985C2B_F645_49CC_B6F1_2A1666C8E697__INCLUDED_) #define AFX_TX_H__1C985C2B_F645_49CC_B6F1_2A1666C8E697__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // Tx.h : header file // #include "Code.h" // create an access to Ccode class for Ccode*code var,object of the Tx . #include "Frame.h" // create an access to Cframe class for Cframe*frame var of the Tx. ///////////////////////////////////////////////////////////////////////////// // CTx window class CTx : public CButton // we derive this class from Cbutton class to show it as abutton in CDocument Desktop. { // Construction public: CTx(); // CTx constructor that alocate a new memory space to some its pointer object class var. // Attributes public: BOOL moved;// it shows that this object is moved by user or not? POINT PreviousPoint;// it contains the axis (x,y) of the last point that the captured mouse of this object was there befor moving. BOOL created;// it shows that this object button is created and shown in document or not. RECT position;// it shows the rectangular position of this object button . int MinQueueSize;// the mimimum queue size for sub chips that is sent by this object. BYTE* SubChipQueue;// sub chip queue contains a string of sub chips that is to be sent by this object. CFrame* frame;// every frame that is mode by this object is stored in this class. BOOL RndStartTime;// 0= start time of transmission for this object is static 1= start time of transmission for this object is random int StartTime;// start time of transmission of this object . BYTE SubChipPerChip;// time division or minimum time unit that is used for current simulation . int SubChipCounter; //to design random start time we must define it as a interger number not BYTE ........ a counter that counts the subchips that is sent by this object . int ByteCounter;// a counter that counts the number of bytes that is sent by this object . int BitCounter;// a counter that counts the number of bits that is sent by this object . int ChipCounter;// a counter that counts the number of chips that is sent by this object int BufferIndex;// it shows the index of buffer it means that the previous bytes of buffer have sent by this object. BOOL RndProcDelay;// 0= the process delay between transmissiom of frames is static 1= the process delay between transmissiom of frames is random int ProcDelay;// the process delay between two frames that is sent by this object . int CurrentChip;// it shows the current chip that this object is sending or is subject to send(ing). int CurrentBit;// it shows the current bit that this object is sending or is subject to send(ing). BYTE CurrentByte;// it shows the current byte that this object is sending or is subject to send(ing). CCode* code;// it shows the address of the Ccode object that is assigned to this object. char* buffer;// a string of chatacters that contains the info that is subjected to send as the name of buffer. int UsedBufferSize;// shows the size of buffer that is used by our information. int BufferSize;// shows the buffer size of this object. int PacketSize;// shows the packet size of this oject. int CRCSize;// shows the CRC size of this object. int PayloadSize;// shows the payload size of this oject. int HeaderSize;// shows the header size of this oject. int WindowSize;// shows the window size of this oject. BOOL OnOff; //On=TRUE Off=FALSE it means that this object (Tx) is ready for transmission ....... it means that this object (Tx) is off and has no transmission. BYTE TxID;// transmitter ID // Operations public: void InitCurrentState();// initialize the current state by calculating the byte ,bit,chip and subchip. int TwoPower(int num);// get the value of (2^num) void SetBufferIndex(int index);// set the index of this objects buffer to index if it is not bigger than buffer size . BOOL SetPayload(int index); //False returns if Overflows void SetCRC(CCRC* crc);// set CRC of this objects frame. void SetNextFrame (CFrame* frm );// make the next frame . void SetFirstFrame (CFrame* frm );// make the first frame. void SetNextHeader (CHeader* head);// make the next header . void SetFirstHeader(CHeader* head);// make the first header. int RndProcDelayGen();// generate a random process delay . void Clock();// clock() is the main procedure (function) of this object that send the current subchip with regards to current byte , current bit ,current chip and finally current subchip in subchip queue . void InitClock();// initialize the clock function by set the first current byte,bit,chip,subchip. BOOL GetChipAt(int ByteIndex,int BitIndex,int ChipIndex);// get the chip at the desire position that specify by byte index, bit index , chip index. BOOL GetBitAt(int ByteIndex,int BitIndex);// returns the bit @ desire position that is specifyly byte index and bit index. // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CTx) public: virtual void Serialize(CArchive& ar);// to archive the properties of this object to the file . //}}AFX_VIRTUAL // Implementation public: void ShiftQueue();// shift the subchip queue of the transmitter to discard sent subchip and virtual ~CTx();// deconstructor of this object that delete the alocated memory to its variables // Generated message map functions protected: //{{AFX_MSG(CTx) afx_msg void OnClicked();// this message function is called when user clicks the button of this object. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);// this message function is called when user hold left button of the mouse on the button of this object . afx_msg void OnLButtonUp(UINT nFlags, CPoint point);// this message function is called when user hold release button of the mouse on the button of this object . afx_msg void OnMouseMove(UINT nFlags, CPoint point);// this message function is called when user move mouse on the button of this object. //}}AFX_MSG DECLARE_MESSAGE_MAP() }; ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_TX_H__1C985C2B_F645_49CC_B6F1_2A1666C8E697__INCLUDED_)