Commits

Ginés Martínez Sánchez  committed 68cdf84 Draft

circle full closed? perhaps!!

  • Participants
  • Parent commits 4479ac9

Comments (0)

Files changed (2)

File ginsfsm/examples/router/test_router.py

 #                   GAplic TITI
 #===============================================================
 def ac_message(self, event):
-    print "ORDENNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN"
+    print "ORDENNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN %s %s" % (
+        self.counter,
+        event.__subscriptor_reference__,
+    )
     list_globals()
+    self.counter += 1
+    if self.counter > 4:
+        # delete subscription
+        pass
+
+    # causes broadcast EV_MESSAGE again
     self.gaplic.send_event_to_external_gaplic(
         'TOTO',             # gaplic_name
         'sample2',          # gobj_name
     """
     def __init__(self):
         GObj.__init__(self, SAMPLE1_FSM, SAMPLE1_GCONFIG)
+        self.counter = 0
 
     def start_up(self):
         """

File ginsfsm/gaplic.py

 * :meth:`GAplic.send_event_to_external_gaplic`
 * :meth:`GAplic.send_event_to_external_role`
 * :meth:`GAplic.subscribe_event_from_external_gaplic`
+* :meth:`GAplic.subscribe_event_from_external_role`
+* :meth:`GAplic.unsubscribe_event_from_external_gaplic`
+* :meth:`GAplic.unsubscribe_event_from_external_role`
 * :meth:`GAplic.add_callback`
 * :meth:`GAplic.run_forever`
 * :meth:`GAplic.stop`
         send_event_to_external_gaplic,
         send_event_to_external_role,
         subscribe_event_from_external_gaplic,
+        subscribe_event_from_external_role,
+        unsubscribe_event_from_external_gaplic,
+        unsubscribe_event_from_external_role,
         add_callback,
         run_forever,
         stop,
 
     def subscribe_event_from_external_gaplic(
             self, gaplic_name, gobj_name, event_name, subscriber_gobj, **kw):
-        """ Subscribe an event of an external gaplic.
+        """ Subscribe an event of an external gaplic by name.
         """
         kw.update({'__subscribe_event__': True})
         return self.send_event_to_external_gaplic(
 
     def subscribe_event_from_external_role(
             self, role, gobj_name, event_name, subscriber_gobj, **kw):
-        """ Subscribe an event of an external gaplic.
+        """ Subscribe an event of an external gaplic by role.
         """
         kw.update({'__subscribe_event__': True})
         return self.send_event_to_external_role(
             **kw
         )
 
+    def unsubscribe_event_from_external_gaplic(
+            self, gaplic_name, gobj_name, event_name, subscriber_gobj, **kw):
+        """ Subscribe an event of an external gaplic by name.
+        """
+        kw.update({'__unsubscribe_event__': True})
+        return self.send_event_to_external_gaplic(
+            gaplic_name,
+            gobj_name,
+            event_name,
+            subscriber_gobj,
+            **kw
+        )
+
+    def unsubscribe_event_from_external_role(
+            self, role, gobj_name, event_name, subscriber_gobj, **kw):
+        """ Subscribe an event of an external gaplic by role.
+        """
+        kw.update({'__unsubscribe_event__': True})
+        return self.send_event_to_external_role(
+            role,
+            gobj_name,
+            event_name,
+            subscriber_gobj,
+            **kw
+        )
+
     def delete_all_references(self, gobj):
         """ Delete all references of gobj in timer and event queues.
         """