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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
23 @note Constant definitions for clients using PAN agent.
24 Includes constants for controlling the state of the PAN network
28 Base value for constants for use with Control() call
31 @see RConnection::Control
32 @note KCO* values for use with PAN agent
34 const TInt KCOAgentPanBase = 0x1000;
40 @see RConnection::Control
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.
49 RConnection connection;
50 TBTDevAddr remoteDeviceToAdd;
52 <Connect RConnection object, and find the remote device to add to the PAN>
54 TPtr8 ptr = remoteDeviceToAdd.Des();
55 User::LeaveIfError(connection.Control(KCOLAgent, KCOAgentPanConnectDevice, ptr));
58 The use of a temporary TPtr is safe, as the Control method is synchronous.
60 @note KCO* value for use with PAN agent
62 const TInt KCOAgentPanConnectDevice = KCOAgentPanBase | KConnReadUserDataBit;
68 @see RConnection::Control
70 Attempt to remove a connected device from the PAN network.
73 RConnection connection;
74 TBTDevAddr remoteDeviceToRemove;
76 <Connect RConnection object, and find the remote device to remove from the PAN>
78 TPtr8 ptr = remoteDeviceToRemove.Des();
79 User::LeaveIfError(connection.Control(KCOLAgent, KCOAgentPanDisconnectDevice, ptr));
82 The use of a temporary TPtr is safe, as the Control method is synchronous.
84 @note KCO* value for use with PAN agent
86 const TInt KCOAgentPanDisconnectDevice = KCOAgentPanBase + 1 | KConnReadUserDataBit;
93 @see RConnection::Control
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.
99 @note Devices which are still in the process of connecting to the PAN network
100 will not be included.
103 RConnection connection;
105 <Connect RConnection object>
107 TBuf8<7 * sizeof(TBTDevAddr)> buffer;
108 User::LeaveIfError(connection.Control(KCOLAgent, KCOAgentPanEnumerateDevices, buffer));
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];
115 // Or to iterate through the list:
117 while (start < buffer.Length())
119 const TBTDevAddr* thisDevice = reinterpret_cast<const TBTDevAddr*>(buffer.Ptr() + start);
120 start += sizeof(TBTDevAddr);
124 @note KCO* value for use with PAN agent
126 const TInt KCOAgentPanEnumerateDevices = KCOAgentPanBase + 2 | KConnWriteUserDataBit;
128 enum TPANAgentProgress
130 PAN agent progress values
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
151 enum TPanNapNetworkType
153 Type of network provided by the NAP gateway
161 ECableModem = 0x0003,
162 E10MbEthernet = 0x0004,
163 E100MbEthernet = 0x0005,
164 E4MbTokenRing = 0x0006,
165 E16MbTokenRing = 0x0007,
166 E100MbTokenRing = 0x0008,
171 E3GCellular = 0x000D,