libraries/btserial/src/connection/btservice.h
changeset 0 7f656887cf89
equal deleted inserted replaced
-1:000000000000 0:7f656887cf89
       
     1 // Copyright (c) 2004-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 "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 // 
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 // 
       
    11 // Contributors:
       
    12 // Accenture - modified for fshell's btincomingserial.dll
       
    13 // 
       
    14 // Description:
       
    15 // Name     : CBtService.h
       
    16 // Part of  : ex_btsocket
       
    17 // Created  : 17/11/2004 by Shane Kearns
       
    18 // Server "smart connector" class
       
    19 // Version  :
       
    20 // 
       
    21 
       
    22 #ifndef CBTSERVICE_H
       
    23 #define CBTSERVICE_H
       
    24 
       
    25 #include <e32std.h>
       
    26 #include <bt_sock.h>
       
    27 #include <btsdp.h>
       
    28 
       
    29 class CBluetoothIncomingSerialConnection;
       
    30 
       
    31 /**
       
    32 This class implements a simple bluetooth application service
       
    33 Its responsibility is to advertise and accept incoming bluetooth connections
       
    34 */
       
    35 NONSHARABLE_CLASS(CBtService) : public CBase, MBluetoothSocketNotifier
       
    36 	{
       
    37 	public:
       
    38 		static CBtService* NewL(const TUUID& aServiceUUID, 
       
    39 			RSdp& aSdpSession, 
       
    40 			RSocketServ& aSocketServer, 
       
    41 			CBluetoothIncomingSerialConnection& aOwner,
       
    42 			TUint aProtocol,
       
    43 			const TBTServiceSecurity* aSecurity=NULL);
       
    44 		~CBtService();
       
    45 
       
    46 		void AcceptConnection(CBluetoothSocket& aBlankSocket);
       
    47 	private:
       
    48 		CBtService(RSocketServ& aSocketServer, 
       
    49 			CBluetoothIncomingSerialConnection& aOwner, 
       
    50 			TUint aProtocol
       
    51 			);
       
    52 		void ConstructL(const TUUID& aServiceUUID, 
       
    53 			RSdp& aSdpSession, 
       
    54 			const TBTServiceSecurity* aSecurity=NULL);
       
    55 		//Virtual functions from MBluetoothSocketNotifier
       
    56 		virtual void HandleConnectCompleteL(TInt aErr);
       
    57 		virtual void HandleAcceptCompleteL(TInt aErr);
       
    58 		virtual void HandleShutdownCompleteL(TInt aErr);
       
    59 		virtual void HandleSendCompleteL(TInt aErr);
       
    60 		virtual void HandleReceiveCompleteL(TInt aErr);
       
    61 		virtual void HandleIoctlCompleteL(TInt aErr);
       
    62 		virtual void HandleActivateBasebandEventNotifierCompleteL(TInt aErr, TBTBasebandEventNotification& aEventNotification);
       
    63 
       
    64 		//Data members
       
    65 		RSocketServ& iSocketServer;
       
    66 		CBluetoothSocket *iAcceptorSocket;
       
    67 		CBluetoothSocket *iConnectionSocket; //not owned
       
    68 		RSdpDatabase iServiceRecord;
       
    69 		TSdpServRecordHandle iServiceRecordHandle;
       
    70 		CBluetoothIncomingSerialConnection& iOwner;
       
    71 		TUint iProtocol;
       
    72 	};
       
    73 
       
    74 #endif //CBTSERVICE_H