Example #1
0
    def doit(self):
        msg = gs.message()
        msg["sender"] = "sender"
        msg["command"] = "start"
        msg["reply"] = self.msgfifo.name()
        msg["sub"] = gs.message('a', 'b', 'c')

        # Send to receiver
        try:
            print self.name(), ": sending a message to receiver: start"
            receiver = gs.findReceiver("Zreceiver")
            receiver.write(msg)
        except gs.BadReceiverName, e:
            print self.name(), ": invalid receiver:", e
            receiver = gs.findReceiver("receiver")
            receiver.write(msg)
Example #2
0
 def sender(self):
     gs.wait(10,gs.NS)
     print self.name(), ": sending a message"
     msg = gs.message()
     msg["command"] = "hello"
     msg["value"] = 2.1734
     msg["reply"] = self.msg2fifo.name()
     msg["boolt"] = True
     msg["boolf"] = False
     ss = gs.message(hello = 10, fish = "james")
     msg["sub"] = ss
     remote = gs.findReceiver("sc-bidir.sc-bidir")
     remote.write(msg)
     print self.name(), ": waiting for messages on", self.msg2fifo.name()
     msg1 = self.msg2fifo.read()
     print self.name(), ": got a reply", msg1["command"], ". Field foo.pi =", msg1["foo.pi"]
Example #3
0
    def doit(self):
        msg = gs.message()
        msg["sender"] = "sender"
        msg["command"] = "start"
        msg["reply"] = self.msgfifo.name()
        msg["sub"] = gs.message('a', 'b', 'c')

        # Send to receiver
        try:
            print self.name(), ": sending a message to receiver: start"
            receiver = gs.findReceiver("Zreceiver")
            receiver.write(msg)
        except gs.BadReceiverName, e:
            print self.name(), ": invalid receiver:", e
            receiver = gs.findReceiver("receiver")
            receiver.write(msg)
Example #4
0
 def rx2(self):
   prev = gs.message(fish = -1)
   nr_rx = 0
   while nr_rx < 20:
     t = self.msg3fifo.read()
     nr_rx += 1
     print nr_rx, "now I read a message with fish =", t["fish"], prev["fish"]
     prev = t
Example #5
0
    def doit(self):
        msg = gs.message(
            sender="sender",
            configset=gs.message(
                cache=gs.message(size=10),
                CPU=gs.message("adder", "multiplexor"),
            ),
            reply=self.msgfifo.name(),
        )

        # Send to receiver
        try:
            print self.name(), ": sending a message to receiver: start"
            receiver = gs.findReceiver("receiver")
            receiver.write(msg)
        except BadReceiverName, e:
            print self.name(), ": invalid receiver:", e.message
            return
Example #6
0
 def sender(self):
     dest = gs.findReceiver("sc-bidir.sc-bidir")
     x = 0
     while True:
         msg = gs.message(sender="python", command="test", data=x)
         x += 1
         print "          send new msg", x, "to", dest.num_free()
         while not dest.nb_write(msg):
             gs.wait(dest.data_read_event())
Example #7
0
 def sender(self):
   dest = gs.findReceiver("sc-bidir.sc-bidir")
   x = 0
   while True:
     msg = gs.message(sender = "python", command = "test", data = x)
     x += 1
     print "          send new msg", x, "to", dest.num_free()
     while not dest.nb_write(msg):
       gs.wait(dest.data_read_event());
Example #8
0
    def doit(self):
        msg = gs.message(
          sender = "sender",
          configset = gs.message(
              cache = gs.message(size = 10),
              CPU = gs.message("adder", "multiplexor"),
          ),
          reply = self.msgfifo.name(),
        )

        # Send to receiver
        try:
            print self.name(), ": sending a message to receiver: start"
            receiver = gs.findReceiver("receiver")
            receiver.write(msg)
        except BadReceiverName, e:
            print self.name(), ": invalid receiver:", e.message
            return
Example #9
0
 def internal(self):
   gs.wait(3,gs.NS)
   tmp = no_process("py_no_process")
   tmp.debug = test_debug
   gs.wait(35,gs.NS)
   m = gs.findReceiver("gs_module.py_no_process")
   # can use "tmp" directly of course #
   for i in range(10):
     ms = gs.message()
     ms["fish"] = i*i
     m.nb_write(ms)
     gs.wait(5,gs.NS)
   gs.stop()