1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __OBEXREADERBASE_H__ |
|
17 #define __OBEXREADERBASE_H__ |
|
18 |
|
19 #include <obex/internal/obexactiverw.h> |
|
20 |
|
21 /** |
|
22 @file |
|
23 @publishedPartner |
|
24 @released |
|
25 */ |
|
26 |
|
27 /** |
|
28 CObexReaderBase provides obex specific reader behaviour for concrete readers to use. |
|
29 Derive from this class when providing a reader for a specific transport. |
|
30 |
|
31 In a concrete reader the following things must be done: |
|
32 (a) In DoTransfer a read data transfer is issued over the reader's transport |
|
33 (b) GetMaxPacketSize must return the maximum packet size that can be received |
|
34 (c) GetInitialPacketSize must return a packet size that can be used in the event that the packet |
|
35 size of the packet to be read is not yet known (for example irda and bt use the obexpacketheadersize and usb |
|
36 uses the buffer size of the packet created to receive the data) |
|
37 (d)The NewL function must call BaseConstructL(). This is future proofing in the event that the iFuture1 variable is used |
|
38 and requires initialisation |
|
39 */ |
|
40 class CObexReaderBase : public CObexActiveRW |
|
41 { |
|
42 public: |
|
43 IMPORT_C virtual ~CObexReaderBase(); |
|
44 |
|
45 protected: |
|
46 IMPORT_C CObexReaderBase(TPriority aPriority, MObexTransportNotify& aOwner, TObexConnectionInfo& aInfo); |
|
47 IMPORT_C void BaseConstructL(); |
|
48 |
|
49 protected: // from CObexActiveRW |
|
50 IMPORT_C virtual void StartTransfer (CObexPacket& aPacket); |
|
51 IMPORT_C TBool CompleteTransfer (); |
|
52 IMPORT_C void OnReadActivity(); |
|
53 IMPORT_C virtual void OnCompleteTransfer(); |
|
54 IMPORT_C TInt Remaining(); |
|
55 IMPORT_C TInt GetObexPacketBufferSize(); |
|
56 IMPORT_C TInt GetObexPacketHeaderSize(); |
|
57 IMPORT_C TInt GetObexPacketDataLimit(); |
|
58 /** This method issues either a read of data over the relevant transport object. |
|
59 @see NewRequest*/ |
|
60 virtual void DoTransfer () =0; |
|
61 |
|
62 //ExtensionPattern |
|
63 IMPORT_C virtual TAny* GetInterface(TUid aUid); |
|
64 /** Returns the maximum packet size that can be received */ |
|
65 virtual TInt GetMaxPacketSize() = 0; |
|
66 |
|
67 /** Returns a initial packet size when the packet size of iPacket is not know. This is used |
|
68 when determining the remaining bytes to be read. */ |
|
69 virtual TInt GetInitialPacketSize() = 0; |
|
70 |
|
71 private: |
|
72 TBool iGotHeader; |
|
73 TInt iTransferError; |
|
74 |
|
75 //For future data expansion |
|
76 TAny* iFuture1; |
|
77 }; |
|
78 |
|
79 #endif // __OBEXREADERBASE_H__ |
|