Home | Trees | Indices | Help |
|
---|
|
The following code is a typical example of use:
from ivy.ivy import IvyServer class MyAgent(IvyServer): def __init__(self, name): IvyServer.__init__(self,'MyAgent') self.name = name self.start('127.255.255.255:2010') self.bind_msg(self.handle_hello, 'hello .*') self.bind_msg(self.handle_button, 'BTN ([a-fA-F0-9]+)') def handle_hello(self, agent): print '[Agent %s] GOT hello from %r'%(self.name, agent) def handle_button(self, agent, btn_id): print '[Agent %s] GOT BTN button_id=%s from %r'%(self.name, btn_id, agent) # let's answer! self.send_msg('BTN_ACK %s'%btn_id) a=MyAgent('007')
An Ivy client is made of several threads:
Copyright (c) 2005-2008 Sebastien Bigaret <sbigaret@users.sourceforge.net>
|
|||
IvyProtocolError | |||
IvyMalformedMessage | |||
IvyIllegalStateError | |||
IvyClient Represents a client connected to the bus. |
|||
IvyServer An Ivy server is responsible for receiving and handling the messages that other clients send on an Ivy bus to a given agent. |
|||
IvyHandler An IvyHandler is associated to one IvyClient connected to our server. |
|||
IvyTimer An IvyTimer object is responsible for calling a function regularly. |
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|
|||
IvyRegexpAdded = 3
|
|||
IvyRegexpRemoved = 4
|
|||
NOT_INITIALIZED = 0
|
|||
INITIALIZATION_IN_PROGRESS = 1
|
|||
INITIALIZED = 2
|
|||
Messages types | |||
---|---|---|---|
BYE = 0
|
|||
ADD_REGEXP = 1
|
|||
MSG = 2
|
|||
ERROR = 3
|
|||
DEL_REGEXP = 4
|
|||
END_INIT = 5
|
|||
END_REGEXP = 5
|
|||
START_INIT = 6
|
|||
START_REGEXP = 6
|
|||
DIRECT_MSG = 7
|
|||
DIE = 8
|
|||
Separators | |||
ARG_START =
|
|||
ARG_END =
|
|||
Misc. constants | |||
DEFAULT_IVYBUS =
|
|||
PROTOCOL_VERSION = 3
|
|||
DEFAULT_TTL = 64
|
|||
IvyApplicationConnected = 1
|
|||
IvyApplicationDisconnected = 2
|
|||
IVY_SHOULD_NOT_DIE =
|
|||
Objects and functions related to logging | |||
ivylogger = logging.getLogger('Ivy')
|
|||
ivy_loghdlr = logging.StreamHandler()
|
|||
ivy_logformatter = logging.Formatter('%(asctime)s %(levelname)
|
|
Called by an IvyServer at startup; the method is responsible for:
|
|
|
|
|
ivy_logformatter
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Tue Jun 10 18:21:20 2008 | http://epydoc.sourceforge.net |