Module indiclient :: Class bigindiclient
[show private | hide private]
[frames | no frames]

Class bigindiclient

Known Subclasses:
indiclient


Method Summary
  __init__(self, host, port)
indi_custom_element_handler add_custom_element_handler(self, handler)
Adds a custom handler function for an indielement, the handler will be called each time the indielement is received.
indi_custom_vector_handler add_custom_vector_handler(self, handler)
Adds a custom handler function for an indivector, the handler will be called each time the vector is received.
mini_element_handler add_mini_element_handler(self, devicename, vectorname, elementname, handlermethod)
Adds handler that will be called each time the element is received.
NoneType enable_blob(self)
Sends a signal to the server that tells it, that this client wants to receive indiblob objects.
indielement get_element(self, devicename, vectorname, elementname)
Returns an indielement matching the given devicename and vectorname This method will wait until it has been received.
indivector get_vector(self, devicename, vectorname)
Returns an indivector matching the given devicename and vectorname This method will wait until it has been received.
NoneType process_events(self)
Has to be called frequently by any program using this client.
NoneType quit(self)
must be called in order to close the indiclient instance
NoneType reset_connection(self)
Resets the connection to the server
NoneType send_vector(self, vector)
Sends an INDI vector to the INDI server.
NoneType set_def_handlers(self, blob_def_handler, number_def_handler, switch_def_handler, text_def_handler, light_def_handler)
Sets new def handlers.
NoneType set_message_handler(self, handler)
Sets a new message handler.
NoneType set_timeout_handler(self, handler)
Sets a new timeout handler.
NoneType tell(self)
prints all indivectors and their elements to the screen
NoneType wait_until_vector_available(self, devicename, vectorname)
Looks if the requested vector has already been received and waits until it is received otherwise

Instance Variable Summary
function blob_def_handler: Called when a new indiblobvector is defined by the driver (see set_def_handlers)
StringType currentData: A buffer to accumulate the character data to be written into the value attribute of currentElement
indivector currentElement: The INDI element currently being processed by the XML parser
indimessage currentMessage: The INDI message currently being processed by the XML parser
indivector currentVector: The INDI vector currently being processed by the XML parser
list of indivector defvectorlist: A list of vectors that have been received with def*Vector signal at least one time
xml.parsers.expat expat: an expat XML parser
StringType host: The hostname of the INDI server, this instance of indiclient is connected to
_indilist of indivector indivectors: The list of all indivectors received so far
function message_handler: (see set_message_handler)
function number_def_handler: Called when a new indinumbervector is defined by the driver (see set_def_handlers)
IntType port: The port address of the INDI server, this instance of indiclient is connected to
Queue.Queue receive_event_queue: A background process (_receiver) is continuesly receiving data and putting them into this queue.
threading.Timer receivetimer: needed to run the _receive thread
Queue.Queue running_queue: During its destructor indiclient puts signal into this queue in order to stop the background process.
socket.socket.socket socket: a TCP/IP socket to communicate with the server
function text_def_handler: Called when a new inditextvector is defined by the driver (see set_def_handlers)
FloatType timeout: A timeout value (see timeout_handler)
function timeout_handler: This function will be called whenever an indielement has been requested but was not received for a time longer than timeout since the request was issued.
BooleanType verbose: If True all XML data will be printed to the screen

Method Details

__init__(self, host, port)
(Constructor)

Parameters:
host - The hostname or IP address of the server you want to connect to
           (type=StringType)
port - The port address of the server you want to connect to.
           (type=IntType)

add_custom_element_handler(self, handler)

Adds a custom handler function for an indielement, the handler will be called each time the indielement is received. Furthermore this method will call the hander once. If the element has not been received yet, this function will wait until the element is received before calling the handler function. If the indielement does not exist this method will not return.
Parameters:
handler - The handler to be called.
           (type=indi_custom_element_handler)
Returns:
The handler given in the parameter handler
           (type=indi_custom_element_handler)

add_custom_vector_handler(self, handler)

Adds a custom handler function for an indivector, the handler will be called each time the vector is received. Furthermore this method will call the hander once. If the vector has not been received yet, this function will wait until the vector is received before calling the handler function. If the vector does not exist this method will not return.
Parameters:
handler - The handler to be called.
           (type=indi_custom_vector_handler)
Returns:
The handler given in the parameter handler
           (type=indi_custom_vector_handler)

add_mini_element_handler(self, devicename, vectorname, elementname, handlermethod)

Adds handler that will be called each time the element is received. Here the handler is a function that takes only one argument, namely the element that was received. This function is deprecated. It has been replaced by the add_custom_element_handler function.
Parameters:
devicename - The name of the device
           (type=StringType)
vectorname - The name of the vector
           (type=StringType)
elementname - The name of the element
           (type=StringType)
handlermethod - The function to be called
           (type=function)
Returns:
The handler object created
           (type=mini_element_handler)

enable_blob(self)

Sends a signal to the server that tells it, that this client wants to receive indiblob objects. If this method is not called, the server will not send any indiblob. The DCD clients calls it each time an indiblob is defined.
Returns:
None
           (type=NoneType)

get_element(self, devicename, vectorname, elementname)

Returns an indielement matching the given devicename and vectorname This method will wait until it has been received. In case the vector doesn't exists this routine will never return.
Parameters:
devicename - The name of the device
           (type=StringType)
vectorname - The name of the vector
           (type=StringType)
elementname - The name of the element
           (type=StringType)
Returns:
The element found
           (type=indielement)

get_vector(self, devicename, vectorname)

Returns an indivector matching the given devicename and vectorname This method will wait until it has been received. In case the vector doesn't exists this routine will never return.
Parameters:
devicename - The name of the device
           (type=StringType)
vectorname - The name of the vector
           (type=StringType)
Returns:
The indivector found
           (type=indivector)

process_events(self)

Has to be called frequently by any program using this client. All custom handler methods will called by this (and only by this) method. furthermore the def*handler and massage_handler methods will be called here. See also add_custom_element_handler, set_def_handlers, set_message_handler . If you just don't want to use any custom handlers and you do not use gtkindiclient functions, you do not need to call this method at all.
Returns:
None
           (type=NoneType)

quit(self)

must be called in order to close the indiclient instance
Returns:
None
           (type=NoneType)

reset_connection(self)

Resets the connection to the server
Returns:
None
           (type=NoneType)

send_vector(self, vector)

Sends an INDI vector to the INDI server.
Parameters:
vector - The INDI vector to be send
           (type=indivector)
Returns:
None
           (type=NoneType)

set_def_handlers(self, blob_def_handler, number_def_handler, switch_def_handler, text_def_handler, light_def_handler)

Sets new def handlers. These will be called whenever an indivector was received with an def*Vector tag. This means that the INDI driver has called an IDDef* function and thus defined a new INDI vector. These handlers will only be called once for each indivector, even if more than one def*Vector signals are received, for the same indivector.
Parameters:
blob_def_handler - the new defBLOBVector handler
           (type=function)
number_def_handler - the new defNumberVector handler (see _default_def_handler for example)
           (type=function)
switch_def_handler - the new defSwitchVector handler (see _default_def_handler for example)
           (type=function)
text_def_handler - the new defTextVector handler (see _default_def_handler for example)
           (type=function)
light_def_handler - the new defLightVector handler (see _default_def_handler for example)
           (type=function)
Returns:
None
           (type=NoneType)

set_message_handler(self, handler)

Sets a new message handler. This handler will be called whenever an INDI message has been received from the server.
Parameters:
handler - the new message handler (see _default_message_handler for an example)
           (type=function)
Returns:
None
           (type=NoneType)

set_timeout_handler(self, handler)

Sets a new timeout handler.
Parameters:
handler - the new timeout handler (see _default_timeout_handler for an example) It will be called whenever an indielement has been requested but was not received for a time longer than timeout since the request was issued.
           (type=function)
Returns:
None
           (type=NoneType)

tell(self)

prints all indivectors and their elements to the screen
Returns:
None
           (type=NoneType)

wait_until_vector_available(self, devicename, vectorname)

Looks if the requested vector has already been received and waits until it is received otherwise
Parameters:
devicename - The name of the device
           (type=StringType)
vectorname - The name of the vector
           (type=StringType)
Returns:
None
           (type=NoneType)

Instance Variable Details

blob_def_handler

Called when a new indiblobvector is defined by the driver (see set_def_handlers)
Type:
function

currentData

A buffer to accumulate the character data to be written into the value attribute of currentElement
Type:
StringType

currentElement

The INDI element currently being processed by the XML parser
Type:
indivector

currentMessage

The INDI message currently being processed by the XML parser
Type:
indimessage

currentVector

The INDI vector currently being processed by the XML parser
Type:
indivector

defvectorlist

A list of vectors that have been received with def*Vector signal at least one time
Type:
list of indivector

expat

an expat XML parser
Type:
xml.parsers.expat

host

The hostname of the INDI server, this instance of indiclient is connected to
Type:
StringType

indivectors

The list of all indivectors received so far
Type:
_indilist of indivector

message_handler

(see set_message_handler)
Type:
function

number_def_handler

Called when a new indinumbervector is defined by the driver (see set_def_handlers)
Type:
function

port

The port address of the INDI server, this instance of indiclient is connected to
Type:
IntType

receive_event_queue

A background process (_receiver) is continuesly receiving data and putting them into this queue. This queue will be read by the process_events method, that the user has to call in order to process any custom handlers.
Type:
Queue.Queue

receivetimer

needed to run the _receive thread
Type:
threading.Timer

running_queue

During its destructor indiclient puts signal into this queue in order to stop the background process.
Type:
Queue.Queue

socket

a TCP/IP socket to communicate with the server
Type:
socket.socket.socket

text_def_handler

Called when a new inditextvector is defined by the driver (see set_def_handlers)
Type:
function

timeout

A timeout value (see timeout_handler)
Type:
FloatType

timeout_handler

This function will be called whenever an indielement has been requested but was not received for a time longer than timeout since the request was issued. (see also set_timeout_handler)
Type:
function

verbose

If True all XML data will be printed to the screen
Type:
BooleanType

Generated by Epydoc 2.1 on Sat Sep 10 10:26:05 2005 http://epydoc.sf.net