|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE concept |
|
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
|
12 <concept xml:lang="en" id="GUID-7FAE6FE0-D5CB-55D4-94B0-ADD545577CA7"><title> Creating and setting properties for a Sub-Connection: Tutorial</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>This tutorial shows how an application can create Quality of Service properties and assign them to a sub-connection. </p> <p>Error handling is not included to aid clarity. </p> <codeblock id="GUID-F9A41E8A-D15B-5028-ABC4-DB400EF0DB19" xml:space="preserve">// Create the container for all sub connection parameters |
|
13 RSubConParameterBundle subconParams; |
|
14 CleanupClosePushL(subconParams); |
|
15 |
|
16 // Create a container for QoS sub connection parameters (Param bundle takes ownership) |
|
17 CSubConParameterFamily* qosFamily = CSubConParameterFamily::NewL(subconParams, |
|
18 KSubConQoSFamily); |
|
19 |
|
20 // Create the requested generic parameter set for QoS (Qos family takes ownership) |
|
21 CSubConQosGenericParamSet* reqGenericParams = CSubConQosGenericParamSet::NewL(*qosFamily, |
|
22 CSubConParameterFamily::ERequested); |
|
23 |
|
24 // Set the requested Generic Parameters |
|
25 reqGenericParams->SetDownlinkBandwidth(128); |
|
26 reqGenericParams->SetUplinkBandwidth(64); |
|
27 |
|
28 // Create the acceptable generic parameter set for QoS (Qos family takes ownership) |
|
29 CSubConQosGenericParamSet* accGenericParams = CSubConQosGenericParamSet::NewL(*qosFamily, |
|
30 CSubConParameterFamily::EAcceptable); |
|
31 |
|
32 // Set the acceptable Generic Parameters |
|
33 accGenericParams->SetDownlinkBandwidth(48); |
|
34 accGenericParams->SetUplinkBandwidth(32); |
|
35 |
|
36 // Create a requested technology specific parameter set for QoS (Qos family takes ownership) |
|
37 CSubConQosR99ParamSet* reqRel99Params = CSubConQosR99ParamSet::NewL(*qosFamily, |
|
38 CSubConParameterFamily::ERequested); |
|
39 |
|
40 // Set the requested Technology Specific Params |
|
41 reqRel99Params->SetMaxSDUSize(1024); |
|
42 |
|
43 // Create a acceptable technology specific parameter set for QoS (Qos family takes ownership) |
|
44 CSubConQosR99ParamSet* accRel99Params = CSubConQosR99ParamSet::NewL(*qosFamily, |
|
45 CSubConParameterFamily::EAcceptable); |
|
46 |
|
47 // Set the acceptable Technology Specific Params |
|
48 accRel99Params->SetMaxSDUSize(512); |
|
49 |
|
50 // Now open the sub-connection as normal… |
|
51 ……… |
|
52 ……… |
|
53 // Create a new sub-connection |
|
54 subconn.Open(ss, RSubConnection::ECreateNew, conn); |
|
55 |
|
56 // Set Properties of the sub-connection |
|
57 subconn.SetParameters(subconParams); |
|
58 |
|
59 // Destroy parameters |
|
60 CleanupStack::PopAndDestroy(); // subconParams |
|
61 |
|
62 // Open a TCP socket on the sub-connection |
|
63 sock.Open(ss, KAfInet, KSockStream, KProtocolInetTcp, subconn); |
|
64 |
|
65 _LIT(KRasAddr,"10.159.24.13"); |
|
66 const TInt KEchoPort = 7; |
|
67 |
|
68 TInetAddr destAddr; |
|
69 destAddr.Input(KRasAddr); |
|
70 destAddr.SetPort(KEchoPort); |
|
71 |
|
72 // Connect the Socket to the destination over the sub-connection |
|
73 sock.Connect(destAddr, status); |
|
74 User::WaitForRequest(status); |
|
75 |
|
76 // Fetch the granted qos |
|
77 RSubConParameterBundle grantedParams; |
|
78 subconn.GetParameters(grantedParams); |
|
79 </codeblock> </conbody></concept> |