[tuxdroid-svn] r5452 - software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-inst
Status: Beta
Brought to you by:
ks156
|
From: remi <c2m...@c2...> - 2009-09-21 07:45:20
|
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
|