1 /* |
|
2 * Copyright (c) 2006 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: PTP tranport plugin interface API |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef PTP_TRANSPORT_H |
|
21 #define PTP_TRANSPORT_H |
|
22 |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32base.h> |
|
26 |
|
27 class MNPtpCallback; |
|
28 const TUid KPtpTransportInterfaceUid = { 0x1020E46C }; |
|
29 |
|
30 // Dataset to send/receive operations, responses and events. |
|
31 class TNPtpContainer |
|
32 { |
|
33 public: |
|
34 TUint16 iOperationCode; |
|
35 TUint16 iResponseCode; |
|
36 TUint32 iSessionId; |
|
37 TUint32 iTransactionId; |
|
38 TUint32 iParam1; |
|
39 TUint32 iParam2; |
|
40 TUint32 iParam3; |
|
41 // events can only have three parameters. |
|
42 TUint32 iParam4; |
|
43 TUint32 iParam5; |
|
44 }; |
|
45 |
|
46 // CLASS DECLARATION |
|
47 |
|
48 // ------------------------------------------------------------------------------------------------ |
|
49 // PTPTransport ECOM plugin interface. |
|
50 // This is the plugin interface that each plugin module must implement to provide a PTP transport |
|
51 // layer interface. Currently only USB media is supported, but each created plugin module must |
|
52 // implement this interface. |
|
53 // |
|
54 // @lib ptptransport.lib |
|
55 // ------------------------------------------------------------------------------------------------ |
|
56 |
|
57 class CNPtpTransport : public CBase |
|
58 { |
|
59 |
|
60 public: // Constructors and destructor |
|
61 |
|
62 /** |
|
63 * C++ Consructor. |
|
64 */ |
|
65 IMPORT_C CNPtpTransport(); |
|
66 /** |
|
67 * Destructor. |
|
68 */ |
|
69 IMPORT_C ~CNPtpTransport(); |
|
70 |
|
71 /** |
|
72 * Two-phased constructor. |
|
73 */ |
|
74 IMPORT_C static CNPtpTransport* NewL( const TUid aTransport, MNPtpCallback* aCallback ); |
|
75 |
|
76 public: // API |
|
77 |
|
78 /** |
|
79 * Connects the client transport interface with the "Host". |
|
80 * Can be used with Bluetooth or TCP/IP transport plugin adapters in the future, |
|
81 * USB plugin (SICD) does not need a separate connection because it is created |
|
82 * when the USB cable is attached to the device. |
|
83 * @since S60 3.2 |
|
84 * @return None. |
|
85 */ |
|
86 IMPORT_C void ConnectL( ); |
|
87 |
|
88 /** |
|
89 * Disconnects the client transport interface with the "Host". |
|
90 * Can be used with Bluetooth or TCP/IP transport plugin adapters in the future, |
|
91 * USB media disconnection is not needed. The connection may exists until |
|
92 * SICD component is deleted or cable is unattached. |
|
93 * @since S60 3.2 |
|
94 * @return None. |
|
95 */ |
|
96 IMPORT_C void DisconnectL(); |
|
97 |
|
98 /** |
|
99 * Sends an PTP event to the connected "Host". Particulary used with USB media. |
|
100 * @param aStatus, Asynchronous completion word for the operation. |
|
101 * @param aEventData, PTP container containing all the information for the event. |
|
102 * @since S60 3.2 |
|
103 * @return None. |
|
104 */ |
|
105 IMPORT_C void SendEventL( TRequestStatus& aStatus, const TNPtpContainer& aEventData ); |
|
106 |
|
107 /** |
|
108 * Cancels the asynchronous event sending operation. |
|
109 * @since S60 3.2 |
|
110 * @return none |
|
111 */ |
|
112 IMPORT_C void CancelEvent(); |
|
113 |
|
114 protected: |
|
115 |
|
116 // hide the virtual methods from the public interface to enable future extension without breaking BC |
|
117 virtual void DoConnectL() = 0; |
|
118 virtual void DoDisconnectL() = 0; |
|
119 virtual void DoSendEventL( TRequestStatus& aStatus, const TNPtpContainer& aEventData ) = 0; |
|
120 virtual void DoCancelEvent() = 0; |
|
121 |
|
122 private: |
|
123 TUid iEComTag; |
|
124 }; |
|
125 |
|
126 |
|
127 void CleanupEComArray(TAny* aArray); |
|
128 |
|
129 #endif // PTP_TRANSPORT_H |
|