|
1 // Copyright (c) 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 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef BTBASEBAND_H |
|
17 #define BTBASEBAND_H |
|
18 |
|
19 /** |
|
20 @file |
|
21 @internalTechnology |
|
22 @released |
|
23 */ |
|
24 |
|
25 #include <e32base.h> |
|
26 #include <es_sock.h> |
|
27 #include <btsockaddr.h> |
|
28 #include <bttypes.h> |
|
29 #include <btbasebandpolicy.h> |
|
30 #include <bluetooth/lmoptions.h> |
|
31 |
|
32 NONSHARABLE_CLASS(RBTBaseband) |
|
33 /** API useful for Bluetooth as seen from a single physical link perspective |
|
34 @internalTechnology |
|
35 @released |
|
36 WARNING: For internal use ONLY. Compatibility is not guaranteed in future releases. |
|
37 */ |
|
38 { |
|
39 public: |
|
40 RBTBaseband(); |
|
41 //API useful for Bluetooth as seen from a single physical link perspective |
|
42 TInt Open(RSocketServ& aSocketServ, RSocket& aSocket); |
|
43 TInt Open(RSocketServ& aSocketServ, const TBTDevAddr& aDevAddr); |
|
44 void Close(); |
|
45 TInt PhysicalLinkState(TUint32& aState); |
|
46 TInt BasebandState(TUint32& aState); |
|
47 TInt PreventRoleSwitch(); |
|
48 TInt AllowRoleSwitch(); |
|
49 TInt RequestMasterRole(); |
|
50 TInt RequestSlaveRole(); |
|
51 TInt PreventLowPowerModes(TUint32 aLowPowerModes); |
|
52 TInt AllowLowPowerModes(TUint32 aLowPowerModes); |
|
53 TInt ActivateSniffRequester(); |
|
54 TInt ActivateParkRequester(); |
|
55 TInt CancelLowPowerModeRequester(); |
|
56 TInt RequestExplicitActiveMode(TBool aActive); |
|
57 TInt RequestChangeSupportedPacketTypes(TUint16 aPacketTypes); |
|
58 //THE TWO NOTIFY METHODS BELOW MUST NOT BE CALLED CONCURRENTLY |
|
59 //Method to be used if only the next event should be notified |
|
60 void ActivateNotifierForOneShot(TBTBasebandEvent& aEventNotification, |
|
61 TRequestStatus& aStatus, |
|
62 TUint32 aEventMask); |
|
63 //Method to be used if it is intended to call it again |
|
64 //(or call CancelNextBasebandChangeEventNotifier) when it completes |
|
65 // - this sets up a continuous monitoring of events on the server. |
|
66 //Each time ActivateNotifierForOneShot is called it will either return |
|
67 //the next event in the servers notification queue or if the |
|
68 //queue is empty it will await the next event. |
|
69 void ActivateNotifierForRecall(TBTBasebandEvent& aEventNotification, |
|
70 TRequestStatus& aStatus, |
|
71 TUint32 aEventMask); |
|
72 void ReadNewPhysicalLinkMetricValue(TRequestStatus& aStatus, |
|
73 TDes8& aData, |
|
74 TBTLMIoctls aIoctl); |
|
75 void CancelPhysicalLinkMetricUpdate(); |
|
76 void CancelNextBasebandChangeEventNotifier(); |
|
77 TInt Authenticate(); |
|
78 |
|
79 //API useful for Bluetooth as seen from a device perspective |
|
80 TInt Open(RSocketServ& aSocketServ); |
|
81 void Connect(const TBTDevAddr& aDevAddr, TRequestStatus& aStatus); |
|
82 void Connect(const TPhysicalLinkQuickConnectionToken& aToken, TRequestStatus& aStatus); |
|
83 TInt Broadcast(const TDesC8& aData); // testing broadcast writes |
|
84 TInt ReadRaw(TDes8& aData); |
|
85 TInt Enumerate(RBTDevAddrArray& aBTDevAddrArray, TUint aMaxNumber); |
|
86 void TerminatePhysicalLink(TInt aReason); |
|
87 void TerminatePhysicalLink(TInt aReason, TRequestStatus& aStatus); |
|
88 void TerminatePhysicalLink(TInt aReason, const TBTDevAddr& aDevAddr, TRequestStatus& aStatus); |
|
89 void ShutdownPhysicalLink(TRequestStatus& aStatus); |
|
90 void TerminateAllPhysicalLinks(TInt aReason); |
|
91 void TerminateAllPhysicalLinks(TInt aReason, TRequestStatus& aStatus); |
|
92 TInt SubSessionHandle() const; |
|
93 |
|
94 private: |
|
95 TInt RequestRole(TBTLMOptions aRole); |
|
96 void LocalComplete(TRequestStatus& aStatus, TInt aErr); |
|
97 void SetClientPending(TRequestStatus& aStatus); |
|
98 void DoConnect(TRequestStatus& aStatus); |
|
99 TInt Enumerate(TDes8& aData); |
|
100 TInt Construct(); |
|
101 |
|
102 private: |
|
103 TAny* iUnusedPointer; |
|
104 RSocket iSocket; |
|
105 |
|
106 TRequestStatus* iClientRequestStatus; |
|
107 TBTSockAddr iSocketAddress; |
|
108 TPhysicalLinkQuickConnectionTokenBuf iConnectToken; |
|
109 TBuf8<1> iConnectInData; // not used yet - needed tho! |
|
110 TBuf8<1> iDummySCOShutdownDescriptor; |
|
111 |
|
112 // This data padding has been added to help prevent future binary compatibility breaks |
|
113 // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used |
|
114 TUint32 iPadding1; |
|
115 TUint32 iPadding2; |
|
116 }; |
|
117 |
|
118 #endif // BTBASEBAND_H |