33 TCommConfig TheConfigBuf; |
33 TCommConfig TheConfigBuf; |
34 TCommConfigV01& TheConfig = TheConfigBuf(); |
34 TCommConfigV01& TheConfig = TheConfigBuf(); |
35 |
35 |
36 const TInt KReceiveBufferLength = 8192; |
36 const TInt KReceiveBufferLength = 8192; |
37 |
37 |
|
38 //_LIT(KUsbCsyName, "ECACM"); |
38 _LIT(KUsbPortName, "ACM::0"); |
39 _LIT(KUsbPortName, "ACM::0"); |
39 _LIT(KUsbLddName, "EUSBC"); |
40 _LIT(KUsbLddName, "EUSBC"); |
40 |
41 |
41 #define _printf console->Printf |
42 #define _printf console->Printf |
42 #define _getch console->Getch |
43 #define _getch console->Getch |
418 } |
419 } |
419 |
420 |
420 _printf(_L("Writing data\n")); |
421 _printf(_L("Writing data\n")); |
421 for (timeout = 10; timeout<100; timeout++) |
422 for (timeout = 10; timeout<100; timeout++) |
422 { |
423 { |
|
424 // FillBuffer(readBuf); |
|
425 |
423 port.Write(status, readBuf); |
426 port.Write(status, readBuf); |
424 |
427 |
425 // Wait before cancelling |
428 // Wait before cancelling |
426 timer.After(status, timeout); |
429 timer.After(status, timeout); |
427 User::WaitForRequest(status); |
430 User::WaitForRequest(status); |
522 _printf(_L("Shutdown complete.\nWaiting for read to terminate.")); |
525 _printf(_L("Shutdown complete.\nWaiting for read to terminate.")); |
523 User::WaitForRequest(status); |
526 User::WaitForRequest(status); |
524 |
527 |
525 if (status != KErrNone) // Error code ? TODO |
528 if (status != KErrNone) // Error code ? TODO |
526 { |
529 { |
|
530 //LEAVE(status.Int()); |
527 _printf(_L("Read failed\n")); |
531 _printf(_L("Read failed\n")); |
528 } |
532 } |
529 |
533 |
530 _printf(_L("Read complete.\nRestarting USB Manager\n")); |
534 _printf(_L("Read complete.\nRestarting USB Manager\n")); |
531 TheUsb.Start(status); |
535 TheUsb.Start(status); |
1127 |
1132 |
1128 LEAVEIFERROR(port.Open(TheCommServ, KUsbPortName, ECommExclusive, ECommRoleDCE)); |
1133 LEAVEIFERROR(port.Open(TheCommServ, KUsbPortName, ECommExclusive, ECommRoleDCE)); |
1129 CleanupClosePushL(port); |
1134 CleanupClosePushL(port); |
1130 |
1135 |
1131 port.SetConfig(TheConfigBuf); |
1136 port.SetConfig(TheConfigBuf); |
|
1137 |
|
1138 // _printf(_L("----------------------------------------\n")); |
|
1139 // _printf(_L("Initial port config:\n")); |
|
1140 // _printf(_L(" Rate: %d bps\n"), TheConfig.iRate); |
|
1141 // _printf(_L(" Data bits: %d. Parity type: %d. Stop bits: %d\n"), |
|
1142 // TheConfig.iStopBits, TheConfig.iParity, TheConfig.iStopBits); |
|
1143 // _printf(_L(" Handshaking options: 0x%X\n"), TheConfig.iHandshake); |
|
1144 // _printf(_L("----------------------------------------\n\n")); |
1132 |
1145 |
1133 CleanupStack::PopAndDestroy(); // port |
1146 CleanupStack::PopAndDestroy(); // port |
1134 |
1147 |
1135 TBool noExit = ETrue; |
1148 TBool noExit = ETrue; |
1136 while (noExit) |
1149 while (noExit) |
1170 _printf(_L("8. Break (test 2.7)\n")); |
1183 _printf(_L("8. Break (test 2.7)\n")); |
1171 _printf(_L("9. Event notification, signal change (test 2.8.1)\n")); |
1184 _printf(_L("9. Event notification, signal change (test 2.8.1)\n")); |
1172 _printf(_L("a. Event notification, flow control (test 2.8.2)\n")); |
1185 _printf(_L("a. Event notification, flow control (test 2.8.2)\n")); |
1173 _printf(_L("b. Event notification, config change (test 2.8.3)\n")); |
1186 _printf(_L("b. Event notification, config change (test 2.8.3)\n")); |
1174 _printf(_L("c. Second client (test 2.9)\n")); |
1187 _printf(_L("c. Second client (test 2.9)\n")); |
1175 _printf(_L("p. Loopback test (test 2.12)\n")); |
1188 /* _printf(_L("d. ACM request, encapsulated command (test 2.10.1)\n")); |
|
1189 _printf(_L("e. ACM request, break (test 2.10.2)\n")); |
|
1190 _printf(_L("f. ACM request, setting feature (test 2.10.3)\n")); |
|
1191 _printf(_L("g. ACM request, clearing feature (test 2.10.4)\n")); |
|
1192 _printf(_L("h. ACM request, setting line coding (test 2.10.5)\n")); |
|
1193 _printf(_L("i. ACM request, control line state (test 2.10.6)\n")); |
|
1194 _printf(_L("j. ACM request, encapsualted response (test 2.10.7)\n")); |
|
1195 _printf(_L("k. ACM request, comms feature (test 2.10.8)\n")); |
|
1196 _printf(_L("l. ACM request, getting line coding (test 2.10.9)\n")); |
|
1197 _printf(_L("m. ACM Notifications, send serial state (test 2.11.1)\n")); |
|
1198 _printf(_L("n. ACM Notifications, network status (test 2.11.2)\n")); |
|
1199 _printf(_L("o. ACM Notifications, response available (test 2.11.3)\n")); |
|
1200 */ _printf(_L("p. Loopback test (test 2.12)\n")); |
1176 _printf(_L("q. Main menu\n")); |
1201 _printf(_L("q. Main menu\n")); |
1177 |
1202 |
1178 ch = (char) _getch(); |
1203 ch = (char) _getch(); |
1179 _printf(_L("\n")); |
1204 _printf(_L("\n")); |
1180 switch (ch) |
1205 switch (ch) |