def onConnect(client, data, rc): global connected if rc == 0: print("DriveController: Connected to rover " + selectedRoverTxt + " @ " + roverAddress[selectedRover] + ".") agent.init(client, "DriveAgent.py") connected = True else: print("DriveController: Connection returned error result: " + str(rc)) os._exit(rc)
def main(p): import useLib import usePgx import useAgent import useOnto import agent agent.init() p['package']['agent'] = agent p['help']['agent'] = agent.__doc__ p['sy']['agentPush'] = agPush #(mych,recvCh,parameter) p['help']['agentPush'] = "agPush (recvCh,parameter)" p['sy']['agentPop'] = agPop p['help']['agentPop'] = "agPop (recvCh,,txt)" p['sy']['agentDo'] = agDo p['help']['agentDo'] = "agDo (recvCh,command,,)" return (p)
# -*- coding: utf-8 -*- import logging, sys from agent import init if __name__ == "__main__": init("local") from agent import app app.run()
# -*- coding: utf-8 -*- from agent import init init("bae") from agent import app from bae.core.wsgi import WSGIApplication application = WSGIApplication(app)
def onConnect(client, data, rc): if rc == 0: agent.init(client, id, "TestAgent.py") else: print("Connection returned error result: " + str(rc)) os._exit(rc)
if __name__ == '__main__': os.system('clear') while True: print ('1. Agente') print ('2. Fumador') type = input('Opcion: ') if type in ['1', '2']: break else: os.system('clear') os.system('clear') if type == '1': # Agente print ('Agente') from agent import init init(get_port()) else: # Fumador while True: print ('Fumador') for i in codes: print ('{}. {}'.format(i, store[i].get('name'))) type = input('Opcion: ') if type in codes: break else: os.system('clear') ip = input('Ip del agente: ') from smoker import init init(ip, get_port(), type)