20 #include "CdcDataInterface.h" |
20 #include "CdcDataInterface.h" |
21 #include "AcmPanic.h" |
21 #include "AcmPanic.h" |
22 #include "AcmUtils.h" |
22 #include "AcmUtils.h" |
23 #include "HostPushedChangeObserver.h" |
23 #include "HostPushedChangeObserver.h" |
24 #include "BreakController.h" |
24 #include "BreakController.h" |
25 #include "OstTraceDefinitions.h" |
25 #include <usb/usblogger.h> |
26 #ifdef OST_TRACE_COMPILER_IN_USE |
26 |
27 #include "CdcAcmClassTraces.h" |
27 #ifdef __FLOG_ACTIVE |
|
28 _LIT8(KLogComponent, "ECACM"); |
28 #endif |
29 #endif |
29 |
30 |
30 extern const TInt32 KUsbAcmHostCanHandleZLPs = 0; |
31 extern const TInt32 KUsbAcmHostCanHandleZLPs = 0; |
31 |
32 |
32 CCdcAcmClass::CCdcAcmClass() |
33 CCdcAcmClass::CCdcAcmClass() |
33 /** |
34 /** |
34 * Constructor. |
35 * Constructor. |
35 */ |
36 */ |
36 { |
37 { |
37 OstTraceFunctionEntry0( CCDCACMCLASS_CCDCACMCLASS_CONS_ENTRY ); |
|
38 SetDefaultAcm(); |
38 SetDefaultAcm(); |
39 OstTraceFunctionExit0( CCDCACMCLASS_CCDCACMCLASS_CONS_EXIT ); |
|
40 } |
39 } |
41 |
40 |
42 CCdcAcmClass* CCdcAcmClass::NewL(const TUint8 aProtocolNum, const TDesC16& aAcmControlIfcName, const TDesC16& aAcmDataIfcName) |
41 CCdcAcmClass* CCdcAcmClass::NewL(const TUint8 aProtocolNum, const TDesC16& aAcmControlIfcName, const TDesC16& aAcmDataIfcName) |
43 /** |
42 /** |
44 * Create a new CCdcAcmClass object |
43 * Create a new CCdcAcmClass object |
45 * |
44 * |
46 * @return Ownership of a new CCdcAcmClass object |
45 * @return Ownership of a new CCdcAcmClass object |
47 */ |
46 */ |
48 { |
47 { |
49 OstTraceFunctionEntry0( CCDCACMCLASS_NEWL_ENTRY ); |
48 LOG_STATIC_FUNC_ENTRY |
|
49 |
50 CCdcAcmClass* self = new(ELeave) CCdcAcmClass; |
50 CCdcAcmClass* self = new(ELeave) CCdcAcmClass; |
51 CleanupStack::PushL(self); |
51 CleanupStack::PushL(self); |
52 self->ConstructL(aProtocolNum, aAcmControlIfcName, aAcmDataIfcName); |
52 self->ConstructL(aProtocolNum, aAcmControlIfcName, aAcmDataIfcName); |
53 CLEANUPSTACK_POP(self); |
53 CLEANUPSTACK_POP(self); |
54 OstTraceFunctionExit0( CCDCACMCLASS_NEWL_EXIT ); |
|
55 return self; |
54 return self; |
56 } |
55 } |
57 |
56 |
58 void CCdcAcmClass::ConstructL(const TUint8 aProtocolNum, const TDesC16& aControlIfcName, const TDesC16& aDataIfcName) |
57 void CCdcAcmClass::ConstructL(const TUint8 aProtocolNum, const TDesC16& aControlIfcName, const TDesC16& aDataIfcName) |
59 /** |
58 /** |
61 * @param aProtocolNum contains the Table 17 protocol number. |
60 * @param aProtocolNum contains the Table 17 protocol number. |
62 * @param aControlIfcName contains the interface name |
61 * @param aControlIfcName contains the interface name |
63 * @param aDataIfcName contains the interface name |
62 * @param aDataIfcName contains the interface name |
64 */ |
63 */ |
65 { |
64 { |
66 OstTraceFunctionEntry0( CCDCACMCLASS_CONSTRUCTL_ENTRY ); |
|
67 |
|
68 TUint8 interfaceNumber; |
65 TUint8 interfaceNumber; |
69 TInt res; |
66 TInt res; |
70 |
67 |
71 OstTrace0( TRACE_NORMAL, CCDCACMCLASS_CONSTRUCTL, "CCdcAcmClass::ConstructL;\tabout to create control interface with name" ); |
68 LOGTEXT(_L8("\tabout to create control interface with name")); |
72 iControl = CCdcControlInterface::NewL(*this, aProtocolNum, aControlIfcName); |
69 iControl = CCdcControlInterface::NewL(*this, aProtocolNum, aControlIfcName); |
73 |
70 |
74 OstTrace0( TRACE_NORMAL, CCDCACMCLASS_CONSTRUCTL_DUP1, "CCdcAcmClass::ConstructL;\tabout to create data interface with name" ); |
71 LOGTEXT(_L8("\tabout to create data interface with name")); |
75 iData = CCdcDataInterface::NewL(aDataIfcName); |
72 iData = CCdcDataInterface::NewL(aDataIfcName); |
76 |
73 |
77 iBreakController = CBreakController::NewL(*this); |
74 iBreakController = CBreakController::NewL(*this); |
78 |
75 |
79 OstTrace0( TRACE_NORMAL, CCDCACMCLASS_CONSTRUCTL_DUP2, "CCdcAcmClass::ConstructL;\tabout to call GetInterfaceNumber" ); |
76 LOGTEXT(_L8("\tabout to call GetInterfaceNumber")); |
80 res = iData->GetInterfaceNumber(interfaceNumber); |
77 res = iData->GetInterfaceNumber(interfaceNumber); |
81 if ( res ) |
78 if ( res ) |
82 { |
79 { |
83 OstTrace1( TRACE_NORMAL, CCDCACMCLASS_CONSTRUCTL_DUP3, "CCdcAcmClass::ConstructL;\tGetInterfaceNumber=%d", res ); |
80 LOGTEXT2(_L8("\tGetInterfaceNumber=%d"), res); |
84 if (res < 0) |
81 LEAVEIFERRORL(res); |
85 { |
82 } |
86 User::Leave(res); |
83 |
87 } |
84 LOGTEXT(_L8("\tabout to call SetupClassSpecificDescriptor")); |
88 } |
|
89 |
|
90 OstTrace0( TRACE_NORMAL, CCDCACMCLASS_CONSTRUCTL_DUP4, "CCdcAcmClass::ConstructL;\tabout to call SetupClassSpecificDescriptor" ); |
|
91 res = iControl->SetupClassSpecificDescriptor(interfaceNumber); |
85 res = iControl->SetupClassSpecificDescriptor(interfaceNumber); |
92 if ( res ) |
86 if ( res ) |
93 { |
87 { |
94 OstTrace1( TRACE_NORMAL, CCDCACMCLASS_CONSTRUCTL_DUP5, "CCdcAcmClass::ConstructL;\tSetupClassSpecificDescriptor=%d", res ); |
88 LOGTEXT2(_L8("\tSetupClassSpecificDescriptor=%d"), res); |
95 if (res < 0) |
89 LEAVEIFERRORL(res); |
96 { |
90 } |
97 User::Leave(res); |
|
98 } |
|
99 } |
|
100 OstTraceFunctionExit0( CCDCACMCLASS_CONSTRUCTL_EXIT ); |
|
101 } |
91 } |
102 |
92 |
103 CCdcAcmClass::~CCdcAcmClass() |
93 CCdcAcmClass::~CCdcAcmClass() |
104 /** |
94 /** |
105 * Destructor. |
95 * Destructor. |
106 */ |
96 */ |
107 { |
97 { |
108 OstTraceFunctionEntry0( CCDCACMCLASS_CCDCACMCLASS_DES_ENTRY ); |
98 LOG_FUNC |
|
99 |
109 delete iControl; |
100 delete iControl; |
110 delete iData; |
101 delete iData; |
111 delete iBreakController; |
102 delete iBreakController; |
112 OstTraceFunctionExit0( CCDCACMCLASS_CCDCACMCLASS_DES_EXIT ); |
|
113 } |
103 } |
114 |
104 |
115 void CCdcAcmClass::SetCallback(MHostPushedChangeObserver* aCallback) |
105 void CCdcAcmClass::SetCallback(MHostPushedChangeObserver* aCallback) |
116 /** |
106 /** |
117 * Set the ACM class callback object. This cannot be done at construction |
107 * Set the ACM class callback object. This cannot be done at construction |
118 * because the ACM class and the port have different lifetimes. |
108 * because the ACM class and the port have different lifetimes. |
119 */ |
109 */ |
120 { |
110 { |
121 OstTraceFunctionEntry0( CCDCACMCLASS_SETCALLBACK_ENTRY ); |
111 LOGTEXT2(_L8(">>CCdcAcmClass::SetCallback aCallback=0x%08x"), aCallback); |
122 OstTraceExt1( TRACE_NORMAL, CCDCACMCLASS_SETCALLBACK, "CCdcAcmClass::SetCallback;aCallback=%p", aCallback ); |
112 |
123 iCallback = aCallback; |
113 iCallback = aCallback; |
124 |
114 |
125 // remember that this function can also be called to |
115 // remember that this function can also be called to |
126 // unset the callback when it is given a NULL pointer |
116 // unset the callback when it is given a NULL pointer |
127 if ( iCallback ) |
117 if ( iCallback ) |
135 // send off whatever has been seen from Host |
125 // send off whatever has been seen from Host |
136 // requests to set the control line state |
126 // requests to set the control line state |
137 iCallback->HostSignalChange(iDtrState,iRtsState); |
127 iCallback->HostSignalChange(iDtrState,iRtsState); |
138 } |
128 } |
139 |
129 |
140 OstTraceFunctionExit0( CCDCACMCLASS_SETCALLBACK_EXIT ); |
130 LOGTEXT(_L8("<<CCdcAcmClass::SetCallback")); |
141 } |
131 } |
142 |
132 |
143 void CCdcAcmClass::SetBreakCallback(MBreakObserver* aBreakCallback) |
133 void CCdcAcmClass::SetBreakCallback(MBreakObserver* aBreakCallback) |
144 /** |
134 /** |
145 * Set the observer for break events. This cannot be done at construction |
135 * Set the observer for break events. This cannot be done at construction |
146 * because the ACM class and the port have different lifetimes. |
136 * because the ACM class and the port have different lifetimes. |
147 */ |
137 */ |
148 { |
138 { |
149 OstTraceFunctionEntry0( CCDCACMCLASS_SETBREAKCALLBACK_ENTRY ); |
139 LOGTEXT2(_L8(">>CCdcAcmClass::SetBreakCallback aBreakCallback=0x%08x"), |
150 OstTraceExt1( TRACE_NORMAL, CCDCACMCLASS_SETBREAKCALLBACK, "CCdcAcmClass::SetBreakCallback;aBreakCallback=%p", aBreakCallback ); |
140 aBreakCallback); |
|
141 |
151 iBreakCallback = aBreakCallback; |
142 iBreakCallback = aBreakCallback; |
152 OstTraceFunctionExit0( CCDCACMCLASS_SETBREAKCALLBACK_EXIT ); |
143 |
|
144 LOGTEXT(_L8("<<CCdcAcmClass::SetBreakCallback")); |
153 } |
145 } |
154 |
146 |
155 void CCdcAcmClass::ReadOneOrMore(MReadOneOrMoreObserver& aObserver, TDes8& aDes) |
147 void CCdcAcmClass::ReadOneOrMore(MReadOneOrMoreObserver& aObserver, TDes8& aDes) |
156 /** |
148 /** |
157 * Read from the bus a specified amount but complete if any data arrives. |
149 * Read from the bus a specified amount but complete if any data arrives. |
158 * |
150 * |
159 * @param aObserver The observer to notify completion to. |
151 * @param aObserver The observer to notify completion to. |
160 * @param aDes Descriptor to read into |
152 * @param aDes Descriptor to read into |
161 */ |
153 */ |
162 { |
154 { |
163 OstTraceFunctionEntry0( CCDCACMCLASS_READONEORMORE_ENTRY ); |
155 LOGTEXT2(_L8(">>CCdcAcmClass::ReadOneOrMore aObserver=0x%08x"), |
164 OstTraceExt1( TRACE_NORMAL, CCDCACMCLASS_READONEORMORE, "CCdcAcmClass::ReadOneOrMore;aObserver=%p", &aObserver ); |
156 &aObserver); |
|
157 |
165 ReadOneOrMore(aObserver, aDes, aDes.Length()); |
158 ReadOneOrMore(aObserver, aDes, aDes.Length()); |
166 OstTraceFunctionExit0( CCDCACMCLASS_READONEORMORE_EXIT ); |
159 |
|
160 LOGTEXT(_L8("<<CCdcAcmClass::ReadOneOrMore")); |
167 } |
161 } |
168 |
162 |
169 void CCdcAcmClass::ReadOneOrMore(MReadOneOrMoreObserver& aObserver, |
163 void CCdcAcmClass::ReadOneOrMore(MReadOneOrMoreObserver& aObserver, |
170 TDes8& aDes, |
164 TDes8& aDes, |
171 TInt aLength) |
165 TInt aLength) |
175 * @param aObserver The observer to notify completion to. |
169 * @param aObserver The observer to notify completion to. |
176 * @param aDes Descriptor to read into |
170 * @param aDes Descriptor to read into |
177 * @param aLength Amount of data to read |
171 * @param aLength Amount of data to read |
178 */ |
172 */ |
179 { |
173 { |
180 OstTraceFunctionEntry0( CCDCACMCLASS_READONEORMORE_MREADONEORMOREOBSERVERREF_TDES8REF_TINT_ENTRY ); |
174 LOGTEXT3(_L8(">>CCdcAcmClass::ReadOneOrMore aObserver=0x%08x, " |
181 OstTraceExt2( TRACE_NORMAL, CCDCACMCLASS_READONEORMORE_MREADONEORMOREOBSERVERREF_TDES8REF_TINT, |
175 "aLength=%d"), |
182 "CCdcAcmClass::ReadOneOrMore;aObserver=%p;aLength=%d", &aObserver, aLength ); |
176 &aObserver, aLength); |
183 |
177 |
184 if (!iData) |
178 __ASSERT_DEBUG(iData, _USB_PANIC(KAcmPanicCat, EPanicInternalError)); |
185 { |
|
186 OstTrace1( TRACE_FATAL, CCDCACMCLASS_READONEORMORE_MREADONEORMOREOBSERVERREF_TDES8REF_TINT_DUP1, "CCdcAcmClass::ReadOneOrMore;iData=%d", (TInt)iData ); |
|
187 __ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) ); |
|
188 } |
|
189 iData->ReadOneOrMore(aObserver, aDes, aLength); |
179 iData->ReadOneOrMore(aObserver, aDes, aLength); |
190 |
180 |
191 OstTraceFunctionExit0( CCDCACMCLASS_READONEORMORE_MREADONEORMOREOBSERVERREF_TDES8REF_TINT_EXIT ); |
181 LOGTEXT(_L8("<<CCdcAcmClass::ReadOneOrMore")); |
192 } |
182 } |
193 |
183 |
194 void CCdcAcmClass::Read(MReadObserver& aObserver, TDes8& aDes) |
184 void CCdcAcmClass::Read(MReadObserver& aObserver, TDes8& aDes) |
195 /** |
185 /** |
196 * Read from the bus |
186 * Read from the bus |
197 * |
187 * |
198 * @param aObserver The observer to notify completion to. |
188 * @param aObserver The observer to notify completion to. |
199 * @param aDes Descriptor to read into. |
189 * @param aDes Descriptor to read into. |
200 */ |
190 */ |
201 { |
191 { |
202 OstTraceFunctionEntry0( CCDCACMCLASS_READ_ENTRY ); |
192 LOGTEXT2(_L8(">>CCdcAcmClass::Read aObserver=0x%08x"), &aObserver); |
203 OstTraceExt1( TRACE_NORMAL, CCDCACMCLASS_READ, "CCdcAcmClass::Read;aObserver=%p", &aObserver ); |
193 |
204 Read(aObserver, aDes, aDes.Length()); |
194 Read(aObserver, aDes, aDes.Length()); |
205 OstTraceFunctionExit0( CCDCACMCLASS_READ_EXIT ); |
195 |
|
196 LOGTEXT(_L8("<<CCdcAcmClass::Read")); |
206 } |
197 } |
207 |
198 |
208 void CCdcAcmClass::Read(MReadObserver& aObserver, TDes8& aDes, TInt aLength) |
199 void CCdcAcmClass::Read(MReadObserver& aObserver, TDes8& aDes, TInt aLength) |
209 /** |
200 /** |
210 * Read from the bus a specified amount. |
201 * Read from the bus a specified amount. |
212 * @param aObserver The observer to notify completion to. |
203 * @param aObserver The observer to notify completion to. |
213 * @param aDes Descriptor to read into. |
204 * @param aDes Descriptor to read into. |
214 * @param aLength Amount of data to read. |
205 * @param aLength Amount of data to read. |
215 */ |
206 */ |
216 { |
207 { |
217 OstTraceFunctionEntry0( CCDCACMCLASS_READ_ENTRY_DUP1 ); |
208 LOGTEXT3(_L8(">>CCdcAcmClass::Read aObserver=0x%08x, aLength=%d"), |
218 OstTraceExt2( TRACE_NORMAL, CCDCACMCLASS_READ_DUP1, "CCdcAcmClass::Read;aObserver=%p;aLength=%d", &aObserver, aLength ); |
209 &aObserver, aLength); |
219 if (!iData) |
210 |
220 { |
211 __ASSERT_DEBUG(iData, _USB_PANIC(KAcmPanicCat, EPanicInternalError)); |
221 OstTraceExt1( TRACE_FATAL, CCDCACMCLASS_READ_DUP2, "CCdcAcmClass::Read;iData=%p", iData ); |
|
222 __ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) ); |
|
223 } |
|
224 iData->Read(aObserver, aDes, aLength); |
212 iData->Read(aObserver, aDes, aLength); |
225 OstTraceFunctionExit0( CCDCACMCLASS_READ_ENTRY_DUP1_EXIT ); |
213 |
|
214 LOGTEXT(_L8("<<CCdcAcmClass::Read")); |
226 } |
215 } |
227 |
216 |
228 void CCdcAcmClass::ReadCancel() |
217 void CCdcAcmClass::ReadCancel() |
229 /** |
218 /** |
230 * Cancel a read request. |
219 * Cancel a read request. |
231 */ |
220 */ |
232 { |
221 { |
233 OstTraceFunctionEntry0( CCDCACMCLASS_READCANCEL_ENTRY ); |
222 LOG_FUNC |
234 |
223 |
235 if (!iData) |
224 __ASSERT_DEBUG(iData, _USB_PANIC(KAcmPanicCat, EPanicInternalError)); |
236 { |
|
237 OstTraceExt1( TRACE_FATAL, CCDCACMCLASS_READCANCEL, "CCdcAcmClass::ReadCancel;iData=%p", iData ); |
|
238 __ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) ); |
|
239 } |
|
240 iData->CancelRead(); |
225 iData->CancelRead(); |
241 OstTraceFunctionExit0( CCDCACMCLASS_READCANCEL_EXIT ); |
|
242 } |
226 } |
243 |
227 |
244 void CCdcAcmClass::Write(MWriteObserver& aObserver, const TDesC8& aDes) |
228 void CCdcAcmClass::Write(MWriteObserver& aObserver, const TDesC8& aDes) |
245 /** |
229 /** |
246 * Write to the bus. |
230 * Write to the bus. |
247 * |
231 * |
248 * @param aObserver The observer to notify completion to. |
232 * @param aObserver The observer to notify completion to. |
249 * @param aDes Descriptor containing the data to be written. |
233 * @param aDes Descriptor containing the data to be written. |
250 */ |
234 */ |
251 { |
235 { |
252 OstTraceFunctionEntry0( CCDCACMCLASS_WRITE_ENTRY ); |
236 LOGTEXT2(_L8(">>CCdcAcmClass::Write aObserver=0x%08x"), |
253 OstTraceExt1( TRACE_NORMAL, CCDCACMCLASS_WRITE, "CCdcAcmClass::Write;aObserver=%p", &aObserver ); |
237 &aObserver); |
|
238 |
254 Write(aObserver, aDes, aDes.Length()); |
239 Write(aObserver, aDes, aDes.Length()); |
255 OstTraceFunctionExit0( CCDCACMCLASS_WRITE_EXIT ); |
240 |
|
241 LOGTEXT(_L8("<<CCdcAcmClass::Write")); |
256 } |
242 } |
257 |
243 |
258 void CCdcAcmClass::Write(MWriteObserver& aObserver, |
244 void CCdcAcmClass::Write(MWriteObserver& aObserver, |
259 const TDesC8& aDes, |
245 const TDesC8& aDes, |
260 TInt aLength) |
246 TInt aLength) |
264 * @param aObserver The observer to notify completion to. |
250 * @param aObserver The observer to notify completion to. |
265 * @param aDes Descriptor containing the data to be written. |
251 * @param aDes Descriptor containing the data to be written. |
266 * @param aLength The amount of data to write. |
252 * @param aLength The amount of data to write. |
267 */ |
253 */ |
268 { |
254 { |
269 OstTraceFunctionEntry0( CCDCACMCLASS_WRITE_ENTRY_DUP1 ); |
255 LOGTEXT3(_L8(">>CCdcAcmClass::Write aObserver=0x%08x, aLength=%d"), |
270 OstTraceExt2( TRACE_NORMAL, CCDCACMCLASS_WRITE_DUP1, "CCdcAcmClass::Write;aObserver=%p;aLength=%d", &aObserver, aLength ); |
256 &aObserver, aLength); |
271 if (!iData) |
257 |
272 { |
258 __ASSERT_DEBUG(iData, _USB_PANIC(KAcmPanicCat, EPanicInternalError)); |
273 OstTraceExt1( TRACE_FATAL, CCDCACMCLASS_WRITE_DUP2, "CCdcAcmClass::Write;iData=%p", iData ); |
|
274 __ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) ); |
|
275 } |
|
276 iData->Write(aObserver, aDes, aLength); |
259 iData->Write(aObserver, aDes, aLength); |
277 OstTraceFunctionExit0( CCDCACMCLASS_WRITE_ENTRY_DUP1_EXIT ); |
260 |
|
261 LOGTEXT(_L8("<<CCdcAcmClass::Write")); |
278 } |
262 } |
279 |
263 |
280 void CCdcAcmClass::WriteCancel() |
264 void CCdcAcmClass::WriteCancel() |
281 /** |
265 /** |
282 * Cancel the write request. |
266 * Cancel the write request. |
283 */ |
267 */ |
284 { |
268 { |
285 OstTraceFunctionEntry0( CCDCACMCLASS_WRITECANCEL_ENTRY ); |
269 LOG_FUNC |
286 if (!iData) |
270 |
287 { |
271 __ASSERT_DEBUG(iData, _USB_PANIC(KAcmPanicCat, EPanicInternalError)); |
288 OstTraceExt1( TRACE_FATAL, CCDCACMCLASS_WRITECANCEL, "CCdcAcmClass::WriteCancel;iData=%p", iData ); |
|
289 __ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) ); |
|
290 } |
|
291 iData->CancelWrite(); |
272 iData->CancelWrite(); |
292 OstTraceFunctionExit0( CCDCACMCLASS_WRITECANCEL_EXIT ); |
|
293 } |
273 } |
294 |
274 |
295 TInt CCdcAcmClass::HandleGetCommFeature(const TUint16 aSelector, |
275 TInt CCdcAcmClass::HandleGetCommFeature(const TUint16 aSelector, |
296 TDes8& aReturnData) |
276 TDes8& aReturnData) |
297 /** |
277 /** |
300 * @param aSelector Multiplex control for the feature is held in wValue field |
280 * @param aSelector Multiplex control for the feature is held in wValue field |
301 * @param aReturnData Descriptor containing the multiplexed and idle state of |
281 * @param aReturnData Descriptor containing the multiplexed and idle state of |
302 * the ACM device or the country code from ISO 3166. |
282 * the ACM device or the country code from ISO 3166. |
303 */ |
283 */ |
304 { |
284 { |
305 OstTraceFunctionEntry0( CCDCACMCLASS_HANDLEGETCOMMFEATURE_ENTRY ); |
285 LOGTEXT2(_L8(">>CCdcAcmClass::HandleGetCommFeature aSelector=%d"), |
306 OstTrace1( TRACE_NORMAL, CCDCACMCLASS_HANDLEGETCOMMFEATURE, "CCdcAcmClass::HandleGetCommFeature;aSelector=%d", (TInt)aSelector ); |
286 aSelector); |
|
287 |
307 TInt ret = KErrNone; |
288 TInt ret = KErrNone; |
308 |
289 |
309 // check the feature selector from the header and reject if invalid, |
290 // check the feature selector from the header and reject if invalid, |
310 // otherwise deal with it. |
291 // otherwise deal with it. |
311 switch ( aSelector ) |
292 switch ( aSelector ) |
318 TUint8** ppbuffer; |
299 TUint8** ppbuffer; |
319 pbuffer = &aReturnData[0]; |
300 pbuffer = &aReturnData[0]; |
320 ppbuffer = &pbuffer; |
301 ppbuffer = &pbuffer; |
321 |
302 |
322 CCdcControlInterface::PutU16(ppbuffer,iAcmState); |
303 CCdcControlInterface::PutU16(ppbuffer,iAcmState); |
323 OstTraceExt1( TRACE_NORMAL, CCDCACMCLASS_HANDLEGETCOMMFEATURE_DUP1, |
304 |
324 "CCdcAcmClass::HandleGetCommFeature;\tAbstract State [0x%hx]", iAcmState ); |
305 LOGTEXT2(_L8("\tAbstract State [0x%04X]"), iAcmState); |
325 } |
306 } |
326 break; |
307 break; |
327 |
308 |
328 case EUsbCommFeatureSelectCountryCode: |
309 case EUsbCommFeatureSelectCountryCode: |
329 { |
310 { |
330 #if defined(DISABLE_ACM_CF_COUNTRY_SETTING) |
311 #if defined(DISABLE_ACM_CF_COUNTRY_SETTING) |
331 |
312 |
332 aReturnData.SetLength(0); |
313 aReturnData.SetLength(0); |
333 OstTrace0( TRACE_NORMAL, CCDCACMCLASS_HANDLEGETCOMMFEATURE_DUP2, |
314 LOGTEXT(_L8("\tCountry Code Not Supported")); |
334 "CCdcAcmClass::HandleGetCommFeature;\tCountry Code Not Supported" ); |
|
335 ret = KErrNotSupported; |
315 ret = KErrNotSupported; |
336 |
316 |
337 #elif defined(ENABLE_ACM_CF_COUNTRY_SETTING) |
317 #elif defined(ENABLE_ACM_CF_COUNTRY_SETTING) |
338 |
318 |
339 aReturnData.SetLength(2); |
319 aReturnData.SetLength(2); |
342 TUint8** ppbuffer; |
322 TUint8** ppbuffer; |
343 pbuffer = &aReturnData[0]; |
323 pbuffer = &aReturnData[0]; |
344 ppbuffer = &pbuffer; |
324 ppbuffer = &pbuffer; |
345 |
325 |
346 CCdcControlInterface::PutU16(ppbuffer,iCountryCode); |
326 CCdcControlInterface::PutU16(ppbuffer,iCountryCode); |
347 OstTraceExt1( TRACE_NORMAL, CCDCACMCLASS_HANDLEGETCOMMFEATURE_DUP3, |
327 |
348 "CCdcAcmClass::HandleGetCommFeature;\tCountry Code [0x%hx]", iCountryCode ); |
328 LOGTEXT2(_L8("\tCountry Code [0x%04X]"), iCountryCode); |
|
329 |
349 #endif |
330 #endif |
350 } |
331 } |
351 break; |
332 break; |
352 |
333 |
353 default: |
334 default: |
354 aReturnData.SetLength(0); |
335 aReturnData.SetLength(0); |
355 OstTrace0( TRACE_NORMAL, CCDCACMCLASS_HANDLEGETCOMMFEATURE_DUP4, "CCdcAcmClass::HandleGetCommFeature;\tBad Selector" ); |
336 LOGTEXT(_L8("\tBad Selector")); |
356 ret = KErrUnknown; |
337 ret = KErrUnknown; |
357 } |
338 } |
358 |
339 |
359 OstTrace1( TRACE_NORMAL, CCDCACMCLASS_HANDLEGETCOMMFEATURE_DUP5, |
340 LOGTEXT2(_L8("<<CCdcAcmClass::HandleGetCommFeature ret=%d"), ret); |
360 "CCdcAcmClass::HandleGetCommFeature;ret=%d", ret ); |
|
361 OstTraceFunctionExit0( CCDCACMCLASS_HANDLEGETCOMMFEATURE_EXIT ); |
|
362 return ret; |
341 return ret; |
363 } |
342 } |
364 |
343 |
365 TInt CCdcAcmClass::HandleClearCommFeature(const TUint16 aSelector) |
344 TInt CCdcAcmClass::HandleClearCommFeature(const TUint16 aSelector) |
366 /** |
345 /** |
367 * Callback for Clear Comm Feature requests |
346 * Callback for Clear Comm Feature requests |
368 * @param aSelector Multiplex control for the feature is held in wValue field |
347 * @param aSelector Multiplex control for the feature is held in wValue field |
369 */ |
348 */ |
370 { |
349 { |
371 OstTraceFunctionEntry0( CCDCACMCLASS_HANDLECLEARCOMMFEATURE_ENTRY ); |
350 LOGTEXT2(_L8(">>CCdcAcmClass::HandleClearCommFeature aSelector=%d"), |
372 OstTrace1( TRACE_NORMAL, CCDCACMCLASS_HANDLECLEARCOMMFEATURE, "CCdcAcmClass::HandleClearCommFeature;aSelector=%d", (TInt)aSelector ); |
351 aSelector); |
|
352 |
373 TInt ret = KErrNone; |
353 TInt ret = KErrNone; |
374 |
354 |
375 // check the feature selector from the header and reject if invalid, |
355 // check the feature selector from the header and reject if invalid, |
376 // otherwise deal with it. |
356 // otherwise deal with it. |
377 switch ( aSelector ) |
357 switch ( aSelector ) |
378 { |
358 { |
379 case EUsbCommFeatureSelectAbstractState: |
359 case EUsbCommFeatureSelectAbstractState: |
380 { |
360 { |
381 // reset to guaranteed-success default, so ignore return value |
361 // reset to guaranteed-success default, so ignore return value |
382 static_cast<void>(HandleNewAbstractState(EUsbAbstractStateDataMultiplex)); |
362 static_cast<void>(HandleNewAbstractState(EUsbAbstractStateDataMultiplex)); |
383 OstTraceExt1( TRACE_NORMAL, CCDCACMCLASS_HANDLECLEARCOMMFEATURE_DUP1, |
363 LOGTEXT2(_L8("\tAbstract State [0x%04X]"), iAcmState); |
384 "CCdcAcmClass::HandleClearCommFeature;\tAbstract State [0x%hx]", iAcmState ); |
|
385 } |
364 } |
386 break; |
365 break; |
387 |
366 |
388 case EUsbCommFeatureSelectCountryCode: |
367 case EUsbCommFeatureSelectCountryCode: |
389 { |
368 { |
390 #if defined(DISABLE_ACM_CF_COUNTRY_SETTING) |
369 #if defined(DISABLE_ACM_CF_COUNTRY_SETTING) |
391 |
370 |
392 OstTrace0( TRACE_NORMAL, CCDCACMCLASS_HANDLECLEARCOMMFEATURE_DUP2, |
371 LOGTEXT(_L8("\tCountry Code Not Supported")); |
393 "CCdcAcmClass::HandleClearCommFeature;\tCountry Code Not Supported" ); |
|
394 ret = KErrNotSupported; |
372 ret = KErrNotSupported; |
395 |
373 |
396 #elif defined(ENABLE_ACM_CF_COUNTRY_SETTING) |
374 #elif defined(ENABLE_ACM_CF_COUNTRY_SETTING) |
397 |
375 |
398 HandleNewCountryCode(KUsbCommCountryCode0); |
376 HandleNewCountryCode(KUsbCommCountryCode0); |
399 OstTraceExt1( TRACE_NORMAL, CCDCACMCLASS_HANDLECLEARCOMMFEATURE_DUP3, |
377 LOGTEXT2(_L8("\tCountry Code [0x%04X]"), iCountryCode); |
400 "CCdcAcmClass::HandleClearCommFeature;\tCountry Code [0x%hx]", iCountryCode ); |
|
401 |
378 |
402 #endif |
379 #endif |
403 } |
380 } |
404 break; |
381 break; |
405 |
382 |
406 default: |
383 default: |
407 { |
384 { |
408 OstTrace0( TRACE_NORMAL, CCDCACMCLASS_HANDLECLEARCOMMFEATURE_DUP4, "CCdcAcmClass::HandleClearCommFeature;\tBad Selector" ); |
385 LOGTEXT(_L8("\tBad Selector")); |
409 ret = KErrUnknown; |
386 ret = KErrUnknown; |
410 } |
387 } |
411 } |
388 } |
412 |
389 |
413 OstTrace1( TRACE_NORMAL, CCDCACMCLASS_HANDLECLEARCOMMFEATURE_DUP5, "CCdcAcmClass::HandleClearCommFeature;ret=%d", ret ); |
390 LOGTEXT2(_L8("<<CCdcAcmClass::HandleClearCommFeature ret=%d"), ret); |
414 OstTraceFunctionExit0( CCDCACMCLASS_HANDLECLEARCOMMFEATURE_EXIT ); |
|
415 return ret; |
391 return ret; |
416 } |
392 } |
417 |
393 |
418 TInt CCdcAcmClass::HandleSetLineCoding(const TDesC8& aData) |
394 TInt CCdcAcmClass::HandleSetLineCoding(const TDesC8& aData) |
419 /** |
395 /** |
685 |
654 |
686 // discrepancy check to see if the client application needs to be |
655 // discrepancy check to see if the client application needs to be |
687 // informed, note that the callback may not have been placed. |
656 // informed, note that the callback may not have been placed. |
688 if( iAcmState != newstate ) |
657 if( iAcmState != newstate ) |
689 { |
658 { |
690 OstTraceExt1( TRACE_NORMAL, CCDCACMCLASS_HANDLENEWABSTRACTSTATE_DUP1, |
659 LOGTEXT2(_L8("\tNew Combo [0x%04X]"), newstate); |
691 "CCdcAcmClass::HandleNewAbstractState;\tNew Combo [0x%hx]", newstate ); |
|
692 |
660 |
693 if ( iCallback ) |
661 if ( iCallback ) |
694 { |
662 { |
695 // If there was such a function in class |
663 // If there was such a function in class |
696 // MHostPushedChangeObserver, notify |
664 // MHostPushedChangeObserver, notify |
697 // via iCallback->HostAbstractStateChange(newstate); |
665 // via iCallback->HostAbstractStateChange(newstate); |
698 OstTrace0( TRACE_NORMAL, CCDCACMCLASS_HANDLENEWABSTRACTSTATE_DUP2, |
666 LOGTEXT(_L8("\tHas No Notification Method in class MHostPushedChangeObserver")); |
699 "CCdcAcmClass::HandleNewAbstractState;\tHas No Notification Method in class MHostPushedChangeObserver" ); |
|
700 } |
667 } |
701 } |
668 } |
702 |
669 |
703 // and save the new state ready for next check |
670 // and save the new state ready for next check |
704 iAcmState = newstate; |
671 iAcmState = newstate; |
705 OstTrace1( TRACE_NORMAL, CCDCACMCLASS_HANDLENEWABSTRACTSTATE_DUP3, "CCdcAcmClass::HandleNewAbstractState;ret=%d", ret ); |
672 |
706 OstTraceFunctionExit0( CCDCACMCLASS_HANDLENEWABSTRACTSTATE_EXIT ); |
673 LOGTEXT2(_L8("<<CCdcAcmClass::HandleNewAbstractState ret=%d"), ret); |
707 return ret; |
674 return ret; |
708 } |
675 } |
709 |
676 |
710 TInt CCdcAcmClass::HandleNewCountryCode(const TUint16 aCountryCode) |
677 TInt CCdcAcmClass::HandleNewCountryCode(const TUint16 aCountryCode) |
711 /** |
678 /** |
737 |
705 |
738 ret = KErrNone; |
706 ret = KErrNone; |
739 |
707 |
740 #endif |
708 #endif |
741 |
709 |
742 OstTrace1( TRACE_NORMAL, CCDCACMCLASS_HANDLENEWCOUNTRYCODE_DUP1, "CCdcAcmClass::HandleNewCountryCode;ret=%d", ret ); |
710 LOGTEXT2(_L8("<<CCdcAcmClass::HandleNewCountryCode ret=%d"), ret); |
743 OstTraceFunctionExit0( CCDCACMCLASS_HANDLENEWCOUNTRYCODE_EXIT ); |
|
744 return ret; |
711 return ret; |
745 } |
712 } |
746 |
713 |
747 TInt CCdcAcmClass::HandleSendEncapCommand(const TDesC8& /*aData*/) |
714 TInt CCdcAcmClass::HandleSendEncapCommand(const TDesC8& /*aData*/) |
748 /** |
715 /** |
749 * Callback for Send Encapsulated Command requests |
716 * Callback for Send Encapsulated Command requests |
750 * |
717 * |
751 * @param aData Pointer to the Encapsulated message |
718 * @param aData Pointer to the Encapsulated message |
752 */ |
719 */ |
753 { |
720 { |
754 OstTraceFunctionEntry0( CCDCACMCLASS_HANDLESENDENCAPCOMMAND_ENTRY ); |
721 LOG_FUNC |
755 OstTrace0( TRACE_NORMAL, CCDCACMCLASS_HANDLESENDENCAPCOMMAND, "CCdcAcmClass::HandleSendEncapCommand;\t***not supported" ); |
722 |
756 OstTraceFunctionExit0( CCDCACMCLASS_HANDLESENDENCAPCOMMAND_EXIT ); |
723 LOGTEXT(_L8("\t***not supported")); |
|
724 |
757 return KErrNotSupported; |
725 return KErrNotSupported; |
758 } |
726 } |
759 |
727 |
760 TInt CCdcAcmClass::HandleGetEncapResponse(TDes8& /*aReturnData*/) |
728 TInt CCdcAcmClass::HandleGetEncapResponse(TDes8& /*aReturnData*/) |
761 /** |
729 /** |
762 * Callback for Get Encapsulated Response requests |
730 * Callback for Get Encapsulated Response requests |
763 * |
731 * |
764 * @param aReturnData Pointer to the Response field |
732 * @param aReturnData Pointer to the Response field |
765 */ |
733 */ |
766 { |
734 { |
767 OstTraceFunctionEntry0( CCDCACMCLASS_HANDLEGETENCAPRESPONSE_ENTRY ); |
735 LOG_FUNC |
768 OstTrace0( TRACE_NORMAL, CCDCACMCLASS_HANDLEGETENCAPRESPONSE, "CCdcAcmClass::HandleGetEncapResponse;\t***not supported" ); |
736 |
769 OstTraceFunctionExit0( CCDCACMCLASS_HANDLEGETENCAPRESPONSE_EXIT ); |
737 LOGTEXT(_L8("\t***not supported")); |
|
738 |
770 return KErrNotSupported; |
739 return KErrNotSupported; |
771 } |
740 } |
772 |
741 |
773 TInt CCdcAcmClass::HandleSetCommFeature(const TUint16 aSelector, |
742 TInt CCdcAcmClass::HandleSetCommFeature(const TUint16 aSelector, |
774 const TDes8& aData) |
743 const TDes8& aData) |
778 * @param aSelector Multiplex control for the feature is held in wValue field |
747 * @param aSelector Multiplex control for the feature is held in wValue field |
779 * @param aData Descriptor containing the multiplexed and idle state of |
748 * @param aData Descriptor containing the multiplexed and idle state of |
780 * the ACM device or the country code from ISO 3166. |
749 * the ACM device or the country code from ISO 3166. |
781 */ |
750 */ |
782 { |
751 { |
783 OstTraceFunctionEntry0( CCDCACMCLASS_HANDLESETCOMMFEATURE_ENTRY ); |
752 LOGTEXT2(_L8(">>CCdcAcmClass::HandleSetCommFeature aSelector=%d"), |
784 OstTrace1( TRACE_NORMAL, CCDCACMCLASS_HANDLESETCOMMFEATURE, "CCdcAcmClass::HandleSetCommFeature;aSelector=%d", (TInt)aSelector ); |
753 aSelector); |
785 |
754 |
786 // reject any message that has malformed data |
755 // reject any message that has malformed data |
787 if ( aData.Length() != 2 ) |
756 if ( aData.Length() != 2 ) |
788 { |
757 { |
789 OstTrace1( TRACE_NORMAL, CCDCACMCLASS_HANDLESETCOMMFEATURE_DUP1, |
758 LOGTEXT2(_L8("\t***aData.Length (%d) incorrect"), aData.Length()); |
790 "CCdcAcmClass::HandleSetCommFeature;\t***aData.Length (%d) incorrect", aData.Length() ); |
759 LOGTEXT2(_L8("<<CCdcAcmClass::HandleSetCommFeature ret=%d"), |
791 OstTrace1( TRACE_NORMAL, CCDCACMCLASS_HANDLESETCOMMFEATURE_DUP2, |
760 KErrArgument); |
792 "CCdcAcmClass::HandleSetCommFeature;ret=%d", KErrArgument ); |
|
793 OstTraceFunctionExit0( CCDCACMCLASS_HANDLESETCOMMFEATURE_EXIT ); |
|
794 return KErrArgument; |
761 return KErrArgument; |
795 } |
762 } |
796 |
763 |
797 TInt ret = KErrNone; |
764 TInt ret = KErrNone; |
798 |
765 |
812 newstate = CCdcControlInterface::GetU16(ppbuffer); |
779 newstate = CCdcControlInterface::GetU16(ppbuffer); |
813 |
780 |
814 if ( newstate != iAcmState ) |
781 if ( newstate != iAcmState ) |
815 { |
782 { |
816 ret = HandleNewAbstractState(newstate); |
783 ret = HandleNewAbstractState(newstate); |
817 OstTraceExt3( TRACE_NORMAL, CCDCACMCLASS_HANDLESETCOMMFEATURE_DUP3, |
784 |
818 "CCdcAcmClass::HandleSetCommFeature;\tHandleNewAbstractState=%d [%hu]->[%hu]", |
785 LOGTEXT4(_L8("\tHandleNewAbstractState=%d [0x%04X]->[0x%04X]"), |
819 ret, iAcmState, newstate ); |
786 ret, iAcmState, newstate); |
820 } |
787 } |
821 } |
788 } |
822 break; |
789 break; |
823 |
790 |
824 case EUsbCommFeatureSelectCountryCode: |
791 case EUsbCommFeatureSelectCountryCode: |
825 { |
792 { |
826 #if defined(DISABLE_ACM_CF_COUNTRY_SETTING) |
793 #if defined(DISABLE_ACM_CF_COUNTRY_SETTING) |
827 |
794 |
828 OstTrace0( TRACE_NORMAL, CCDCACMCLASS_HANDLESETCOMMFEATURE_DUP4, "CCdcAcmClass::HandleSetCommFeature;Country Code Not Supported" ); |
795 LOGTEXT(_L8("Country Code Not Supported")); |
829 ret = KErrNotSupported; |
796 ret = KErrNotSupported; |
830 |
797 |
831 #elif defined(ENABLE_ACM_CF_COUNTRY_SETTING) |
798 #elif defined(ENABLE_ACM_CF_COUNTRY_SETTING) |
832 |
799 |
833 TUint16 newcountry; |
800 TUint16 newcountry; |
840 newcountry = CCdcControlInterface::GetU16(ppbuffer); |
807 newcountry = CCdcControlInterface::GetU16(ppbuffer); |
841 |
808 |
842 if( newcountry != iCountryCode ) |
809 if( newcountry != iCountryCode ) |
843 { |
810 { |
844 ret = HandleNewCountryCode(newcountry); |
811 ret = HandleNewCountryCode(newcountry); |
845 OstTraceExt3( TRACE_NORMAL, CCDCACMCLASS_HANDLESETCOMMFEATURE_DUP5, |
812 |
846 "CCdcAcmClass::HandleSetCommFeature;\tHandleNewCountryCode=%d [%u]->[%u]", ret, iCountryCode, newcountry ); |
813 LOGTEXT4(_L8("\tHandleNewCountryCode=%d [0x%04X]->[0x%04X]"), |
|
814 ret, iCountryCode, newcountry); |
847 } |
815 } |
848 |
816 |
849 #endif |
817 #endif |
850 break; |
818 break; |
851 } |
819 } |
852 |
820 |
853 default: |
821 default: |
854 { |
822 { |
855 OstTrace0( TRACE_NORMAL, CCDCACMCLASS_HANDLESETCOMMFEATURE_DUP6, "CCdcAcmClass::HandleSetCommFeature;\tBad Selector" ); |
823 LOGTEXT(_L8("\tBad Selector")); |
856 ret = KErrUnknown; |
824 ret = KErrUnknown; |
857 } |
825 } |
858 } |
826 } |
859 OstTrace1( TRACE_NORMAL, CCDCACMCLASS_HANDLESETCOMMFEATURE_DUP7, "CCdcAcmClass::HandleSetCommFeature;ret=%d", ret ); |
827 |
860 OstTraceFunctionExit0( CCDCACMCLASS_HANDLESETCOMMFEATURE_EXIT_DUP1 ); |
828 LOGTEXT2(_L8("<<CCdcAcmClass::HandleSetCommFeature ret=%d"), ret); |
861 return ret; |
829 return ret; |
862 } |
830 } |
863 |
831 |
864 TInt CCdcAcmClass::HandleGetLineCoding(TDes8& aReturnData) |
832 TInt CCdcAcmClass::HandleGetLineCoding(TDes8& aReturnData) |
865 /** |
833 /** |
882 CCdcControlInterface::PutU32(ppbuffer, iUsbConfig.iRate ); |
851 CCdcControlInterface::PutU32(ppbuffer, iUsbConfig.iRate ); |
883 CCdcControlInterface::PutU08(ppbuffer, static_cast<TUint8>(iUsbConfig.iStopBits)); |
852 CCdcControlInterface::PutU08(ppbuffer, static_cast<TUint8>(iUsbConfig.iStopBits)); |
884 CCdcControlInterface::PutU08(ppbuffer, static_cast<TUint8>(iUsbConfig.iParity )); |
853 CCdcControlInterface::PutU08(ppbuffer, static_cast<TUint8>(iUsbConfig.iParity )); |
885 CCdcControlInterface::PutU08(ppbuffer, static_cast<TUint8>(iUsbConfig.iDataBits)); |
854 CCdcControlInterface::PutU08(ppbuffer, static_cast<TUint8>(iUsbConfig.iDataBits)); |
886 |
855 |
887 OstTraceFunctionExit0( CCDCACMCLASS_HANDLEGETLINECODING_EXIT ); |
|
888 return KErrNone; |
856 return KErrNone; |
889 } |
857 } |
890 |
858 |
891 TInt CCdcAcmClass::HandleSetControlLineState(TBool aRtsState, TBool aDtrState) |
859 TInt CCdcAcmClass::HandleSetControlLineState(TBool aRtsState, TBool aDtrState) |
892 /** |
860 /** |
894 * |
862 * |
895 * @param aRtsState RTS state. |
863 * @param aRtsState RTS state. |
896 * @param aDtrState DTR state. |
864 * @param aDtrState DTR state. |
897 */ |
865 */ |
898 { |
866 { |
899 OstTraceFunctionEntry0( CCDCACMCLASS_HANDLESETCONTROLLINESTATE_ENTRY ); |
867 LOGTEXT3(_L8(">>CCdcAcmClass::HandleSetControlLineState aRtsState=%d, " |
900 OstTraceExt2( TRACE_NORMAL, CCDCACMCLASS_HANDLESETCONTROLLINESTATE, |
868 "aDtrState=%d"), |
901 "CCdcAcmClass::HandleSetControlLineState;aRtsState=%d;aDtrState=%d", (TInt)aRtsState, (TInt)aDtrState ); |
869 aRtsState, aDtrState); |
902 |
870 |
903 iRtsState = aRtsState; |
871 iRtsState = aRtsState; |
904 iDtrState = aDtrState; |
872 iDtrState = aDtrState; |
905 if ( iCallback ) |
873 if ( iCallback ) |
906 { |
874 { |
907 iCallback->HostSignalChange(iDtrState,iRtsState); |
875 iCallback->HostSignalChange(iDtrState,iRtsState); |
908 } |
876 } |
909 |
877 |
910 OstTrace0( TRACE_NORMAL, CCDCACMCLASS_HANDLESETCONTROLLINESTATE_DUP1, "CCdcAcmClass::HandleSetControlLineState;ret=0" ); |
878 LOGTEXT(_L8("<<CCdcAcmClass::HandleSetControlLineState ret=0")); |
911 OstTraceFunctionExit0( CCDCACMCLASS_HANDLESETCONTROLLINESTATE_EXIT ); |
|
912 return KErrNone; |
879 return KErrNone; |
913 } |
880 } |
914 |
881 |
915 TInt CCdcAcmClass::HandleSendBreak(TUint16 aDuration) |
882 TInt CCdcAcmClass::HandleSendBreak(TUint16 aDuration) |
916 /** |
883 /** |
917 * Callback for Send Break requests |
884 * Callback for Send Break requests |
918 * |
885 * |
919 * @param aDuration Duration of the break in milliseconds. |
886 * @param aDuration Duration of the break in milliseconds. |
920 */ |
887 */ |
921 { |
888 { |
922 OstTraceFunctionEntry0( CCDCACMCLASS_HANDLESENDBREAK_ENTRY ); |
889 LOG_FUNC |
923 OstTrace1( TRACE_NORMAL, CCDCACMCLASS_HANDLESENDBREAK, "CCdcAcmClass::HandleSendBreak;aDuration=%d", (TInt)aDuration ); |
890 LOGTEXT2(_L8("\taDuration = %d"), aDuration); |
|
891 |
924 TInt ret = KErrNone; |
892 TInt ret = KErrNone; |
925 |
893 |
926 // timing value as given is checked for 'special' values |
894 // timing value as given is checked for 'special' values |
927 if ( aDuration == 0 ) |
895 if ( aDuration == 0 ) |
928 { |
896 { |
957 * |
924 * |
958 * Note that the BREAK signal is managed locally in the break controller |
925 * Note that the BREAK signal is managed locally in the break controller |
959 * Active Object. |
926 * Active Object. |
960 */ |
927 */ |
961 { |
928 { |
962 OstTraceFunctionEntry0( CCDCACMCLASS_SENDSERIALSTATE_ENTRY ); |
929 LOGTEXT4(_L8(">>CCdcAcmClass::SendSerialState aRing=%d, " |
963 OstTraceExt3( TRACE_NORMAL, CCDCACMCLASS_SENDSERIALSTATE, |
930 "aDsr=%d, aDcd=%d"), |
964 "CCdcAcmClass::SendSerialState;aRing=%d;aDsr=%d;aDcd=%d", (TInt)aRing, (TInt)aDsr, (TInt)aDcd ); |
931 aRing, aDsr, aDcd); |
965 |
932 |
966 // stub non-supported flags |
933 // stub non-supported flags |
967 TBool overrun = EFalse; |
934 TBool overrun = EFalse; |
968 TBool parity = EFalse; |
935 TBool parity = EFalse; |
969 TBool framing = EFalse; |
936 TBool framing = EFalse; |
983 aRing, |
950 aRing, |
984 BreakActive(), |
951 BreakActive(), |
985 aDsr, |
952 aDsr, |
986 aDcd); |
953 aDcd); |
987 |
954 |
988 OstTrace1( TRACE_NORMAL, CCDCACMCLASS_SENDSERIALSTATE_DUP1, "CCdcAcmClass::SendSerialState;ret=%d", ret ); |
955 LOGTEXT2(_L8("<<CCdcAcmClass::SendSerialState ret=%d"), ret); |
989 OstTraceFunctionExit0( CCDCACMCLASS_SENDSERIALSTATE_EXIT ); |
|
990 return ret; |
956 return ret; |
991 } |
957 } |
992 |
958 |
993 TBool CCdcAcmClass::BreakActive() const |
959 TBool CCdcAcmClass::BreakActive() const |
994 /** |
960 /** |
995 * Simply pass the state of the local BREAK flag back to caller |
961 * Simply pass the state of the local BREAK flag back to caller |
996 * |
962 * |
997 * @return Break flag. |
963 * @return Break flag. |
998 */ |
964 */ |
999 { |
965 { |
1000 OstTraceFunctionEntry0( CCDCACMCLASS_BREAKACTIVE_ENTRY ); |
|
1001 OstTraceFunctionExit0( CCDCACMCLASS_BREAKACTIVE_EXIT ); |
|
1002 return iBreakActive; |
966 return iBreakActive; |
1003 } |
967 } |
1004 |
968 |
1005 TBool CCdcAcmClass::RingState() const |
969 TBool CCdcAcmClass::RingState() const |
1006 /** |
970 /** |
1007 * Accessor for the ring state. |
971 * Accessor for the ring state. |
1008 * |
972 * |
1009 * @return Whether RNG is set or not. |
973 * @return Whether RNG is set or not. |
1010 */ |
974 */ |
1011 { |
975 { |
1012 OstTraceFunctionEntry0( CCDCACMCLASS_RINGSTATE_ENTRY ); |
|
1013 OstTraceFunctionExit0( CCDCACMCLASS_RINGSTATE_EXIT ); |
|
1014 return iRingState; |
976 return iRingState; |
1015 } |
977 } |
1016 |
978 |
1017 TBool CCdcAcmClass::DsrState() const |
979 TBool CCdcAcmClass::DsrState() const |
1018 /** |
980 /** |
1019 * Accessor for the DSR state. |
981 * Accessor for the DSR state. |
1020 * |
982 * |
1021 * @return Whether DSR is set or not. |
983 * @return Whether DSR is set or not. |
1022 */ |
984 */ |
1023 { |
985 { |
1024 OstTraceFunctionEntry0( CCDCACMCLASS_DSRSTATE_ENTRY ); |
|
1025 OstTraceFunctionExit0( CCDCACMCLASS_DSRSTATE_EXIT ); |
|
1026 return iDsrState; |
986 return iDsrState; |
1027 } |
987 } |
1028 |
988 |
1029 TBool CCdcAcmClass::DcdState() const |
989 TBool CCdcAcmClass::DcdState() const |
1030 /** |
990 /** |
1031 * Accessor for the DCD state. |
991 * Accessor for the DCD state. |
1032 * |
992 * |
1033 * @return Whether DCD is set or not. |
993 * @return Whether DCD is set or not. |
1034 */ |
994 */ |
1035 { |
995 { |
1036 OstTraceFunctionEntry0( CCDCACMCLASS_DCDSTATE_ENTRY ); |
|
1037 OstTraceFunctionExit0( CCDCACMCLASS_DCDSTATE_EXIT ); |
|
1038 return iDcdState; |
996 return iDcdState; |
1039 } |
997 } |
1040 |
998 |
1041 void CCdcAcmClass::SetBreakActive(TBool aBreakActive) |
999 void CCdcAcmClass::SetBreakActive(TBool aBreakActive) |
1042 /** |
1000 /** |
1043 * Sets the break flag on or off. |
1001 * Sets the break flag on or off. |
1044 * |
1002 * |
1045 * @param aBreakActive The break flag is set to this value. |
1003 * @param aBreakActive The break flag is set to this value. |
1046 */ |
1004 */ |
1047 { |
1005 { |
1048 OstTraceFunctionEntry0( CCDCACMCLASS_SETBREAKACTIVE_ENTRY ); |
|
1049 iBreakActive = aBreakActive; |
1006 iBreakActive = aBreakActive; |
1050 OstTraceFunctionExit0( CCDCACMCLASS_SETBREAKACTIVE_EXIT ); |
|
1051 } |
1007 } |
1052 |
1008 |
1053 MHostPushedChangeObserver* CCdcAcmClass::Callback() |
1009 MHostPushedChangeObserver* CCdcAcmClass::Callback() |
1054 /** |
1010 /** |
1055 * Accessor for the MHostPushedChangeObserver callback. |
1011 * Accessor for the MHostPushedChangeObserver callback. |
1056 * |
1012 * |
1057 * @return The observer of host-pushed changes. |
1013 * @return The observer of host-pushed changes. |
1058 */ |
1014 */ |
1059 { |
1015 { |
1060 OstTraceFunctionEntry0( CCDCACMCLASS_CALLBACK_ENTRY ); |
|
1061 OstTraceFunctionExit0( CCDCACMCLASS_CALLBACK_EXIT ); |
|
1062 return iCallback; |
1016 return iCallback; |
1063 } |
1017 } |
1064 |
1018 |
1065 MBreakObserver* CCdcAcmClass::BreakCallback() |
1019 MBreakObserver* CCdcAcmClass::BreakCallback() |
1066 /** |
1020 /** |
1067 * Accessor for the MBreakObserver callback. |
1021 * Accessor for the MBreakObserver callback. |
1068 * |
1022 * |
1069 * @return The observer of break changes. |
1023 * @return The observer of break changes. |
1070 */ |
1024 */ |
1071 { |
1025 { |
1072 OstTraceFunctionEntry0( CCDCACMCLASS_BREAKCALLBACK_ENTRY ); |
|
1073 OstTraceFunctionExit0( CCDCACMCLASS_BREAKCALLBACK_EXIT ); |
|
1074 return iBreakCallback; |
1026 return iBreakCallback; |
1075 } |
1027 } |
1076 |
1028 |
1077 TInt CCdcAcmClass::BreakRequest(CBreakController::TRequester aRequester, |
1029 TInt CCdcAcmClass::BreakRequest(CBreakController::TRequester aRequester, |
1078 CBreakController::TState aState, |
1030 CBreakController::TState aState, |
1085 * make the break inactive. |
1037 * make the break inactive. |
1086 * @param aDelay The time delay, only used for a timed break. |
1038 * @param aDelay The time delay, only used for a timed break. |
1087 * @return Error, for instance if a different entity already owns the break. |
1039 * @return Error, for instance if a different entity already owns the break. |
1088 */ |
1040 */ |
1089 { |
1041 { |
1090 OstTraceFunctionEntry0( CCDCACMCLASS_BREAKREQUEST_ENTRY ); |
1042 LOG_FUNC |
1091 |
1043 |
1092 if (!iBreakController) |
1044 __ASSERT_DEBUG(iBreakController, |
1093 { |
1045 _USB_PANIC(KAcmPanicCat, EPanicInternalError)); |
1094 OstTraceExt1( TRACE_FATAL, CCDCACMCLASS_BREAKREQUEST, "CCdcAcmClass::BreakRequest;iBreakController=%p", iBreakController ); |
|
1095 __ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) ); |
|
1096 } |
|
1097 |
1046 |
1098 TInt err = iBreakController->BreakRequest(aRequester, aState, aDelay); |
1047 TInt err = iBreakController->BreakRequest(aRequester, aState, aDelay); |
1099 OstTrace1( TRACE_NORMAL, CCDCACMCLASS_BREAKREQUEST_DUP1, "CCdcAcmClass::BreakRequest;err=%d", err ); |
1048 LOGTEXT2(_L8("\tBreakRequest = %d"), err); |
1100 OstTraceFunctionExit0( CCDCACMCLASS_BREAKREQUEST_EXIT ); |
|
1101 return err; |
1049 return err; |
1102 } |
1050 } |
1103 |
1051 |
1104 void CCdcAcmClass::NotifyDataAvailable(MNotifyDataAvailableObserver& aObserver) |
1052 void CCdcAcmClass::NotifyDataAvailable(MNotifyDataAvailableObserver& aObserver) |
1105 /** |
1053 /** |
1106 * Notify the caller when data is available to be read from the LDD. |
1054 * Notify the caller when data is available to be read from the LDD. |
1107 * |
1055 * |
1108 * @param aObserver The observer to notify completion to. |
1056 * @param aObserver The observer to notify completion to. |
1109 */ |
1057 */ |
1110 { |
1058 { |
1111 OstTraceFunctionEntry0( CCDCACMCLASS_NOTIFYDATAAVAILABLE_ENTRY ); |
1059 LOGTEXT2(_L8(">>CCdcAcmClass::NotifyDataAvailable aObserver=0x%08x"), &aObserver); |
1112 OstTraceExt1( TRACE_NORMAL, CCDCACMCLASS_NOTIFYDATAAVAILABLE, "CCdcAcmClass::NotifyDataAvailable;aObserver=%p", &aObserver ); |
1060 |
1113 |
1061 __ASSERT_DEBUG(iData, _USB_PANIC(KAcmPanicCat, EPanicInternalError)); |
1114 if (!iData) |
|
1115 { |
|
1116 OstTraceExt1( TRACE_FATAL, CCDCACMCLASS_NOTIFYDATAAVAILABLE_DUP1, "CCdcAcmClass::NotifyDataAvailable;iData=%p", iData ); |
|
1117 __ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) ); |
|
1118 } |
|
1119 iData->NotifyDataAvailable(aObserver); |
1062 iData->NotifyDataAvailable(aObserver); |
1120 OstTraceFunctionExit0( CCDCACMCLASS_NOTIFYDATAAVAILABLE_EXIT ); |
1063 |
|
1064 LOGTEXT(_L8("<<CCdcAcmClass::NotifyDataAvailable")); |
1121 } |
1065 } |
1122 |
1066 |
1123 void CCdcAcmClass::NotifyDataAvailableCancel() |
1067 void CCdcAcmClass::NotifyDataAvailableCancel() |
1124 /** |
1068 /** |
1125 * Cancel the request to be notified (when data is available to be read from the LDD). |
1069 * Cancel the request to be notified (when data is available to be read from the LDD). |
1126 */ |
1070 */ |
1127 { |
1071 { |
1128 OstTraceFunctionEntry0( CCDCACMCLASS_NOTIFYDATAAVAILABLECANCEL_ENTRY ); |
1072 LOG_FUNC |
1129 if (!iData) |
1073 |
1130 { |
1074 __ASSERT_DEBUG(iData, _USB_PANIC(KAcmPanicCat, EPanicInternalError)); |
1131 OstTraceExt1( TRACE_FATAL, CCDCACMCLASS_NOTIFYDATAAVAILABLECANCEL, "CCdcAcmClass::NotifyDataAvailableCancel;iData=%p", iData ); |
|
1132 __ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) ); |
|
1133 } |
|
1134 iData->CancelNotifyDataAvailable(); |
1075 iData->CancelNotifyDataAvailable(); |
1135 OstTraceFunctionExit0( CCDCACMCLASS_NOTIFYDATAAVAILABLECANCEL_EXIT ); |
|
1136 } |
1076 } |
1137 |
1077 |
1138 // |
1078 // |
1139 // End of file |
1079 // End of file |