ginsfsm.examples.router

Routing events between gaplics.

You can run this file with gserve test_router.ini

class ginsfsm.examples.router.test_router.Sample1[source]

Sample1 GObj.

Configurable Parameters:
Name Type Default value Description
Diagram:

Input-Events:

  • 'EV_MESSAGE': .

Output-Events:

start_up()[source]
class ginsfsm.examples.router.test_router.Sample2[source]

Sample2 GObj.

Configurable Parameters:
Name Type Default value Description
Diagram:

Input-Events:

  • 'EV_TIMEOUT': .

Output-Events:

  • 'EV_MESSAGE': .
start_up()[source]
In this example:
TITI gaplic of main thread TOTO gaplic another thread or subprocess

TOTO enable router server in port 8000 TITI add static router to localhost:8000

TOTO has EV_SET_TIMEOUT Api.
Its action is set a timeout that broadcast EV_MESSAGE.
TITI do two things:
  • subscribe to event EV_MESSAGE of external TOTO
  • send EV_SET_TIMEOUT to external TOTO

The EV_SET_TIMEOUT event reachs TOTO, then it set the timer that broadcast EV_MESSAGE.

TITI receive the external EV_MESSAGE because it’s subscribe it.

When TITI receive the EV_MESSAGE, re-send EV_SET_TIMEOUT to external TOTO and so on.