compbio
Classes | Functions | Variables
win32_threespace_utils Namespace Reference

Classes

class  BLUETOOTH_ADDRESS
 
class  BLUETOOTH_DEVICE_INFO
 
class  BLUETOOTH_DEVICE_SEARCH_PARAMS
 
class  GUID
 Classes ### COM Port stuctures. More...
 
class  SP_DEVICE_INTERFACE_DATA
 
class  SP_DEVINFO_DATA
 
class  SYSTEMTIME
 

Functions

def toLong (number, base=None)
 
def getComPorts (filter=TSS_FIND_ALL)
 
def getDeviceInfoFromComPort (port_name, poll_device=True)
 

Variables

int NULL = 0
 Globals ###.
 
 HDEVINFO = ctypes.c_void_p
 
 PCTSTR = ctypes.c_char_p
 
 CHAR = ctypes.c_char
 
 LPDWORD = ctypes.POINTER(DWORD)
 
 LPBYTE = ctypes.c_void_p
 
 PHKEY = ctypes.POINTER(HKEY)
 
 ACCESS_MASK = DWORD
 
 REGSAM = ACCESS_MASK
 
 UCHAR = BYTE
 
 BTH_ADDR = ULONGLONG
 
int BLUETOOTH_MAX_NAME_SIZE = 248
 
 HBLUETOOTH_DEVICE_FIND = HANDLE
 
int ERROR_NO_MORE_ITEMS = 259
 
int ERROR_INVALID_PARAMETER = 87
 
int ERROR_REVISION_MISMATCH = 1306
 
int ERROR_OUTOFMEMORY = 14
 
int ERROR_SUCCESS = 0
 
int ERROR_INVALID_HANDLE = 6
 
int ERROR_MORE_DATA = 234
 
int DIGCF_PRESENT = 2
 
int DIGCF_DEVICEINTERFACE = 16
 
int DIGCF_ALLCLASSES = 4
 
int INVALID_HANDLE_VALUE = 0
 
int ERROR_INSUFFICIENT_BUFFER = 122
 
int SPDRP_HARDWAREID = 1
 
int SPDRP_FRIENDLYNAME = 12
 
int DICS_FLAG_GLOBAL = 1
 
int DIREG_DEV = 0x00000001
 
int KEY_READ = 0x20019
 
int REG_SZ = 1
 
int SPDRP_DEVICEDESC = 0
 
int SPDRP_DEVTYPE = 19
 
int SPDRP_DRIVER = 9
 
int SPDRP_ENUMERATOR_NAME = 0x16
 
int SPDRP_LOCATION_INFORMATION = 0xD
 
int SPDRP_PHYSICAL_DEVICE_OBJECT_NAME = 0xE
 
int SPDRP_MFG = 0xB
 
int SPDRP_SERVICE = 4
 
int SPDRP_CLASS = 7
 
int SPDRP_COMPATIBLEIDS = 2
 
int SPDRP_CLASSGUID = 0x8
 
int SPDRP_ADDRESS = 0x1C
 
 bthprops = ctypes.windll["bthprops.cpl"]
 
 kernel32 = ctypes.windll["Kernel32.dll"]
 
 setupapi = ctypes.windll.LoadLibrary("setupapi")
 
 advapi32 = ctypes.windll.LoadLibrary("Advapi32")
 
string PortName = b'PortName'
 
 PSP_DEVINFO_DATA = ctypes.POINTER(SP_DEVINFO_DATA)
 Structures/Class Pointers ###.
 
 PSP_DEVICE_INTERFACE_DATA = ctypes.POINTER(SP_DEVICE_INTERFACE_DATA)
 
 PSP_DEVICE_INTERFACE_DETAIL_DATA = ctypes.c_void_p
 
 SetupDiDestroyDeviceInfoList = setupapi.SetupDiDestroyDeviceInfoList
 
 argtypes
 
 restype
 
 SetupDiGetClassDevs = setupapi.SetupDiGetClassDevsA
 
 errcheck
 
 SetupDiEnumDeviceInterfaces = setupapi.SetupDiEnumDeviceInterfaces
 
 SetupDiGetDeviceInterfaceDetail = setupapi.SetupDiGetDeviceInterfaceDetailA
 
 SetupDiGetDeviceRegistryProperty = setupapi.SetupDiGetDeviceRegistryPropertyA
 
 SetupDiOpenDevRegKey = setupapi.SetupDiOpenDevRegKey
 
 RegCloseKey = advapi32.RegCloseKey
 
 RegQueryValueEx = advapi32.RegQueryValueExA
 
 GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR = GUID(toLong(0x4D36E978), 0xE325, 0x11CE, (BYTE * 8)(0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18))
 
 GUID_DEVINTERFACE_COMPORT = GUID(toLong(0x86E0D1E0), 0x8089, 0x11D0, (BYTE * 8)(0x9C, 0xE4, 0x08, 0x00, 0x3E, 0x30, 0x1F, 0x73))
 

Detailed Description

This module is a utility module for Windows.
    
    The Win32 ThreeSpace Utils module is a collection of classes, functions,
    structures, and static variables use exclusivly for Windows. All functions
    in this module are used to scan for available ThreeSpace devices on the host
    system and information on them. This module can be used with a system
    running Python 2.5 and newer (including Python 3.x).

Function Documentation

§ getComPorts()

def win32_threespace_utils.getComPorts (   filter = TSS_FIND_ALL)
Queries the system for all available serial COM ports and returns a list
    of them.
    
    Args:
        filter: An interger denoting a flag of what 3-Space Sensors device
            type to be found (default is TSS_FIND_ALL)
    
    Returns:
        A list of all known serial COM ports. Each element of the list is a
            tuple formatted as such:
                (COM_PORT_NAME, FRIENDLY_NAME, YEI_TECH_DEVICE_TYPE)
        Note:
            YEI_TECH_DEVICE_TYPE will be an empty string if the port's
                driver's vendor and product IDs do not match any known YEI
                Techology products.
            Possible YEI_TECH_DEVICE_TYPE strings are:
                '???' - Unknown
                'BTL' - Bootloader (No Firmware)
                'USB' - USB
                'DNG' - Dongle
                'WL' - Wireless
                'EM' - Embedded
                'DL' - Data-logging
                'BT' - Bluetooth

§ getDeviceInfoFromComPort()

def win32_threespace_utils.getDeviceInfoFromComPort (   port_name,
  poll_device = True 
)
Analyzes a serial COM port of a 3-Space Sensor and returns details about
    the device.
    
    Args:
        port_name: A string representing the name of the serial COM port to
            analyze.
        poll_device: An optional boolean that controls whether the named COM
            port is written to and queried for information about the device.
            If this value is True, please take caution as the COM port's
            device will be written to and may produce undesired effects if
            the device is unknown or not a 3-Space Sensor (default is True)
    
    Returns:
        A list of 5 values describing various details about the COM port's
        device:
            Friendly name,
            3-Space Type,
            3-Space ID,
            3-Space Firmware Version String,
            3-Space Hardware Version String,
            isInBootloader
    
    Raises:
        No explicit exceptions are raised.