Module pyinsim :: Class OutReceiver
[hide private]
[frames] | no frames]

Class OutReceiver

source code

Known Subclasses:

Class to handle incoming UDP packets from LFS, OutSim, OutGauge and IS_MCI/IS_NLP packets.

Instance Methods [hide private]
 
__init__(self, mode=0, timeout=10.0, name='default')
Initailise the OutReceiver object.
source code
 
setTimeout(self, timeout)
Set the timeout seconds.
source code
number
getTimeout(self)
Get the timeout seconds.
source code
string
getName(self)
Get the name of the socket.
source code
 
setName(self, name)
Set the name of the socket.
source code
boolean
isConnected(self)
Get if the OutReceiver is connected.
source code
 
start(self, host='localhost', port=30000)
Start the OutReceiver.
source code
 
stop(self)
Stop the OutReceiver.
source code
 
__stop(self)
Internal version of stop() that doesn't raise a close event.
source code
 
run(self)
Block the calling thread until the OutReceiver has closed.
source code
 
bind(self, evtType, callback)
Bind an event-handler.
source code
 
unbind(self, evtType, callback)
Unbind an event-handler.
source code
boolean
isBound(self, evtType, callback)
Get if an event-handler has been bound.
source code
 
__receiveThread(self)
Internal UDP receive thread.
source code
 
onOutEvent(self, evtType, args)
Virtual method called when a Closed event is raised.
source code
 
raisePacketEvent(self, *packets)
Raise a packet-event as if it has been received by the OutReceiver.
source code
Method Details [hide private]

__init__(self, mode=0, timeout=10.0, name='default')
(Constructor)

source code 

Initailise the OutReceiver object. The mode defines what sort of packets OutReceiver raises events for.

>>> OUT_INSIM - InSim packets, such as MCI and NLP.
>>> OUT_OUTSIM - OutSim packets.
>>> OUT_OUTGAUGE - OutGauge packets.

Upon timing out OutReceiver raises EVT_TIMEOUT event.

Parameters:
  • mode (enum) - The mode for the OutReceiver from the OUT_ enumeration.
  • timeout (number) - The number of seconds to wait before timing out.
  • name (string) - An optional name for the OutReceiver.

setTimeout(self, timeout)

source code 

Set the timeout seconds.

Parameters:
  • timeout (number) - The timeout.

getTimeout(self)

source code 

Get the timeout seconds.

Returns: number
The timeout.

getName(self)

source code 

Get the name of the socket.

Returns: string
The socket name.

setName(self, name)

source code 

Set the name of the socket.

Parameters:
  • name (string) - The socket name.

isConnected(self)

source code 

Get if the OutReceiver is connected.

Returns: boolean
True if connected.

start(self, host='localhost', port=30000)

source code 

Start the OutReceiver.

Parameters:
  • host (string) - The host IP to receive data on.
  • port (number) - The port to receive data through.

bind(self, evtType, callback)

source code 

Bind an event-handler.

Parameters:
  • evtType (enum) - Type of event.
  • callback (function) - Function to bind.

unbind(self, evtType, callback)

source code 

Unbind an event-handler.

Parameters:
  • evtType (enum) - Type of event.
  • callback (function) - Function to unbind.

isBound(self, evtType, callback)

source code 

Get if an event-handler has been bound.

Parameters:
  • evtType (enum) - Type of event.
  • callback (function) - Function to check.
Returns: boolean
True if the function has been bound.

onOutEvent(self, evtType, args)

source code 

Virtual method called when a Closed event is raised.

Parameters:
  • evtType (enum) - The type of the event from the EVT_ enumeration.
  • args (args) - The close arguments.

raisePacketEvent(self, *packets)

source code 

Raise a packet-event as if it has been received by the OutReceiver.

Parameters:
  • packets (list) - A list of packets to raise events for.