1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef PANPROG_H |
|
17 #define PANPROG_H |
|
18 |
|
19 #include <nifvar.h> |
|
20 |
|
21 /** |
|
22 @file |
|
23 @note Constant definitions for clients using PAN agent. |
|
24 Includes constants for controlling the state of the PAN network |
|
25 */ |
|
26 |
|
27 /** |
|
28 Base value for constants for use with Control() call |
|
29 @publishedPartner |
|
30 @released |
|
31 @see RConnection::Control |
|
32 @note KCO* values for use with PAN agent |
|
33 */ |
|
34 const TInt KCOAgentPanBase = 0x1000; |
|
35 |
|
36 |
|
37 /** |
|
38 @publishedPartner |
|
39 @released |
|
40 @see RConnection::Control |
|
41 |
|
42 Bring a new device into the PAN network. The Control() call will complete as |
|
43 soon as the PAN agent has started the process, so it may be several seconds |
|
44 before the device is addressable. It is also possible for the connection |
|
45 attempt to fail even if the Control() method returns KErrNone, due to the |
|
46 actual processing occuring asynchronously. |
|
47 |
|
48 @code |
|
49 RConnection connection; |
|
50 TBTDevAddr remoteDeviceToAdd; |
|
51 ... |
|
52 <Connect RConnection object, and find the remote device to add to the PAN> |
|
53 ... |
|
54 TPtr8 ptr = remoteDeviceToAdd.Des(); |
|
55 User::LeaveIfError(connection.Control(KCOLAgent, KCOAgentPanConnectDevice, ptr)); |
|
56 @endcode |
|
57 |
|
58 The use of a temporary TPtr is safe, as the Control method is synchronous. |
|
59 |
|
60 @note KCO* value for use with PAN agent |
|
61 */ |
|
62 const TInt KCOAgentPanConnectDevice = KCOAgentPanBase | KConnReadUserDataBit; |
|
63 |
|
64 |
|
65 /** |
|
66 @publishedPartner |
|
67 @released |
|
68 @see RConnection::Control |
|
69 |
|
70 Attempt to remove a connected device from the PAN network. |
|
71 |
|
72 @code |
|
73 RConnection connection; |
|
74 TBTDevAddr remoteDeviceToRemove; |
|
75 ... |
|
76 <Connect RConnection object, and find the remote device to remove from the PAN> |
|
77 ... |
|
78 TPtr8 ptr = remoteDeviceToRemove.Des(); |
|
79 User::LeaveIfError(connection.Control(KCOLAgent, KCOAgentPanDisconnectDevice, ptr)); |
|
80 @endcode |
|
81 |
|
82 The use of a temporary TPtr is safe, as the Control method is synchronous. |
|
83 |
|
84 @note KCO* value for use with PAN agent |
|
85 */ |
|
86 const TInt KCOAgentPanDisconnectDevice = KCOAgentPanBase + 1 | KConnReadUserDataBit; |
|
87 |
|
88 |
|
89 |
|
90 /** |
|
91 @publishedPartner |
|
92 @released |
|
93 @see RConnection::Control |
|
94 |
|
95 Return a list of connected devices. If the buffer supplied is too small to |
|
96 hold all of the device addresses, as many as will fit will be returned. The |
|
97 descriptor length will be adjusted to reflect the total connected device count. |
|
98 |
|
99 @note Devices which are still in the process of connecting to the PAN network |
|
100 will not be included. |
|
101 |
|
102 @code |
|
103 RConnection connection; |
|
104 ... |
|
105 <Connect RConnection object> |
|
106 ... |
|
107 TBuf8<7 * sizeof(TBTDevAddr)> buffer; |
|
108 User::LeaveIfError(connection.Control(KCOLAgent, KCOAgentPanEnumerateDevices, buffer)); |
|
109 |
|
110 // For a c-style array: |
|
111 TInt connectedDevices = buffer.Length() / sizeof(TBTDevAddr); |
|
112 const TBTDevAddr* devices = reinterpret_cast<const TBTDevAddr*>(buffer.Ptr()); |
|
113 const TBTDevAddr device2 = devices[2]; |
|
114 |
|
115 // Or to iterate through the list: |
|
116 TInt start = 0; |
|
117 while (start < buffer.Length()) |
|
118 { |
|
119 const TBTDevAddr* thisDevice = reinterpret_cast<const TBTDevAddr*>(buffer.Ptr() + start); |
|
120 start += sizeof(TBTDevAddr); |
|
121 } |
|
122 @endcode |
|
123 |
|
124 @note KCO* value for use with PAN agent |
|
125 */ |
|
126 const TInt KCOAgentPanEnumerateDevices = KCOAgentPanBase + 2 | KConnWriteUserDataBit; |
|
127 |
|
128 enum TPANAgentProgress |
|
129 /** |
|
130 PAN agent progress values |
|
131 @publishedAll |
|
132 @released |
|
133 */ |
|
134 { |
|
135 EPanAgtInitialising = KMinAgtProgress, |
|
136 EPanAgtConnected = KConnectionOpen, ///< Agent is up and running |
|
137 EPanAgtIdle, ///< Agent is idle |
|
138 EPanAgtListening, ///< Listening for incoming connections |
|
139 EPanAgtURole, ///< In U role |
|
140 EPanAgtGnRole, ///< In GN role |
|
141 EPanAgtNapRole, ///< In NAP role |
|
142 EPanAgtConnectedNewDevice, ///< A device has connected |
|
143 EPanAgtDisconnectedDevice, ///< A device has disconnected |
|
144 EPanAgtReconfiguringPiconet, ///< Role change is in progress |
|
145 EPanAgtUplinkRequired, ///< A connection authorised to use the uplink exists |
|
146 EPanAgtUplinkNotRequired, ///< A connection authorised to use the uplink does not exists |
|
147 EPanAgtDisconnecting = KConnectionStartingClose, |
|
148 EPanAgtDisconnected = KConnectionClosed |
|
149 }; |
|
150 |
|
151 enum TPanNapNetworkType |
|
152 /** |
|
153 Type of network provided by the NAP gateway |
|
154 @publishedAll |
|
155 @released |
|
156 */ |
|
157 { |
|
158 EPstn = 0x0000, |
|
159 EIsdn = 0x0001, |
|
160 EDsl = 0x0002, |
|
161 ECableModem = 0x0003, |
|
162 E10MbEthernet = 0x0004, |
|
163 E100MbEthernet = 0x0005, |
|
164 E4MbTokenRing = 0x0006, |
|
165 E16MbTokenRing = 0x0007, |
|
166 E100MbTokenRing = 0x0008, |
|
167 EFddi = 0x0009, |
|
168 EGsm = 0x000A, |
|
169 ECdma = 0x000B, |
|
170 EGprs = 0x000C, |
|
171 E3GCellular = 0x000D, |
|
172 EOther = 0xFFFE |
|
173 }; |
|
174 |
|
175 #endif // PANPROG_H |
|