Author: jerome
Date: 2009-09-09 16:13:10 +0200 (Wed, 09 Sep 2009)
New Revision: 5343

Modified:
   
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/Report.pas
   
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/TuxUtils.pas
   
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/Unit1.dfm
   
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/Unit1.pas
Log:
* Improved test steps.
* Restarting smart core at step 2 in all cases ( less problems with run at once 
).

Modified: 
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/Report.pas
===================================================================
--- 
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/Report.pas
        2009-09-09 09:01:49 UTC (rev 5342)
+++ 
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/Report.pas
        2009-09-09 14:13:10 UTC (rev 5343)
@@ -25,7 +25,7 @@
 
 uses
    ShellAPI, Windows, TuxUtils, Dialogs, zLib, SysUtils, Controls, Classes,
-   StdCtrls, ShlObj, Msinfo32Wrapper, KAZip, Forms, IdComponent, 
IdMessageCoder,
+   StdCtrls, ShlObj, KAZip, Forms, IdComponent, IdMessageCoder,
    IdMessageCoderMIME, IdBaseComponent, IdMessage, IdSMTP, IdIOHandler,
    IdIOHandlerSocket, IdSSLOpenSSL, WinInet, IdHttp, ComputerInfos,
    Registry, TlHelp32;
@@ -255,8 +255,6 @@
 
  //Create a file that contains computer base informations.
  function TReportMaker.CreateReportDatas() : boolean;
- var
-   msinfo : TMsinfo;
  begin
    computerDatas := ReportFilesDirectory + '\info.nfo';
    // Get the computer informations

Modified: 
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/TuxUtils.pas
===================================================================
--- 
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/TuxUtils.pas
      2009-09-09 09:01:49 UTC (rev 5342)
+++ 
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/TuxUtils.pas
      2009-09-09 14:13:10 UTC (rev 5343)
@@ -164,9 +164,12 @@
   beginPos, endPos : Integer;
 begin
 
-  values := TStringList.Create;
-
   try
+    values := TStringList.Create;
+  except
+  end;
+  
+  try
     //Searching for dongle state ( <dongleState> )
     beginPos := Pos('<dongleState>', aString) + Length('<dongleState>');
     endPos := Pos('</dongleState>', aString);

Modified: 
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/Unit1.dfm
===================================================================
--- 
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/Unit1.dfm
 2009-09-09 09:01:49 UTC (rev 5342)
+++ 
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/Unit1.dfm
 2009-09-09 14:13:10 UTC (rev 5343)
@@ -1,5 +1,5 @@
 object Form1: TForm1
-  Left = 426
+  Left = 427
   Top = 221
   BorderIcons = [biSystemMenu, biMinimize]
   BorderStyle = bsNone

Modified: 
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/Unit1.pas
===================================================================
--- 
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/Unit1.pas
 2009-09-09 09:01:49 UTC (rev 5342)
+++ 
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/Unit1.pas
 2009-09-09 14:13:10 UTC (rev 5343)
@@ -87,8 +87,6 @@
 
   RADIO_ERROR    = 'The radio connection between Tux Droid and the fish dongle 
has not been established. Please make sure your Tux Droid is connected to the 
transformer and do a reset by turning Tux Droid off and on again.';
 
-  WINDOWS_ERROR  = 'Your fish dongle was not properly detected by Windows. 
Please replug your dongle.';
-
   OK     = 'Ok';
 
   CANCEL = 'Cancel';
@@ -177,9 +175,13 @@
       Y: Integer);
 
     procedure startServer();
+    procedure AskAndSend();
+    procedure validateButtons();
+    procedure invalidateButtons();
 
 
 
+
   private
     { D�clarations priv�es }
     function getAttitunePath() : string;
@@ -203,6 +205,7 @@
   BoxOk1  : TForm3;
   values : TStringList;
   testCount : byte;
+  hardwareTestCount : byte;
 
 implementation
 
@@ -239,6 +242,7 @@
   LabelSendReport.Caption := gettext(END_SEND_REPORT);
 
   testCount := 1;
+  hardwareTestCount := 1;
 
   TuxUtils.initKnowedVars();
 end;
@@ -283,31 +287,36 @@
 //Start smart core and display splashscreen.
 procedure TForm1.startServer();
 begin
-  if (not TuxUtils.isTuxDroidServerStarted()) or  (not 
TuxUtils.getStates(values)) then
-    begin
-    Form1.Enabled := False;
-    Form1.ShowSplashScreen();
-    TuxUtils.startServer(Application);
-    Form1.HideSplashScreen();
-    Steps.ActivePageIndex := 1;
-    Form1.Enabled := True;
-    if TuxUtils.isTuxDroidServerStarted() then
-      Report.SERVER := True
-    else
-      Report.SERVER := False;
-    end
+  Form1.Enabled := False;
+  Form1.ShowSplashScreen();
+  TuxUtils.startServer(Application);
+  Form1.HideSplashScreen();
+  Steps.ActivePageIndex := 1;
+  Form1.Enabled := True;
+
+  if TuxUtils.isTuxDroidServerStarted() then
+    Report.SERVER := True
   else
-    begin
-      Report.SERVER := True;
-    end;
+    Report.SERVER := False;
 end;
 
 
 {#### Next button clicked ####}
 procedure TForm1.NextButtonClick();
 begin
-  //Go next in steps.
-  Steps.SelectNextPage(true);
+  //Invalidate buttons
+  invalidateButtons();
+
+  //Refreshing server datas and tux statuses.
+  try
+    if values <> nil then
+      values.Clear;
+    TuxUtils.getStates(values);
+    sleep(500);
+  except
+      //Do nothing on exception, server not ready.
+  end;
+
   setPreviousEnabled(true);
 
   case Steps.ActivePageIndex of
@@ -325,36 +334,21 @@
     //**************************************************//
     //****  Step 3 on screen => Testing dongle state****//
     begin
-      //Checking dongle state.
-      values.Clear;
-      TuxUtils.getStates(values);
+
+      Inc(hardwareTestCount, 1);
+
       if not TuxUtils.isDongleConnected(values) then
         begin
-          Form1.Enabled := False;
+          invalidateButtons();
           Report.DONGLE := False;
-          //Checking first if it's a hardware problem.
-          if isHIDReady() then
-            begin
-            //Showing the error message.
-            BoxOk1.showMessageDialog(gettext(DONGLE_ERROR), gettext(OK));
-
-            //Refreshing informations.
-            startServer();
-            values.Clear;
-            TuxUtils.getStates(values);
-            end
-          else
-            begin
-            //Displaying HID error message.
-            BoxOk1.showMessageDialog(gettext(WINDOWS_ERROR), gettext(OK));
-            Steps.ActivePageIndex := 1;
-            NextLabel.Caption := gettext(NEXTB);
-            Next.OnMouseUp := Form1.NextMouseUp;
-            NextLabel.OnMouseUp := Form1.NextMouseUp;
-          end;
-          Form1.Enabled := True;
+          BoxOk1.showMessageDialog(gettext(DONGLE_ERROR), gettext(OK));
+          Steps.ActivePageIndex := 1;
+          NextLabel.Caption := gettext(NEXTB);
+          Next.OnMouseUp := Form1.NextMouseUp;
+          NextLabel.OnMouseUp := Form1.NextMouseUp;
         end
       else
+        Steps.SelectNextPage(true);
         Report.DONGLE := True;
     end;
 
@@ -362,43 +356,44 @@
     //**************************************************//
     //****  Step 4 on screen => Testing radio state****//
     begin
-      values.Clear;
-      TuxUtils.getStates(values);
+
       if not TuxUtils.isRadioConnected(values) then
         begin
-        Form1.Enabled := false;
+
+        invalidateButtons();
         Report.RADIO := False;
         //Showing the error message.
+
+        Next.Enabled := False;
         BoxOk1.showMessageDialog(gettext(RADIO_ERROR), gettext(OK));
 
-        //Refreshing informations.
-        startServer();
-        values.Clear;
-        TuxUtils.getStates(values);
-
-        Steps.ActivePageIndex := 1;
+        Steps.ActivePageIndex := 3;
         NextLabel.Caption := gettext(NEXTB);
         Next.OnMouseUp := Form1.NextMouseUp;
         NextLabel.OnMouseUp := Form1.NextMouseUp;
-        Form1.Enabled := True;
+
         end
       else
         begin
+        Steps.SelectNextPage(true);
         Report.RADIO := True;
+        NextLabel.Caption := gettext(TEST);
+        Next.OnMouseUp := Form1.TestButtonClick;
+        NextLabel.OnMouseUp := Form1.TestButtonClick;
         end;
     end;
 
-  4 :
-    begin
-    NextLabel.Caption := gettext(TEST);
-    Next.OnMouseUp := Form1.TestButtonClick;
-    NextLabel.OnMouseUp := Form1.TestButtonClick;
-    end;
   5 :
     begin
     Form1.setNextEnabled(false);
     end;
   end;
+
+  if  Steps.ActivePageIndex in [0..1]  then
+    Steps.SelectNextPage(true);
+
+  validateButtons();
+  
 end;
 
 
@@ -502,27 +497,7 @@
               end
             else
               begin
-              Form1.setNextEnabled(false);
-              setPreviousEnabled(false);
-
-              result := Box1.showMessageDialog(gettext(SCREEN_5_CHOICE_3), 
gettext(YES), gettext(NO));
-
-              if result = Box.bOk then
-                begin
-                sendReport(Report.ERROR);
-                Application.Terminate;
-                end
-              else
-                begin
-                Steps.ActivePageIndex := 5;
-                Next.Hide;
-                Previous.Hide;
-                NextLabel.Hide;
-                PreviousLabel.Hide;
-                ExitLabel.Caption := gettext(FINISH);
-                Exit.OnMouseUp := FinishButtonClick;
-                ExitLabel.OnMouseUp := FinishButtonClick;
-                end;
+                AskAndSend();
               end;
             end;
           end;
@@ -576,6 +551,62 @@
  ###########################################################
 }
 
+
+procedure TForm1.AskAndSend();
+var
+  result : Integer;
+begin
+  Form1.setNextEnabled(false);
+  setPreviousEnabled(false);
+
+  result := Box1.showMessageDialog(gettext(SCREEN_5_CHOICE_3), gettext(YES), 
gettext(NO));
+
+  if result = Box.bOk then
+    begin
+    sendReport(Report.ERROR);
+    Application.Terminate;
+    end
+  else
+    begin
+    Steps.ActivePageIndex := 5;
+    Next.Hide;
+    Previous.Hide;
+    NextLabel.Hide;
+    PreviousLabel.Hide;
+    ExitLabel.Caption := gettext(FINISH);
+    Exit.OnMouseUp := FinishButtonClick;
+    ExitLabel.OnMouseUp := FinishButtonClick;
+  end;
+end;
+
+
+//Enable control buttons.
+procedure TForm1.validateButtons();
+begin
+  Next.Enabled := True;
+  Previous.Enabled := True;
+  Exit.Enabled := True;
+
+  NextLabel.Enabled := True;
+  PreviousLabel.Enabled := True;
+  ExitLabel.Enabled := True;
+end;
+
+
+//Disable control buttons.
+procedure TForm1.invalidateButtons();
+begin
+  Next.Enabled := False;
+  Previous.Enabled := False;
+  Exit.Enabled := False;
+
+  NextLabel.Enabled := False;
+  PreviousLabel.Enabled := False;
+  ExitLabel.Enabled := False;
+end;
+
+
+
 function TForm1.isNextButtonEnabled() : boolean;
 begin
   result := Next.Tag = 1;


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to