Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

How do I extend the searchTimeout?

Rank

Total Posts: 2

Joined 2013-09-16

PM

I recently found out that the ANT method "setSearchTimeout()" doesn't let you set the searchTimeout to anything beyond the MAX, which is 25 seconds for low priority and 5 seconds for high priority. Specifically for my situation, I want to extend the searchTimeout to 10 minutes or ideally to set it to the screen display's timeout. Additionally, I am only using one ANT channel at all times, so low and high priority are of no significance to me.

I know I can set an arbitrary searchTimeout via the "setSearchTimeout()" method and have it retry an X amount of times in order to accomplish the 10 minute goal. I am just not sure where to put that logic or how to implement it. Any help is appreciated.

For reference, I am using Java on a Samsung S4 Galaxy. Let me know if you have any coding ideas on how to extend the searchTimeout to 10 minutes.

Thanks      
Rank

Total Posts: 4

Joined 2023-11-22

PM

Ken San Vicente - 24 July 2023 01:55 PM
I recently found out that the ANT method "setSearchTimeout()" doesn't let you set the searchTimeout to anything beyond the MAX, which is 25 seconds for low priority and 5 seconds for high priority. Specifically for my situation, I want to extend the searchTimeout to 10 minutes or ideally to set it to the screen display's timeout. Additionally, I am only using one ANT channel at all times, so low and high priority are of no significance to me.

I know I can set an arbitrary searchTimeout via the "setSearchTimeout()" method and have it retry an X amount of times in order to accomplish the 10 minute goal. I am just not sure where to put that logic or how to implement it. Any help is appreciated.

For reference, I am getting over it Java on a Samsung S4 Galaxy. Let me know if you have any coding ideas on how to extend the searchTimeout to 10 minutes.

Thanks


Use TimeTask to implement custom searchTimeout logic. A Timer is a task that can be scheduled to be performed once or repeatedly using a Timer. You can create a TimeTask to cancel the ANT search after a certain amount of time, then restart it if necessary. You can also use the ANT getSearchTimeout() method to get the current searchTimeout value and the ANT setSearchTimeout() method to set it to the maximum value before starting the search.
​      
Rank

Total Posts: 3

Joined 2023-11-13

PM

To extend the search timeout beyond the maximum value provided by the ANT library, you can implement a custom logic that retries the search multiple times with shorter timeouts. You can take:
- Determine the desired total search time: In your case, you want to extend the search timeout to 10 minutes. Convert this time to milliseconds (10 minutes = 600,000 milliseconds).
- Determine the number of retries: Decide how many times you want to retry the spacebar clicker search within the total search time. For example, if you want to retry every 30 seconds, you'll have 20 retries (600,000 milliseconds / 30,000 milliseconds).
- Implement the retry logic: Use a loop to perform the search with a shorter timeout and retry until the total search time or the maximum number of retries is reached.