Page 212 - PDA Robotics Using Your Personal Digital Assistant to Control Your Robot
P. 212
PDA 09 5/27/03 8:50 AM Page 188
PDA Robotics
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
IMPLEMENT_DYNAMIC(CPDASocket, CSocket)
CPDASocket::CPDASocket(PURPOSE_E iPurpose):
CCeSocket(iPurpose)
{
}
void CPDASocket::OnReceive(int nErrorCode)
{
//
// Call the ReadPDAData() that exists in
// the CPDABotDlg class
//
((CPDABotDlg *)AfxGetApp())->ReadPDAData();
CSocket::OnReceive(nErrorCode);
}
CPDASocket inherits everything from CceSocket, meaning users call
and access all the public member functions and variables. The virtual
function OnReceive(int nErrorCode) is overridden so that users can
implement their own version, but still use the underlying code and
features. Note that the default socket type is set to data.
CCeSocket::CCeSocket
This constructor creates an instance of a socket object.
CCeSocket ( PURPOSE_E iPurpose = FOR_DATA);
Parameters
iPurpose specifies the enumerated constant that designates whether
the socket is to be a listening socket or a data socket. It is one of the
following values:
• FOR_LISTENING
• FOR_DATA
Remarks
When constructing a CCeSocket object, specify whether it is a listen-
ing socket or a data socket. After construction, call the Create method.
188