Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
beansdoc [2011/01/05 10:03] – More basic beans hourdin | beansdoc [2011/06/21 16:08] (current) – [Beans managing time and threads] hourdin | ||
---|---|---|---|
Line 30: | Line 30: | ||
A simple method is then used to trigger the boolean event: | A simple method is then used to trigger the boolean event: | ||
* **FireBool()**: | * **FireBool()**: | ||
- | * **^BooleanCreated**: | + | * **^BooleanCreated**: |
==== BoolFilter ==== | ==== BoolFilter ==== | ||
This bean is used to propagate a boolean event only when its value is either //true// or //false//, but not both. The filtered value of the boolean event can be parametrized by the **Filter** property of the bean. When the received event value matches the Filter property value, the BoolFilter can send two events, a void and an integer event: | This bean is used to propagate a boolean event only when its value is either //true// or //false//, but not both. The filtered value of the boolean event can be parametrized by the **Filter** property of the bean. When the received event value matches the Filter property value, the BoolFilter can send two events, a void and an integer event: | ||
- | * **^EventFiltered**: | + | * **^EventFiltered**: |
- | * **^IntValEmitted**: | + | * **^IntValEmitted**: |
* **SetLevel(**// | * **SetLevel(**// | ||
==== Counter ==== | ==== Counter ==== | ||
+ | |||
+ | This integer counter increments its internal value when the **Increment()** input method is called. It sends a //void// event indicating that its value has changed, and provides an //integer// property (Value) and thus the **get_Value()** property getter method to retrieve the value of the internal counter. | ||
+ | |||
+ | Moreover, it has the ability to apply a modulo to the incrementing internal counter. This can be useful to make binary counters (modulo = 2) for example. In this case, when the counter comes back to 0, the Carry event is raised, allowing to cascade the counters when a modulo is used, and create a multi-bit counter for example. The value of the modulo is parametrized by the **Modulo** property. | ||
+ | |||
+ | * **Increment()**: | ||
+ | * **^ValueChanged**: | ||
+ | * **^Carry**: //void// notification of reset of the counter value because of modulo value reaching. | ||
+ | * **Reset()**: | ||
+ | |||
==== EventFilter ==== | ==== EventFilter ==== | ||
+ | The EventFilter bean acts as an electric relay on a flow of //void// events. It has a boolean property indicating if it is closed or open, and an input method relayed to an output event. | ||
+ | * **FireEvent()**: | ||
+ | * **^EventOut**: | ||
+ | * **set_Propagate(**// | ||
+ | |||
==== EventToggler ==== | ==== EventToggler ==== | ||
+ | This bean allows to create alternating event calls from a single event stream. It receives a //void// event and sends alternatively the **^EventOut0** and **^EventOut1** //void// events. It also sends a boolean event alternating between //true// and //false// values. | ||
+ | * **FireEvent()**: | ||
+ | * **^EventOut**: | ||
==== PrimitiveValueEmitter ==== | ==== PrimitiveValueEmitter ==== | ||
The PrimitiveValueEmitter is probably the most useful bean, since it can convert a void event to any primitive type of events, like //string//, // | The PrimitiveValueEmitter is probably the most useful bean, since it can convert a void event to any primitive type of events, like //string//, // | ||
* **FireValueEvent()**: | * **FireValueEvent()**: | ||
- | * **^Emit// | + | * **^Emit// |
* **set_// | * **set_// | ||
==== Threshold ==== | ==== Threshold ==== | ||
+ | |||
+ | This bean allows to filter a //string// event flow containing decimal numbers according to a minimal or maximal value of the decimal number. For example, it can allow events to be relayed only when the value in the string is higher than " | ||
+ | * **set_Value(**// | ||
+ | * **^CeilledValue**: | ||
+ | * **^ThresholdReachedBool**: | ||
+ | * The **ThresholdValue** property parametrizes the value of the threshold that evaluates incoming events. | ||
+ | |||
==== ValueFormatter ==== | ==== ValueFormatter ==== | ||
+ | This bean allows to convert a primitive type event to a string. This is nearly the opposite of the [[beansdoc# | ||
+ | * **Format(**// | ||
+ | * **^StringValueChanged**: | ||
+ | More than allowing to convert primitive types to a string, the ValueFormatter allows to modify the format of the output string, for example to add the unit of an integer value. The **ValueFormat** property of the bean allows to change the output format of the string. The format of the ValueFormat property is the standard C# formatting syntax [[http:// | ||
+ | |||
+ | Example: a "{0} ms" ValueFormat value will emit a "12 ms" string for a Format(12) method invocation. | ||
+ | |||
+ | ===== Beans managing time and threads (in the Basic category) ===== | ||
+ | |||
+ | ==== Timer ==== | ||
+ | The timer bean allows an event to be sent periodically. It creates a single thread that manages the loop. A sleep is done before each event sending, for the time defined by the **Period** property. It means that if the methods called by the event sending (if the event is linked to methods of other beans) take one second to execute, the actual time between two events will be 1s+Period. The [[beansdoc# | ||
+ | * **^TimerTick**: | ||
+ | * **Start()**: | ||
+ | * **Stop()**: stops the loop and thus event sending. | ||
+ | |||
+ | ==== ActiveTimer ==== | ||
+ | This timer has the same goal than the [[beansdoc# | ||
+ | It has the same interface than [[beansdoc# | ||
+ | ==== Delay ==== | ||
+ | This bean acts as a simple event delayer. It is a generic bean, meaning that it can handle any type of event in input and methods in output. When its **Input()** method is called, it will wait for a delay configured by the **DelayMillisec** property, and send the **^Output** event with the same arguments than the Input. | ||
+ | The method and event of this bean, and all other generic beans, won't appear in the compatible list when creating a link. It has to be searched in the incompatible list of methods. |