1 /* |
|
2 * Copyright (c) 2004-2007 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: Contains the CRsBtDevice class definition. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CRSBTDEVICE_H |
|
20 #define CRSBTDEVICE_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <bt_sock.h> |
|
24 #include <btdevice.h> |
|
25 |
|
26 #include "tprinter.h" |
|
27 #include "btprotocolconsts.h" |
|
28 #include "tprintcapability.h" |
|
29 |
|
30 /** |
|
31 * @brief Stores information on Bluetooth device. |
|
32 * |
|
33 * Contains information related to a Bluetooth device, such as a printer. This includes Bluetooth |
|
34 * information like device ID and device class, BPP and OPP information like port (channel), number of prints made, |
|
35 * and time stamps of discovery and last use. |
|
36 */ |
|
37 NONSHARABLE_CLASS( CRsBtDevice ): public CBase |
|
38 { |
|
39 public: |
|
40 TBool UpdateDeviceL(CRsBtDevice &aDevice); |
|
41 TBool UpdateDeviceAndBPPL(CRsBtDevice& aDevice); |
|
42 TBool UpdateAllL(CRsBtDevice &aDevice); |
|
43 TBool UpdateUsedL(CRsBtDevice &aDevice); |
|
44 |
|
45 void SetDisappeared(TBool aDisappeared); |
|
46 TBool IsDisappeared() const; |
|
47 |
|
48 void SetSupportedProtocols(TUint aSupportedProtocols); |
|
49 TUint SupportedProtocols() const; |
|
50 |
|
51 void SetBPPPort(TUint aPort); |
|
52 TUint BPPPort() const; |
|
53 |
|
54 void SetSTSPort(TUint aPort); |
|
55 TUint STSPort() const; |
|
56 |
|
57 void SetOPPPort(TUint aPort); |
|
58 TUint OPPPort() const; |
|
59 |
|
60 void SetTimeLastUsed(TTime aTime); |
|
61 TTime TimeLastUsed() const; |
|
62 |
|
63 void SetTimeDiscovered(TTime aTime); |
|
64 TTime TimeDiscovered() const; |
|
65 |
|
66 const TBTDevAddr& BDAddr() const; |
|
67 TBTDeviceClass DeviceClass() const; |
|
68 |
|
69 TBool Equals( const CRsBtDevice &aDevice ) const; |
|
70 CRsBtDevice* CopyL(); |
|
71 CRsBtDevice* CopyL(CRsBtDevice& aSource); |
|
72 |
|
73 static CRsBtDevice* NewLC(const CRsBtDevice &a); |
|
74 static CRsBtDevice* NewLC(const TNameRecord &aName); |
|
75 static CRsBtDevice* NewLC(); |
|
76 static CRsBtDevice* NewL(const CRsBtDevice &a); |
|
77 static CRsBtDevice* NewL(const TNameRecord &aName); |
|
78 static CRsBtDevice* NewL(); |
|
79 |
|
80 virtual ~CRsBtDevice(); |
|
81 |
|
82 void ExternalizeL(RWriteStream& aStream) const; |
|
83 void InternalizeL(RReadStream& aStream); |
|
84 |
|
85 const TDesC& FriendlyName() const; |
|
86 |
|
87 void SetPrinterModelL(const TDesC& aModelName); |
|
88 const TDesC& GetPrinterModel() const; |
|
89 |
|
90 void SetJustFound(TBool aJustFound); |
|
91 TBool IsJustFound() const; |
|
92 |
|
93 TInt DeviceId() const; |
|
94 void SetDeviceId(TInt aNewId); |
|
95 |
|
96 void SetVendor( TPrinter::TPrinterVendor aVendor ); |
|
97 TPrinter::TPrinterVendor Vendor() const; |
|
98 |
|
99 void AddCapability(TPrintCapability& aCapability); |
|
100 void GetCapabilityIDs(RArray<TInt>& aCapabilityIDs ); |
|
101 TInt GetCapability(const TInt aCapabilityID, TPrintCapability& aCapability); |
|
102 TInt SetDefaultCapability(TInt aCapabilityID, TInt aValue); |
|
103 TInt CapabilityCount() const; |
|
104 |
|
105 TPrinter ToTPrinter(); |
|
106 TBool IsUsed() const; |
|
107 void SetUsed(TBool aUsed); |
|
108 |
|
109 TInt UsedProtocol() const; |
|
110 TInt ComposeUsedProtocol(TInt aRequestedProtocols); |
|
111 void SetUsedProtocol(TInt aProtocol); |
|
112 |
|
113 private: |
|
114 CRsBtDevice(); |
|
115 // copy constructor |
|
116 CRsBtDevice(const CRsBtDevice &a); |
|
117 |
|
118 void ConstructL(const TNameRecord &aName); |
|
119 void ConstructL(const CRsBtDevice &a); |
|
120 void ConstructL(); |
|
121 void Init(); |
|
122 void ExternalizeCapabilitiesL(RWriteStream& aStream) const; |
|
123 void InternalizeCapabilitiesL(RReadStream& aStream); |
|
124 |
|
125 private: |
|
126 TTime iTimeLastUsed; |
|
127 TTime iTimeDiscovered; |
|
128 TUint iBPPPort; |
|
129 TUint iSTSPort; |
|
130 TUint iOPPPort; |
|
131 TUint iSupportedProtocols; |
|
132 TPrinter::TPrinterVendor iVendor; |
|
133 CBTDevice* iDevice; |
|
134 HBufC *iPrinterModel; |
|
135 TBool iJustFound; |
|
136 TInt iInternalDeviceId; |
|
137 |
|
138 TBool iUsed; |
|
139 TBool iDisappeared; |
|
140 |
|
141 TInt iUsedProtocol; |
|
142 RArray<TPrintCapability> iCapabilities; |
|
143 |
|
144 |
|
145 }; |
|
146 |
|
147 #endif // CRSBTDEVICE_H |
|
148 |
|
149 // End of File |
|