Author: remi
Date: 2009-09-21 13:03:45 +0200 (Mon, 21 Sep 2009)
New Revision: 5463
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/Unit1.pas
Log:
* Added method to wait for Tux Droid audio cards detected
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-21 10:27:04 UTC (rev 5462)
+++
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/TuxUtils.pas
2009-09-21 11:03:45 UTC (rev 5463)
@@ -26,7 +26,7 @@
uses
ShellAPI, Registry, SysUtils, Variants, Classes, TlHelp32,
ComCtrls, StdCtrls, OleCtrls, Controls, Windows, IdBaseComponent,
IdComponent, IdTCPConnection, IdTCPClient,
- IdHTTP, dialogs, Forms, ComputerInfos;
+ IdHTTP, dialogs, Forms, ComputerInfos, MMSYSTEM;
function DownloadHTTP(const AUrl : string): string;
function getStates(var values : TStringList): boolean;
@@ -37,6 +37,7 @@
function isTransformerConnected(states : TStringList) : boolean;
function isSoundOn(states : TStringList) : boolean;
function waitForTuxDroidReady(timeout: integer): boolean;
+ function waitForTuxDroidAudioCards(timeout: integer): boolean;
function isRadioConnected(states : TStringList) : boolean;
function isOnActivity(states : TStringList) : boolean;
function getUserLanguage() : String;
@@ -345,7 +346,35 @@
end;
end;
+{#### Wait for Tux Droid audio cards ####}
+// Timeout in seconds
+function waitForTuxDroidAudioCards(timeout: integer): boolean;
+var
+ i, j : integer;
+ caps : WaveOutCapsA;
+begin
+ result := false;
+ i := timeout * 10;
+ while true do
+ begin
+ for j := 0 to waveOutGetNumDevs - 1 do
+ begin
+ waveOutGetDevCapsA(j, @caps, sizeof(caps));
+ if pos('TuxDroid-TTS', caps.szPname) <> 0 then
+ begin
+ result := true;
+ exit;
+ 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
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-21 10:27:04 UTC (rev 5462)
+++
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/Unit1.pas
2009-09-21 11:03:45 UTC (rev 5463)
@@ -309,6 +309,7 @@
Form1.ShowSplashScreen();
TuxUtils.startServer(Application);
Form1.HideSplashScreen();
+ Form1.Enabled := True;
end;
@@ -394,7 +395,13 @@
//**************************************************//
//**** Step 4 on screen => Testing radio state****//
begin
-
+ // Stop server
+ stopServer;
+ // Wait Audio cards
+ waitForTuxDroidAudioCards(120);
+ // Restart server
+ startWithSplash;
+ // Wait for Tux Droid ready
if not TuxUtils.waitForTuxDroidReady(120) then
begin
------------------------------------------------------------------------------
Come build with us! The BlackBerry® 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-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn