1 // Copyright (c) 2003-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 the License "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 // LDD for testing SDIO functions |
|
15 // |
|
16 // |
|
17 |
|
18 #include "sdio_io.h" |
|
19 |
|
20 /** Text to replace any overflow in logging */ |
|
21 _LIT(KEllipses, "..."); |
|
22 |
|
23 #if defined(_UNICODE) |
|
24 void CIOBase::TIOOverflowHandler::Overflow(TDes16 &aDes) |
|
25 { |
|
26 // Replace the last three characters with ellipses |
|
27 aDes.RightTPtr(KEllipses().Length()).Copy(KEllipses); |
|
28 } |
|
29 #else |
|
30 void CIOBase::TIOOverflowHandler::Overflow(TDes8 &aDes) |
|
31 { |
|
32 // Replace the last three characters with ellipses |
|
33 aDes.RightTPtr(KEllipses().Length()).Copy(KEllipses); |
|
34 } |
|
35 #endif |
|
36 |
|
37 // |
|
38 // CIOBase |
|
39 // |
|
40 void CIOBase::Heading(TRefByValue<const TDesC> aFmt,...) |
|
41 { |
|
42 FORMAT_TEXT(aFmt); |
|
43 DoHeading(); |
|
44 } |
|
45 |
|
46 void CIOBase::Instructions(TBool topLine, TRefByValue<const TDesC> aFmt,...) |
|
47 { |
|
48 FORMAT_TEXT(aFmt); |
|
49 DoInstructions(topLine); |
|
50 } |
|
51 |
|
52 void CIOBase::Printf(TRefByValue<const TDesC> aFmt,...) |
|
53 { |
|
54 FORMAT_TEXT(aFmt); |
|
55 DoPrintf(); |
|
56 } |
|
57 |
|
58 void CIOBase::FormatText(TRefByValue<const TDesC> aFmt, VA_LIST aList) |
|
59 { |
|
60 iText.Zero(); |
|
61 iText.AppendFormatList(aFmt, aList, &iOverflowHandler); |
|
62 } |
|
63 |
|
64 // |
|
65 // CIOConsole |
|
66 // |
|
67 CIOConsole::~CIOConsole() |
|
68 { |
|
69 iDisplay.Destroy(); |
|
70 } |
|
71 |
|
72 void CIOConsole::CreateL(TPtrC aName) |
|
73 { |
|
74 iDisplay.CreateL(aName); |
|
75 } |
|
76 |
|
77 void CIOConsole::DoHeading() |
|
78 { |
|
79 iDisplay.Heading(iText); |
|
80 } |
|
81 |
|
82 void CIOConsole::DoInstructions(TBool topLine) |
|
83 { |
|
84 iDisplay.Instructions(topLine, iText); |
|
85 } |
|
86 |
|
87 void CIOConsole::DoPrintf() |
|
88 { |
|
89 iDisplay.Printf(iText); |
|
90 } |
|
91 |
|
92 void CIOConsole::ReportError(TPtrC errText, TInt anErr) |
|
93 { |
|
94 iDisplay.ReportError(errText, anErr); |
|
95 } |
|
96 |
|
97 void CIOConsole::CurserToDataStart() |
|
98 { |
|
99 iDisplay.CurserToDataStart(); |
|
100 } |
|
101 |
|
102 TKeyCode CIOConsole::Getch() |
|
103 { |
|
104 return iDisplay.Getch(); |
|
105 } |
|
106 |
|
107 void CIOConsole::ClearScreen() |
|
108 { |
|
109 iDisplay.ClearScreen(); |
|
110 } |
|
111 |
|
112 // |
|
113 // CIORDebug |
|
114 // |
|
115 void CIORDebug::CreateL(TPtrC aName) |
|
116 { |
|
117 RDebug::RawPrint(aName); |
|
118 } |
|
119 |
|
120 void CIORDebug::DoHeading() |
|
121 { |
|
122 RDebug::RawPrint(iText); |
|
123 } |
|
124 |
|
125 void CIORDebug::DoPrintf() |
|
126 { |
|
127 RDebug::RawPrint(iText); |
|
128 } |
|
129 |
|
130 void CIORDebug::ReportError(TPtrC errText, TInt anErr) |
|
131 { |
|
132 RDebug::RawPrint(errText); |
|
133 RDebug::Printf("Error Code: %d", anErr); |
|
134 } |
|
135 |
|
136 void CIORDebug::ClearScreen() |
|
137 { |
|
138 RDebug::Printf("\n\n"); |
|
139 } |
|