0
|
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 |
* CUCCSDeviceProtocol Class
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
#ifndef _CUCCSDeviceProtocol_H
|
|
22 |
#define _CUCCSDeviceProtocol_H
|
|
23 |
|
|
24 |
|
|
25 |
/*****************************************************************************
|
|
26 |
*
|
|
27 |
* System Includes
|
|
28 |
*
|
|
29 |
****************************************************************************/
|
|
30 |
#include <e32cons.h>
|
|
31 |
|
|
32 |
|
|
33 |
/*****************************************************************************
|
|
34 |
*
|
|
35 |
* Local Includes
|
|
36 |
*
|
|
37 |
****************************************************************************/
|
|
38 |
//#include "MUCCTransport.h"
|
|
39 |
//#include "CProtocolTypes.h"
|
|
40 |
|
|
41 |
#include <mucctransport.h>
|
|
42 |
#include <cprotocoltypes.h>
|
|
43 |
|
|
44 |
|
|
45 |
/*****************************************************************************
|
|
46 |
*
|
|
47 |
* Types
|
|
48 |
*
|
|
49 |
****************************************************************************/
|
|
50 |
typedef enum {
|
|
51 |
TDP_SUCCESS,
|
|
52 |
TDP_INVALIDCMDID,
|
|
53 |
TDP_SENDERROR,
|
|
54 |
TDP_RECVERROR,
|
|
55 |
TDP_ERRINTIALISING,
|
|
56 |
TDP_UIDMISMATCH,
|
|
57 |
} TDPError;
|
|
58 |
|
|
59 |
typedef enum {
|
|
60 |
TDP_IDLE,
|
|
61 |
TDP_CONNECTED
|
|
62 |
} TDPStatus;
|
|
63 |
|
|
64 |
|
|
65 |
typedef enum
|
|
66 |
{
|
|
67 |
TDP_NONE,
|
|
68 |
TDP_SERIAL,
|
|
69 |
TDP_TCP
|
|
70 |
} TDPTransport;
|
|
71 |
|
|
72 |
/*****************************************************************************
|
|
73 |
*
|
|
74 |
* Class Definition
|
|
75 |
*
|
|
76 |
****************************************************************************/
|
|
77 |
class CUCCSDeviceProtocol : public CBase
|
|
78 |
{
|
|
79 |
public:
|
|
80 |
CUCCSDeviceProtocol();
|
|
81 |
~CUCCSDeviceProtocol();
|
|
82 |
|
|
83 |
TDPError initialise(TBufC16<40> aRemoteHost, TDPTransport aTransportType = TDP_SERIAL );
|
|
84 |
TDPError disconnect();
|
|
85 |
|
|
86 |
TDPError sendMessage(TPCommand aCmd, int aDataLength, void *aData);
|
|
87 |
TDPError receiveMessage(TPCommand* aCmd, int* aDataLength, void* aData);
|
|
88 |
|
|
89 |
private:
|
|
90 |
bool isValidCMDID(TPCommand aCommand);
|
|
91 |
|
|
92 |
int iRand_UID;
|
|
93 |
MUCCTransport* iTransport;
|
|
94 |
TBufC16<40> iRemoteHost;
|
|
95 |
TInt64 iRandomSeed;
|
|
96 |
TDPStatus iStatus;
|
|
97 |
|
|
98 |
};
|
|
99 |
|
|
100 |
#endif
|