How to use the spade.ACLMessage.ACLMessage function in spade

To help you get started, we’ve selected a few spade examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github javipalanca / spade / examples / unittests / basicTestCase.py View on Github external
def _process(self):
        msg = spade.ACLMessage.ACLMessage()
        msg.setPerformative("inform")
        msg.addReceiver(spade.AID.aid("b@"+host,["xmpp://b@"+host]))
        msg.setContent("testSendMsg")
        
        self.myAgent.send(msg)
github javipalanca / spade / examples / unittests / p2pTestCase.py View on Github external
def _process(self):
        msg = spade.ACLMessage.ACLMessage()
        msg.setPerformative("inform")
        msg.addReceiver(spade.AID.aid("b@"+host,["xmpp://b@"+host]))
        msg.setContent("testSendAndRecvMsg")

        self.myAgent.send(msg, method=self.method)
        self.myAgent.msg = None
        self.myAgent.msg = self._receive(block=True,timeout=10)
github javipalanca / spade / examples / unittests / p2pTestCase.py View on Github external
def _process(self):
        msg = spade.ACLMessage.ACLMessage()
        msg.setPerformative("inform")
        msg.addReceiver(spade.AID.aid("b@"+host,["xmpp://b@"+host]))
        msg.setContent("testSendMsg")
        
        self.myAgent.send(msg,method=self.method)
github javipalanca / spade / examples / thomas.py View on Github external
def _process(self):
			# Show platform info
			pi = self.myAgent.getPlatformInfo()
			print pi

			# Set the receiver data
			receiver = spade.AID.aid(name="OMS@clapton:1099/JADE", 
                                     addresses=["http://clapton.dsic.upv.es:7778/acc"])
			
			# Build the message to register in THOMAS
			self.msg = spade.ACLMessage.ACLMessage()  # Instantiate the message
			#self.msg.setPerformative("inform")       # Set the "request" FIPA performative
			self.msg.addReceiver(receiver)            # Add the message receiver
			#self.msg.setContent("http://localhost:8080/OMS/OWLS//RegisterUnitProcess.owl UnitID=miunidad1 ParentUnitID= Type=flat Goal=ConquerWorld")
			#self.msg.setContent("http://localhost:8080/OMS/OWLS//SearchService.owl ServicePurpose=")
			self.msg.setContent("AcquireRole('Virtual','Member')")
			
			# Third, send the message with the "send" method of the agent
			self.myAgent.send(self.msg)			
			print "> Register message sent to THOMAS"
			self.rep = ""
			self.rep = self._receive(True, 10)
			if self.rep:
				print "> Message from THOMAS:", self.rep
			self.rep = ""
			self.rep = self._receive(True, 10)
			if self.rep:
github javipalanca / spade / examples / dalmuti / gameManager.py View on Github external
def send2player(self, nP, perf, id, content):
        msg = spade.ACLMessage.ACLMessage()
        msg.setOntology("Dalmuti")
        msg.setPerformative( perf )
        msg.setConversationId( id )
        msg.setContent( content )

        jugador = self.jugadores.keys()[ self.jugadores.values().index(nP) ]        

        receiver = spade.AID.aid(name=jugador,addresses=["xmpp://"+jugador])
        msg.addReceiver( receiver )

        self.send(msg)
github javipalanca / spade / xmppd / modules / webadmin.py View on Github external
def sendFIPAMsg(self, to, performative, content):
        msg = ACLMessage.ACLMessage()
        msg.addReceiver(to)
        msg.setPerformative(performative)
        msg.setContent(content)
        #self.myAgent.send(msg)
github javipalanca / spade / spade / mtp / http.py View on Github external
return (envelope, payload)


#Required constants
PROTOCOL = "http"
INSTANCE = http


if __name__ == "__main__":

    http_mtp = http("SpadeHttpSever", None, None)

    import time
    time.sleep(5)
    msg = ACLMessage.ACLMessage()
    msg.setPerformative("inform")
    msg.addReceiver(AID.aid("b@localhost", ["xmpp://b@localhost", "http://localhost:2099/b"]))
    msg.setContent("testACLMessage")
    msg.setLanguage(ACLMessage.FIPA_ACL_REP_XML)
    env = Envelope.Envelope()
    env.addTo(AID.aid("b@localhost", ["xmpp://b@localhost", "http://localhost:2099/b"]))
    env.setFrom(AID.aid("a@localhost", ["xmpp://a@localhost", "http://localhost:2099/a"]))
    env.setAclRepresentation(ACLMessage.FIPA_ACL_REP_XML)
    env.setPayloadEncoding("US-ASCII")
    env.setDate("20121105T134259368626")

    http_mtp.send(env, msg)


"""
TODO
github javipalanca / spade / examples / dalmuti / jugador.py View on Github external
def send2game(self, perf, id, content):
         # Creamos el mensaje
         msg = spade.ACLMessage.ACLMessage()
         # Lo rellenamos
         msg.setOntology( "Dalmuti" )
         msg.setPerformative( perf )
         msg.setConversationId( id )
         msg.setContent( content )
         gameManager = spade.AID.aid(name="dalmuti@127.0.0.1",addresses=["xmpp://dalmuti@127.0.0.1"])
         msg.addReceiver( gameManager )
         # Enviamos al gameManager
         self.send(msg)