29 #include "usbtypes.h" |
29 #include "usbtypes.h" |
30 #include "mdrivedisplay.h" |
30 #include "mdrivedisplay.h" |
31 #include "cdisplay.h" |
31 #include "cdisplay.h" |
32 |
32 |
33 // Display positions and test constants |
33 // Display positions and test constants |
|
34 |
|
35 // Available drives |
|
36 static const TInt KStartRow_AvailableDrives = 1; |
|
37 _LIT(KAvailDriveMsg, "Drives: "); |
|
38 |
34 // Number of attached devices |
39 // Number of attached devices |
35 static const TInt KRow_DevicesNumber = 13; |
40 static const TInt KRow_DevicesNumber = 2; |
36 _LIT(KMsg_DevicesAttached, "USB Devices Attached = %d"); |
41 _LIT(KMsg_DevicesAttached, "USB Devices Attached = %d"); |
37 |
42 |
38 // Device Map |
43 // Device Map |
39 static const TInt KStartRow_DeviceMap = KRow_DevicesNumber + 2; |
44 static const TInt KStartRow_DeviceMap = KRow_DevicesNumber + 2; |
40 static const TInt KMaxRows_DeviceMap = 4; |
45 static const TInt KMaxRows_DeviceMap = 4; |
41 _LIT(KMsg_DeviceMap_DriveList, "%d: "); // [drive index] |
46 _LIT(KMsg_DeviceMap_DriveList, "%d: "); // [drive index] |
42 _LIT(KMsg_DeviceMap_DriveLunEntry, "%c "); // [drive letter] |
47 _LIT(KMsg_DeviceMap_DriveLunEntry, "%c "); // [drive letter] |
43 |
48 |
44 |
|
45 // Drive Map |
49 // Drive Map |
46 static const TInt KStartRow_DriveMap = KStartRow_DeviceMap + KMaxRows_DeviceMap; |
50 static const TInt KStartRow_DriveMap = KStartRow_DeviceMap + KMaxRows_DeviceMap; |
47 static const TInt KMaxRows_DriveMap = 4; |
51 static const TInt KMaxRows_DriveMap = 4; |
|
52 |
|
53 // Drive info |
|
54 static const TInt KStartRow_MsgWindow = KStartRow_DriveMap + KMaxRows_DriveMap + 2; |
|
55 |
48 _LIT(KMsg_DriveMap_EntryLetter, "%c token = %d"); // [drive letter] [token] |
56 _LIT(KMsg_DriveMap_EntryLetter, "%c token = %d"); // [drive letter] [token] |
49 _LIT(KDbgMsg_DriveMap_EntryLetter, "*** %c token = %d"); // [drive letter] [token] |
57 _LIT(KDbgMsg_DriveMap_EntryLetter, "*** %c token = %d"); // [drive letter] [token] |
|
58 |
|
59 static const TInt KRowScrollWindowStart = KStartRow_MsgWindow; |
50 |
60 |
51 // System Status |
61 // System Status |
52 static const TInt KStartRow_UpTime = 28; |
62 static TPoint KPointSystemStatus(5, 0); |
53 _LIT(KMsg_UpTime, "up time : %dh:%dm:%ds "); // use trailing space to overwrite any leftover chars in line |
63 _LIT(KMsg_UpTime, "up time : %dh:%dm:%ds "); // use trailing space to overwrite any leftover chars in line |
54 |
64 |
55 static const TInt KStartRow_MemoryFree = 29; |
65 //static const TInt KStartRow_MemoryFree = 1 + KStartRow_SystemStatus; |
|
66 static TPoint KPointMemoryFree(5, 1); |
56 _LIT(KMsg_MemoryFree, "mem (bytes) : 0x%X"); |
67 _LIT(KMsg_MemoryFree, "mem (bytes) : 0x%X"); |
57 |
68 |
58 // User Keys |
69 // User Keys |
59 static const TInt KStartRow_UserKeys = 25; |
70 static const TPoint KPointUser1Keys(5,2); |
60 _LIT(KMsgUser1Keys, "[Esc]=Quit [A-Z]=DriveInfo"); |
71 _LIT(KMsgUser1Keys, "[Esc]=Quit [A-Z]=DriveInfo"); |
61 _LIT(KMsgUser2Keys, "[F5]=Hub update"); |
72 static const TPoint KPointUser2Keys(5,3); |
|
73 _LIT(KMsgUser2Keys, "[F5|SPACE]=Hub update"); |
62 |
74 |
63 |
75 |
64 // Scroll Window status |
76 // Scroll Window status |
65 _LIT(KScrollWindowStatus, "Page %d of %d"); |
77 _LIT(KScrollWindowStatus, "Page %d of %d"); |
66 |
78 |
67 // Available drives |
|
68 static const TInt KStartRow_AvailableDrives = 1; |
|
69 _LIT(KAvailDriveMsg, "Drives: "); |
|
70 |
79 |
71 _LIT(KDriveAtts,"DriveList %c: %02x "); |
80 _LIT(KDriveAtts,"DriveList %c: %02x "); |
72 |
81 |
73 // Drive info |
|
74 static const TInt KStartRow_MsgWindow = 3; |
|
75 static const TInt KStartRow_DriveInfo = KStartRow_MsgWindow; |
|
76 |
82 |
77 // **************************************************************************** |
83 // **************************************************************************** |
78 |
84 |
79 |
85 |
80 CScrollWindow* CScrollWindow::NewL(CConsoleBase& aConsole) |
86 CScrollWindow* CScrollWindow::NewL(CConsoleBase& aConsole, TInt aStartRow, TInt aEndRow) |
81 { |
87 { |
82 CScrollWindow* r = new (ELeave) CScrollWindow(aConsole); |
88 CScrollWindow* r = new (ELeave) CScrollWindow(aConsole, aStartRow, aEndRow); |
83 CleanupStack::PushL(r); |
89 CleanupStack::PushL(r); |
84 r->ConstructL(); |
90 r->ConstructL(); |
85 CleanupStack::Pop(r); |
91 CleanupStack::Pop(r); |
86 return r; |
92 return r; |
87 } |
93 } |
88 |
94 |
89 |
95 |
90 void CScrollWindow::ConstructL() |
96 void CScrollWindow::ConstructL() |
91 { |
97 { |
92 |
98 } |
93 } |
99 |
94 |
100 _LIT(KTxtPanic,"HUSBCONSAPP"); |
95 |
101 |
96 CScrollWindow::CScrollWindow(CConsoleBase& aConsole) |
102 CScrollWindow::CScrollWindow(CConsoleBase& aConsole, TInt aStartRow, TInt aEndRow) |
97 : iConsole(aConsole) |
103 : iConsole(aConsole), |
98 { |
104 iStartRow(aStartRow), |
|
105 iEndRow(aEndRow), |
|
106 iPageLength(iEndRow - iStartRow) |
|
107 { |
|
108 __ASSERT_ALWAYS(iEndRow > iStartRow, User::Panic(KTxtPanic, -1)); |
99 } |
109 } |
100 |
110 |
101 CScrollWindow::~CScrollWindow() |
111 CScrollWindow::~CScrollWindow() |
102 { |
112 { |
103 iLineArray.Close(); |
113 iLineArray.Close(); |
128 } |
138 } |
129 |
139 |
130 |
140 |
131 void CScrollWindow::Update() |
141 void CScrollWindow::Update() |
132 { |
142 { |
133 TInt line = iPage * KPageLength; |
143 TInt line = iPage * iPageLength; |
134 |
144 |
135 TInt row = KStartRow_DriveInfo; |
145 TInt row = iStartRow; |
136 do |
146 do |
137 { |
147 { |
138 iConsole.SetPos(0, row + line%KPageLength); |
148 iConsole.SetPos(0, row + line%iPageLength); |
139 if (line < iLineArray.Count()) |
149 if (line < iLineArray.Count()) |
140 { |
150 { |
141 iConsole.Printf(iLineArray[line]); |
151 iConsole.Printf(iLineArray[line]); |
142 } |
152 } |
143 iConsole.ClearToEndOfLine(); |
153 iConsole.ClearToEndOfLine(); |
144 line++; |
154 line++; |
145 } |
155 } |
146 while (((line-1)%KPageLength) != (KPageLength - 1)); |
156 while (((line-1)%iPageLength) != (iPageLength - 1)); |
147 iConsole.SetPos(0, KStartRow_DriveInfo + KPageLength); |
157 |
148 iConsole.Printf(KScrollWindowStatus, iPage + 1, iLineArray.Count()/KPageLength + 1); |
158 iConsole.SetPos(0, iStartRow + iPageLength); |
|
159 iConsole.Printf(KScrollWindowStatus, iPage + 1, iLineArray.Count()/iPageLength + 1); |
149 } |
160 } |
150 |
161 |
151 void CScrollWindow::PageInc() |
162 void CScrollWindow::PageInc() |
152 { |
163 { |
153 TInt lastPage = iLineArray.Count()/KPageLength; |
164 TInt lastPage = iLineArray.Count()/iPageLength; |
154 if (iPage == lastPage) |
165 if (iPage == lastPage) |
155 { |
166 { |
156 iPage = 0; |
167 iPage = 0; |
157 } |
168 } |
158 else |
169 else |
590 line->Format(KSize, aVolumeInfo.iSize); |
603 line->Format(KSize, aVolumeInfo.iSize); |
591 line = iScrollWindow->NewLineL(); |
604 line = iScrollWindow->NewLineL(); |
592 line->Format(KFree, aVolumeInfo.iFree); |
605 line->Format(KFree, aVolumeInfo.iFree); |
593 line = iScrollWindow->NewLineL(); |
606 line = iScrollWindow->NewLineL(); |
594 line->Format(KVolName, &aVolumeInfo.iName); |
607 line->Format(KVolName, &aVolumeInfo.iName); |
595 |
|
596 } |
608 } |
597 |
609 |
598 |
610 |
599 void CDisplay::UpTime(TUint aUpTime) const |
611 void CDisplay::UpTime(TUint aUpTime) const |
600 { |
612 { |
601 TUint totalMins = aUpTime/60; |
613 TUint totalMins = aUpTime/60; |
602 TUint totalHrs = totalMins/60; |
614 TUint totalHrs = totalMins/60; |
603 iConsole.SetPos(0, KStartRow_UpTime); |
615 |
|
616 SetFooterPos(KPointSystemStatus); |
604 iConsole.Printf(KMsg_UpTime, totalHrs, totalMins%60, aUpTime%60); |
617 iConsole.Printf(KMsg_UpTime, totalHrs, totalMins%60, aUpTime%60); |
605 CursorHome(); |
618 CursorHome(); |
606 } |
619 } |
607 |
620 |
608 void CDisplay::MemoryFree(TInt aBytes) const |
621 void CDisplay::MemoryFree(TInt aBytes) const |
609 { |
622 { |
610 iConsole.SetPos(0, KStartRow_MemoryFree); |
623 SetFooterPos(KPointMemoryFree); |
611 iConsole.Printf(KMsg_MemoryFree, aBytes); |
624 iConsole.Printf(KMsg_MemoryFree, aBytes); |
612 CursorHome(); |
625 CursorHome(); |
613 } |
626 } |
614 |
627 |
615 |
628 |