Author: remi
Date: 2009-09-21 09:45:00 +0200 (Mon, 21 Sep 2009)
New Revision: 5452

Modified:
   
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/TuxUtils.pas
Log:
* Added a method to wait that the Tux Droid is ready.

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-20 23:07:36 UTC (rev 5451)
+++ 
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/TuxUtils.pas
      2009-09-21 07:45:00 UTC (rev 5452)
@@ -36,6 +36,7 @@
     function isDongleConnected(states : TStringList) : boolean;
     function isTransformerConnected(states : TStringList) : boolean;
     function isSoundOn(states : TStringList) : boolean;
+    function waitForTuxDroidReady(timeout: integer): boolean;
     function isRadioConnected(states : TStringList)  : boolean;
     function isOnActivity(states : TStringList) : boolean;
     function getUserLanguage() : String;
@@ -315,6 +316,36 @@
 end;
 
 
+{#### Wait for Tux Droid ready ####}
+// Timeout in seconds
+function waitForTuxDroidReady(timeout: integer): boolean;
+var
+  states : TStringList;
+  i : integer;
+begin
+  result := false;
+  states := TStringList.Create;
+  states.Add('');
+  i := timeout * 10;
+  while true do
+  begin
+    if getStates(states) then
+    begin
+      if isSoundOn(states) and isDongleConnected(states) and 
isRadioConnected(states) then
+      begin
+        result := true;
+        break;
+      end;
+    end;
+    i := i - 1;
+    if i <= 0 then
+      break;
+    Sleep(100);
+    application.ProcessMessages;
+  end;
+end;
+
+
 {#### Return the radio connection state ####}
 function isRadioConnected(states : TStringList)  : boolean;
 begin


------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to