|
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 * |
|
16 */ |
|
17 |
|
18 |
|
19 #if (!defined __T_BT_SOCK_ADDR_API_TRFCOMMSOCKADDR_DATA_H__) |
|
20 #define __T_BT_SOCK_ADDR_API_TRFCOMMSOCKADDR_DATA_H__ |
|
21 |
|
22 // User Includes |
|
23 #include "DataWrapperBase.h" |
|
24 // Classes to get to protected members |
|
25 #include "T_TRfcommSockAddrChild.h" |
|
26 |
|
27 // EPOC includes |
|
28 #include <w32std.h> |
|
29 #include <e32std.h> |
|
30 #include <es_sock.h> // TSockAddr address |
|
31 #include <bt_sock.h> // Bluetooth address classes |
|
32 |
|
33 |
|
34 class CT_TRfcommSockAddrData: public CDataWrapperBase |
|
35 { |
|
36 public: |
|
37 /** |
|
38 * Two phase constructor |
|
39 */ |
|
40 static CT_TRfcommSockAddrData* NewL(); |
|
41 |
|
42 /** |
|
43 * Process a command read from the ini file |
|
44 * |
|
45 * @param aCommand The command to process |
|
46 * @param aSection The section in the ini containing data for the command |
|
47 * @param aAsyncErrorIndex Command index for async calls to return errors to |
|
48 * |
|
49 * @return ETrue if the command is processed |
|
50 * |
|
51 * @leave System wide error |
|
52 */ |
|
53 virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex); |
|
54 |
|
55 /** |
|
56 * Destructor |
|
57 */ |
|
58 ~CT_TRfcommSockAddrData(); |
|
59 |
|
60 /** |
|
61 * Set the object that the data wraps |
|
62 * |
|
63 * @param aObject object that the wrapper is testing |
|
64 * |
|
65 * @leave KErrNotSupported if the the function is not supported |
|
66 */ |
|
67 virtual void SetObjectL(TAny* aObject); |
|
68 |
|
69 /** |
|
70 * The object will no longer be owned by this |
|
71 * |
|
72 * @leave KErrNotSupported if the the function is not supported |
|
73 */ |
|
74 virtual void DisownObjectL(); |
|
75 |
|
76 inline virtual TCleanupOperation CleanupOperation(); |
|
77 |
|
78 protected: |
|
79 /** |
|
80 * Protected constructor. First phase construction |
|
81 */ |
|
82 CT_TRfcommSockAddrData(); |
|
83 |
|
84 /** |
|
85 * Return a pointer to the object that the data wraps |
|
86 * |
|
87 * \return pointer to the object that the data wraps |
|
88 */ |
|
89 virtual TAny* GetObject(); |
|
90 private: |
|
91 // Implementation of DoCommandL for each of the commands |
|
92 inline void TRfcommSockAddrConstruct(const TDesC& aSection); |
|
93 inline void TRfcommSockAddrCastFromTSockAddr(const TDesC& aSection); |
|
94 inline void TRfcommSockAddrSetBTAddr(const TDesC& aSection); |
|
95 inline void TRfcommSockAddrBTAddr(const TDesC& aSection); |
|
96 inline void TRfcommSockAddrSetSecurity(const TDesC& aSection); |
|
97 inline void TRfcommSockAddrBTSecurity(const TDesC& aSection); |
|
98 inline void TRfcommSockAddrSetFamily(const TDesC& aSection); |
|
99 inline void TRfcommSockAddrFamily(const TDesC& aSection); |
|
100 inline void TRfcommSockAddrSetPort(const TDesC& aSection); |
|
101 inline void TRfcommSockAddrPort(const TDesC& aSection); |
|
102 inline void TRfcommSockAddrCmpPort(const TDesC& aSection); |
|
103 inline void TRfcommSockAddrPROTECTEDSetUserLen(const TDesC& aSection); |
|
104 inline void TRfcommSockAddrGetUserLen(const TDesC& aSection); |
|
105 inline void TRfcommSockAddrPROTECTEDUserPtr(); |
|
106 inline void TRfcommSockAddrPROTECTEDEndBTSockAddrPtr(); |
|
107 |
|
108 /** |
|
109 * Delete iTBTSockAddr if owned and set to 0 |
|
110 */ |
|
111 void Cleanup(); |
|
112 |
|
113 static void CleanupOperation(TAny* aAny); |
|
114 |
|
115 private: |
|
116 // An object of iT_TRfcommSockAddrChild class in order to retain state between calls |
|
117 // T_TRfcommSockAddrChild is a wrapper around the TRfcommSockAddr to reach protected methods |
|
118 |
|
119 T_TRfcommSockAddrChild* iTRfcommSockAddr; |
|
120 // Identifies if the iTRfcommSockAddr is owned, needed due to cast |
|
121 TBool iTRfcommSockAddrOwned; |
|
122 |
|
123 }; |
|
124 #endif /* __T_BT_SOCK_ADDR_API_TRFCOMMSOCKADDR_DATA_H__ */ |