WebRadioApp  0.1
_CoreTask.h
Go to the documentation of this file.
1 /*******************************************************************************
2 *
3 * E M B E D D E D W I Z A R D P R O J E C T
4 *
5 * Copyright (c) TARA Systems GmbH
6 * written by Paul Banach and Manfred Schweyer
7 *
8 ********************************************************************************
9 *
10 * This file was generated automatically by Embedded Wizard Studio.
11 *
12 * Please do not make any modifications of this file! The modifications are lost
13 * when the file is generated again by Embedded Wizard Studio!
14 *
15 * The template of this heading text can be found in the file 'head.ewt' in the
16 * directory 'Platforms' of your Embedded Wizard installation directory. If you
17 * wish to adapt this text, please copy the template file 'head.ewt' into your
18 * project directory and edit the copy only. Please avoid any modifications of
19 * the original template file!
20 *
21 * Version : 10.00
22 * Profile : STM32H747
23 * Platform : STM.STM32.RGB565
24 *
25 *******************************************************************************/
26 
27 #ifndef _CoreTask_H
28 #define _CoreTask_H
29 
30 #ifdef __cplusplus
31  extern "C"
32  {
33 #endif
34 
35 #include "ewrte.h"
36 #if EW_RTE_VERSION != 0x000A0000
37  #error Wrong version of Embedded Wizard Runtime Environment.
38 #endif
39 
40 #include "ewgfx.h"
41 #if EW_GFX_VERSION != 0x000A0000
42  #error Wrong version of Embedded Wizard Graphics Engine.
43 #endif
44 
45 /* Forward declaration of the class Core::Task */
46 #ifndef _CoreTask_
47  EW_DECLARE_CLASS( CoreTask )
48 #define _CoreTask_
49 #endif
50 
51 /* Forward declaration of the class Core::TaskQueue */
52 #ifndef _CoreTaskQueue_
53  EW_DECLARE_CLASS( CoreTaskQueue )
54 #define _CoreTaskQueue_
55 #endif
56 
57 
58 /* The class Core::Task provides the basic functionality for implementing tasks
59  which then can be scheduled for later execution. The execution of tasks is controlled
60  by instances of the class Core::TaskQueue.
61  Usually you will use this class to derive your own task class. In your task class
62  you can implement what to do when the task is started, canceled or completed.
63  For this purpose you can override the methods @OnStart(), @OnCancel(), @OnComplete()
64  and @OnContinue().
65  It is essential to understand, that the entire 'task' functionality has nothing
66  to do with multi-threading or multi-tasking features known from operating systems.
67  Applications developed with Chora are limited to a single-thread environment.
68  There is no real background thread activity. Accordingly your implementation
69  of a task should behave cooperatively. A well designed task should perform its
70  job quickly, use timers or effects to delay execution and when the job is done
71  reports its completion by calling the method @Complete(). */
72 EW_DEFINE_FIELDS( CoreTask, XObject )
73  EW_VARIABLE( queue, CoreTaskQueue )
74  EW_VARIABLE( prev, CoreTask )
75  EW_VARIABLE( next, CoreTask )
76 EW_END_OF_FIELDS( CoreTask )
77 
78 /* Virtual Method Table (VMT) for the class : 'Core::Task' */
79 EW_DEFINE_METHODS( CoreTask, XObject )
80  EW_METHOD( OnComplete, void )( CoreTask _this, CoreTaskQueue aQueue )
81  EW_METHOD( OnCancel, void )( CoreTask _this, CoreTaskQueue aQueue )
82  EW_METHOD( OnStart, void )( CoreTask _this, CoreTaskQueue aQueue )
83  EW_METHOD( Complete, void )( CoreTask _this )
84 EW_END_OF_METHODS( CoreTask )
85 
86 /* The method OnComplete() is called when the task is done with its work. The default
87  implementation of this method does nothing. You can override this method in derived
88  task classes and implement what to do when the task is finished. For example,
89  you can release resources used temporarily during animations.
90  To complete a task you should call explicitly the method @Complete(). The parameter
91  aQueue refers to the queue this task belonged to. It can be used e.g. to schedule
92  again a task to the same queue, etc. */
93 void CoreTask_OnComplete( CoreTask _this, CoreTaskQueue aQueue );
94 
95 /* Wrapper function for the virtual method : 'Core::Task.OnComplete()' */
96 void CoreTask__OnComplete( void* _this, CoreTaskQueue aQueue );
97 
98 /* The method OnCancel() is called when the task is canceled after being started.
99  The default implementation of this method does nothing. You can override this
100  method in derived task classes and implement what to do when the task is prematurely
101  aborted. For example, you can stop running timers and effects started in the
102  preceding @OnStart() method.
103  To cancel a task you should call explicitly the method @Cancel(). The parameter
104  aQueue refers to the queue this task belonged to. It can be used e.g. to schedule
105  again a task to the same queue, etc. */
106 void CoreTask_OnCancel( CoreTask _this, CoreTaskQueue aQueue );
107 
108 /* Wrapper function for the virtual method : 'Core::Task.OnCancel()' */
109 void CoreTask__OnCancel( void* _this, CoreTaskQueue aQueue );
110 
111 /* The method OnStart() is called at the begin of the execution of this task. The
112  default implementation of the method simply cancels the task causing the next
113  available task in the task queue to be started. You should override this method
114  in derived task classes to implement what the task should do.
115  There are three typical application cases how to implement the OnStart() method:
116  - In its simplest case the entire task algorithm is implemented in the OnStart()
117  method. In this case the method @Complete() should be called before leaving OnStart().
118  - If the task does take long time for execution by using timers or effects, you
119  should put in OnStart() the code necessary to start the timers/effects. Don't
120  forget to call @Complete() when all timers/effects are done.
121  - If the task is divided in many small execution steps, the OnStart() method
122  should call @Continue() to request the @OnContinue() method to be executed after
123  a short delay (usually after the next screen update). In @OnContinue() you can
124  perform the next step of the task. If necessary, @OnContinue() can also request
125  to be called again after a short delay. At the end of the task, after the last
126  step is terminated, don't forget to call @Complete().
127  The parameter aQueue refers to the queue this task belongs to. It can be used
128  to schedule more task to execute later. */
129 void CoreTask_OnStart( CoreTask _this, CoreTaskQueue aQueue );
130 
131 /* Wrapper function for the virtual method : 'Core::Task.OnStart()' */
132 void CoreTask__OnStart( void* _this, CoreTaskQueue aQueue );
133 
134 /* The method Complete() informs the task queue about the completion of this task.
135  Thereupon the next available task in the queue can be executed. This method is
136  usually called in context of the @OnStart() or @OnContinue() method when the
137  task has finalized its work. Calling the method for a not current task has no
138  effect. */
139 void CoreTask_Complete( CoreTask _this );
140 
141 /* Wrapper function for the virtual method : 'Core::Task.Complete()' */
142 void CoreTask__Complete( void* _this );
143 
144 /* The method Cancel() removes this task from the task queue where the task has
145  been previously scheduled. In the case the task is already in progress, the queue
146  will advise the task to abort its work immediately before the task is removed
147  from the queue (see @OnCancel()).
148  Whether a task is waiting for execution can be determined by @IsScheduled().
149  Whether a task is in progress can be determined by @IsCurrent().
150  Canceling a running task will cause the task queue to start the next available
151  task. */
152 void CoreTask_Cancel( CoreTask _this );
153 
154 /* The method IsCurrent() returns 'true' if the affected task is currently performed.
155  The method returns 'false' if the task is done, waiting for execution or it simply
156  doesn't belong to any task queue. */
157 XBool CoreTask_IsCurrent( CoreTask _this );
158 
159 #ifdef __cplusplus
160  }
161 #endif
162 
163 #endif /* _CoreTask_H */
164 
165 /* Embedded Wizard */
ewrte.h
CoreTask__Complete
void CoreTask__Complete(void *_this)
Definition: Core.c:6910
CoreTask_Cancel
void CoreTask_Cancel(CoreTask _this)
Definition: Core.c:6923
CoreTask_OnCancel
void CoreTask_OnCancel(CoreTask _this, CoreTaskQueue aQueue)
Definition: Core.c:6853
EW_END_OF_FIELDS
#define EW_END_OF_FIELDS(aClass)
Definition: ewrte.h:460
EW_DECLARE_CLASS
#define EW_DECLARE_CLASS(aClass)
Definition: ewrte.h:393
EW_VARIABLE
#define EW_VARIABLE(aName, aType)
Definition: ewrte.h:464
ewgfx.h
_obj_XObject
Definition: ewrte.h:281
XBool
char XBool
Definition: ewrte.h:1592
EW_DEFINE_METHODS
#define EW_DEFINE_METHODS(aClass, aSuperClass)
Definition: ewrte.h:524
CoreTask__OnCancel
void CoreTask__OnCancel(void *_this, CoreTaskQueue aQueue)
Definition: Core.c:6861
CoreTask_IsCurrent
XBool CoreTask_IsCurrent(CoreTask _this)
Definition: Core.c:6932
CoreTask__OnStart
void CoreTask__OnStart(void *_this, CoreTaskQueue aQueue)
Definition: Core.c:6893
EW_METHOD
EW_METHOD(OnComplete, void)(CoreTask _this
CoreTask_OnComplete
CoreTask_OnComplete
Definition: Core.c:6943
CoreTask__OnComplete
void CoreTask__OnComplete(void *_this, CoreTaskQueue aQueue)
Definition: Core.c:6840
aQueue
CoreTaskQueue aQueue CoreTaskQueue aQueue CoreTaskQueue aQueue CoreTaskQueue aQueue
Definition: _CoreTask.h:93
CoreTask_OnStart
void CoreTask_OnStart(CoreTask _this, CoreTaskQueue aQueue)
Definition: Core.c:6884
EW_END_OF_METHODS
#define EW_END_OF_METHODS(aClass)
Definition: ewrte.h:539
CoreTask_Complete
void CoreTask_Complete(CoreTask _this)
Definition: Core.c:6903
EW_DEFINE_FIELDS
#define EW_DEFINE_FIELDS(aClass, aSuperClass)
Definition: ewrte.h:451