28
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 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 |
* header file of class for read and write data from share chunk LDD
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
/**
|
|
21 |
@file
|
|
22 |
@internalComponent
|
|
23 |
*/
|
|
24 |
|
|
25 |
#ifndef NCMCOMMINTERFACESENDERANDRECEIVER_H
|
|
26 |
#define NCMCOMMINTERFACESENDERANDRECEIVER_H
|
|
27 |
|
|
28 |
#include <e32base.h>
|
|
29 |
|
|
30 |
#ifndef __OVER_DUMMYUSBSCLDD__
|
|
31 |
#include <d32usbcsc.h>
|
|
32 |
#else
|
|
33 |
#include <dummyusbsclddapi.h>
|
|
34 |
#endif
|
|
35 |
|
|
36 |
|
|
37 |
|
|
38 |
class CNcmCommunicationInterface;
|
|
39 |
|
|
40 |
/**
|
|
41 |
Responsible for sending and receiving data on Control Endpoint
|
|
42 |
*/
|
|
43 |
|
|
44 |
NONSHARABLE_CLASS(CNcmCommInterfaceSenderAndReceiver) : public CActive
|
|
45 |
{
|
|
46 |
public:
|
|
47 |
static CNcmCommInterfaceSenderAndReceiver* NewL(RDevUsbcScClient& aPort, CNcmCommunicationInterface& aCommInterface);
|
|
48 |
~CNcmCommInterfaceSenderAndReceiver();
|
|
49 |
void Start();
|
|
50 |
void Stop();
|
|
51 |
/**
|
|
52 |
* read aLength data from LDD
|
|
53 |
*
|
|
54 |
* @param aStatus complete status for this request.
|
|
55 |
* @param aBuf buffer to store data.
|
|
56 |
* @param aLength length to read.
|
|
57 |
*/
|
|
58 |
TInt Read(TRequestStatus& aStatus, TDes8& aBuf, TInt aLength);
|
|
59 |
/**
|
|
60 |
* write aLength data to LDD
|
|
61 |
*
|
|
62 |
* @param aStatus complete status for this request.
|
|
63 |
* @param aBuf buffer of data.
|
|
64 |
* @param aLength length to write.
|
|
65 |
*/
|
|
66 |
TInt Write(TRequestStatus& aStatus, TDesC8& aBuf, TInt aLength);
|
|
67 |
|
|
68 |
private:
|
|
69 |
enum TNcmControlEndpointState
|
|
70 |
{
|
|
71 |
EUnInit = 1,
|
|
72 |
EIdle,
|
|
73 |
EReceiving,
|
|
74 |
ESending
|
|
75 |
};
|
|
76 |
|
|
77 |
CNcmCommInterfaceSenderAndReceiver(RDevUsbcScClient& aPort, CNcmCommunicationInterface& aCommInterface);
|
|
78 |
void ReadData();
|
|
79 |
|
|
80 |
private:
|
|
81 |
/**
|
|
82 |
* derived from CActive
|
|
83 |
*/
|
|
84 |
void RunL();
|
|
85 |
void DoCancel();
|
|
86 |
|
|
87 |
private:
|
|
88 |
RDevUsbcScClient& iPort;
|
|
89 |
/**
|
|
90 |
* LDD control endpoint buffer
|
|
91 |
*/
|
|
92 |
TEndpointBuffer iEp0Buffer;
|
|
93 |
CNcmCommunicationInterface& iCommInterface;
|
|
94 |
/**
|
|
95 |
* point to buffer to store data of Read function, this is not ownership
|
|
96 |
*/
|
|
97 |
TDes8* iReceiveBuf;
|
|
98 |
/**
|
|
99 |
* length of data left to be read from LDD for a Read request
|
|
100 |
*/
|
|
101 |
TInt iToReceiveLength;
|
|
102 |
/**
|
|
103 |
* complete status for Read and Write function, this is not ownership
|
|
104 |
*/
|
|
105 |
TRequestStatus* iCompleteStatus;
|
|
106 |
TNcmControlEndpointState iState;
|
|
107 |
|
|
108 |
};
|
|
109 |
|
|
110 |
|
|
111 |
#endif //NCMCOMMINTERFACESENDERANDRECEIVER_H
|
|
112 |
|