|
1 /* |
|
2 * Copyright (c) 2004-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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <pv_2way_symbian_interface.h> |
|
20 #include <pv_2way_h324m_interface.h> |
|
21 #include "mvtprotocolhandler.h" |
|
22 #include "ch324confighandler.h" |
|
23 #include "cvtuserinput.h" |
|
24 |
|
25 #ifdef _DEBUG |
|
26 # define __IF_DEBUG(t) {RDebug::t;} |
|
27 #else |
|
28 # define __IF_DEBUG(t) |
|
29 #endif |
|
30 |
|
31 // Define image sizes. |
|
32 // QCIF. |
|
33 const TInt KVtProtoResolutionQCIFWidth = 176; |
|
34 const TInt KVtProtoResolutionQCIFHeight = 144; |
|
35 |
|
36 // SQCIF. |
|
37 const TInt KVtProtoResolutionSQCIFWidth = 128; |
|
38 const TInt KVtProtoResolutionSQCIFHeight = 96; |
|
39 |
|
40 // ----------------------------------------------------------------------------- |
|
41 // TH324ConfigHandler::TH324ConfigHandler |
|
42 // Constructor. |
|
43 // ----------------------------------------------------------------------------- |
|
44 // |
|
45 TH324ConfigHandler::TH324ConfigHandler(MVtProtocolHandler* aProtocolHandler) : iProtocolHandler(aProtocolHandler) |
|
46 { |
|
47 __IF_DEBUG(Print(_L("VTProto: TH324ConfigHandler::TH324ConfigHandler<"))); |
|
48 __IF_DEBUG(Print(_L("VTProto: TH324ConfigHandler::TH324ConfigHandler>"))); |
|
49 } |
|
50 |
|
51 // ----------------------------------------------------------------------------- |
|
52 // TH324ConfigHandler::MPVH324MConfigCommandCompletedL |
|
53 // Handle an event that has been generated. |
|
54 // ----------------------------------------------------------------------------- |
|
55 // |
|
56 void TH324ConfigHandler::MPVH324MConfigCommandCompletedL(const CPVCmdResponse& aResponse) |
|
57 { |
|
58 __IF_DEBUG(Print(_L("VTProto: TH324ConfigHandler::MPVH324MConfigCommandCompletedL<"))); |
|
59 TVtCommandType cmdType = (TVtCommandType)aResponse.GetCmdType(); |
|
60 TInt cmdId = aResponse.GetCmdId(); |
|
61 TInt cmdResponse = aResponse.GetCmdStatus(); |
|
62 TVtCommandResponse commandRsp(cmdType, cmdId, cmdResponse); |
|
63 iProtocolHandler->HandleH324MConfigCommandCompletedL(commandRsp); |
|
64 __IF_DEBUG(Print(_L("VTProto: TH324ConfigHandler::MPVH324MConfigCommandCompletedL>"))); |
|
65 } |
|
66 |
|
67 // ----------------------------------------------------------------------------- |
|
68 // TH324ConfigHandler::MPVH324MConfigInformationalEventL |
|
69 // Handle an information event. |
|
70 // ----------------------------------------------------------------------------- |
|
71 // |
|
72 void TH324ConfigHandler::MPVH324MConfigInformationalEventL(const CPVAsyncInformationalEvent& aEvent) |
|
73 { |
|
74 __IF_DEBUG(Print(_L("VTProto: TH324ConfigHandler::MPVH324MConfigInformationalEventL<"))); |
|
75 const TUint8* buffer = aEvent.GetLocalBuffer(); |
|
76 TInt eventType = aEvent.GetEventType(); |
|
77 TVtIndicationEvent vtEvent(eventType, buffer); |
|
78 iProtocolHandler->HandleH324MConfigInformationalEventL(vtEvent); |
|
79 __IF_DEBUG(Print(_L("VTProto: TH324ConfigHandler::MPVH324MConfigInformationalEventL>"))); |
|
80 } |
|
81 |
|
82 // ----------------------------------------------------------------------------- |
|
83 // CH324ConfigCommand::SetVendorId |
|
84 // Sets the vendor identification data. |
|
85 // ----------------------------------------------------------------------------- |
|
86 // |
|
87 TInt CH324ConfigCommand::SetVendorId(TUint8 cc, TUint8 ext, TUint32 mc, const TDesC8* aProduct, const TDesC8* aVersion) |
|
88 { |
|
89 __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SetVendorId"))); |
|
90 return iH324Config->SetVendor(cc, ext, mc, aProduct, aVersion); |
|
91 } |
|
92 |
|
93 // ----------------------------------------------------------------------------- |
|
94 // CH324ConfigCommand::SendVideoTemporalSpatialTradeoffCommand |
|
95 // This API allows the user to send a videoTemporalSpatialTradeOff command to the peer. |
|
96 // ----------------------------------------------------------------------------- |
|
97 // |
|
98 TInt CH324ConfigCommand::SendVideoTemporalSpatialTradeoffCommand(TUint aLogicalChannel, TUint8 aTradeoff) |
|
99 { |
|
100 __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SendVideoTemporalSpatialTradeoffCommand"))); |
|
101 return iH324Config->SendVideoTemporalSpatialTradeoffCommand(aLogicalChannel, aTradeoff); |
|
102 } |
|
103 |
|
104 // ----------------------------------------------------------------------------- |
|
105 // CH324ConfigCommand::SendVideoTemporalSpatialTradeoffIndication |
|
106 // This API allows the user to send a videoTemporalSpatialTradeOff command to the peer. |
|
107 // ----------------------------------------------------------------------------- |
|
108 // |
|
109 TInt CH324ConfigCommand::SendVideoTemporalSpatialTradeoffIndication(TUint aLogicalChannel, TUint8 aTradeoff) |
|
110 { |
|
111 __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SendVideoTemporalSpatialTradeoffIndication"))); |
|
112 return iH324Config->SendVideoTemporalSpatialTradeoffIndication(aLogicalChannel, aTradeoff); |
|
113 } |
|
114 |
|
115 // ----------------------------------------------------------------------------- |
|
116 // CH324ConfigCommand::SetVideoResolutions |
|
117 // This API allows the user to specify the supported resolutions for video for transmit and receive. |
|
118 // ----------------------------------------------------------------------------- |
|
119 // |
|
120 TInt CH324ConfigCommand::SetSupportedResolutions() |
|
121 { |
|
122 __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SetSupportedResolutions"))); |
|
123 RArray<TPVVideoResolutionRange> resolutions; |
|
124 TPVVideoResolutionRange qcif; |
|
125 qcif.first.iWidth = KVtProtoResolutionQCIFWidth; |
|
126 qcif.first.iHeight = KVtProtoResolutionQCIFHeight; |
|
127 qcif.last.iWidth = KVtProtoResolutionQCIFWidth; |
|
128 qcif.last.iHeight = KVtProtoResolutionQCIFHeight; |
|
129 TInt err( resolutions.Append( qcif ) ); |
|
130 if ( err == KErrNone ) |
|
131 { |
|
132 TPVVideoResolutionRange sqcif; |
|
133 sqcif.first.iWidth = KVtProtoResolutionSQCIFWidth; |
|
134 sqcif.first.iHeight = KVtProtoResolutionSQCIFHeight; |
|
135 sqcif.last.iWidth = KVtProtoResolutionSQCIFWidth; |
|
136 sqcif.last.iHeight = KVtProtoResolutionSQCIFHeight; |
|
137 err = resolutions.Append( sqcif ); |
|
138 if ( err == KErrNone ) |
|
139 { |
|
140 err = iH324Config->SetVideoResolutions( INCOMING, resolutions ); |
|
141 } |
|
142 } |
|
143 resolutions.Close(); |
|
144 |
|
145 return err; |
|
146 } |
|
147 |
|
148 // ----------------------------------------------------------------------------- |
|
149 // CH324ConfigCommand::SetFastCsupOptions |
|
150 // This API allows the user to set options for fast call setup procedures. |
|
151 // ----------------------------------------------------------------------------- |
|
152 // |
|
153 TInt CH324ConfigCommand::SetFastCsupOptions( ) |
|
154 { |
|
155 __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SetFastCsupOptions"))); |
|
156 TPVH324FastCsupOptions fastCsupOptions; |
|
157 fastCsupOptions.iEnableWnsrp = ETrue; |
|
158 fastCsupOptions.iEnableMona = EFalse; |
|
159 return iH324Config->SetFastCsupOptions(fastCsupOptions); |
|
160 } |
|
161 |
|
162 // ----------------------------------------------------------------------------- |
|
163 // CH324ConfigCommand::SendUserInputMessageL |
|
164 // Causes the vt2way to send the specified user input to the remote terminal using |
|
165 // control channel. |
|
166 // ----------------------------------------------------------------------------- |
|
167 // |
|
168 TInt CH324ConfigCommand::SendUserInputMessageL(MVTUserInput& user_input) |
|
169 { |
|
170 __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SendUserInputMessageL<"))); |
|
171 if (user_input.GetType() == EVtUiiDTFM) |
|
172 { |
|
173 CVTUserInputDtmf* dtmf = static_cast<CVTUserInputDtmf*>(&user_input); |
|
174 return iH324Config->SendUserInputL(*dtmf->iUII); |
|
175 } |
|
176 else if (user_input.GetType() == EVtUiiAlphaNumeric) |
|
177 { |
|
178 CVTUserInputAlphanumeric* alphanumeric = static_cast<CVTUserInputAlphanumeric*>(&user_input); |
|
179 return iH324Config->SendUserInputL(*alphanumeric->iUII); |
|
180 } |
|
181 __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SendUserInputMessageL>"))); |
|
182 return KErrNone; |
|
183 } |
|
184 |
|
185 // ----------------------------------------------------------------------------- |
|
186 // CH324ConfigCommand::SetObserverL |
|
187 // This API allows the user to specify observers for the 324m interface. |
|
188 // ----------------------------------------------------------------------------- |
|
189 // |
|
190 void CH324ConfigCommand::SetObserverL(MVtProtocolHandler* aHandler) |
|
191 { |
|
192 __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SetObserverL<"))); |
|
193 iH324ConfigHandler = new (ELeave)TH324ConfigHandler(aHandler); |
|
194 __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SetObserverL observer %d"), iH324ConfigHandler)); |
|
195 iH324Config->SetObserver(iH324ConfigHandler); |
|
196 __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SetObserverL>"))); |
|
197 } |
|
198 |
|
199 // ----------------------------------------------------------------------------- |
|
200 // CH324ConfigCommand::~CH324ConfigCommand |
|
201 // Destructor. |
|
202 // ----------------------------------------------------------------------------- |
|
203 // |
|
204 CH324ConfigCommand::~CH324ConfigCommand() |
|
205 { |
|
206 __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::~CH324ConfigCommand<"))); |
|
207 delete iH324ConfigHandler; |
|
208 __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::~CH324ConfigCommand>"))); |
|
209 } |
|
210 |
|
211 // end of file |