Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
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)
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)
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:
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)
def sendFIPAMsg(self, to, performative, content):
msg = ACLMessage.ACLMessage()
msg.addReceiver(to)
msg.setPerformative(performative)
msg.setContent(content)
#self.myAgent.send(msg)
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
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)