OOSMOS API Reference
Allocate
AllocateVisible
AnalogMapAccurate
AnalogMapFast
AsyncBegin
AsyncDelayMS
AsyncEnd
AsyncFinally
AsyncWaitCond
AsyncWaitCond_TimeoutMS
AsyncWaitCond_TimeoutMS_Event
AsyncWaitCond_TimeoutMS_Exit
AsyncWaitEvent
AsyncWaitEvent_TimeoutMS
AsyncWaitEvent_TimeoutMS_Event
AsyncWaitEvent_TimeoutMS_Exit
AsyncYield
ChoiceInit
ClockSpeedInMHz
COMPLETE
CompositeInit
CompositeInitNoCode
CompositeInitNoDefault
CompositeInitNoDefaultNoCode
Debug
DebugCode
DEFAULT
DelayMS
DelaySeconds
DelayUS
EndProgram
ENTER
EXIT
FinalInit
FinalInitNoCode
INSTATE
IsInState
LeafInit
LeafInitNoCode
ORTHO
OrthoInit
OrthoInitNoCode
OrthoRegionInit
OrthoRegionInitNoCode
QueueConstruct
QueuePop
QueuePush
RegisterActiveObject
RunStateMachine
RunStateMachines
sActiveObject
sChoice
sComposite
SendEvent
sEvent
sFinal
sLeaf
sOrtho
sOrthoRegion
sQueue
sRegion
sStateMachine
sStateMachineNoQueue
sSubscriberList
StateMachineInit
StateMachineInitNoQueue
StateTimeoutMS
StateTimeoutSeconds
StateTimeoutUS
sTimeout
SubscriberListAdd
SubscriberListInit
SubscriberListNotify
SubscriberListNotifyWithArgs
TIMEOUT
TimeoutHasExpired
TimeoutInMS
TimeoutInSeconds
TimeoutInUS
Transition
TransitionAction
Allocate
AllocateVisible
AnalogMapAccurate
AnalogMapFast
AsyncBegin
AsyncDelayMS
AsyncEnd
AsyncFinally
AsyncWaitCond
AsyncWaitCond_TimeoutM...
AsyncWaitCond_TimeoutM...
AsyncWaitCond_TimeoutM...
AsyncWaitEvent
AsyncWaitEvent_Timeout...
AsyncWaitEvent_Timeout...
AsyncWaitEvent_Timeout...
AsyncYield
ChoiceInit
ClockSpeedInMHz
COMPLETE
CompositeInit
CompositeInitNoCode
CompositeInitNoDefault
CompositeInitNoDefault...
Debug
DebugCode
DEFAULT
DelayMS
DelaySeconds
DelayUS
EndProgram
ENTER
EXIT
FinalInit
FinalInitNoCode
INSTATE
IsInState
LeafInit
LeafInitNoCode
ORTHO
OrthoInit
OrthoInitNoCode
OrthoRegionInit
OrthoRegionInitNoCode
QueueConstruct
QueuePop
QueuePush
RegisterActiveObject
RunStateMachine
RunStateMachines
sActiveObject
sChoice
sComposite
SendEvent
sEvent
sFinal
sLeaf
sOrtho
sOrthoRegion
sQueue
sRegion
sStateMachine
sStateMachineNoQueue
sSubscriberList
StateMachineInit
StateMachineInitNoQueu...
StateTimeoutMS
StateTimeoutSeconds
StateTimeoutUS
sTimeout
SubscriberListAdd
SubscriberListInit
SubscriberListNotify
SubscriberListNotifyWi...
TIMEOUT
TimeoutHasExpired
TimeoutInMS
TimeoutInSeconds
TimeoutInUS
Transition
TransitionAction
Allocate
AllocateVisible
AnalogMapAccurate
AnalogMapFast
AsyncBegin
AsyncDelayMS
AsyncEnd
AsyncFinally
AsyncWaitCond
AsyncWaitCond_Timeou...
AsyncWaitCond_Timeou...
AsyncWaitCond_Timeou...
AsyncWaitEvent
AsyncWaitEvent_Timeo...
AsyncWaitEvent_Timeo...
AsyncWaitEvent_Timeo...
AsyncYield
ChoiceInit
ClockSpeedInMHz
COMPLETE
CompositeInit
CompositeInitNoCode
CompositeInitNoDefau...
CompositeInitNoDefau...
Debug
DebugCode
DEFAULT
DelayMS
DelaySeconds
DelayUS
EndProgram
ENTER
EXIT
FinalInit
FinalInitNoCode
INSTATE
IsInState
LeafInit
LeafInitNoCode
ORTHO
OrthoInit
OrthoInitNoCode
OrthoRegionInit
OrthoRegionInitNoCod...
QueueConstruct
QueuePop
QueuePush
RegisterActiveObject
RunStateMachine
RunStateMachines
sActiveObject
sChoice
sComposite
SendEvent
sEvent
sFinal
sLeaf
sOrtho
sOrthoRegion
sQueue
sRegion
sStateMachine
sStateMachineNoQueue
sSubscriberList
StateMachineInit
StateMachineInitNoQu...
StateTimeoutMS
StateTimeoutSeconds
StateTimeoutUS
sTimeout
SubscriberListAdd
SubscriberListInit
SubscriberListNotify
SubscriberListNotify...
TIMEOUT
TimeoutHasExpired
TimeoutInMS
TimeoutInSeconds
TimeoutInUS
Transition
TransitionAction
Allocate
AllocateVisible
AnalogMapAccurate
AnalogMapFast
AsyncBegin
AsyncDelayMS
AsyncEnd
AsyncFinally
AsyncWaitCond
AsyncWaitCond_Time...
AsyncWaitCond_Time...
AsyncWaitCond_Time...
AsyncWaitEvent
AsyncWaitEvent_Tim...
AsyncWaitEvent_Tim...
AsyncWaitEvent_Tim...
AsyncYield
ChoiceInit
ClockSpeedInMHz
COMPLETE
CompositeInit
CompositeInitNoCod...
CompositeInitNoDef...
CompositeInitNoDef...
Debug
DebugCode
DEFAULT
DelayMS
DelaySeconds
DelayUS
EndProgram
ENTER
EXIT
FinalInit
FinalInitNoCode
INSTATE
IsInState
LeafInit
LeafInitNoCode
ORTHO
OrthoInit
OrthoInitNoCode
OrthoRegionInit
OrthoRegionInitNoC...
QueueConstruct
QueuePop
QueuePush
RegisterActiveObje...
RunStateMachine
RunStateMachines
sActiveObject
sChoice
sComposite
SendEvent
sEvent
sFinal
sLeaf
sOrtho
sOrthoRegion
sQueue
sRegion
sStateMachine
sStateMachineNoQue...
sSubscriberList
StateMachineInit
StateMachineInitNo...
StateTimeoutMS
StateTimeoutSecond...
StateTimeoutUS
sTimeout
SubscriberListAdd
SubscriberListInit
SubscriberListNoti...
SubscriberListNoti...
TIMEOUT
TimeoutHasExpired
TimeoutInMS
TimeoutInSeconds
TimeoutInUS
Transition
TransitionAction
Allocate
AllocateVisible
AnalogMapAccurat...
AnalogMapFast
AsyncBegin
AsyncDelayMS
AsyncEnd
AsyncFinally
AsyncWaitCond
AsyncWaitCond_Ti...
AsyncWaitCond_Ti...
AsyncWaitCond_Ti...
AsyncWaitEvent
AsyncWaitEvent_T...
AsyncWaitEvent_T...
AsyncWaitEvent_T...
AsyncYield
ChoiceInit
ClockSpeedInMHz
COMPLETE
CompositeInit
CompositeInitNoC...
CompositeInitNoD...
CompositeInitNoD...
Debug
DebugCode
DEFAULT
DelayMS
DelaySeconds
DelayUS
EndProgram
ENTER
EXIT
FinalInit
FinalInitNoCode
INSTATE
IsInState
LeafInit
LeafInitNoCode
ORTHO
OrthoInit
OrthoInitNoCode
OrthoRegionInit
OrthoRegionInitN...
QueueConstruct
QueuePop
QueuePush
RegisterActiveOb...
RunStateMachine
RunStateMachines
sActiveObject
sChoice
sComposite
SendEvent
sEvent
sFinal
sLeaf
sOrtho
sOrthoRegion
sQueue
sRegion
sStateMachine
sStateMachineNoQ...
sSubscriberList
StateMachineInit
StateMachineInit...
StateTimeoutMS
StateTimeoutSeco...
StateTimeoutUS
sTimeout
SubscriberListAd...
SubscriberListIn...
SubscriberListNo...
SubscriberListNo...
TIMEOUT
TimeoutHasExpire...
TimeoutInMS
TimeoutInSeconds
TimeoutInUS
Transition
TransitionAction
Allocate
AllocateVisibl...
AnalogMapAccur...
AnalogMapFast
AsyncBegin
AsyncDelayMS
AsyncEnd
AsyncFinally
AsyncWaitCond
AsyncWaitCond_...
AsyncWaitCond_...
AsyncWaitCond_...
AsyncWaitEvent
AsyncWaitEvent...
AsyncWaitEvent...
AsyncWaitEvent...
AsyncYield
ChoiceInit
ClockSpeedInMH...
COMPLETE
CompositeInit
CompositeInitN...
CompositeInitN...
CompositeInitN...
Debug
DebugCode
DEFAULT
DelayMS
DelaySeconds
DelayUS
EndProgram
ENTER
EXIT
FinalInit
FinalInitNoCod...
INSTATE
IsInState
LeafInit
LeafInitNoCode
ORTHO
OrthoInit
OrthoInitNoCod...
OrthoRegionIni...
OrthoRegionIni...
QueueConstruct
QueuePop
QueuePush
RegisterActive...
RunStateMachin...
RunStateMachin...
sActiveObject
sChoice
sComposite
SendEvent
sEvent
sFinal
sLeaf
sOrtho
sOrthoRegion
sQueue
sRegion
sStateMachine
sStateMachineN...
sSubscriberLis...
StateMachineIn...
StateMachineIn...
StateTimeoutMS
StateTimeoutSe...
StateTimeoutUS
sTimeout
SubscriberList...
SubscriberList...
SubscriberList...
SubscriberList...
TIMEOUT
TimeoutHasExpi...
TimeoutInMS
TimeoutInSecon...
TimeoutInUS
Transition
TransitionActi...
Allocate
AllocateVisi...
AnalogMapAcc...
AnalogMapFas...
AsyncBegin
AsyncDelayMS
AsyncEnd
AsyncFinally
AsyncWaitCon...
AsyncWaitCon...
AsyncWaitCon...
AsyncWaitCon...
AsyncWaitEve...
AsyncWaitEve...
AsyncWaitEve...
AsyncWaitEve...
AsyncYield
ChoiceInit
ClockSpeedIn...
COMPLETE
CompositeIni...
CompositeIni...
CompositeIni...
CompositeIni...
Debug
DebugCode
DEFAULT
DelayMS
DelaySeconds
DelayUS
EndProgram
ENTER
EXIT
FinalInit
FinalInitNoC...
INSTATE
IsInState
LeafInit
LeafInitNoCo...
ORTHO
OrthoInit
OrthoInitNoC...
OrthoRegionI...
OrthoRegionI...
QueueConstru...
QueuePop
QueuePush
RegisterActi...
RunStateMach...
RunStateMach...
sActiveObjec...
sChoice
sComposite
SendEvent
sEvent
sFinal
sLeaf
sOrtho
sOrthoRegion
sQueue
sRegion
sStateMachin...
sStateMachin...
sSubscriberL...
StateMachine...
StateMachine...
StateTimeout...
StateTimeout...
StateTimeout...
sTimeout
SubscriberLi...
SubscriberLi...
SubscriberLi...
SubscriberLi...
TIMEOUT
TimeoutHasEx...
TimeoutInMS
TimeoutInSec...
TimeoutInUS
Transition
TransitionAc...
Allocate
AllocateVi...
AnalogMapA...
AnalogMapF...
AsyncBegin
AsyncDelay...
AsyncEnd
AsyncFinal...
AsyncWaitC...
AsyncWaitC...
AsyncWaitC...
AsyncWaitC...
AsyncWaitE...
AsyncWaitE...
AsyncWaitE...
AsyncWaitE...
AsyncYield
ChoiceInit
ClockSpeed...
COMPLETE
CompositeI...
CompositeI...
CompositeI...
CompositeI...
Debug
DebugCode
DEFAULT
DelayMS
DelaySecon...
DelayUS
EndProgram
ENTER
EXIT
FinalInit
FinalInitN...
INSTATE
IsInState
LeafInit
LeafInitNo...
ORTHO
OrthoInit
OrthoInitN...
OrthoRegio...
OrthoRegio...
QueueConst...
QueuePop
QueuePush
RegisterAc...
RunStateMa...
RunStateMa...
sActiveObj...
sChoice
sComposite
SendEvent
sEvent
sFinal
sLeaf
sOrtho
sOrthoRegi...
sQueue
sRegion
sStateMach...
sStateMach...
sSubscribe...
StateMachi...
StateMachi...
StateTimeo...
StateTimeo...
StateTimeo...
sTimeout
Subscriber...
Subscriber...
Subscriber...
Subscriber...
TIMEOUT
TimeoutHas...
TimeoutInM...
TimeoutInS...
TimeoutInU...
Transition
Transition...

oosmos_Allocate

oosmos_Allocate is a macro that returns a pointer to an unused object from a fixed number of statically preallocated objects. The static preallocation is done automatically within the macro. Once allocated, objects cannot be returned to the pool. See the example on line 64.
If you need dynamic memory, use malloc in place of this function and then create a complementary toggleDelete function and then do a free to release it.
1
2
3
 
Type * oosmos_Allocate(Pointer, Type, Elements, pOutOfMemory);
 
Prototype
Pointer
The name of the variable that will hold the pointer to the allocated object. You'll use this to initialize your object's members, including the state machine (if the object has one). You must return this pointer to the caller. (See toggle.c line 79 below.)
Type
The data type of the object. (See line 28 of toggle.h below.)
Elements
The number of objects to pre-allocate. You can specify a number here, but it would be better to use the macro technique used in lines 27-29 of the toggle.c where you specify a default amount that can be overridden on the compilation command line. This is commonly done with most compilers like this: -D toggleMax=10.
pOutOfMemory
The address of a subroutine to call if all preallocated objects have been exhausted. See type oosmos_tOutOfMemory for information about how to implement the called routine.
If NULL, oosmos_Allocate will loop forever when all objects of this type are exhausted.
See Also
1
22
23
27
28
29
30
31
32
[GPLv2]
 
#ifndef ...
 
typedef struct toggleTag toggle;
 
extern toggle * toggleNew(pin * pPin, int TimeOnMS, int TimeOffMS);
 
#endif
oosmos/Classes/toggle.h
1
22
23
26
27
28
29
30
31
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
[GPLv2]
 
[...]
 
#ifndef toggleMAX
#define toggleMAX 4
#endif
 
[...]
 
extern toggle * toggleNew(pin * pPin, const int TimeOnMS, const int TimeOffMS)
{
oosmos_Allocate(pToggle, toggle, toggleMAX, NULL);
 
// StateName Parent Default
// ========================================================
oosmos_StateMachineInitNoQueue(pToggle, StateMachine, NULL, Running_State);
oosmos_LeafInit (pToggle, Running_State, StateMachine );
 
pToggle->m_pPin = pPin;
pToggle->m_TimeOnMS = TimeOnMS;
pToggle->m_TimeOffMS = TimeOffMS;
 
oosmos_DebugCode(
oosmos_Debug(&pToggle->StateMachine, true, NULL);
)
 
return pToggle;
}
oosmos/Classes/toggle.c

oosmos_AllocateVisible

oosmos_AllocateVisible is functionally the same as oosmos_Allocate but allows the user to allocate the array of objects in an outer scope thereby allowing access to that array by other parts of the implementation of the object. (See line 80 of the example below.)
1
2
3
 
Type * oosmos_AllocateVisible(Pointer, Type, List, Count, Elements, pOutOfMemory);
 
Prototype
Pointer
The name of the variable that will hold the pointer to the allocated object. You'll use this to initialize your object's members, including the state machine (if the object has one). You must return this pointer to the caller (see line 87).
Type
The data type of the object. (See line 31 of Interrupt.c.)
List
The address of the array of objects you pre-allocated. (See line 45.)
Count
The number of objects that have been returned from oosmos_AllocateVisible. (See line 46.)
Elements
The number of objects to pre-allocate.
pOutOfMemory
The address of a subroutine to call if all preallocated objects have been exhausted. See type oosmos_tOutOfMemory for information about how to implement the called routine.
If NULL is specified, oosmos_AllocateVisible will loop forever when all objects of this type are exhausted.
See Also
1
22
23
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
62
63
77
78
79
80
81
82
83
84
85
86
87
88
89
90
107
108
109
110
[GPLv2]
 
[...]
 
//
// Demonstrates structure of how to react to interrupts using OOSMOS.
//
 
typedef struct uartTag uart;
 
struct uartTag
{
uint8_t m_UartId;
 
oosmos_sQueue m_ReceiveDataQueue;
uint8_t m_ReceiveDataQueueData[10];
 
oosmos_sActiveObject m_ActiveObject;
};
 
#define MAX_UARTS 5
 
static uart UartList[MAX_UARTS];
static int UartCount;
 
static void ReceiverStateMachine(...) {...}
 
static void ISR(...) {...}
return;
}
}
 
extern uart * uartNew(const int UartId)
{
oosmos_AllocateVisible(pUART, uart, UartList, UartCount, MAX_UARTS, NULL);
 
pUART->m_UartId = (uint8_t) UartId;
 
oosmos_QueueConstruct(&pUART->m_ReceiveDataQueue, pUART->m_ReceiveDataQueueData);
oosmos_RegisterActiveObject(pUART, ReceiverStateMachine, &pUART->m_ActiveObject);
 
extern int main() {...}
 
return 0;
}
 
oosmos/Examples/Interrupt/Windows/Interrupt.c

oosmos_AnalogMapAccurate

Scales a value from a point within one range to the proportionate point in a different range. This function uses a floating point type to guarantee the most accurate result. If speed is more important than accuracy, use oosmos_AnalogMapFast.
See example on line 33, below.
1
2
3
 
float oosmos_AnalogMapAccurate(float Value, float InMin, float InMax, float OutMin, float OutMax);
 
Prototype
Value
The value to be scaled.
InMin
The low end of the source range.
InMax
The high end of the source range.
OutMin
The low end of the target range.
OutMax
The high end of the target range.
RETURN
Returns the scaled number as a floating point value.
See Also
1
22
23
30
31
32
33
34
35
36
37
38
39
40
[GPLv2]
 
[...]
 
static void TestAccurate(float Value, float InMin, float InMax, float OutMin, float OutMax)
{
const float Result = oosmos_AnalogMapAccurate(Value, InMin, InMax, OutMin, OutMax);
long IntResult;
 
printf("Value:%f, InMin:%f, InMax:%f, OutMin:%f, OutMax:%f, Result:%f\n", Value, InMin, InMax, OutMin, OutMax, Result);
 
IntResult = (long) (Result + .5f);
AccurateDistribution[IntResult]++;
[...]
oosmos/Examples/AnalogMap/Windows/AnalogMap.c

oosmos_AnalogMapFast

Scales a value from a point within one range to the proportionate point in a different range. This function uses a long integral data type in order to calculate the result quickly. If accuracy is more important than speed, use oosmos_AnalogMapAccurate.
See example on line 42, below.
1
2
3
 
long oosmos_AnalogMapFast(long Value, long InMin, long InMax, long OutMin, long OutMax);
 
Prototype
Value
The value to be scaled.
InMin
The low end of the source range.
InMax
The high end of the source range.
OutMin
The low end of the target range.
OutMax
The high end of the target range.
RETURN
Returns the scaled number as a long integral value.
See Also
1
22
23
39
40
41
42
43
44
45
46
47
48
[GPLv2]
 
[...]
AccurateDistribution[IntResult]++;
}
 
static void TestFast(long Value, long InMin, long InMax, long OutMin, long OutMax)
{
const long Result = oosmos_AnalogMapFast(Value, InMin, InMax, OutMin, OutMax);
printf("Value:%ld, InMin:%ld, InMax:%ld, OutMin:%ld, OutMax:%ld, Result:%ld\n", Value, InMin, InMax, OutMin, OutMax, Result);
 
FastDistribution[Result]++;
[...]
oosmos/Examples/AnalogMap/Windows/AnalogMap.c

oosmos_AsyncBegin

oosmos_AsyncBegin and oosmos_AsyncEnd bracket OOSMOS Async calls within and oosmos_INSTATE event handler.
See line 47 in the code snippet below for an example.
1
2
3
 
oosmos_AsyncBegin(oosmos_sRegion * pRegion);
 
Prototype
pRegion
The same pRegion argument that was passed into the containing state handler.
See Also
1
22
23
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
[GPLv2]
 
[...]
 
static bool Running_State_Code(void * pObject, oosmos_sRegion * pRegion, const oosmos_sEvent * pEvent)
{
toggle * pToggle = (toggle *) pObject;
 
switch (pEvent->Code) {
case oosmos_INSTATE:
oosmos_AsyncBegin(pRegion);
while (true) {
pinOn(pToggle->m_pPin);
oosmos_AsyncDelayMS(pRegion, pToggle->m_TimeOnMS);
 
pinOff(pToggle->m_pPin);
oosmos_AsyncDelayMS(pRegion, pToggle->m_TimeOffMS);
}
oosmos_AsyncEnd(pRegion);
return true;
}
 
return false;
}
 
[...]
oosmos/Classes/toggle.c

oosmos_AsyncDelayMS

oosmos_AsyncDelayMS blocks the current object for the specified number of Milliseconds.
Note that this is an object blocker, not a thread blocker.
See line 110 in the code snippet below for an example.
1
2
3
 
bool oosmos_AsyncDelayMS(oosmos_sRegion * pRegion, int Milliseconds);
 
Prototype
pRegion
The same pRegion argument that was passed into the containing state handler.
Milliseconds
The number of milliseconds to suspend the object.
See Also
1
22
23
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
[GPLv2]
 
[...]
 
 
//
// Test oosmos_AsyncDelayMS.
//
static bool Ortho_RegionA_TestA_State_Code(void * pObject, oosmos_sRegion * pRegion, const oosmos_sEvent * pEvent)
{
asynctest * pAsyncTest = (asynctest *) pObject;
 
switch (pEvent->Code) {
case oosmos_INSTATE:
oosmos_AsyncBegin(pRegion);
prtFormatted("Test AsyncDelayMS...\n");
oosmos_AsyncDelayMS(pRegion, 100);
oosmos_AsyncEnd(pRegion);
 
return oosmos_Transition(pRegion, &pAsyncTest->Ortho_RegionA_TestB_State);
}
 
return false;
}
 
[...]
oosmos/Classes/Tests/asynctest.c

oosmos_AsyncEnd

oosmos_AsyncBegin and oosmos_AsyncEnd bracket OOSMOS Async calls within and oosmos_INSTATE event handler.
See line 55 in the code snippet below for an example.
1
2
3
 
oosmos_AsyncEnd(oosmos_sRegion * pRegion);
 
Prototype
pRegion
The same pRegion argument that was passed into the containing state handler.
See Also
1
22
23
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
[GPLv2]
 
[...]
 
static bool Running_State_Code(void * pObject, oosmos_sRegion * pRegion, const oosmos_sEvent * pEvent)
{
toggle * pToggle = (toggle *) pObject;
 
switch (pEvent->Code) {
case oosmos_INSTATE:
oosmos_AsyncBegin(pRegion);
while (true) {
pinOn(pToggle->m_pPin);
oosmos_AsyncDelayMS(pRegion, pToggle->m_TimeOnMS);
 
pinOff(pToggle->m_pPin);
oosmos_AsyncDelayMS(pRegion, pToggle->m_TimeOffMS);
}
oosmos_AsyncEnd(pRegion);
return true;
}
 
return false;
}
 
[...]
oosmos/Classes/toggle.c

oosmos_AsyncFinally

oosmos_AsyncFinally is an optional construct that begins a section of code to be executed before exiting the Async block. It is always used in cooperation with one of the _Exit forms of Async, namely oosmos_AsyncWaitCond_TimeoutMS_Exit and oosmos_AsyncWaitEvent_TimeoutMS_Exit.
oosmos_AsyncFinally and its code must be placed immediately before the oosmos_AsyncEnd.
See asynctest.c, below, line 208 for an example.
1
2
3
 
oosmos_AsyncFinally(oosmos_sRegion * pRegion)
 
Prototype
pRegion
The same pRegion argument that was passed into the containing state handler.
See Also
1
22
23
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
[GPLv2]
 
[...]
 
//
// oosmos_AsyncWaitCond_TimeoutMS_Exit
//
static bool Ortho_RegionA_TestD_State_Code(void * pObject, oosmos_sRegion * pRegion, const oosmos_sEvent * pEvent)
{
asynctest * pAsyncTest = (asynctest *) pObject;
 
switch (pEvent->Code) {
case oosmos_INSTATE:
oosmos_AsyncBegin(pRegion);
prtFormatted("Test AsyncWaitCond_TimeoutMS_Exit...\n");
 
oosmos_AsyncWaitCond_TimeoutMS_Exit(pRegion, 100,
ConditionTrue()
);
Successes += 1;
 
oosmos_AsyncWaitCond_TimeoutMS_Exit(pRegion, 100,
ConditionFalse()
);
Failures += 1;
 
oosmos_AsyncFinally(pRegion);
Successes += 1;
oosmos_Transition(pRegion, &pAsyncTest->Ortho_RegionA_TestE_State);
 
oosmos_AsyncEnd(pRegion);
return true;
}
 
return false;
}
 
[...]
oosmos/Classes/Tests/asynctest.c

oosmos_AsyncWaitCond

oosmos_AsyncWaitCond effectively blocks execution of this object until a condition is met. See line 133 in the code snippet below for an example.
This form of AsyncWaitCond does not accept a timeout, so you must be certain that the condition will be met eventually. There are other forms of AsyncWaitCond that do accept a timeout value.
1
2
3
 
bool oosmos_AsyncWaitCond(oosmos_sRegion * pRegion, bool Condition);
 
Prototype
pRegion
The same pRegion argument that was passed into the containing state handler.
Condition
When this condition is false, OOSMOS returns from the function to run other objects and then re-enters this statement to check the condition again. It keeps doing this until the condition is true, and then execution continues to the next statement.
See Also
1
22
23
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
[GPLv2]
 
[...]
 
//
// oosmos_AsyncWaitCond
// oosmos_AsyncWaitCond_TimeoutMS
//
static bool Ortho_RegionA_TestB_State_Code(void * pObject, oosmos_sRegion * pRegion, const oosmos_sEvent * pEvent)
{
asynctest * pAsyncTest = (asynctest *) pObject;
bool TimedOut;
 
switch (pEvent->Code) {
case oosmos_INSTATE:
oosmos_AsyncBegin(pRegion);
prtFormatted("Test AsyncWaitCond...\n");
 
oosmos_AsyncWaitCond(pRegion, ConditionRandom(2));
 
prtFormatted("Test AsyncWaitCond_TimeoutMS...\n");
 
oosmos_AsyncWaitCond_TimeoutMS(pRegion, 100, &TimedOut,
ConditionTrue()
);
Successes += (TimedOut == false);
 
oosmos_AsyncWaitCond_TimeoutMS(pRegion, 100, &TimedOut,
ConditionFalse()
);
Successes += (TimedOut == true);
oosmos_AsyncEnd(pRegion);
 
return oosmos_Transition(pRegion, &pAsyncTest->Ortho_RegionA_TestC_State);
}
 
return false;
}
 
[...]
oosmos/Classes/Tests/asynctest.c

oosmos_AsyncWaitCond_TimeoutMS

oosmos_AsyncWaitCond_TimeoutMS effectively blocks execution of this object until a condition is met or a timeout expires. See lines 137-139 and 142-144 in the code snippet below for examples.
1
2
3
4
5
6
 
bool oosmos_AsyncWaitCond_TimeoutMS(oosmos_sRegion * pRegion,
int Timeout,
bool * pTimeoutStatus,
bool Condition);
 
Prototype
pRegion
The same pRegion argument that was passed into the containing state handler.
Timeout
The timeout value in milliseconds.
pTimeoutStatus
The address of a bool variable that will indicate whether the timeout expired first (true) or the condition occurred first (false).
Condition
When this condition is false, OOSMOS returns from the function to run other objects and then re-enters this statement to check the condition again. It keeps doing this until the condition is true and then execution continues to the next statement.
See Also
1
22
23
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
[GPLv2]
 
[...]
 
//
// oosmos_AsyncWaitCond
// oosmos_AsyncWaitCond_TimeoutMS
//
static bool Ortho_RegionA_TestB_State_Code(void * pObject, oosmos_sRegion * pRegion, const oosmos_sEvent * pEvent)
{
asynctest * pAsyncTest = (asynctest *) pObject;
bool TimedOut;
 
switch (pEvent->Code) {
case oosmos_INSTATE:
oosmos_AsyncBegin(pRegion);
prtFormatted("Test AsyncWaitCond...\n");
 
oosmos_AsyncWaitCond(pRegion, ConditionRandom(2));
 
prtFormatted("Test AsyncWaitCond_TimeoutMS...\n");
 
oosmos_AsyncWaitCond_TimeoutMS(pRegion, 100, &TimedOut,
ConditionTrue()
);
Successes += (TimedOut == false);
 
oosmos_AsyncWaitCond_TimeoutMS(pRegion, 100, &TimedOut,
ConditionFalse()
);
Successes += (TimedOut == true);
oosmos_AsyncEnd(pRegion);
 
return oosmos_Transition(pRegion, &pAsyncTest->Ortho_RegionA_TestC_State);
}
 
return false;
}
 
[...]
oosmos/Classes/Tests/asynctest.c

oosmos_AsyncWaitCond_TimeoutMS_Event

oosmos_AsyncWaitCond_TimeoutMS_Event effectively blocks execution of this object until a condition is met or a timeout expires. See lines 166-168 and 171-173 in the code snippet below for examples. Line 178 is where the event is handled.
1
2
3
 
bool oosmos_AsyncWaitCond_TimeoutMS_Event(oosmos_sRegion * pRegion, int TimeoutMS, int NotificationEventCode, bool Condition);
 
Prototype
pRegion
The same pRegion argument that was passed into the containing state handler.
Timeout
The timeout value in milliseconds.
NotificationEventCode
The event code to send to the current object when a timeout occurs.
Condition
When this condition is false, OOSMOS returns from the function to run other objects and then re-enters this statement to check the condition again. It keeps doing this until the condition is true and then execution continues to the next statement.
See Also
1
22
23
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
[GPLv2]
 
[...]
 
//
// oosmos_AsyncWaitCond_TimeoutMS_Event
//
static bool Ortho_RegionA_TestC_State_Code(void * pObject, oosmos_sRegion * pRegion, const oosmos_sEvent * pEvent)
{
asynctest * pAsyncTest = (asynctest *) pObject;
 
switch (pEvent->Code) {
case oosmos_INSTATE:
oosmos_AsyncBegin(pRegion);
prtFormatted("Test AsyncWaitCond_TimeoutMS_Event...\n");
 
oosmos_AsyncWaitCond_TimeoutMS_Event(pRegion, 100, eventTimedOut,
ConditionTrue()
);
Successes += 1;
 
oosmos_AsyncWaitCond_TimeoutMS_Event(pRegion, 100, eventTimedOut,
ConditionFalse()
);
Failures += 1;
oosmos_AsyncEnd(pRegion);
return oosmos_Transition(pRegion, &pAsyncTest->Ortho_RegionA_TestD_State);
 
case eventTimedOut:
Successes += 1;
return true;
}
 
return false;
}
 
[...]
oosmos/Classes/Tests/asynctest.c

oosmos_AsyncWaitCond_TimeoutMS_Exit

oosmos_AsyncWaitCond_TimeoutMS_Event effectively blocks execution of this object until a condition is met or a timeout expires.
See lines 198-200 and 203-205 in the code snippet below for examples.
1
2
3
 
bool oosmos_AsyncWaitCond_TimeoutMS_Exit(oosmos_sRegion * pRegion, int TimeoutMS, bool Condition);
 
Prototype
pRegion
The same pRegion argument that was passed into the containing state handler.
Timeout
The timeout value in milliseconds.
Condition
When this condition is false, OOSMOS returns from the function to run other objects and then re-enters this statement to check the condition again. It keeps doing this until the condition is true and then execution continues to the next statement.
See Also
1
22
23
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
[GPLv2]
 
[...]
 
//
// oosmos_AsyncWaitCond_TimeoutMS_Exit
//
static bool Ortho_RegionA_TestD_State_Code(void * pObject, oosmos_sRegion * pRegion, const oosmos_sEvent * pEvent)
{
asynctest * pAsyncTest = (asynctest *) pObject;
 
switch (pEvent->Code) {
case oosmos_INSTATE:
oosmos_AsyncBegin(pRegion);
prtFormatted("Test AsyncWaitCond_TimeoutMS_Exit...\n");
 
oosmos_AsyncWaitCond_TimeoutMS_Exit(pRegion, 100,
ConditionTrue()
);
Successes += 1;
 
oosmos_AsyncWaitCond_TimeoutMS_Exit(pRegion, 100,
ConditionFalse()
);
Failures += 1;
 
oosmos_AsyncFinally(pRegion);
Successes += 1;
oosmos_Transition(pRegion, &pAsyncTest->Ortho_RegionA_TestE_State);
 
oosmos_AsyncEnd(pRegion);
return true;
}
 
return false;
}
 
[...]
oosmos/Classes/Tests/asynctest.c

oosmos_AsyncWaitEvent

oosmos_AsyncWaitEvent effectively blocks execution of this object until the specified event is received. See line 234 in the code snippet below for an example.
This form of AsyncWaitEvent does not accept a timeout, so you should be certain that the event will be received eventually. There are other forms of AsyncWaitEvent that do accept a timeout value.
1
2
3
 
bool oosmos_AsyncWaitEvent(oosmos_sRegion * pRegion, const oosmos_sEvent * pEvent, int WaitEventCode);
 
Prototype
pRegion
The same pRegion argument that was passed into the containing state handler.
pEvent
The same pEvent argument that was passed into the containing state handler.
WaitEventCode
The event code that must be received before execution can continue.
See Also
1
22
23
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
[GPLv2]
 
[...]
 
//
// oosmos_AsyncWaitEvent
// oosmos_AsyncWaitEvent_TimeoutMS
//
static bool Ortho_RegionA_TestE_State_Code(void * pObject, oosmos_sRegion * pRegion, const oosmos_sEvent * pEvent)
{
asynctest * pAsyncTest = (asynctest *) pObject;
bool TimedOut;
 
switch (pEvent->Code) {
case oosmos_INSTATE:
oosmos_AsyncBegin(pRegion);
prtFormatted("Test AsyncWaitEvent...\n");
 
oosmos_SendEvent(pAsyncTest, eventPrint);
oosmos_AsyncWaitEvent(pRegion, pEvent, eventDone);
 
prtFormatted("Test AsyncWaitEvent_TimeoutMS...\n");
 
oosmos_SendEvent(pAsyncTest, eventPrint);
oosmos_AsyncWaitEvent_TimeoutMS(pRegion, pEvent, 100, &TimedOut,
eventDone
);
Successes += (TimedOut == false);
 
oosmos_AsyncWaitEvent_TimeoutMS(pRegion, pEvent, 100, &TimedOut,
eventDone
);
Successes += (TimedOut == true);
oosmos_AsyncEnd(pRegion);
 
return oosmos_Transition(pRegion, &pAsyncTest->Ortho_RegionA_TestF_State);
}
 
return false;
}
 
[...]
oosmos/Classes/Tests/asynctest.c

oosmos_AsyncWaitEvent_TimeoutMS

oosmos_AsyncWaitEvent_TimeoutMS effectively blocks execution of this object until a condition is met or a timeout expires. See lines 239-241 and 244-246 in the code snippet below for examples.
1
2
3
4
5
6
7
 
bool oosmos_AsyncWaitEvent_TimeoutMS(oosmos_sRegion * pRegion,
const oosmos_sEvent * pEvent,
int TimeoutMS,
bool * pTimeoutStatus,
int WaitEventCode);
 
Prototype
pRegion
The same pRegion argument that was passed into the containing state handler.
pEvent
The same pEvent argument that was passed into the containing state handler.
TimeoutMS
The timeout value in milliseconds.
pTimeoutStatus
The address of a bool variable that will indicate whether the timeout expired first (true) or the condition occurred first (false).
WaitEventCode
The event code that must be received before execution can continue.
See Also
1
22
23
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
[GPLv2]
 
[...]
 
//
// oosmos_AsyncWaitEvent
// oosmos_AsyncWaitEvent_TimeoutMS
//
static bool Ortho_RegionA_TestE_State_Code(void * pObject, oosmos_sRegion * pRegion, const oosmos_sEvent * pEvent)
{
asynctest * pAsyncTest = (asynctest *) pObject;
bool TimedOut;
 
switch (pEvent->Code) {
case oosmos_INSTATE:
oosmos_AsyncBegin(pRegion);
prtFormatted("Test AsyncWaitEvent...\n");
 
oosmos_SendEvent(pAsyncTest, eventPrint);
oosmos_AsyncWaitEvent(pRegion, pEvent, eventDone);
 
prtFormatted("Test AsyncWaitEvent_TimeoutMS...\n");
 
oosmos_SendEvent(pAsyncTest, eventPrint);
oosmos_AsyncWaitEvent_TimeoutMS(pRegion, pEvent, 100, &TimedOut,
eventDone
);
Successes += (TimedOut == false);
 
oosmos_AsyncWaitEvent_TimeoutMS(pRegion, pEvent, 100, &TimedOut,
eventDone
);
Successes += (TimedOut == true);
oosmos_AsyncEnd(pRegion);
 
return oosmos_Transition(pRegion, &pAsyncTest->Ortho_RegionA_TestF_State);
}
 
return false;
}
 
[...]
oosmos/Classes/Tests/asynctest.c

oosmos_AsyncWaitEvent_TimeoutMS_Event

oosmos_AsyncWaitEvent_TimeoutMS_Event effectively blocks execution of this object until the specified event is received or a timeout expires.
See lines 273-275 and 281-283 in the code snippet below for examples and line 288 for an example of the timeout event handler.
1
2
3
4
5
6
7
 
bool OOSMOS_AsyncWaitEvent_TimeoutMS_Event(oosmos_sRegion * pRegion,
const oosmos_sEvent * pEvent,
int TimeoutMS,
int NotificationEventCode,
int WaitEventCode);
 
Prototype
pRegion
The same pRegion argument that was passed into the containing state handler.
TimeoutMS
The timeout value in milliseconds.
NotificationEventCode
If the timeout expires, NotificationEventCode is sent to the current object.
WaitEventCode
The event code that must be received before execution can continue.
See Also
1
22
23
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
[GPLv2]
 
[...]
 
//
// oosmos_AsyncWaitEvent_TimeoutMS_Event
//
static bool Ortho_RegionA_TestF_State_Code(void * pObject, oosmos_sRegion * pRegion, const oosmos_sEvent * pEvent)
{
asynctest * pAsyncTest = (asynctest *) pObject;
 
switch (pEvent->Code) {
case oosmos_INSTATE:
oosmos_AsyncBegin(pRegion);
prtFormatted("Test AsyncWaitEvent_TimeoutMS_Event...\n");
 
//
// Enqueue 'eventPrint' to the orthogonal state. We expect to get and 'eventDone' well
// before the timeout.
//
oosmos_SendEvent(pAsyncTest, eventPrint);
oosmos_AsyncWaitEvent_TimeoutMS_Event(pRegion, pEvent, 100, eventTimedOut,
eventDone
);
Successes += 1;
 
//
// We don't enqueue 'eventPrint' so we don't expect an 'eventDone' therefore it should time out.
//
oosmos_AsyncWaitEvent_TimeoutMS_Event(pRegion, pEvent, 100, eventTimedOut,
eventDone
);
Failures += 1;
oosmos_AsyncEnd(pRegion);
return oosmos_Transition(pRegion, &pAsyncTest->Ortho_RegionA_TestG_State);
 
case eventTimedOut:
Successes += 1;
return true;
}
 
return false;
}
 
[...]
oosmos/Classes/Tests/asynctest.c

oosmos_AsyncWaitEvent_TimeoutMS_Exit

oosmos_AsyncWaitEvent_TimeoutMS_Exit effectively blocks execution of this object until the specified event is received or a timeout expires. If the timeout expires before receiving the WaitEventCode, we exit the Async block.
See lines 313-315 and 321-323 in the code snippet below for examples. Line 326 specifies an oosmos_AsyncFinally to execute before exiting.
1
2
3
4
5
6
 
bool oosmos_AsyncWaitEvent_TimeoutMS_Exit(oosmos_sRegion * pRegion,
const oosmos_sEvent * pEvent,
int TimeoutMS,
int WaitEventCode);
 
Prototype
pRegion
The same pRegion argument that was passed into the containing state handler.
pEvent
The same pEvent argument that was passed into the containing state handler.
TimeoutMS
The timeout value in milliseconds.
WaitEventCode
If the WaitEventCode has not yet been delivered, OOSMOS returns from the function to run other objects and then re-enters this statement to check again if the event has been delivered. It keeps doing this until either the event is received or the timeout expires. If the event is received, execution continues to the next statement. If the timeout has expired, then we exit the Async block, executing the oosmos_AsyncFinally block if one was specified.
See Also
1
22
23
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
[GPLv2]
 
[...]
 
//
// oosmos_AsyncWaitEvent_TimeoutMS_Exit
//
static bool Ortho_RegionA_TestG_State_Code(void * pObject, oosmos_sRegion * pRegion, const oosmos_sEvent * pEvent)
{
asynctest * pAsyncTest = (asynctest *) pObject;
 
switch (pEvent->Code) {
case oosmos_INSTATE:
oosmos_AsyncBegin(pRegion);
prtFormatted("Test AsyncWaitEvent_TimeoutMS_Exit...\n");
 
//
// Enqueue 'eventPrint' to the orthogonal state. We expect to get and 'eventDone' well
// before the timeout.
//
oosmos_SendEvent(pAsyncTest, eventPrint);
oosmos_AsyncWaitEvent_TimeoutMS_Exit(pRegion, pEvent, 100,
eventDone
);
Successes += 1;
 
//
// We don't enqueue 'eventPrint' so we don't expect an 'eventDone' therefore it should time out.
//
oosmos_AsyncWaitEvent_TimeoutMS_Exit(pRegion, pEvent, 100,
eventDone
);
Failures += 1;
 
oosmos_AsyncFinally(pRegion);
oosmos_Transition(pRegion, &pAsyncTest->Ortho_RegionA_Done_State);
 
oosmos_AsyncEnd(pRegion);
return true;
}
 
return false;
}
 
[...]
oosmos/Classes/Tests/asynctest.c

oosmos_AsyncYield

If you have a loop that will use a lot of CPU time, it could hold up execution of other OOSMOS objects in the system, you can use the oosmos_AsyncYield call to relinquish control occasionally in your loop.
See line 55 in the code snippet below for an example. In this example, we relinquish control every time through the loop, but you could use the C modulo operator (%) to relinquish every N iterations through the loop.
1
2
3
 
oosmos_AsyncYield(oosmos_sRegion * pRegion);
 
Prototype
pRegion
The same pRegion argument that was passed into the containing state handler.
See Also
1
22
23
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
[GPLv2]
 
[...]
 
//
// Test oosmos_asyncyieldtest.
//
static bool Running_State_Code(void * pObject, oosmos_sRegion * pRegion, const oosmos_sEvent * pEvent)
{
asyncyieldtest * pAsyncYieldTest = (asyncyieldtest *) pObject;
 
switch (pEvent->Code) {
case oosmos_INSTATE:
oosmos_AsyncBegin(pRegion);
for (pAsyncYieldTest->m_Count = 1; pAsyncYieldTest->m_Count <= pAsyncYieldTest->m_Iterations; pAsyncYieldTest->m_Count++) {
prtFormatted("Test asyncyieldtest, '%s'...\n", pAsyncYieldTest->m_pID);
oosmos_AsyncYield(pRegion);
}
oosmos_AsyncEnd(pRegion);
 
return oosmos_Transition(pRegion, &pAsyncYieldTest->Final_State);
case oosmos_EXIT:
return prtFormatted("Test asyncyieldtest, '%s' DONE.\n", pAsyncYieldTest->m_pID);
}
 
return false;
}
 
[...]
oosmos/Classes/Tests/asyncyieldtest.c

oosmos_ChoiceInit

oosmos_ChoiceInit is a macro that initializes an oosmos_sChoice state. See the example on line 180, below.
1
22
23
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
[GPLv2]
 
[...]
 
static motor * motorNew(void)
{
oosmos_Allocate(pMotor, motor, 2, NULL);
 
// StateName Parent Default
// =============================================================================
oosmos_StateMachineInit (pMotor, StateMachine, NULL, Ortho_State );
oosmos_OrthoInitNoCode (pMotor, Ortho_State, StateMachine );
oosmos_OrthoRegionInit (pMotor, Limits_State, Ortho_State, Limits_Choice_State );
oosmos_ChoiceInit (pMotor, Limits_Choice_State, Limits_State );
oosmos_LeafInitNoCode (pMotor, Limits_InBounds_State, Limits_State );
oosmos_LeafInitNoCode (pMotor, Limits_AtUpperLimit_State, Limits_State );
oosmos_LeafInitNoCode (pMotor, Limits_AtLowerLimit_State, Limits_State );
oosmos_OrthoRegionInitNoCode (pMotor, Motion_State, Ortho_State, Motion_Stopped_State);
oosmos_LeafInit (pMotor, Motion_Stopped_State, Motion_State );
oosmos_CompositeInitNoDefault(pMotor, Motion_Moving_State, Motion_State );
oosmos_LeafInit (pMotor, Motion_Moving_Up_State, Motion_Moving_State );
oosmos_LeafInit (pMotor, Motion_Moving_Down_State, Motion_Moving_State );
 
oosmos_Debug(&pMotor->StateMachine, true, EventNames);
 
return pMotor;
}
 
[...]
oosmos/Examples/Ortho/Windows/Motion.c

oosmos_ClockSpeedInMHz

oosmos_ClockSpeedInMHz tells OOSMOS the speed of the processor as configured externally. This call only applies to the PIC32 architecture.
1
2
3
 
oosmos_ClockSpeedInMHz(int ClockSpeedMHz);
 
Prototype

oosmos_COMPLETE

oosmos_COMPLETE is one of the six predefined event macros. This event is generated when the final states within all orthogonal regions have been entered. See The User's Guide for more information.
See Also

oosmos_CompositeInit

oosmos_CompositeInit initializes an oosmos_sComposite state.
See line 107 of the code snippet below for an example.
1
2
3
 
oosmos_CompositeInit(pObject, CompositeState, ParentState, DefaultState);
 
Prototype
pObject
The address of the object that contains the state machine.
CompositeState
The name of the composite state.
ParentState
The name of the parent state.
DefaultState
The name of the default state.
1
22
23
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
[GPLv2]
 
[...]
 
static test * testNew(void)
{
oosmos_Allocate(pTest, test, 1, NULL);
 
// StateName Parent Default
// ==================================================
oosmos_StateMachineInitNoQueue(pTest, StateMachine, NULL, A_State );
oosmos_CompositeInit (pTest, A_State, StateMachine, Choice );
oosmos_ChoiceInit (pTest, Choice, A_State );
oosmos_LeafInit (pTest, Left_State, A_State );
oosmos_LeafInit (pTest, Right_State, A_State );
oosmos_FinalInitNoCode (pTest, FinalA_State, A_State );
oosmos_LeafInitNoCode (pTest, B_State, StateMachine );
 
oosmos_Debug(&pTest->StateMachine, true, NULL);
 
return pTest;
}
 
[...]