diff -r 89d6a7a84779 -r 25a17d01db0c Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/panconnection_8h-source.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/panconnection_8h-source.html Fri Jan 22 18:26:19 2010 +0000 @@ -0,0 +1,163 @@ + + +TB10.1 Example Applications: examples/Bluetooth/BTExample1/inc/panconnection.h Source File + + + + +

examples/Bluetooth/BTExample1/inc/panconnection.h

00001 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+00002 // All rights reserved.
+00003 // This component and the accompanying materials are made available
+00004 // under the terms of "Eclipse Public License v1.0"
+00005 // which accompanies this distribution, and is available
+00006 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
+00007 //
+00008 // Initial Contributors:
+00009 // Nokia Corporation - initial contribution.
+00010 //
+00011 // Contributors:
+00012 //
+00013 // Description:
+00014 //
+00015 
+00016 #ifndef PANCONNECTION_H
+00017 #define PANCONNECTION_H
+00018 
+00019 
+00020 #include <e32base.h>
+00021 #include <e32cons.h> 
+00022 #include <bt_sock.h> 
+00023 #include <es_sock.h>
+00024 #include <in_sock.h>
+00025 #include <btsdp.h>
+00026 
+00027 // Enum for determining which side we want to change role on
+00028 enum TSide
+00029         {
+00030         ELocalRole,
+00031         EPeerRole
+00032         };
+00033 
+00034 // SDP constants
+00035 
+00036 const TInt KIpUUID = 0x0009; // IP UUID for SDP
+00037 const TInt KTcpUUID = 0x0004;// TCP UUID for SDP 
+00038 
+00039 /* Attribute ID for service description is calculated from the sum of offset and language base */
+00040 static const TSdpAttributeID KSdpAttrIdServiceDescription 
+00041                                                         = KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetServiceDescription;
+00042 /* Attribute ID for service description is calculated from the sum of offset and language base */
+00043 static const TSdpAttributeID KSdpAttrIdServiceName 
+00044                                                         = KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetServiceName;
+00045 
+00046 _LIT(KServiceName, "PAN Profile Engine");
+00047 _LIT(KServiceDescription, "This device is ready to use PAN profile");
+00048 
+00056 class CPanConnections : public CActive
+00057         {
+00058 public:
+00059         static CPanConnections* NewL(CConsoleBase & aConsole);
+00060         
+00061         ~CPanConnections();
+00062         void CancelRecvFrom();
+00063         TInt StartConnection(TBTDevAddr* aDevAddr, TBool aUsePANNotifier, TBool aUseTcpTransport);
+00064         TInt StopConnection();
+00065         TInt SetActivePanConn(TUint aConnIndex);
+00066         void SetLocalIpAddrL(TUint32 aAddr);
+00067         void SetFixedRoleL(TSide aSide, TUint aRole);
+00068         void PrintConns();
+00069         TInt TcpIpBindAndListen();
+00070         TInt TcpIpBindAndConnect();
+00071         void ListenDoCancel();
+00072         void ConnectDoCancel();
+00073         TInt CloseTcpIpSocketConnect();
+00074         TUint32 GetRemoteIpAddr() const;
+00075         void SetRemoteIpAddr(TUint32 aAddr);
+00076         TInt AcceptNewSocket();
+00077         void PrintTcpSocketConnections();
+00078         TInt GetLocalRole() const;
+00079         void CancelIap();
+00080         TInt StopIAP();
+00081         TInt CloseAllTcpIpSockets();
+00082         TInt CloseCurrentTcpIpSocket();
+00083         TInt ActiveConnCount();
+00084         void CancelAllOperations();
+00085         TInt UdpBind();
+00086         void RunL();
+00087         void DoCancel();
+00088         
+00089         RArray<TInetAddr>& RemoteNames();
+00090         RSocket& GetSocket();
+00091         RArray<RSocket>& GetSocketArray();
+00092         
+00093 private:
+00094         CPanConnections(CConsoleBase & aConsole);
+00095         void SetTransportLayerProtocol(TUint aProtocol);
+00096         void IapStarted();
+00097         void TcpIpConnectionComplete();
+00098         void TcpIpListenComplete();
+00099         TInt StartIAP();
+00100         void PrintIAPL();
+00101         TInt UpdateCurrentConnections();        
+00102         TInt Initialise();
+00103         TUint32 GetLocalIpAddr();
+00104         void ConfigureIAPL(TBool aIsListening, TBTDevAddr* aDevAddr, TBool aUsePANNotifier);
+00105         void RecvTcpIpPacket();
+00106         void RegisterSdpL();    
+00107         void ReceiveRemoteName();
+00108 
+00109 public:
+00110         TBool iIapStarted;
+00111         TBool iIapLoading;
+00112         TBool iListening;       
+00113 
+00114 private:
+00115         enum TActiveMode
+00116                 {
+00117                 EIAPStart,
+00118                 ESocketAccept,
+00119                 ESocketConnect,
+00120                 EUdpReceive
+00121                 };
+00122 
+00123         // Used to select different IAPs from commdb
+00124         enum PanProfileIAPs
+00125                 {
+00126                 EGeneralIAP = 1,
+00127                 EUnknownConnUnknownRolesListen,
+00128                 EUnknownConnUnknownRoles,
+00129                 EKnownConnUnknownRolesListen
+00130                 };      
+00131                 
+00132         RSocket iSocket;
+00133         RArray<RSocket> iSocketArray;
+00134         TInt iActiveTcpSocket;
+00135         TPckgBuf<TInt> iBuff;
+00136         TInetAddr iSrcAddr;
+00137         TInetAddr iDstAddr;
+00138         TUint iLocalRole;
+00139         TUint iPeerRole;
+00140         TBool iUseTcpTransport;
+00141         TActiveMode iActiveMode;
+00142         TBTDevAddr iControlAddr;
+00143         TInt iActivePanConn;    
+00144         RConnection iConnection;
+00145         RSocketServ iSockSvr;
+00146         CConsoleBase& iConsole;
+00147         RBTDevAddrArray iActiveConnections;// array of TBTDevAddrs on PAN
+00148         TUint32 iRemoteIpAddr;
+00149         TUint32 iLocalIpAddr;
+00150         RSdp iSdp;
+00151         RSdpDatabase iSdpdb;
+00152         TInetAddr iRemoteName;
+00153         RArray<TInetAddr> iRemoteNames;
+00154 
+00155         };
+00156         
+00157 
+00158 #endif // PANCONNECTION_H
+

Generated on Thu Jan 21 10:32:57 2010 for TB10.1 Example Applications by  + +doxygen 1.5.3
+ +