epoc32/include/panprog.h
branchSymbian2
changeset 2 2fe1408b6811
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/panprog.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,175 @@
     1.4 +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// 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
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#ifndef PANPROG_H
    1.20 +#define PANPROG_H
    1.21 +
    1.22 +#include <nifvar.h>
    1.23 +
    1.24 +/**
    1.25 +@file
    1.26 +@note Constant definitions for clients using PAN agent.
    1.27 +Includes constants for controlling the state of the PAN network
    1.28 +*/
    1.29 +
    1.30 +/**
    1.31 +Base value for constants for use with Control() call
    1.32 +@publishedPartner
    1.33 +@released
    1.34 +@see RConnection::Control
    1.35 +@note KCO* values for use with PAN agent
    1.36 +*/
    1.37 +const TInt KCOAgentPanBase = 0x1000;
    1.38 +
    1.39 +
    1.40 +/**
    1.41 +@publishedPartner
    1.42 +@released
    1.43 +@see RConnection::Control
    1.44 +
    1.45 +Bring a new device into the PAN network.  The Control() call will complete as
    1.46 +soon as the PAN agent has started the process, so it may be several seconds
    1.47 +before the device is addressable.  It is also possible for the connection
    1.48 +attempt to fail even if the Control() method returns KErrNone, due to the
    1.49 +actual processing occuring asynchronously.
    1.50 +
    1.51 +@code
    1.52 +RConnection connection;
    1.53 +TBTDevAddr remoteDeviceToAdd;
    1.54 +...
    1.55 +<Connect RConnection object, and find the remote device to add to the PAN>
    1.56 +...
    1.57 +TPtr8 ptr = remoteDeviceToAdd.Des();
    1.58 +User::LeaveIfError(connection.Control(KCOLAgent, KCOAgentPanConnectDevice, ptr));
    1.59 +@endcode
    1.60 +
    1.61 +The use of a temporary TPtr is safe, as the Control method is synchronous.
    1.62 +
    1.63 +@note KCO* value for use with PAN agent
    1.64 +*/
    1.65 +const TInt KCOAgentPanConnectDevice = KCOAgentPanBase | KConnReadUserDataBit;
    1.66 +
    1.67 +
    1.68 +/**
    1.69 +@publishedPartner
    1.70 +@released
    1.71 +@see RConnection::Control
    1.72 +
    1.73 +Attempt to remove a connected device from the PAN network.
    1.74 +
    1.75 +@code
    1.76 +RConnection connection;
    1.77 +TBTDevAddr remoteDeviceToRemove;
    1.78 +...
    1.79 +<Connect RConnection object, and find the remote device to remove from the PAN>
    1.80 +...
    1.81 +TPtr8 ptr = remoteDeviceToRemove.Des();
    1.82 +User::LeaveIfError(connection.Control(KCOLAgent, KCOAgentPanDisconnectDevice, ptr));
    1.83 +@endcode
    1.84 +
    1.85 +The use of a temporary TPtr is safe, as the Control method is synchronous.
    1.86 +
    1.87 +@note KCO* value for use with PAN agent
    1.88 +*/
    1.89 +const TInt KCOAgentPanDisconnectDevice = KCOAgentPanBase + 1 | KConnReadUserDataBit;
    1.90 +
    1.91 +
    1.92 +
    1.93 +/**
    1.94 +@publishedPartner
    1.95 +@released
    1.96 +@see RConnection::Control
    1.97 +
    1.98 +Return a list of connected devices.  If the buffer supplied is too small to
    1.99 +hold all of the device addresses, as many as will fit will be returned.  The
   1.100 +descriptor length will be adjusted to reflect the total connected device count.
   1.101 +
   1.102 +@note Devices which are still in the process of connecting to the PAN network
   1.103 +will not be included.
   1.104 +
   1.105 +@code
   1.106 +RConnection connection;
   1.107 +...
   1.108 +<Connect RConnection object>
   1.109 +...
   1.110 +TBuf8<7 * sizeof(TBTDevAddr)> buffer;
   1.111 +User::LeaveIfError(connection.Control(KCOLAgent, KCOAgentPanEnumerateDevices, buffer));
   1.112 +
   1.113 +// For a c-style array:
   1.114 +TInt connectedDevices = buffer.Length() / sizeof(TBTDevAddr);
   1.115 +const TBTDevAddr* devices = reinterpret_cast<const TBTDevAddr*>(buffer.Ptr());
   1.116 +const TBTDevAddr device2 = devices[2];
   1.117 +
   1.118 +// Or to iterate through the list:
   1.119 +TInt start = 0;
   1.120 +while (start < buffer.Length())
   1.121 +	{
   1.122 +	const TBTDevAddr* thisDevice = reinterpret_cast<const TBTDevAddr*>(buffer.Ptr() + start);
   1.123 +	start += sizeof(TBTDevAddr);
   1.124 +	}
   1.125 +@endcode
   1.126 +
   1.127 +@note KCO* value for use with PAN agent
   1.128 +*/
   1.129 +const TInt KCOAgentPanEnumerateDevices = KCOAgentPanBase + 2 | KConnWriteUserDataBit;
   1.130 +
   1.131 +enum TPANAgentProgress
   1.132 +/**
   1.133 +PAN agent progress values
   1.134 +@publishedAll
   1.135 +@released
   1.136 +*/
   1.137 +	{
   1.138 +	EPanAgtInitialising		= KMinAgtProgress,
   1.139 +	EPanAgtConnected        = KConnectionOpen,		///< Agent is up and running
   1.140 +	EPanAgtIdle,									///< Agent is idle
   1.141 +	EPanAgtListening,								///< Listening for incoming connections
   1.142 +	EPanAgtURole,									///< In U role
   1.143 +	EPanAgtGnRole,									///< In GN role
   1.144 +	EPanAgtNapRole,									///< In NAP role
   1.145 +	EPanAgtConnectedNewDevice,						///< A device has connected
   1.146 +	EPanAgtDisconnectedDevice,						///< A device has disconnected
   1.147 +	EPanAgtReconfiguringPiconet,					///< Role change is in progress
   1.148 +	EPanAgtUplinkRequired,							///< A connection authorised to use the uplink exists
   1.149 +	EPanAgtUplinkNotRequired,						///< A connection authorised to use the uplink does not exists
   1.150 +	EPanAgtDisconnecting 	= KConnectionStartingClose,
   1.151 +	EPanAgtDisconnected     = KConnectionClosed
   1.152 +	};
   1.153 +	
   1.154 +enum TPanNapNetworkType
   1.155 +/**
   1.156 +Type of network provided by the NAP gateway
   1.157 +@publishedAll
   1.158 +@released
   1.159 +*/
   1.160 +	{
   1.161 +	EPstn = 0x0000,
   1.162 +	EIsdn = 0x0001,
   1.163 +	EDsl = 0x0002,
   1.164 +	ECableModem = 0x0003,
   1.165 +	E10MbEthernet = 0x0004,
   1.166 +	E100MbEthernet = 0x0005,
   1.167 +	E4MbTokenRing = 0x0006,
   1.168 +	E16MbTokenRing = 0x0007,
   1.169 +	E100MbTokenRing = 0x0008,
   1.170 +	EFddi = 0x0009,
   1.171 +	EGsm = 0x000A,
   1.172 +	ECdma = 0x000B,
   1.173 +	EGprs = 0x000C,
   1.174 +	E3GCellular = 0x000D,
   1.175 +	EOther = 0xFFFE
   1.176 +	};
   1.177 +
   1.178 +#endif // PANPROG_H