williamr@2
|
1 |
// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@4
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@4
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
//
|
williamr@2
|
15 |
|
williamr@2
|
16 |
#ifndef BTDEFCOMMPORT_H__
|
williamr@2
|
17 |
#define BTDEFCOMMPORT_H__
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#include <e32std.h>
|
williamr@2
|
20 |
#include <e32base.h>
|
williamr@2
|
21 |
#include <bttypes.h>
|
williamr@2
|
22 |
#include <s32mem.h>
|
williamr@2
|
23 |
#include <btmanclient.h>
|
williamr@2
|
24 |
|
williamr@2
|
25 |
/**
|
williamr@2
|
26 |
KBTDefaultServiceSecurityNone
|
williamr@2
|
27 |
Security setting for virtual serial port - in this case no security
|
williamr@2
|
28 |
@publishedAll
|
williamr@2
|
29 |
@released
|
williamr@2
|
30 |
*/
|
williamr@2
|
31 |
static const TUint8 KBTDefaultServiceSecurityNone = 0;
|
williamr@2
|
32 |
|
williamr@2
|
33 |
/**
|
williamr@2
|
34 |
KBTDefaultServiceSecurityAuthenticateOnly
|
williamr@2
|
35 |
Security setting for virtual serial port
|
williamr@2
|
36 |
The virtual serial connection will apply Bluetooth authentication
|
williamr@2
|
37 |
@publishedAll
|
williamr@2
|
38 |
@released
|
williamr@2
|
39 |
*/
|
williamr@2
|
40 |
static const TUint8 KBTDefaultServiceSecurityAuthenticateOnly = 1;
|
williamr@2
|
41 |
|
williamr@2
|
42 |
/**
|
williamr@2
|
43 |
KBTDefaultServiceSecurityAuthenticateAndEncrypt
|
williamr@2
|
44 |
Security setting for virtual serial port
|
williamr@2
|
45 |
The virtual serial connection will apply Bluetooth authentication and encryption
|
williamr@2
|
46 |
@publishedAll
|
williamr@2
|
47 |
@released
|
williamr@2
|
48 |
*/
|
williamr@2
|
49 |
static const TUint8 KBTDefaultServiceSecurityAuthenticateAndEncrypt = 2;
|
williamr@2
|
50 |
|
williamr@2
|
51 |
/**
|
williamr@2
|
52 |
KCommHighUnit
|
williamr@2
|
53 |
The maximum virtual serial port number supported
|
williamr@2
|
54 |
ie. BTCOMM::KCommHighUnit is the maximum Bluetooth serial port that can be opened
|
williamr@2
|
55 |
@publishedAll
|
williamr@2
|
56 |
@released
|
williamr@2
|
57 |
*/
|
williamr@2
|
58 |
static const TUint8 KCommHighUnit=63;
|
williamr@2
|
59 |
|
williamr@2
|
60 |
NONSHARABLE_CLASS(TBTCommPortSettings)
|
williamr@2
|
61 |
/**
|
williamr@2
|
62 |
Used to configure a virtual serial port. The very least that is needed to configure a virtual serial port
|
williamr@2
|
63 |
is the Bluetooth device address of the remote, and the SDP UUID to use on that device.
|
williamr@2
|
64 |
|
williamr@2
|
65 |
This info can then be saved by the registry and retrieved when needed.
|
williamr@2
|
66 |
@publishedAll
|
williamr@2
|
67 |
@released
|
williamr@2
|
68 |
*/
|
williamr@2
|
69 |
{
|
williamr@2
|
70 |
public:
|
williamr@2
|
71 |
IMPORT_C TBTCommPortSettings(const TDesC& aName, TUUID aUUID,TUint32 aBTCommPort, TUint8 aSecurityLevel, TBTDevAddr aBDAddr);
|
williamr@2
|
72 |
IMPORT_C TBTCommPortSettings();
|
williamr@4
|
73 |
IMPORT_C const TDesC& Name() const; //< Returns the name of the service.
|
williamr@4
|
74 |
IMPORT_C TUUID UUID() const; //< Returns the unique id of the service.
|
williamr@4
|
75 |
IMPORT_C TBTDevAddr BDAddr() const; //< Returns the address of the default device associated with the service.
|
williamr@2
|
76 |
IMPORT_C TUint32 Port() const;
|
williamr@2
|
77 |
IMPORT_C TBool IsSecuritySet() const;
|
williamr@2
|
78 |
IMPORT_C TBool IsEncryptionSet() const;
|
williamr@2
|
79 |
IMPORT_C TBool IsAuthenticationOnlySet() const;
|
williamr@4
|
80 |
IMPORT_C void SetName(const TDesC& aName); //< Sets the name of the service.
|
williamr@4
|
81 |
IMPORT_C void SetUUID(TUUID aUUID); //< Sets the unique id of the service.
|
williamr@2
|
82 |
IMPORT_C void SetPort(TUint32 aBTCommPort);
|
williamr@2
|
83 |
IMPORT_C void SetAuthentication();
|
williamr@2
|
84 |
IMPORT_C void SetAuthenticationAndEncryption(); // enforces authentication as well
|
williamr@2
|
85 |
IMPORT_C void SetNoSecurity(); // resets the above two
|
williamr@4
|
86 |
IMPORT_C void SetBTAddr(TBTDevAddr aBDAddr); //< Sets the address of the default device associated with the service.
|
williamr@2
|
87 |
|
williamr@2
|
88 |
IMPORT_C TUint8 SecurityLevel() const;
|
williamr@2
|
89 |
IMPORT_C void SetSecurityLevel(TUint8 aLevel);
|
williamr@2
|
90 |
private:
|
williamr@2
|
91 |
TBuf<32> iName; // The name of the service
|
williamr@2
|
92 |
TUUID iUUID; // The UUID of the service
|
williamr@2
|
93 |
TUint32 iPort; // The port no of the virtual serial port opened by the legacy app
|
williamr@2
|
94 |
TUint8 iSecurityLevel; // for that default service (i.e 0,1,2 = none,auth,encrypt+auth)
|
williamr@2
|
95 |
TBTDevAddr iBDAddr; // The address of the default device
|
williamr@2
|
96 |
|
williamr@2
|
97 |
// This data padding has been added to help prevent future binary compatibility breaks
|
williamr@2
|
98 |
// Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
|
williamr@2
|
99 |
TUint32 iPadding1;
|
williamr@2
|
100 |
TUint32 iPadding2;
|
williamr@2
|
101 |
};
|
williamr@2
|
102 |
|
williamr@2
|
103 |
|
williamr@2
|
104 |
typedef TPckgBuf<TBTCommPortSettings> TBTCommPortSettingsPckg; /*!< Handy package to send TBTCommPortSettings over IPC*/
|
williamr@2
|
105 |
|
williamr@2
|
106 |
|
williamr@2
|
107 |
|
williamr@2
|
108 |
/**
|
williamr@2
|
109 |
A subsession on the Bluetooth Registry server
|
williamr@2
|
110 |
This subsession allows the virtual serial ports to be updated, modified, examined etc.
|
williamr@2
|
111 |
|
williamr@2
|
112 |
@publishedAll
|
williamr@2
|
113 |
@released
|
williamr@2
|
114 |
*/
|
williamr@2
|
115 |
NONSHARABLE_CLASS(RBTCommPortSettings) : public RBTManSubSession
|
williamr@2
|
116 |
{
|
williamr@2
|
117 |
public:
|
williamr@2
|
118 |
IMPORT_C RBTCommPortSettings();
|
williamr@2
|
119 |
IMPORT_C TInt Open(RBTRegServ& aSession); // creates the subsession server side
|
williamr@2
|
120 |
IMPORT_C TInt Get(TBTCommPortSettings& aSettings); //synchronous
|
williamr@2
|
121 |
IMPORT_C void Modify(const TBTCommPortSettings& aSettings, TRequestStatus& aStatus); // may add if not present
|
williamr@2
|
122 |
IMPORT_C void Delete(const TBTCommPortSettings& aSettings, TRequestStatus& aStatus);
|
williamr@2
|
123 |
IMPORT_C void Close();
|
williamr@2
|
124 |
private:
|
williamr@2
|
125 |
TPckgBuf<TBTCommPortSettings> iPortPckg;
|
williamr@2
|
126 |
|
williamr@2
|
127 |
// This data padding has been added to help prevent future binary compatibility breaks
|
williamr@2
|
128 |
// Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
|
williamr@2
|
129 |
TUint32 iPadding1;
|
williamr@2
|
130 |
TUint32 iPadding2;
|
williamr@2
|
131 |
};
|
williamr@2
|
132 |
|
williamr@2
|
133 |
|
williamr@2
|
134 |
#endif
|