|
1 /* |
|
2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: See class definition below. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __MTCBEARERMANAGER_H__ |
|
19 #define __MTCBEARERMANAGER_H__ |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32std.h> |
|
23 |
|
24 // FORWARD DECLARATIONS |
|
25 class MTcBearerObserver; |
|
26 class TInetAddr; |
|
27 |
|
28 // CLASS DEFINITION |
|
29 /** |
|
30 * MTcBearerManager defines an interface for bearer managers. |
|
31 * Managers are used for governing the connections and performing |
|
32 * non-connection related bearer initialization tasks. |
|
33 */ |
|
34 class MTcBearerManager |
|
35 { |
|
36 public: // Constructors and destructor |
|
37 |
|
38 /// Virtual destructor. Allow deletion through this interface. |
|
39 virtual ~MTcBearerManager() {} |
|
40 |
|
41 public: // Abstract methods |
|
42 |
|
43 /// Initialize port and start waiting for incoming connections |
|
44 virtual void ConnectL( TInetAddr* aRemoteAddr = NULL ) = 0; |
|
45 |
|
46 /// Shut down port and stop waiting for incoming connections |
|
47 virtual void Close() = 0; |
|
48 |
|
49 /** |
|
50 * Send a block of data contained in aDes |
|
51 * |
|
52 * @param aDes Data to be sent |
|
53 * @exceptions Panics with KErrNotReady if not connected, and with |
|
54 * KErrInUse if we were already sending or receiving. |
|
55 */ |
|
56 virtual void Send( const TDesC8& aDes ) = 0; |
|
57 |
|
58 /** |
|
59 * Receive a block of data to aDes. Completes when aDes is full. |
|
60 * |
|
61 * @param aDes Buffer for incoming data |
|
62 * @exceptions Panics with KErrNotReady if not connected, and with |
|
63 * KErrInUse if we were already sending or receiving. |
|
64 */ |
|
65 virtual void Receive( TDes8& aDes ) = 0; |
|
66 |
|
67 /** |
|
68 * Receive a block of data to aDes. Completes when at least one |
|
69 * character (byte) has been received. Length of aDes is changed |
|
70 * to reflect the amount of bytes received. |
|
71 * |
|
72 * @param aDes Buffer for incoming data |
|
73 * @exceptions Panics with KErrNotReady if not connected, and with |
|
74 * KErrInUse if we were already sending or receiving. |
|
75 */ |
|
76 virtual void ReceiveOneOrMore( TDes8& aDes ) = 0; |
|
77 |
|
78 /** |
|
79 * Set connection event observer. Use NULL to deregister. |
|
80 * |
|
81 * @param aObserver Pointer to observer object or NULL. |
|
82 */ |
|
83 virtual void SetObserver( MTcBearerObserver* aObserver ) = 0; |
|
84 |
|
85 /** |
|
86 * Retrieves the bearer specific local address and formats |
|
87 * it into human readable form. |
|
88 * |
|
89 * @param aDes Buffer for formatted local address. |
|
90 */ |
|
91 virtual void GetLocalAddressL( TDes& aDes ) = 0; |
|
92 |
|
93 }; |
|
94 |
|
95 #endif // __MTCBEARERMANAGER_H__ |