EasyManua.ls Logo

Keba KeTop T50VGA - Page 89

Keba KeTop T50VGA
165 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Handheld Terminal Software
User's Manual, Version: 1.3 89
© KEBA 2007
Server Implementation
The base of the server are the two classes
CKVCServer and
CKVCConnection. The class CKVCServer establishes and manages the
connections. The class
CKVCConnection constitutes the actual connection.
To correctly implement a server, a derivation of the class
CKVCServer is
needed.
class CKVCTestServer: public CKVCServer{
public:
CKVCTestServer();
virtual ~CKVCTestServer();
CKVCConnection* OnClientConnect(SOCKET socket, sockaddr_in
&sockAdr);
int OnClientDisconnect(CKVCConnection *pConnection,
TKVCDisconInfo info);
};
In this class, the method
OnClientConnect must be overwritten.
In this method, a
CKVCConnection object must be created and initialized.
CKVCConnection* CKVCTestServer::OnClientConnect(SOCKET
socket,
sockaddr_in &sockAdr){
CKVCTestConnection *pConnect = 0;
...
pConnect = new CKVCTestConnection();
if (pConnect != 0){
pConnect->Init(this, socket, sockAdr);
}
...
return pConnect;
}
The method
OnClientDisconnect can be overwritten. But it must be guar-
anteed that the method
CKVCServer::OnClientDisconnect is called in
this derivation.
int CKVCTestServer::OnClientDisconnect(CKVCConnection *pConnection,
TKVCDisconInfo info){
...
return CKVCServer::OnClientDisconnect(pConnection, info);
}
In the derivation of the class CKVCConnection, only the Event and Change
method must be derived. The Get methods can be derived, but it must be
guaranteed that the method of the base class is called before the data are
used.
class CKVCTestConnection: public CKVCConnection{
public:
CKVCTestConnection();
virtual ~CKVCTestConnection();
virtual int OnOverrideChange (SINT16 val);
virtual int OnWheelChange (SINT16 wheelAbsVal);
virtual int OnKeypadEvent (TKVCEvent keyEvent, UINT8 keyNum);

Table of Contents

Related product manuals