Phidgets.Manager (version 2.1.5, October 23 2008)
index
 

Copyright 2008 Phidgets Inc.
This work is licensed under the Creative Commons Attribution 2.5 Canada License. 
To view a copy of this license, visit http://creativecommons.org/licenses/by/2.5/ca/

 
Modules
       
sys

 
Classes
       
Manager

 
class Manager
    This class represents a Phidget Manager.
 
The Phidget manager is a way to keep track of attached phidgets,
it will send Attach and Detach events as Phidgets are added and removed fromt the system.
 
The Phidget manager deals in base Phidget objects.
These objects are not actually connected to opened Phidgets but can be used
to get serial number, name, version, etc.
 
  Methods defined here:
__init__(self)
The Constructor Method for the Manager Class
closeManager(self)
Shuts down the Phidget Manager.
 
This method should be called to close down the Phidget Manager.
Events will no longer be recieved. This method gets calledd automatically when the class is destroyed so calling it is not required.
 
Exceptions:
    PhidgetException: If this manager is not opened.
getAttachedDevices(self)
Returns a list of Phidgets attached to the host computer.
 
This list is updated right before the attach and detach events, and so will be up to date within these events.
 
Returns:
    The list of attached phidgets <array of Phidget objects>.
 
Exceptions:
    PhidgetException
getServerAddress(self)
Returns the Address of a Phidget Webservice when this Manager was opened as remote.
 
This may be an IP Address or a hostname.
 
Returns:
    The server address for the webservice <string>.
 
Exceptions:
    PhidgetException: if the Manager was not opened or opened remotely.
getServerID(self)
Returns the Server ID of a Phidget Webservice when this Manager was opened as remote.
 
This is an arbitrary server identifier, independant of IP address and Port.
 
Returns:
    The serverID <string>.
 
Exceptions:
    PhidgetException: If this manager is not opened or opened remotely.
getServerPort(self)
Returns the Port of a Phidget Webservice when this Manager was opened as remote.
 
Returns:
    The server port for the webservice.
 
Exceptions:
    PhidgetException: if the Manager was not opened or opened remotely.
isAttachedToServer(self)
Returns the network attached status for remotely opened Phidgets.
 
This method returns True or False, depending on whether a connection to the Phidget WebService is open - or not.
If this is false for a remote Phidget then the connection is not active - either because a connection has not yet been established,
or because the connection was terminated.
 
Returns:
    The attached status <boolean>.
 
Exceptions:
    PhidgetException: if the Manager was not opened or opened remotely.
openManager(self)
Starts the PhidgetManager.
 
This method starts the phidget manager running in the base Phidget21 C library.
If attach and detach listeners are to be used, they should be registered before start is called so that no events are missed.
Once start is called, the Phidget Manager will be active until close is called.
 
Exceptions:
    PhidgetException
openRemote(self, serverID, password='')
Open this Manager remotely using a Server ID, and securely using a Password.
 
ServerID can be NULL to get a listing of all Phidgets on all Servers
 
This password can be set as a parameter when starting the Phidget Webservice.
The use of a password is optional and calling the function without providing a password will
connect normally.
 
Parameters:
    serverID<string>: ServerID of the Phidget Webservice.
    password<string>: The secure password for the Phidget Webservice.
 
Exceptions:
    PhidgetException: if the Phidget Webservice cannot be contacted
openRemoteIP(self, IPAddress, port, password='')
Open this Manager remotely using an IP Address and port, and securely using a password.
 
This password can be set as a parameter when starting the Phidget Webservice.
The use of a password is optional and calling the function without providing a password will
connect normally.
 
Parameters:
    IPAddress<string>: IP Address or hostname of the Phidget Webservice
    port<int>: Port of the Phidget Webservice
    password<string>: The secure password for the Phidget Webservice
 
Exceptions:
    PhidgetException: if the Phidget Webservice cannot be contacted
setOnAttachHandler(self, attachHandler)
Set the Attach event handler.
 
The attach handler is a method that will be called when a Phidget is phisically attached to the system,
and has gone through its initalization, and so is ready to be used.
 
Parameters:
    attachHandler: hook to the attachHandler callback function.
 
Exceptions:
    PhidgetException
setOnDetachHandler(self, detachHandler)
Set the Detach event handler.
 
The detach handler is a method that will be called when a Phidget is phisically detached from the system, and is no longer available.
 
Parameters:
    detachHandler: hook to the detachHandler callback function.
 
Exceptions:
    PhidgetException
setOnErrorHandler(self, errorHandler)
Sets the error event handler.
 
The error handler is a method that will be called when an asynchronous error occurs.
Error events are not currently used, but will be in the future to report any problems that happen out of context from a direct function call.
 
Parameters:
    errorHandler: hook to the errorHandler callback function.
 
Exceptions:
    PhidgetException
setOnServerConnectHandler(self, serverConnectHandler)
Sets the ServerConnect event handler
 
The serverConnect handler is a method that will be called when a connection to a server is made
 
Parameters:
    serverConnectHandler: hook to the serverConnectHandler callback function.
 
Exceptions:
    PhidgetException
setOnServerDisconnectHandler(self, serverDisconnectHandler)
Sets the ServerDisconnect event handler.
 
The serverDisconnect handler is a method that will be called when a connection to a server is terminated.
 
Parameters:
    serverDisconnectHandler: hook to the serverDisconnectHandler callback function.
 
Exceptions:
    PhidgetException

 
Functions
       
FormatError(...)
FormatError([integer]) -> string
 
Convert a win32 error code into a string. If the error code is not
given, the return value of a call to GetLastError() is used.
Lock = allocate_lock(...)
allocate_lock() -> lock object
(allocate() is an obsolete synonym)
 
Create a new lock object.  See LockType.__doc__ for information about locks.
addressof(...)
addressof(C instance) -> integer
Return the address of the C instance internal buffer
alignment(...)
alignment(C type) -> integer
alignment(C instance) -> integer
Return the alignment requirements of a C instance
byref(...)
byref(C instance) -> byref-object
Return a pointer lookalike to a C instance, only usable
as function argument
resize(...)
Resize the memory buffer of a ctypes instance
set_conversion_mode(...)
set_conversion_mode(encoding, errors) -> (previous-encoding, previous-errors)
 
Set the encoding and error handling ctypes uses when converting
between unicode and strings.  Returns the previous values.
sizeof(...)
sizeof(C type) -> integer
sizeof(C instance) -> integer
Return the size in bytes of a C instance
stack_size(...)
stack_size([size]) -> size
 
Return the thread stack size used when creating new threads.  The
optional size argument specifies the stack size (in bytes) to be used
for subsequently created threads, and must be 0 (use platform or
configured default) or a positive integer value of at least 32,768 (32k).
If changing the thread stack size is unsupported, a ThreadError
exception is raised.  If the specified size is invalid, a ValueError
exception is raised, and the stack size is unmodified.  32k bytes
 currently the minimum supported stack size value to guarantee
sufficient stack space for the interpreter itself.
 
Note that some platforms may have particular restrictions on values for
the stack size, such as requiring a minimum stack size larger than 32kB or
requiring allocation in multiples of the system memory page size
- platform documentation should be referred to for more information
(4kB pages are common; using multiples of 4096 for the stack size is
the suggested approach in the absence of more specific information).

 
Data
        DEFAULT_MODE = 0
GetLastError = <_FuncPtr object at 0x00B0EAF8>
RTLD_GLOBAL = 0
RTLD_LOCAL = 0
__author__ = 'Adam Stelmack'
__date__ = 'October 23 2008'
__version__ = '2.1.5'
cdll = <ctypes.LibraryLoader object at 0x00944850>
memmove = <CFunctionType object at 0x00B0EB70>
memset = <CFunctionType object at 0x00B0EBE8>
oledll = <ctypes.LibraryLoader object at 0x009448D0>
pydll = <ctypes.LibraryLoader object at 0x00944870>
pythonapi = <PyDLL 'python dll', handle 1e000000 at 944890>
windll = <ctypes.LibraryLoader object at 0x009448B0>

 
Author
        Adam Stelmack