|
1 /* |
|
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Filename: CXClient.h |
|
16 * Author: Sanjeet Matharu |
|
17 * This is the client side of the protocol which sneds name/value pairs and does stuff |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 |
|
23 #ifndef __CXCLIENT_H__ |
|
24 #define __CXCLIENT_H__ |
|
25 |
|
26 #define HT_SOCKET 0 |
|
27 #define HT_WIN32FILEHANDLE 1 |
|
28 #define HT_LINUXFILEHANDLE 2 |
|
29 |
|
30 #define OK_DATATRANSFER 10 |
|
31 #define ERROR_DATATRANSFER 20 |
|
32 |
|
33 #define REPLY_OK "OK" |
|
34 #define REPLY_ERROR "ERROR" |
|
35 #define REPLY_TIMEOUT "TIMEOUT" |
|
36 |
|
37 #define MAXBUFFERLEN 50 |
|
38 |
|
39 //Types |
|
40 typedef enum |
|
41 { |
|
42 SENDING_HELLO, |
|
43 SENDING_GOODBYE, |
|
44 SENDING_DATA, |
|
45 } TClientStatus; |
|
46 |
|
47 //---------------------------------------------------------------------------------- |
|
48 //generic server class |
|
49 class CXClient |
|
50 { |
|
51 public: |
|
52 |
|
53 //constructor/destructor |
|
54 CXClient(); |
|
55 ~CXClient(); |
|
56 |
|
57 int OnExecute(int socket, char* cValue, int dim1, int dim2); |
|
58 |
|
59 private: |
|
60 |
|
61 //functions |
|
62 int SendHello(int handle); |
|
63 int SendGoodbye(int handle); |
|
64 int SendData(int handle, char* aValue); |
|
65 |
|
66 int ReadClient(int handle, int handletype, char* c); |
|
67 int WriteClient(int handle, int handletype, char *buff, int bufflen); |
|
68 |
|
69 //data |
|
70 TClientStatus iClientStatus; |
|
71 char hellobuffer[6]; |
|
72 char goodbyebuffer[8]; |
|
73 }; |
|
74 |
|
75 //---------------------------------------------------------------------------------- |
|
76 |
|
77 #endif __CXCLIENT_H__ |