1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of the License "Eclipse Public License v1.0" |
4 // under the terms of the License "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
40 #include "cusbhostserver.h" |
39 #include "cusbhostserver.h" |
41 #include "cusbhostsession.h" |
40 #include "cusbhostsession.h" |
42 |
41 |
43 |
42 |
44 CUsbHostSession* CUsbHostSession::NewL() |
43 CUsbHostSession* CUsbHostSession::NewL() |
45 { |
44 { |
46 __MSFNSLOG |
45 CUsbHostSession* r = new (ELeave) CUsbHostSession(); |
47 CUsbHostSession* r = new (ELeave) CUsbHostSession(); |
46 CleanupStack::PushL(r); |
48 CleanupStack::PushL(r); |
47 r->ConstructL(); |
49 r->ConstructL(); |
48 CleanupStack::Pop(); |
50 CleanupStack::Pop(); |
49 return r; |
51 return r; |
50 } |
52 } |
|
53 |
51 |
54 |
52 |
55 CUsbHostSession::CUsbHostSession() |
53 CUsbHostSession::CUsbHostSession() |
56 { |
54 { |
57 __MSFNSLOG |
55 } |
58 |
|
59 } |
|
60 |
56 |
61 void CUsbHostSession::ConstructL() |
57 void CUsbHostSession::ConstructL() |
62 { |
58 { |
63 __MSFNSLOG |
59 } |
64 } |
|
65 |
60 |
66 |
61 |
67 void CUsbHostSession::CreateL() |
62 void CUsbHostSession::CreateL() |
68 { |
63 { |
69 __MSFNSLOG |
|
70 Server().AddSession(); |
64 Server().AddSession(); |
71 } |
65 } |
72 |
66 |
73 |
67 |
74 CUsbHostSession::~CUsbHostSession() |
68 CUsbHostSession::~CUsbHostSession() |
75 { |
69 { |
76 __MSFNSLOG |
|
77 Server().RemoveSession(); |
70 Server().RemoveSession(); |
78 } |
71 } |
79 |
72 |
80 |
73 |
81 void CUsbHostSession::ServiceL(const RMessage2& aMessage) |
74 void CUsbHostSession::ServiceL(const RMessage2& aMessage) |
82 { |
75 { |
83 __MSFNSLOG |
76 DispatchMessageL(aMessage); |
84 DispatchMessageL(aMessage); |
77 } |
85 } |
|
86 |
78 |
87 |
79 |
88 void CUsbHostSession::DispatchMessageL(const RMessage2& aMessage) |
80 void CUsbHostSession::DispatchMessageL(const RMessage2& aMessage) |
89 { |
81 { |
90 __MSFNSLOG |
82 TInt ret = KErrNone; |
91 TInt ret = KErrNone; |
|
92 |
83 |
93 switch (aMessage.Function()) |
84 switch (aMessage.Function()) |
94 { |
85 { |
95 case EUsbHostStart: |
86 case EUsbHostStart: |
96 ret = Start(aMessage); |
87 ret = Start(aMessage); |
97 break; |
88 break; |
98 default: |
89 default: |
99 aMessage.Panic(KUsbHostClientPncCat, EUsbHostPanicIllegalIPC); |
90 aMessage.Panic(KUsbHostClientPncCat, EUsbHostPanicIllegalIPC); |
100 break; |
91 break; |
101 } |
92 } |
102 |
93 |
103 aMessage.Complete(ret); |
94 aMessage.Complete(ret); |
104 } |
95 } |
105 |
96 |
106 |
97 |
107 TInt CUsbHostSession::Start(const RMessage2& aMessage) |
98 TInt CUsbHostSession::Start(const RMessage2& aMessage) |
108 { |
99 { |
109 __MSFNSLOG |
|
110 Server().iUsbHost->Start(); |
100 Server().iUsbHost->Start(); |
111 return KErrNone; |
101 return KErrNone; |
112 } |
102 } |