Bug #400

Cyclic file reader thread using deprecated methods

Added by Espen Solbu over 5 years ago. Updated over 5 years ago.

Status:ClosedStart date:04/20/2012
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:SimulatorSpent time:-
Target version:2.0 Multiple models

Description

Android has deprecated Thread.stop()

I suggest implenting threads either as done in the cyclic update part of the dashboard, or the existing cyclic Simulator class (using Handlers and runnable)

Or as a full class like done in the DataLogger (class RawLogger for instance) - Implementing Runnable


Related issues

Related to Task #409: Refactor FileSimulator New 04/25/2012

Associated revisions

Revision 344
Added by Hans Cappelle over 5 years ago

refs #400 still requires proper shutdown of thread on closure of app and state onresume of sim activity isn't correct if thread has been started and stopped. Start/stop on itself works now. Also updated the way the file is handled.

History

#1 Updated by Espen Solbu over 5 years ago

  • Description updated (diff)

#2 Updated by Hans Cappelle over 5 years ago

Yes I'll go for a proper class anyway and implement some state.

WTF how can they just deprecate stop? And strange that I wasn't noticed by the javadoc?

#3 Updated by Espen Solbu over 5 years ago

Yea, I find that Android has a lot of best-practices, however finding them all is not as simple...

#4 Updated by Hans Cappelle over 5 years ago

It might be a better idea to create a service for this instead of a thread. As far as threads go on Android I keep running into AsyncTask but that really is for some predefined work, no iterations like for simulator.

#5 Updated by Espen Solbu over 5 years ago

I do not want a service for it. I would like it done the same way the exisiting cyclic simulator runs. Or alternately the way the individual dataloggers work. Async Task is not good for this, as order is not deterministic.

#6 Updated by Hans Cappelle over 5 years ago

  • Status changed from New to In Progress

Espen Solbu wrote:

I do not want a service for it. I would like it done the same way the exisiting cyclic simulator runs. Or alternately the way the individual dataloggers work. Async Task is not good for this, as order is not deterministic.

OK I see. With the Handler.postDelayed(Runnable) and then Runnable iterating over bytes sending a single frame per run (delayed over 10s). I will have to load the files into byte arrays up front then.

#7 Updated by Hans Cappelle over 5 years ago

  • Status changed from In Progress to Closed

Also available in: Atom PDF