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