|
1 /* |
|
2 * Copyright (c) 2006 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __TRKDCCCOMM_H__ |
|
20 #define __TRKDCCCOMM_H__ |
|
21 |
|
22 // |
|
23 // class TCapsTrkDccDriver |
|
24 // |
|
25 class TCapsTrkDccDriver |
|
26 { |
|
27 public: |
|
28 TVersion iVersion; |
|
29 }; |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 // |
|
35 // class RTrkDccDriver |
|
36 // |
|
37 class RTrkDccDriver : public RBusLogicalChannel |
|
38 { |
|
39 public: |
|
40 |
|
41 enum TControl |
|
42 { |
|
43 EControlWrite = 0, |
|
44 }; |
|
45 |
|
46 enum TRequest |
|
47 { |
|
48 ERequestRead=0x0, ERequestReadCancel=0x1, |
|
49 ERequestWrite=0x1,ERequestWriteCancel=0x2, |
|
50 }; |
|
51 |
|
52 public: |
|
53 |
|
54 inline TInt Open(); |
|
55 inline void Read(TRequestStatus &aStatus, TDes8 &aDes); |
|
56 inline void Read(TRequestStatus &aStatus, TDes8 &aDes, TInt aLength); |
|
57 inline void ReadOneOrMore(TRequestStatus &aStatus, TDes8 &aDes); |
|
58 inline void ReadCancel(); |
|
59 inline void Write(TRequestStatus &aStatus, const TDesC8 &aDes); |
|
60 inline void Write(TRequestStatus &aStatus, const TDesC8 &aDes, TInt aLength); |
|
61 inline TInt Write(const TDesC8 &aDes); |
|
62 inline TInt Write(const TDesC8 &aDes, TInt aLength); |
|
63 inline void WriteCancel(); |
|
64 |
|
65 }; |
|
66 |
|
67 |
|
68 _LIT(KTrkDccDriverName,"TrkDcc Driver"); |
|
69 |
|
70 // Version information |
|
71 const TInt KMajorDccVersionNumber=1; |
|
72 const TInt KMinorDccVersionNumber=0; |
|
73 const TInt KBuildDccVersionNumber=0; |
|
74 |
|
75 |
|
76 inline TInt RTrkDccDriver::Open() |
|
77 { |
|
78 #ifdef EKA2 |
|
79 return DoCreate(KTrkDccDriverName, TVersion(KMajorDccVersionNumber, KMinorDccVersionNumber, KBuildDccVersionNumber), KNullUnit, NULL, NULL); |
|
80 #else |
|
81 return DoCreate(KTrkDccDriverName, TVersion(KMajorDccVersionNumber, KMinorDccVersionNumber, KBuildDccVersionNumber), NULL, KNullUnit, NULL, NULL); |
|
82 #endif |
|
83 } |
|
84 |
|
85 inline void RTrkDccDriver::Read(TRequestStatus &aStatus, TDes8 &aDes) |
|
86 { |
|
87 TInt len = aDes.MaxLength(); |
|
88 DoRequest(ERequestRead, aStatus, &aDes, &len); |
|
89 } |
|
90 |
|
91 inline void RTrkDccDriver::Read(TRequestStatus &aStatus, TDes8 &aDes, TInt aLength) |
|
92 { |
|
93 DoRequest(ERequestRead, aStatus, &aDes, &aLength); |
|
94 } |
|
95 |
|
96 inline void RTrkDccDriver::ReadOneOrMore(TRequestStatus &aStatus, TDes8 &aDes) |
|
97 { |
|
98 TInt len = (-aDes.MaxLength()); |
|
99 DoRequest(ERequestRead, aStatus, &aDes, &len); |
|
100 } |
|
101 |
|
102 inline void RTrkDccDriver::ReadCancel() |
|
103 { |
|
104 DoCancel(ERequestReadCancel); |
|
105 } |
|
106 |
|
107 inline void RTrkDccDriver::Write(TRequestStatus &aStatus, const TDesC8 &aDes) |
|
108 { |
|
109 TInt len=aDes.Length(); |
|
110 DoRequest(ERequestWrite, aStatus, (TAny *)&aDes, &len); |
|
111 } |
|
112 |
|
113 inline void RTrkDccDriver::Write(TRequestStatus &aStatus, const TDesC8 &aDes, TInt aLength) |
|
114 { |
|
115 DoRequest(ERequestWrite, aStatus, (TAny *)&aDes, &aLength); |
|
116 } |
|
117 |
|
118 inline TInt RTrkDccDriver::Write(const TDesC8 &aDes) |
|
119 { |
|
120 TInt len=aDes.Length(); |
|
121 return DoControl(EControlWrite, reinterpret_cast<TAny*>(len), (TAny*)&aDes); |
|
122 } |
|
123 |
|
124 inline TInt RTrkDccDriver::Write(const TDesC8 &aDes, TInt aLength) |
|
125 { |
|
126 return DoControl(EControlWrite, reinterpret_cast<TAny*>(aLength), (TAny*)&aDes); |
|
127 } |
|
128 |
|
129 inline void RTrkDccDriver::WriteCancel() |
|
130 { |
|
131 DoCancel(ERequestWriteCancel); |
|
132 } |
|
133 |
|
134 |
|
135 #endif // __TRKDCCCOMM_H__ |