# pylint: disable=wrong-spelling-in-comment

from . import SpinnakerC_defs  # pylint: disable=unused-import
from .SpinnakerC_defs import CspinLibraryVersion  # pylint: disable=unused-import
from .SpinnakerC_defs import spinNodeType  # pylint: disable=unused-import
from .SpinnakerC_defs import drspinError
from .SpinnakerC_defs import define_functions

from .base import TeledyneError

from ...core.utils import ctypes_wrap, ctypes_tools, py3
from ..utils import load_lib

import ctypes

class TeledyneSpinnakerError(TeledyneError):
    """Generic Teledyne Spinnaker error"""


class TeledyneSpinnakerLibError(TeledyneSpinnakerError):
    """Generic Teledyne Spinnaker library error"""
    def __init__(self, func, code, lib=None):
        self.func=func
        self.code=code
        self.name=drspinError.get(code,"N/A")
        self.desc=""
        self.full_desc=""
        try:
            if lib is not None:
                last_code=lib.spinErrorGetLast()
                if last_code==self.code:
                    self.desc=py3.as_str(lib.spinErrorGetLastMessage())
                    self.full_desc=py3.as_str(lib.spinErrorGetLastFullMessage())
        except TeledyneSpinnakerLibError:
            pass
        self.msg="function '{}' raised error {}({}): {}".format(func,code,self.name,self.desc)
        super().__init__(self.msg)
def errcheck(passing=None, lib=None):
    """
    Build an error checking function.

    Return a function which checks return codes of Spinnaker library functions.
    `passing` is a list specifying which return codes are acceptable (by default only 0, which is success code, is acceptable).
    """
    if passing is None:
        passing={0}
    def errchecker(result, func, arguments):  # pylint: disable=unused-argument
        if result not in passing:
            raise TeledyneSpinnakerLibError(func.__name__,result,lib=lib)
        return result
    return errchecker


class TeledyneSpinnakerCLib:
    def __init__(self):
        self._initialized=False

    def initlib(self):
        if self._initialized:
            return
        error_message="The library is automatically supplied with Teledyne Spinnaker SDK software\n"+load_lib.par_error_message.format("teledyne_spinnaker")
        self.lib=None
        for vmaj in range(15,-1,-1):
            for vmin in range(9,-1,-1):
                try:
                    self.lib=load_lib.load_lib("SpinnakerC_v{}{}.dll".format(vmaj,vmin),locations=("parameter/teledyne_spinnaker","global"),error_message=error_message,call_conv="stdcall")
                except OSError:
                    pass

        lib=self.lib
        define_functions(lib)

        self.errcheck=errcheck(lib=self)
        wrapper=ctypes_wrap.CFunctionWrapper(errcheck=errcheck(lib=self),default_rvals="pointer")
        def srwrapper(func):
            argprep={"pBuf":strprep,"pBufLen":default_strlen}
            args=[n for n in func.argnames if n not in argprep]
            return wrapper(func,args=args,argprep=argprep,byref=["pBufLen"],rvals=["pBuf"])
        default_strlen=1024
        strprep=ctypes_wrap.strprep(default_strlen)
        self.max_strlen=default_strlen

        #  ctypes.c_int spinErrorGetLast(ctypes.POINTER(ctypes.c_int) pError)
        self.spinErrorGetLast=wrapper(lib.spinErrorGetLast)
        #  ctypes.c_int spinErrorGetLastMessage(ctypes.c_char_p pBuf, ctypes.POINTER(ctypes.c_size_t) pBufLen)
        self.spinErrorGetLastMessage=srwrapper(lib.spinErrorGetLastMessage)
        #  ctypes.c_int spinErrorGetLastBuildDate(ctypes.c_char_p pBuf, ctypes.POINTER(ctypes.c_size_t) pBufLen)
        self.spinErrorGetLastBuildDate=srwrapper(lib.spinErrorGetLastBuildDate)
        #  ctypes.c_int spinErrorGetLastBuildTime(ctypes.c_char_p pBuf, ctypes.POINTER(ctypes.c_size_t) pBufLen)
        self.spinErrorGetLastBuildTime=srwrapper(lib.spinErrorGetLastBuildTime)
        #  ctypes.c_int spinErrorGetLastFileName(ctypes.c_char_p pBuf, ctypes.POINTER(ctypes.c_size_t) pBufLen)
        self.spinErrorGetLastFileName=srwrapper(lib.spinErrorGetLastFileName)
        #  ctypes.c_int spinErrorGetLastFullMessage(ctypes.c_char_p pBuf, ctypes.POINTER(ctypes.c_size_t) pBufLen)
        self.spinErrorGetLastFullMessage=srwrapper(lib.spinErrorGetLastFullMessage)
        #  ctypes.c_int spinErrorGetLastFunctionName(ctypes.c_char_p pBuf, ctypes.POINTER(ctypes.c_size_t) pBufLen)
        self.spinErrorGetLastFunctionName=srwrapper(lib.spinErrorGetLastFunctionName)
        #  ctypes.c_int spinErrorGetLastLineNumber(ctypes.POINTER(ctypes.c_int64) pLineNum)
        self.spinErrorGetLastLineNumber=wrapper(lib.spinErrorGetLastLineNumber)

        
        #  ctypes.c_int spinSystemGetInstance(ctypes.POINTER(spinSystem) phSystem)
        self.spinSystemGetInstance=wrapper(lib.spinSystemGetInstance)
        #  ctypes.c_int spinSystemReleaseInstance(spinSystem hSystem)
        self.spinSystemReleaseInstance=wrapper(lib.spinSystemReleaseInstance)
        #  ctypes.c_int spinSystemIsInUse(spinSystem hSystem, ctypes.POINTER(bool8_t) pbIsInUse)
        self.spinSystemIsInUse=wrapper(lib.spinSystemIsInUse)
        #  ctypes.c_int spinSystemGetLibraryVersion(spinSystem hSystem, ctypes.POINTER(spinLibraryVersion) hLibraryVersion)
        self.spinSystemGetLibraryVersion=wrapper(lib.spinSystemGetLibraryVersion,
            argprep={"hLibraryVersion":CspinLibraryVersion.prep_struct}, rconv={"hLibraryVersion":CspinLibraryVersion.tup_struct})
        
        #  ctypes.c_int spinInterfaceListCreateEmpty(ctypes.POINTER(spinInterfaceList) phInterfaceList)
        self.spinInterfaceListCreateEmpty=wrapper(lib.spinInterfaceListCreateEmpty)
        #  ctypes.c_int spinInterfaceListDestroy(spinInterfaceList hInterfaceList)
        self.spinInterfaceListDestroy=wrapper(lib.spinInterfaceListDestroy)
        #  ctypes.c_int spinInterfaceListGetSize(spinInterfaceList hInterfaceList, ctypes.POINTER(ctypes.c_size_t) pSize)
        self.spinInterfaceListGetSize=wrapper(lib.spinInterfaceListGetSize,)
        #  ctypes.c_int spinInterfaceListGet(spinInterfaceList hInterfaceList, ctypes.c_size_t index, ctypes.POINTER(spinInterface) phInterface)
        self.spinInterfaceListGet=wrapper(lib.spinInterfaceListGet)
        #  ctypes.c_int spinInterfaceListClear(spinInterfaceList hInterfaceList)
        self.spinInterfaceListClear=wrapper(lib.spinInterfaceListClear)
        #  ctypes.c_int spinSystemGetInterfaces(spinSystem hSystem, spinInterfaceList hInterfaceList)
        self.spinSystemGetInterfaces=wrapper(lib.spinSystemGetInterfaces)

        #  ctypes.c_int spinCameraListCreateEmpty(ctypes.POINTER(spinCameraList) phCameraList)
        self.spinCameraListCreateEmpty=wrapper(lib.spinCameraListCreateEmpty)
        #  ctypes.c_int spinCameraListDestroy(spinCameraList hCameraList)
        self.spinCameraListDestroy=wrapper(lib.spinCameraListDestroy)
        #  ctypes.c_int spinCameraListGetSize(spinCameraList hCameraList, ctypes.POINTER(ctypes.c_size_t) pSize)
        self.spinCameraListGetSize=wrapper(lib.spinCameraListGetSize)
        #  ctypes.c_int spinCameraListGet(spinCameraList hCameraList, ctypes.c_size_t index, ctypes.POINTER(spinCamera) phCamera)
        self.spinCameraListGet=wrapper(lib.spinCameraListGet)
        #  ctypes.c_int spinCameraListClear(spinCameraList hCameraList)
        self.spinCameraListClear=wrapper(lib.spinCameraListClear)
        #  ctypes.c_int spinCameraListRemove(spinCameraList hCameraList, ctypes.c_size_t index)
        self.spinCameraListRemove=wrapper(lib.spinCameraListRemove)
        #  ctypes.c_int spinCameraListAppend(spinCameraList hCameraListBase, spinCameraList hCameraListToAppend)
        self.spinCameraListAppend=wrapper(lib.spinCameraListAppend)
        #  ctypes.c_int spinCameraListGetBySerial(spinCameraList hCameraList, ctypes.c_char_p pSerial, ctypes.POINTER(spinCamera) phCamera)
        self.spinCameraListGetBySerial=wrapper(lib.spinCameraListGetBySerial)
        #  ctypes.c_int spinCameraListRemoveBySerial(spinCameraList hCameraList, ctypes.c_char_p pSerial)
        self.spinCameraListRemoveBySerial=wrapper(lib.spinCameraListRemoveBySerial)
        #  ctypes.c_int spinSystemGetCameras(spinSystem hSystem, spinCameraList hCameraList)
        self.spinSystemGetCameras=wrapper(lib.spinSystemGetCameras)
        #  ctypes.c_int spinSystemGetCamerasEx(spinSystem hSystem, bool8_t bUpdateInterfaces, bool8_t bUpdateCameras, spinCameraList hCameraList)
        self.spinSystemGetCamerasEx=wrapper(lib.spinSystemGetCamerasEx)
        #  ctypes.c_int spinSystemUpdateCameras(spinSystem hSystem, ctypes.POINTER(bool8_t) pbChanged)
        self.spinSystemUpdateCameras=wrapper(lib.spinSystemUpdateCameras)
        #  ctypes.c_int spinSystemUpdateCamerasEx(spinSystem hSystem, bool8_t bUpdateInterfaces, ctypes.POINTER(bool8_t) pbChanged)
        self.spinSystemUpdateCamerasEx=wrapper(lib.spinSystemUpdateCamerasEx)
        
        #  ctypes.c_int spinCameraInit(spinCamera hCamera)
        self.spinCameraInit=wrapper(lib.spinCameraInit)
        #  ctypes.c_int spinCameraDeInit(spinCamera hCamera)
        self.spinCameraDeInit=wrapper(lib.spinCameraDeInit)
        #  ctypes.c_int spinCameraIsInitialized(spinCamera hCamera, ctypes.POINTER(bool8_t) pbInit)
        self.spinCameraIsInitialized=wrapper(lib.spinCameraIsInitialized)
        #  ctypes.c_int spinCameraIsValid(spinCamera hCamera, ctypes.POINTER(bool8_t) pbValid)
        self.spinCameraIsValid=wrapper(lib.spinCameraIsValid)
        #  ctypes.c_int spinCameraRelease(spinCamera hCamera)
        self.spinCameraRelease=wrapper(lib.spinCameraRelease)
        #  ctypes.c_int spinCameraGetDeviceID(spinCamera hCamera, ctypes.c_char_p pBuf, ctypes.POINTER(ctypes.c_size_t) pBufLen)
        self.spinCameraGetDeviceID=srwrapper(lib.spinCameraGetDeviceID)
        #  ctypes.c_int spinCameraGetUniqueID(spinCamera hCamera, ctypes.c_char_p pBuf, ctypes.POINTER(ctypes.c_size_t) pBufLen)
        self.spinCameraGetUniqueID=srwrapper(lib.spinCameraGetUniqueID)
        
        #  ctypes.c_int spinSystemGetTLNodeMap(spinSystem hSystem, ctypes.POINTER(spinNodeMapHandle) phNodeMap)
        self.spinSystemGetTLNodeMap=wrapper(lib.spinSystemGetTLNodeMap)
        #  ctypes.c_int spinInterfaceGetTLNodeMap(spinInterface hInterface, ctypes.POINTER(spinNodeMapHandle) phNodeMap)
        self.spinInterfaceGetTLNodeMap=wrapper(lib.spinInterfaceGetTLNodeMap)
        #  ctypes.c_int spinCameraGetNodeMap(spinCamera hCamera, ctypes.POINTER(spinNodeMapHandle) phNodeMap)
        self.spinCameraGetNodeMap=wrapper(lib.spinCameraGetNodeMap)
        #  ctypes.c_int spinCameraGetTLDeviceNodeMap(spinCamera hCamera, ctypes.POINTER(spinNodeMapHandle) phNodeMap)
        self.spinCameraGetTLDeviceNodeMap=wrapper(lib.spinCameraGetTLDeviceNodeMap)
        #  ctypes.c_int spinCameraGetTLStreamNodeMap(spinCamera hCamera, ctypes.POINTER(spinNodeMapHandle) phNodeMap)
        self.spinCameraGetTLStreamNodeMap=wrapper(lib.spinCameraGetTLStreamNodeMap)

        #  ctypes.c_int spinNodeMapGetNode(spinNodeMapHandle hNodeMap, ctypes.c_char_p pName, ctypes.POINTER(spinNodeHandle) phNode)
        self.spinNodeMapGetNode=wrapper(lib.spinNodeMapGetNode)
        #  ctypes.c_int spinNodeMapGetNumNodes(spinNodeMapHandle hNodeMap, ctypes.POINTER(ctypes.c_size_t) pValue)
        self.spinNodeMapGetNumNodes=wrapper(lib.spinNodeMapGetNumNodes)
        #  ctypes.c_int spinNodeMapGetNodeByIndex(spinNodeMapHandle hNodeMap, ctypes.c_size_t index, ctypes.POINTER(spinNodeHandle) phNode)
        self.spinNodeMapGetNodeByIndex=wrapper(lib.spinNodeMapGetNodeByIndex)
        #  ctypes.c_int spinNodeMapReleaseNode(spinNodeMapHandle hNodeMap, spinNodeHandle hNode)
        self.spinNodeMapReleaseNode=wrapper(lib.spinNodeMapReleaseNode)
        #  ctypes.c_int spinNodeMapPoll(spinNodeMapHandle hNodeMap, ctypes.c_int64 timestamp)
        self.spinNodeMapPoll=wrapper(lib.spinNodeMapPoll)

        #  ctypes.c_int spinNodeIsImplemented(spinNodeHandle hNode, ctypes.POINTER(bool8_t) pbResult)
        self.spinNodeIsImplemented=wrapper(lib.spinNodeIsImplemented)
        #  ctypes.c_int spinNodeIsReadable(spinNodeHandle hNode, ctypes.POINTER(bool8_t) pbResult)
        self.spinNodeIsReadable=wrapper(lib.spinNodeIsReadable)
        #  ctypes.c_int spinNodeIsWritable(spinNodeHandle hNode, ctypes.POINTER(bool8_t) pbResult)
        self.spinNodeIsWritable=wrapper(lib.spinNodeIsWritable)
        #  ctypes.c_int spinNodeIsAvailable(spinNodeHandle hNode, ctypes.POINTER(bool8_t) pbResult)
        self.spinNodeIsAvailable=wrapper(lib.spinNodeIsAvailable)
        #  ctypes.c_int spinNodeIsEqual(spinNodeHandle hNodeFirst, spinNodeHandle hNodeSecond, ctypes.POINTER(bool8_t) pbResult)
        self.spinNodeIsEqual=wrapper(lib.spinNodeIsEqual)
        #  ctypes.c_int spinNodeGetAccessMode(spinNodeHandle hNode, ctypes.POINTER(ctypes.c_int) pAccessMode)
        self.spinNodeGetAccessMode=wrapper(lib.spinNodeGetAccessMode)
        #  ctypes.c_int spinNodeGetName(spinNodeHandle hNode, ctypes.c_char_p pBuf, ctypes.POINTER(ctypes.c_size_t) pBufLen)
        self.spinNodeGetName=srwrapper(lib.spinNodeGetName)
        #  ctypes.c_int spinNodeGetNameSpace(spinNodeHandle hNode, ctypes.POINTER(ctypes.c_int) pNamespace)
        self.spinNodeGetNameSpace=wrapper(lib.spinNodeGetNameSpace)
        #  ctypes.c_int spinNodeGetVisibility(spinNodeHandle hNode, ctypes.POINTER(ctypes.c_int) pVisibility)
        self.spinNodeGetVisibility=wrapper(lib.spinNodeGetVisibility)
        #  ctypes.c_int spinNodeGetCachingMode(spinNodeHandle hNode, ctypes.POINTER(ctypes.c_int) pCachingMode)
        self.spinNodeGetCachingMode=wrapper(lib.spinNodeGetCachingMode)
        #  ctypes.c_int spinNodeGetToolTip(spinNodeHandle hNode, ctypes.c_char_p pBuf, ctypes.POINTER(ctypes.c_size_t) pBufLen)
        self.spinNodeGetToolTip=srwrapper(lib.spinNodeGetToolTip)
        #  ctypes.c_int spinNodeGetDescription(spinNodeHandle hNode, ctypes.c_char_p pBuf, ctypes.POINTER(ctypes.c_size_t) pBufLen)
        self.spinNodeGetDescription=srwrapper(lib.spinNodeGetDescription)
        #  ctypes.c_int spinNodeGetDisplayName(spinNodeHandle hNode, ctypes.c_char_p pBuf, ctypes.POINTER(ctypes.c_size_t) pBufLen)
        self.spinNodeGetDisplayName=srwrapper(lib.spinNodeGetDisplayName)
        #  ctypes.c_int spinNodeGetType(spinNodeHandle hNode, ctypes.POINTER(ctypes.c_int) pType)
        self.spinNodeGetType=wrapper(lib.spinNodeGetType)
        #  ctypes.c_int spinNodeRegisterCallback(spinNodeHandle hNode, spinNodeCallbackFunction pCbFunction, ctypes.POINTER(spinNodeCallbackHandle) phCb)
        self.spinNodeRegisterCallback_lib=wrapper(lib.spinNodeRegisterCallback)
        #  ctypes.c_int spinNodeDeregisterCallback(spinNodeHandle hNode, spinNodeCallbackHandle hCb)
        self.spinNodeDeregisterCallback_lib=wrapper(lib.spinNodeDeregisterCallback)
        #  ctypes.c_int spinNodeInvalidateNode(spinNodeHandle hNode)
        self.spinNodeInvalidateNode=wrapper(lib.spinNodeInvalidateNode)
        #  ctypes.c_int spinNodeGetPollingTime(spinNodeHandle hNode, ctypes.POINTER(ctypes.c_int64) pPollingTime)
        self.spinNodeGetPollingTime=wrapper(lib.spinNodeGetPollingTime)
        #  ctypes.c_int spinNodeGetImposedAccessMode(spinNodeHandle hNode, ctypes.c_int imposedAccessMode)
        self.spinNodeGetImposedAccessMode=wrapper(lib.spinNodeGetImposedAccessMode)
        #  ctypes.c_int spinNodeGetImposedVisibility(spinNodeHandle hNode, ctypes.c_int imposedVisibility)
        self.spinNodeGetImposedVisibility=wrapper(lib.spinNodeGetImposedVisibility)

        #  ctypes.c_int spinNodeToString(spinNodeHandle hNode, ctypes.c_char_p pBuf, ctypes.POINTER(ctypes.c_size_t) pBufLen)
        self.spinNodeToString=srwrapper(lib.spinNodeToString)
        #  ctypes.c_int spinNodeToStringEx(spinNodeHandle hNode, bool8_t bVerify, ctypes.c_char_p pBuf, ctypes.POINTER(ctypes.c_size_t) pBufLen)
        self.spinNodeToStringEx=srwrapper(lib.spinNodeToStringEx)
        #  ctypes.c_int spinNodeFromString(spinNodeHandle hNode, ctypes.c_char_p pBuf)
        self.spinNodeFromString=wrapper(lib.spinNodeFromString)
        #  ctypes.c_int spinNodeFromStringEx(spinNodeHandle hNode, bool8_t bVerify, ctypes.c_char_p pBuf)
        self.spinNodeFromStringEx=wrapper(lib.spinNodeFromStringEx)
        
        #  ctypes.c_int spinStringSetValue(spinNodeHandle hNode, ctypes.c_char_p pBuf)
        self.spinStringSetValue=wrapper(lib.spinStringSetValue)
        #  ctypes.c_int spinStringSetValueEx(spinNodeHandle hNode, bool8_t bVerify, ctypes.c_char_p pBuf)
        self.spinStringSetValueEx=wrapper(lib.spinStringSetValueEx)
        #  ctypes.c_int spinStringGetValue(spinNodeHandle hNode, ctypes.c_char_p pBuf, ctypes.POINTER(ctypes.c_size_t) pBufLen)
        self.spinStringGetValue=srwrapper(lib.spinStringGetValue)
        #  ctypes.c_int spinStringGetValueEx(spinNodeHandle hNode, bool8_t bVerify, ctypes.c_char_p pBuf, ctypes.POINTER(ctypes.c_size_t) pBufLen)
        self.spinStringGetValueEx=srwrapper(lib.spinStringGetValueEx)
        #  ctypes.c_int spinStringGetMaxLength(spinNodeHandle hNode, ctypes.POINTER(ctypes.c_int64) pValue)
        self.spinStringGetMaxLength=wrapper(lib.spinStringGetMaxLength)

        #  ctypes.c_int spinIntegerSetValue(spinNodeHandle hNode, ctypes.c_int64 value)
        self.spinIntegerSetValue=wrapper(lib.spinIntegerSetValue)
        #  ctypes.c_int spinIntegerSetValueEx(spinNodeHandle hNode, bool8_t bVerify, ctypes.c_int64 value)
        self.spinIntegerSetValueEx=wrapper(lib.spinIntegerSetValueEx)
        #  ctypes.c_int spinIntegerGetValue(spinNodeHandle hNode, ctypes.POINTER(ctypes.c_int64) pValue)
        self.spinIntegerGetValue=wrapper(lib.spinIntegerGetValue)
        #  ctypes.c_int spinIntegerGetValueEx(spinNodeHandle hNode, bool8_t bVerify, ctypes.POINTER(ctypes.c_int64) pValue)
        self.spinIntegerGetValueEx=wrapper(lib.spinIntegerGetValueEx)
        #  ctypes.c_int spinIntegerGetMin(spinNodeHandle hNode, ctypes.POINTER(ctypes.c_int64) pValue)
        self.spinIntegerGetMin=wrapper(lib.spinIntegerGetMin)
        #  ctypes.c_int spinIntegerGetMax(spinNodeHandle hNode, ctypes.POINTER(ctypes.c_int64) pValue)
        self.spinIntegerGetMax=wrapper(lib.spinIntegerGetMax)
        #  ctypes.c_int spinIntegerGetInc(spinNodeHandle hNode, ctypes.POINTER(ctypes.c_int64) pValue)
        self.spinIntegerGetInc=wrapper(lib.spinIntegerGetInc)
        #  ctypes.c_int spinIntegerGetRepresentation(spinNodeHandle hNode, ctypes.POINTER(ctypes.c_int) pValue)
        self.spinIntegerGetRepresentation=wrapper(lib.spinIntegerGetRepresentation)

        #  ctypes.c_int spinFloatSetValue(spinNodeHandle hNode, ctypes.c_double value)
        self.spinFloatSetValue=wrapper(lib.spinFloatSetValue)
        #  ctypes.c_int spinFloatSetValueEx(spinNodeHandle hNode, bool8_t bVerify, ctypes.c_double value)
        self.spinFloatSetValueEx=wrapper(lib.spinFloatSetValueEx)
        #  ctypes.c_int spinFloatGetValue(spinNodeHandle hNode, ctypes.POINTER(ctypes.c_double) pValue)
        self.spinFloatGetValue=wrapper(lib.spinFloatGetValue)
        #  ctypes.c_int spinFloatGetValueEx(spinNodeHandle hNode, bool8_t bVerify, ctypes.POINTER(ctypes.c_double) pValue)
        self.spinFloatGetValueEx=wrapper(lib.spinFloatGetValueEx)
        #  ctypes.c_int spinFloatGetMin(spinNodeHandle hNode, ctypes.POINTER(ctypes.c_double) pValue)
        self.spinFloatGetMin=wrapper(lib.spinFloatGetMin)
        #  ctypes.c_int spinFloatGetMax(spinNodeHandle hNode, ctypes.POINTER(ctypes.c_double) pValue)
        self.spinFloatGetMax=wrapper(lib.spinFloatGetMax)
        #  ctypes.c_int spinFloatGetRepresentation(spinNodeHandle hNode, ctypes.POINTER(ctypes.c_int) pValue)
        self.spinFloatGetRepresentation=wrapper(lib.spinFloatGetRepresentation)
        #  ctypes.c_int spinFloatGetUnit(spinNodeHandle hNode, ctypes.c_char_p pBuf, ctypes.POINTER(ctypes.c_size_t) pBufLen)
        self.spinFloatGetUnit=srwrapper(lib.spinFloatGetUnit)

        #  ctypes.c_int spinBooleanSetValue(spinNodeHandle hNode, bool8_t value)
        self.spinBooleanSetValue=wrapper(lib.spinBooleanSetValue)
        #  ctypes.c_int spinBooleanGetValue(spinNodeHandle hNode, ctypes.POINTER(bool8_t) pbValue)
        self.spinBooleanGetValue=wrapper(lib.spinBooleanGetValue)

        #  ctypes.c_int spinEnumerationGetNumEntries(spinNodeHandle hEnumNode, ctypes.POINTER(ctypes.c_size_t) pValue)
        self.spinEnumerationGetNumEntries=wrapper(lib.spinEnumerationGetNumEntries)
        #  ctypes.c_int spinEnumerationGetEntryByIndex(spinNodeHandle hEnumNode, ctypes.c_size_t index, ctypes.POINTER(spinNodeHandle) phEntry)
        self.spinEnumerationGetEntryByIndex=wrapper(lib.spinEnumerationGetEntryByIndex)
        #  ctypes.c_int spinEnumerationGetEntryByName(spinNodeHandle hEnumNode, ctypes.c_char_p pName, ctypes.POINTER(spinNodeHandle) phEntry)
        self.spinEnumerationGetEntryByName=wrapper(lib.spinEnumerationGetEntryByName)
        #  ctypes.c_int spinEnumerationGetCurrentEntry(spinNodeHandle hEnumNode, ctypes.POINTER(spinNodeHandle) phEntry)
        self.spinEnumerationGetCurrentEntry=wrapper(lib.spinEnumerationGetCurrentEntry)
        #  ctypes.c_int spinEnumerationReleaseNode(spinNodeHandle hEnumNode, spinNodeHandle hEntry)
        self.spinEnumerationReleaseNode=wrapper(lib.spinEnumerationReleaseNode)
        #  ctypes.c_int spinEnumerationSetIntValue(spinNodeHandle hEnumNode, ctypes.c_int64 value)
        self.spinEnumerationSetIntValue=wrapper(lib.spinEnumerationSetIntValue)
        #  ctypes.c_int spinEnumerationSetEnumValue(spinNodeHandle hEnumNode, ctypes.c_size_t value)
        self.spinEnumerationSetEnumValue=wrapper(lib.spinEnumerationSetEnumValue)
        #  ctypes.c_int spinEnumerationEntryGetIntValue(spinNodeHandle hNode, ctypes.POINTER(ctypes.c_int64) pValue)
        self.spinEnumerationEntryGetIntValue=wrapper(lib.spinEnumerationEntryGetIntValue)
        #  ctypes.c_int spinEnumerationEntryGetEnumValue(spinNodeHandle hNode, ctypes.POINTER(ctypes.c_size_t) pValue)
        self.spinEnumerationEntryGetEnumValue=wrapper(lib.spinEnumerationEntryGetEnumValue)
        #  ctypes.c_int spinEnumerationEntryGetSymbolic(spinNodeHandle hNode, ctypes.c_char_p pBuf, ctypes.POINTER(ctypes.c_size_t) pBufLen)
        self.spinEnumerationEntryGetSymbolic=srwrapper(lib.spinEnumerationEntryGetSymbolic)

        #  ctypes.c_int spinRegisterGet(spinNodeHandle hNode, ctypes.POINTER(ctypes.c_uint8) pBuf, ctypes.c_int64 length)
        self.spinRegisterGet=wrapper(lib.spinRegisterGet)
        #  ctypes.c_int spinRegisterGetEx(spinNodeHandle hNode, bool8_t bVerify, bool8_t bIgnoreCache, ctypes.POINTER(ctypes.c_uint8) pBuf, ctypes.c_int64 length)
        self.spinRegisterGetEx=wrapper(lib.spinRegisterGetEx)
        #  ctypes.c_int spinRegisterGetAddress(spinNodeHandle hNode, ctypes.POINTER(ctypes.c_int64) pAddress)
        self.spinRegisterGetAddress=wrapper(lib.spinRegisterGetAddress)
        #  ctypes.c_int spinRegisterGetLength(spinNodeHandle hNode, ctypes.POINTER(ctypes.c_int64) pLength)
        self.spinRegisterGetLength=wrapper(lib.spinRegisterGetLength)
        #  ctypes.c_int spinRegisterSet(spinNodeHandle hNode, ctypes.POINTER(ctypes.c_uint8) pBuf, ctypes.c_int64 length)
        self.spinRegisterSet=wrapper(lib.spinRegisterSet)
        #  ctypes.c_int spinRegisterSetEx(spinNodeHandle hNode, bool8_t bVerify, ctypes.POINTER(ctypes.c_uint8) pBuf, ctypes.c_int64 length)
        self.spinRegisterSetEx=wrapper(lib.spinRegisterSetEx)
        #  ctypes.c_int spinRegisterSetReference(spinNodeHandle hNode, spinNodeHandle hRef)
        self.spinRegisterSetReference=wrapper(lib.spinRegisterSetReference)
        
        #  ctypes.c_int spinCommandExecute(spinNodeHandle hNode)
        self.spinCommandExecute=wrapper(lib.spinCommandExecute)
        #  ctypes.c_int spinCommandIsDone(spinNodeHandle hNode, ctypes.POINTER(bool8_t) pbValue)
        self.spinCommandIsDone=wrapper(lib.spinCommandIsDone)
        
        #  ctypes.c_int spinCategoryGetNumFeatures(spinNodeHandle hCategoryNode, ctypes.POINTER(ctypes.c_size_t) pValue)
        self.spinCategoryGetNumFeatures=wrapper(lib.spinCategoryGetNumFeatures)
        #  ctypes.c_int spinCategoryGetFeatureByIndex(spinNodeHandle hCategoryNode, ctypes.c_size_t index, ctypes.POINTER(spinNodeHandle) phFeature)
        self.spinCategoryGetFeatureByIndex=wrapper(lib.spinCategoryGetFeatureByIndex)
        #  ctypes.c_int spinCategoryReleaseNode(spinNodeHandle hCategoryNode, spinNodeHandle hFeature)
        self.spinCategoryReleaseNode=wrapper(lib.spinCategoryReleaseNode)

        #  ctypes.c_int spinCameraBeginAcquisition(spinCamera hCamera)
        self.spinCameraBeginAcquisition=wrapper(lib.spinCameraBeginAcquisition)
        #  ctypes.c_int spinCameraEndAcquisition(spinCamera hCamera)
        self.spinCameraEndAcquisition=wrapper(lib.spinCameraEndAcquisition)
        #  ctypes.c_int spinCameraGetNextImage(spinCamera hCamera, ctypes.POINTER(spinImage) phImage)
        self.spinCameraGetNextImage=wrapper(lib.spinCameraGetNextImage)
        #  ctypes.c_int spinCameraGetNextImageEx(spinCamera hCamera, ctypes.c_uint64 grabTimeout, ctypes.POINTER(spinImage) phImage)
        self.spinCameraGetNextImageEx=wrapper(lib.spinCameraGetNextImageEx)
        #  ctypes.c_int spinCameraGetNextImageSync(spinCamera hCamera, ctypes.c_uint64 grabTimeout, ctypes.POINTER(spinImageList) phImageList)
        self.spinCameraGetNextImageSync=wrapper(lib.spinCameraGetNextImageSync)
        #  ctypes.c_int spinCameraIsStreaming(spinCamera hCamera, ctypes.POINTER(bool8_t) pbIsStreaming)
        self.spinCameraIsStreaming=wrapper(lib.spinCameraIsStreaming)

        self.c_image_event_callback=ctypes_tools.WINFUNCTYPE(None,ctypes.c_void_p,ctypes.c_char_p,ctypes.c_void_p)
        #  ctypes.c_int spinImageEventHandlerCreate(ctypes.POINTER(spinImageEventHandler) phImageEventHandler, spinImageEventFunction pFunction, ctypes.c_void_p pUserData)
        self.spinImageEventHandlerCreate=wrapper(lib.spinImageEventHandlerCreate)
        #  ctypes.c_int spinImageEventHandlerDestroy(spinImageEventHandler hImageEventHandler)
        self.spinImageEventHandlerDestroy=wrapper(lib.spinImageEventHandlerDestroy)
        #  ctypes.c_int spinCameraRegisterImageEventHandler(spinCamera hCamera, spinImageEventHandler hImageEventHandler)
        self.spinCameraRegisterImageEventHandler=wrapper(lib.spinCameraRegisterImageEventHandler)
        #  ctypes.c_int spinCameraRegisterImageEventHandlerEx(spinCamera hCamera, spinImageEventHandler hImageEventHandler, ctypes.c_uint64 streamIndex)
        self.spinCameraRegisterImageEventHandlerEx=wrapper(lib.spinCameraRegisterImageEventHandlerEx)
        #  ctypes.c_int spinCameraUnregisterImageEventHandler(spinCamera hCamera, spinImageEventHandler hImageEventHandler)
        self.spinCameraUnregisterImageEventHandler=wrapper(lib.spinCameraUnregisterImageEventHandler)
        
        #  ctypes.c_int spinImageCreateEmpty(ctypes.POINTER(spinImage) phImage)
        self.spinImageCreateEmpty=wrapper(lib.spinImageCreateEmpty)
        #  ctypes.c_int spinImageCreate(spinImage hSrcImage, ctypes.POINTER(spinImage) phDestImage)
        self.spinImageCreate=wrapper(lib.spinImageCreate)
        #  ctypes.c_int spinImageCreateEx(ctypes.POINTER(spinImage) phImage, ctypes.c_size_t width, ctypes.c_size_t height, ctypes.c_size_t offsetX, ctypes.c_size_t offsetY, ctypes.c_int pixelFormat, ctypes.c_void_p pData)
        self.spinImageCreateEx=wrapper(lib.spinImageCreateEx)
        #  ctypes.c_int spinImageCreateEx2(ctypes.POINTER(spinImage) phImage, ctypes.c_size_t width, ctypes.c_size_t height, ctypes.c_size_t offsetX, ctypes.c_size_t offsetY, ctypes.c_int pixelFormat, ctypes.c_void_p pData, ctypes.c_int dataPayloadType, ctypes.c_size_t dataSize)
        self.spinImageCreateEx2=wrapper(lib.spinImageCreateEx2)
        #  ctypes.c_int spinImageDestroy(spinImage hImage)
        self.spinImageDestroy=wrapper(lib.spinImageDestroy)
        #  ctypes.c_int spinImageReset(spinImage hImage, ctypes.c_size_t width, ctypes.c_size_t height, ctypes.c_size_t offsetX, ctypes.c_size_t offsetY, ctypes.c_int pixelFormat)
        self.spinImageReset=wrapper(lib.spinImageReset)
        #  ctypes.c_int spinImageResetEx(spinImage hImage, ctypes.c_size_t width, ctypes.c_size_t height, ctypes.c_size_t offsetX, ctypes.c_size_t offsetY, ctypes.c_int pixelFormat, ctypes.c_void_p pData)
        self.spinImageResetEx=wrapper(lib.spinImageResetEx)
        #  ctypes.c_int spinImageGetID(spinImage hImage, ctypes.POINTER(ctypes.c_uint64) pId)
        self.spinImageGetID=wrapper(lib.spinImageGetID)
        #  ctypes.c_int spinImageGetData(spinImage hImage, ctypes.POINTER(ctypes.c_void_p) ppData)
        self.spinImageGetData=wrapper(lib.spinImageGetData)
        #  ctypes.c_int spinImageGetPrivateData(spinImage hImage, ctypes.POINTER(ctypes.c_void_p) ppData)
        self.spinImageGetPrivateData=wrapper(lib.spinImageGetPrivateData)
        #  ctypes.c_int spinImageGetBufferSize(spinImage hImage, ctypes.POINTER(ctypes.c_size_t) pSize)
        self.spinImageGetBufferSize=wrapper(lib.spinImageGetBufferSize)
        #  ctypes.c_int spinImageDeepCopy(spinImage hSrcImage, spinImage hDestImage)
        self.spinImageDeepCopy=wrapper(lib.spinImageDeepCopy)
        #  ctypes.c_int spinImageGetWidth(spinImage hImage, ctypes.POINTER(ctypes.c_size_t) pWidth)
        self.spinImageGetWidth=wrapper(lib.spinImageGetWidth)
        #  ctypes.c_int spinImageGetHeight(spinImage hImage, ctypes.POINTER(ctypes.c_size_t) pHeight)
        self.spinImageGetHeight=wrapper(lib.spinImageGetHeight)
        #  ctypes.c_int spinImageGetOffsetX(spinImage hImage, ctypes.POINTER(ctypes.c_size_t) pOffsetX)
        self.spinImageGetOffsetX=wrapper(lib.spinImageGetOffsetX)
        #  ctypes.c_int spinImageGetOffsetY(spinImage hImage, ctypes.POINTER(ctypes.c_size_t) pOffsetY)
        self.spinImageGetOffsetY=wrapper(lib.spinImageGetOffsetY)
        #  ctypes.c_int spinImageGetPaddingX(spinImage hImage, ctypes.POINTER(ctypes.c_size_t) pPaddingX)
        self.spinImageGetPaddingX=wrapper(lib.spinImageGetPaddingX)
        #  ctypes.c_int spinImageGetPaddingY(spinImage hImage, ctypes.POINTER(ctypes.c_size_t) pPaddingY)
        self.spinImageGetPaddingY=wrapper(lib.spinImageGetPaddingY)
        #  ctypes.c_int spinImageGetFrameID(spinImage hImage, ctypes.POINTER(ctypes.c_uint64) pFrameID)
        self.spinImageGetFrameID=wrapper(lib.spinImageGetFrameID)
        #  ctypes.c_int spinImageGetTimeStamp(spinImage hImage, ctypes.POINTER(ctypes.c_uint64) pTimeStamp)
        self.spinImageGetTimeStamp=wrapper(lib.spinImageGetTimeStamp)
        #  ctypes.c_int spinImageGetPayloadType(spinImage hImage, ctypes.POINTER(ctypes.c_size_t) pPayloadType)
        self.spinImageGetPayloadType=wrapper(lib.spinImageGetPayloadType)
        #  ctypes.c_int spinImageGetTLPayloadType(spinImage hImage, ctypes.POINTER(ctypes.c_int) pPayloadType)
        self.spinImageGetTLPayloadType=wrapper(lib.spinImageGetTLPayloadType)
        #  ctypes.c_int spinImageGetPixelFormat(spinImage hImage, ctypes.POINTER(ctypes.c_int) pPixelFormat)
        self.spinImageGetPixelFormat=wrapper(lib.spinImageGetPixelFormat)
        #  ctypes.c_int spinImageGetTLPixelFormat(spinImage hImage, ctypes.POINTER(ctypes.c_uint64) pPixelFormat)
        self.spinImageGetTLPixelFormat=wrapper(lib.spinImageGetTLPixelFormat)
        #  ctypes.c_int spinImageGetTLPixelFormatNamespace(spinImage hImage, ctypes.POINTER(ctypes.c_int) pPixelFormatNamespace)
        self.spinImageGetTLPixelFormatNamespace=wrapper(lib.spinImageGetTLPixelFormatNamespace)
        #  ctypes.c_int spinImageGetPixelFormatName(spinImage hImage, ctypes.c_char_p pBuf, ctypes.POINTER(ctypes.c_size_t) pBufLen)
        self.spinImageGetPixelFormatName=srwrapper(lib.spinImageGetPixelFormatName)
        #  ctypes.c_int spinImageIsIncomplete(spinImage hImage, ctypes.POINTER(bool8_t) pbIsIncomplete)
        self.spinImageIsIncomplete=wrapper(lib.spinImageIsIncomplete)
        #  ctypes.c_int spinImageGetStatus(spinImage hImage, ctypes.POINTER(ctypes.c_int) pStatus)
        self.spinImageGetStatus=wrapper(lib.spinImageGetStatus)
        #  ctypes.c_int spinImageGetStatusDescription(ctypes.c_int status, ctypes.c_char_p pBuf, ctypes.POINTER(ctypes.c_size_t) pBufLen)
        self.spinImageGetStatusDescription=srwrapper(lib.spinImageGetStatusDescription)
        #  ctypes.c_int spinImageRelease(spinImage hImage)
        self.spinImageRelease=wrapper(lib.spinImageRelease)
        #  ctypes.c_int spinImageHasCRC(spinImage hImage, ctypes.POINTER(bool8_t) pbHasCRC)
        self.spinImageHasCRC=wrapper(lib.spinImageHasCRC)
        #  ctypes.c_int spinImageCheckCRC(spinImage hImage, ctypes.POINTER(bool8_t) pbCheckCRC)
        self.spinImageCheckCRC=wrapper(lib.spinImageCheckCRC)
        #  ctypes.c_int spinImageGetBitsPerPixel(spinImage hImage, ctypes.POINTER(ctypes.c_size_t) pBitsPerPixel)
        self.spinImageGetBitsPerPixel=wrapper(lib.spinImageGetBitsPerPixel)
        #  ctypes.c_int spinImageGetSize(spinImage hImage, ctypes.POINTER(ctypes.c_size_t) pImageSize)
        self.spinImageGetSize=wrapper(lib.spinImageGetSize)
        #  ctypes.c_int spinImageGetStride(spinImage hImage, ctypes.POINTER(ctypes.c_size_t) pStride)
        self.spinImageGetStride=wrapper(lib.spinImageGetStride)
        
        self._initialized=True



        


        # #  ctypes.c_int spinSystemRegisterDeviceArrivalEventHandler(spinSystem hSystem, spinDeviceArrivalEventHandler hDeviceArrivalEventHandler)
        # self.spinSystemRegisterDeviceArrivalEventHandler=wrapper(lib.spinSystemRegisterDeviceArrivalEventHandler)
        # #  ctypes.c_int spinSystemRegisterDeviceRemovalEventHandler(spinSystem hSystem, spinDeviceRemovalEventHandler hDeviceRemovalEventHandler)
        # self.spinSystemRegisterDeviceRemovalEventHandler=wrapper(lib.spinSystemRegisterDeviceRemovalEventHandler)
        # #  ctypes.c_int spinSystemUnregisterDeviceArrivalEventHandler(spinSystem hSystem, spinDeviceArrivalEventHandler hDeviceArrivalEventHandler)
        # self.spinSystemUnregisterDeviceArrivalEventHandler=wrapper(lib.spinSystemUnregisterDeviceArrivalEventHandler)
        # #  ctypes.c_int spinSystemUnregisterDeviceRemovalEventHandler(spinSystem hSystem, spinDeviceRemovalEventHandler hDeviceRemovalEventHandler)
        # self.spinSystemUnregisterDeviceRemovalEventHandler=wrapper(lib.spinSystemUnregisterDeviceRemovalEventHandler)
        # #  ctypes.c_int spinSystemRegisterInterfaceEventHandler(spinSystem hSystem, spinInterfaceEventHandler hInterfaceEventHandler)
        # self.spinSystemRegisterInterfaceEventHandler=wrapper(lib.spinSystemRegisterInterfaceEventHandler)
        # #  ctypes.c_int spinSystemUnregisterInterfaceEventHandler(spinSystem hSystem, spinInterfaceEventHandler hInterfaceEventHandler)
        # self.spinSystemUnregisterInterfaceEventHandler=wrapper(lib.spinSystemUnregisterInterfaceEventHandler)
        
        # #  ctypes.c_int spinSystemSendActionCommand(spinSystem hSystem, ctypes.c_size_t iDeviceKey, ctypes.c_size_t iGroupKey, ctypes.c_size_t iGroupMask, ctypes.c_size_t iActionTime, bool8_t requestAck, ctypes.POINTER(ctypes.c_size_t) piResultSize, ctypes.POINTER(actionCommandResult) results)
        # self.spinSystemSendActionCommand=wrapper(lib.spinSystemSendActionCommand)
        
        # #  ctypes.c_int spinImageListCreateEmpty(ctypes.POINTER(spinImageList) phImageList)
        # self.spinImageListCreateEmpty=wrapper(lib.spinImageListCreateEmpty)
        # #  ctypes.c_int spinImageListDestroy(spinImageList hImageList)
        # self.spinImageListDestroy=wrapper(lib.spinImageListDestroy)
        # #  ctypes.c_int spinImageListGetSize(spinImageList hImageList, ctypes.POINTER(ctypes.c_size_t) pSize)
        # self.spinImageListGetSize=wrapper(lib.spinImageListGetSize)
        # #  ctypes.c_int spinImageListGet(spinImageList hImageList, ctypes.c_size_t index, ctypes.POINTER(spinImage) phImage)
        # self.spinImageListGet=wrapper(lib.spinImageListGet)
        # #  ctypes.c_int spinImageListClear(spinImageList hImageList)
        # self.spinImageListClear=wrapper(lib.spinImageListClear)
        # #  ctypes.c_int spinImageListRemove(spinImageList hImageList, ctypes.c_size_t index)
        # self.spinImageListRemove=wrapper(lib.spinImageListRemove)
        # #  ctypes.c_int spinImageListAppend(spinImageList hImageListBase, spinImageList hImageListToAppend)
        # self.spinImageListAppend=wrapper(lib.spinImageListAppend)
        # #  ctypes.c_int spinImageListGetByPixelFormat(spinImageList hImageList, ctypes.c_int pixelFormat, ctypes.POINTER(spinImage) phImage)
        # self.spinImageListGetByPixelFormat=wrapper(lib.spinImageListGetByPixelFormat)
        # #  ctypes.c_int spinImageListRemoveByPixelFormat(spinImageList hImageList, ctypes.c_int pixelFormat)
        # self.spinImageListRemoveByPixelFormat=wrapper(lib.spinImageListRemoveByPixelFormat)
        # #  ctypes.c_int spinImageListRelease(spinImageList hImageList)
        # self.spinImageListRelease=wrapper(lib.spinImageListRelease)
        # #  ctypes.c_int spinImageListSave(spinImageList hImageList, ctypes.c_char_p fileName)
        # self.spinImageListSave=wrapper(lib.spinImageListSave)
        # #  ctypes.c_int spinImageListLoad(ctypes.POINTER(spinImageList) phImageList, ctypes.c_char_p fileName)
        # self.spinImageListLoad=wrapper(lib.spinImageListLoad)

        # #  ctypes.c_int spinInterfaceUpdateCameras(spinInterface hInterface, ctypes.POINTER(bool8_t) pbChanged)
        # self.spinInterfaceUpdateCameras=wrapper(lib.spinInterfaceUpdateCameras)
        # #  ctypes.c_int spinInterfaceGetCameras(spinInterface hInterface, spinCameraList hCameraList)
        # self.spinInterfaceGetCameras=wrapper(lib.spinInterfaceGetCameras)
        # #  ctypes.c_int spinInterfaceGetCamerasEx(spinInterface hInterface, bool8_t bUpdateCameras, spinCameraList hCameraList)
        # self.spinInterfaceGetCamerasEx=wrapper(lib.spinInterfaceGetCamerasEx)
        # #  ctypes.c_int spinInterfaceRegisterDeviceArrivalEventHandler(spinInterface hInterface, spinDeviceArrivalEventHandler hDeviceArrivalEventHandler)
        # self.spinInterfaceRegisterDeviceArrivalEventHandler=wrapper(lib.spinInterfaceRegisterDeviceArrivalEventHandler)
        # #  ctypes.c_int spinInterfaceRegisterDeviceRemovalEventHandler(spinInterface hInterface, spinDeviceRemovalEventHandler hDeviceRemovalEventHandler)
        # self.spinInterfaceRegisterDeviceRemovalEventHandler=wrapper(lib.spinInterfaceRegisterDeviceRemovalEventHandler)
        # #  ctypes.c_int spinInterfaceUnregisterDeviceArrivalEventHandler(spinInterface hInterface, spinDeviceArrivalEventHandler hDeviceArrivalEventHandler)
        # self.spinInterfaceUnregisterDeviceArrivalEventHandler=wrapper(lib.spinInterfaceUnregisterDeviceArrivalEventHandler)
        # #  ctypes.c_int spinInterfaceUnregisterDeviceRemovalEventHandler(spinInterface hInterface, spinDeviceRemovalEventHandler hDeviceRemovalEventHandler)
        # self.spinInterfaceUnregisterDeviceRemovalEventHandler=wrapper(lib.spinInterfaceUnregisterDeviceRemovalEventHandler)
        # #  ctypes.c_int spinInterfaceRegisterInterfaceEventHandler(spinInterface hInterface, spinInterfaceEventHandler hInterfaceEventHandler)
        # self.spinInterfaceRegisterInterfaceEventHandler=wrapper(lib.spinInterfaceRegisterInterfaceEventHandler)
        # #  ctypes.c_int spinInterfaceUnregisterInterfaceEventHandler(spinInterface hInterface, spinInterfaceEventHandler hInterfaceEventHandler)
        # self.spinInterfaceUnregisterInterfaceEventHandler=wrapper(lib.spinInterfaceUnregisterInterfaceEventHandler)
        # #  ctypes.c_int spinInterfaceRelease(spinInterface hInterface)
        # self.spinInterfaceRelease=wrapper(lib.spinInterfaceRelease)
        # #  ctypes.c_int spinInterfaceIsInUse(spinInterface hInterface, ctypes.POINTER(bool8_t) pbIsInUse)
        # self.spinInterfaceIsInUse=wrapper(lib.spinInterfaceIsInUse)
        # #  ctypes.c_int spinInterfaceSendActionCommand(spinInterface hInterface, ctypes.c_size_t iDeviceKey, ctypes.c_size_t iGroupKey, ctypes.c_size_t iGroupMask, ctypes.c_size_t iActionTime, bool8_t requestAck, ctypes.POINTER(ctypes.c_size_t) piResultSize, ctypes.POINTER(actionCommandResult) results)
        # self.spinInterfaceSendActionCommand=wrapper(lib.spinInterfaceSendActionCommand)

        # #  ctypes.c_int spinCameraGetAccessMode(spinCamera hCamera, ctypes.POINTER(ctypes.c_int) pAccessMode)
        # self.spinCameraGetAccessMode=wrapper(lib.spinCameraGetAccessMode)
        # #  ctypes.c_int spinCameraReadPort(spinCamera hCamera, ctypes.c_uint64 iAddress, ctypes.c_void_p pBuffer, ctypes.c_size_t iSize)
        # self.spinCameraReadPort=wrapper(lib.spinCameraReadPort)
        # #  ctypes.c_int spinCameraWritePort(spinCamera hCamera, ctypes.c_uint64 iAddress, ctypes.c_void_p pBuffer, ctypes.c_size_t iSize)
        # self.spinCameraWritePort=wrapper(lib.spinCameraWritePort)
        # #  ctypes.c_int spinCameraGetGuiXml(spinCamera hCamera, ctypes.c_char_p pBuf, ctypes.POINTER(ctypes.c_size_t) pBufLen)
        # self.spinCameraGetGuiXml=wrapper(lib.spinCameraGetGuiXml)

        # #  ctypes.c_int spinCameraRegisterDeviceEventHandler(spinCamera hCamera, spinDeviceEventHandler hDeviceEventHandler)
        # self.spinCameraRegisterDeviceEventHandler=wrapper(lib.spinCameraRegisterDeviceEventHandler)
        # #  ctypes.c_int spinCameraRegisterDeviceEventHandlerEx(spinCamera hCamera, spinDeviceEventHandler hDeviceEventHandler, ctypes.c_char_p pName)
        # self.spinCameraRegisterDeviceEventHandlerEx=wrapper(lib.spinCameraRegisterDeviceEventHandlerEx)
        # #  ctypes.c_int spinCameraUnregisterDeviceEventHandler(spinCamera hCamera, spinDeviceEventHandler hDeviceEventHandler)
        # self.spinCameraUnregisterDeviceEventHandler=wrapper(lib.spinCameraUnregisterDeviceEventHandler)
        # #  ctypes.c_int spinCameraRegisterImageListEventHandler(spinCamera hCamera, spinImageListEventHandler hImageListEventHandler)
        # self.spinCameraRegisterImageListEventHandler=wrapper(lib.spinCameraRegisterImageListEventHandler)
        # #  ctypes.c_int spinCameraUnregisterImageListEventHandler(spinCamera hCamera, spinImageListEventHandler hImageListEventHandler)
        # self.spinCameraUnregisterImageListEventHandler=wrapper(lib.spinCameraUnregisterImageListEventHandler)

        # #  ctypes.c_int spinCameraDiscoverMaxPacketSize(spinCamera hCamera, ctypes.POINTER(ctypes.c_uint) pMaxPacketSize)
        # self.spinCameraDiscoverMaxPacketSize=wrapper(lib.spinCameraDiscoverMaxPacketSize)
        # #  ctypes.c_int spinCameraForceIP()
        # self.spinCameraForceIP=wrapper(lib.spinCameraForceIP)

        # #  ctypes.c_int spinImageGetColorProcessing(spinImage hImage, ctypes.POINTER(ctypes.c_int) pAlgorithm)
        # self.spinImageGetColorProcessing=wrapper(lib.spinImageGetColorProcessing)
        # #  ctypes.c_int spinImageGetValidPayloadSize(spinImage hImage, ctypes.POINTER(ctypes.c_size_t) pSize)
        # self.spinImageGetValidPayloadSize=wrapper(lib.spinImageGetValidPayloadSize)
        # #  ctypes.c_int spinImageSave(spinImage hImage, ctypes.c_char_p pFilename, ctypes.c_int format)
        # self.spinImageSave=wrapper(lib.spinImageSave)
        # #  ctypes.c_int spinImageSaveFromExt(spinImage hImage, ctypes.c_char_p pFilename)
        # self.spinImageSaveFromExt=wrapper(lib.spinImageSaveFromExt)
        # #  ctypes.c_int spinImageSavePng(spinImage hImage, ctypes.c_char_p pFilename, ctypes.POINTER(spinPNGOption) pOption)
        # self.spinImageSavePng=wrapper(lib.spinImageSavePng)
        # #  ctypes.c_int spinImageSavePpm(spinImage hImage, ctypes.c_char_p pFilename, ctypes.POINTER(spinPPMOption) pOption)
        # self.spinImageSavePpm=wrapper(lib.spinImageSavePpm)
        # #  ctypes.c_int spinImageSavePgm(spinImage hImage, ctypes.c_char_p pFilename, ctypes.POINTER(spinPGMOption) pOption)
        # self.spinImageSavePgm=wrapper(lib.spinImageSavePgm)
        # #  ctypes.c_int spinImageSaveTiff(spinImage hImage, ctypes.c_char_p pFilename, ctypes.POINTER(spinTIFFOption) pOption)
        # self.spinImageSaveTiff=wrapper(lib.spinImageSaveTiff)
        # #  ctypes.c_int spinImageSaveJpeg(spinImage hImage, ctypes.c_char_p pFilename, ctypes.POINTER(spinJPEGOption) pOption)
        # self.spinImageSaveJpeg=wrapper(lib.spinImageSaveJpeg)
        # #  ctypes.c_int spinImageSaveJpg2(spinImage hImage, ctypes.c_char_p pFilename, ctypes.POINTER(spinJPG2Option) pOption)
        # self.spinImageSaveJpg2=wrapper(lib.spinImageSaveJpg2)
        # #  ctypes.c_int spinImageSaveBmp(spinImage hImage, ctypes.c_char_p pFilename, ctypes.POINTER(spinBMPOption) pOption)
        # self.spinImageSaveBmp=wrapper(lib.spinImageSaveBmp)
        # #  ctypes.c_int spinImageGetChunkLayoutID(spinImage hImage, ctypes.POINTER(ctypes.c_uint64) pId)
        # self.spinImageGetChunkLayoutID=wrapper(lib.spinImageGetChunkLayoutID)
        # #  ctypes.c_int spinImageCalculateStatistics(spinImage hImage, spinImageStatistics hStatistics)
        # self.spinImageCalculateStatistics=wrapper(lib.spinImageCalculateStatistics)

        # #  ctypes.c_int spinDeviceEventHandlerCreate(ctypes.POINTER(spinDeviceEventHandler) phDeviceEventHandler, spinDeviceEventFunction pFunction, ctypes.c_void_p pUserData)
        # self.spinDeviceEventHandlerCreate=wrapper(lib.spinDeviceEventHandlerCreate)
        # #  ctypes.c_int spinDeviceEventHandlerDestroy(spinDeviceEventHandler hDeviceEventHandler)
        # self.spinDeviceEventHandlerDestroy=wrapper(lib.spinDeviceEventHandlerDestroy)
        # #  ctypes.c_int spinImageListEventHandlerCreate(ctypes.POINTER(spinImageListEventHandler) phImageEventHandler, spinImageListEventFunction pFunction, ctypes.c_void_p pUserData)
        # self.spinImageListEventHandlerCreate=wrapper(lib.spinImageListEventHandlerCreate)
        # #  ctypes.c_int spinImageListEventHandlerDestroy(spinImageListEventHandler hImageListEventHandler)
        # self.spinImageListEventHandlerDestroy=wrapper(lib.spinImageListEventHandlerDestroy)
        # #  ctypes.c_int spinDeviceArrivalEventHandlerCreate(ctypes.POINTER(spinDeviceArrivalEventHandler) phDeviceArrivalEventHandler, spinArrivalEventFunction pFunction, ctypes.c_void_p pUserData)
        # self.spinDeviceArrivalEventHandlerCreate=wrapper(lib.spinDeviceArrivalEventHandlerCreate)
        # #  ctypes.c_int spinDeviceArrivalEventHandlerDestroy(spinDeviceArrivalEventHandler hDeviceArrivalEventHandler)
        # self.spinDeviceArrivalEventHandlerDestroy=wrapper(lib.spinDeviceArrivalEventHandlerDestroy)
        # #  ctypes.c_int spinDeviceRemovalEventHandlerCreate(ctypes.POINTER(spinDeviceRemovalEventHandler) phDeviceRemovalEventHandler, spinRemovalEventFunction pFunction, ctypes.c_void_p pUserData)
        # self.spinDeviceRemovalEventHandlerCreate=wrapper(lib.spinDeviceRemovalEventHandlerCreate)
        # #  ctypes.c_int spinDeviceRemovalEventHandlerDestroy(spinDeviceRemovalEventHandler hDeviceRemovalEventHandler)
        # self.spinDeviceRemovalEventHandlerDestroy=wrapper(lib.spinDeviceRemovalEventHandlerDestroy)
        # #  ctypes.c_int spinInterfaceEventHandlerCreate(ctypes.POINTER(spinInterfaceEventHandler) phInterfaceEventHandler, spinArrivalEventFunction pArrivalFunction, spinRemovalEventFunction pRemovalFunction, ctypes.c_void_p pUserData)
        # self.spinInterfaceEventHandlerCreate=wrapper(lib.spinInterfaceEventHandlerCreate)
        # #  ctypes.c_int spinInterfaceEventHandlerDestroy(spinInterfaceEventHandler hInterfaceEventHandler)
        # self.spinInterfaceEventHandlerDestroy=wrapper(lib.spinInterfaceEventHandlerDestroy)
        # #  ctypes.c_int spinLogEventHandlerCreate(ctypes.POINTER(spinLogEventHandler) phLogEventHandler, spinLogEventFunction pFunction, ctypes.c_void_p pUserData)
        # self.spinLogEventHandlerCreate=wrapper(lib.spinLogEventHandlerCreate)
        # #  ctypes.c_int spinLogEventHandlerDestroy(spinLogEventHandler hLogEventHandler)
        # self.spinLogEventHandlerDestroy=wrapper(lib.spinLogEventHandlerDestroy)
        # #  ctypes.c_int spinLogDataGetCategoryName(spinLogEventData hLogEventData, ctypes.c_char_p pBuf, ctypes.POINTER(ctypes.c_size_t) pBufLen)
        # self.spinLogDataGetCategoryName=wrapper(lib.spinLogDataGetCategoryName)
        # #  ctypes.c_int spinLogDataGetPriority(spinLogEventData hLogEventData, ctypes.POINTER(ctypes.c_int64) pValue)
        # self.spinLogDataGetPriority=wrapper(lib.spinLogDataGetPriority)
        # #  ctypes.c_int spinLogDataGetPriorityName(spinLogEventData hLogEventData, ctypes.c_char_p pBuf, ctypes.POINTER(ctypes.c_size_t) pBufLen)
        # self.spinLogDataGetPriorityName=wrapper(lib.spinLogDataGetPriorityName)
        # #  ctypes.c_int spinLogDataGetTimestamp(spinLogEventData hLogEventData, ctypes.c_char_p pBuf, ctypes.POINTER(ctypes.c_size_t) pBufLen)
        # self.spinLogDataGetTimestamp=wrapper(lib.spinLogDataGetTimestamp)
        # #  ctypes.c_int spinLogDataGetNDC(spinLogEventData hLogEventData, ctypes.c_char_p pBuf, ctypes.POINTER(ctypes.c_size_t) pBufLen)
        # self.spinLogDataGetNDC=wrapper(lib.spinLogDataGetNDC)
        # #  ctypes.c_int spinLogDataGetThreadName(spinLogEventData hLogEventData, ctypes.c_char_p pBuf, ctypes.POINTER(ctypes.c_size_t) pBufLen)
        # self.spinLogDataGetThreadName=wrapper(lib.spinLogDataGetThreadName)
        # #  ctypes.c_int spinLogDataGetLogMessage(spinLogEventData hLogEventData, ctypes.c_char_p pBuf, ctypes.POINTER(ctypes.c_size_t) pBufLen)
        # self.spinLogDataGetLogMessage=wrapper(lib.spinLogDataGetLogMessage)
        # #  ctypes.c_int spinDeviceEventGetId(spinDeviceEventData hDeviceEventData, ctypes.POINTER(ctypes.c_uint64) pEventId)
        # self.spinDeviceEventGetId=wrapper(lib.spinDeviceEventGetId)
        # #  ctypes.c_int spinDeviceEventGetPayloadData(spinDeviceEventData hDeviceEventData, ctypes.POINTER(ctypes.c_uint8) pBuf, ctypes.POINTER(ctypes.c_size_t) pBufSize)
        # self.spinDeviceEventGetPayloadData=wrapper(lib.spinDeviceEventGetPayloadData)
        # #  ctypes.c_int spinDeviceEventGetPayloadDataSize(spinDeviceEventData hDeviceEventData, ctypes.POINTER(ctypes.c_size_t) pBufSize)
        # self.spinDeviceEventGetPayloadDataSize=wrapper(lib.spinDeviceEventGetPayloadDataSize)
        # #  ctypes.c_int spinDeviceEventGetName(spinDeviceEventData hDeviceEventData, ctypes.c_char_p pBuf, ctypes.POINTER(ctypes.c_size_t) pBufLen)
        # self.spinDeviceEventGetName=wrapper(lib.spinDeviceEventGetName)
        # #  ctypes.c_int spinImageChunkDataGetIntValue(spinImage hImage, ctypes.c_char_p pName, ctypes.POINTER(ctypes.c_int64) pValue)
        # self.spinImageChunkDataGetIntValue=wrapper(lib.spinImageChunkDataGetIntValue)
        # #  ctypes.c_int spinImageChunkDataGetFloatValue(spinImage hImage, ctypes.c_char_p pName, ctypes.POINTER(ctypes.c_double) pValue)
        # self.spinImageChunkDataGetFloatValue=wrapper(lib.spinImageChunkDataGetFloatValue)





        # #  ctypes.c_int quickSpinInit(spinCamera hCamera, ctypes.POINTER(quickSpin) pQuickSpin)
        # self.quickSpinInit=wrapper(lib.quickSpinInit)
        # #  ctypes.c_int quickSpinInitEx(spinCamera hCamera, ctypes.POINTER(quickSpin) pQuickSpin, ctypes.POINTER(quickSpinTLDevice) pQuickSpinTLDevice, ctypes.POINTER(quickSpinTLStream) pQuickSpinTLStream)
        # self.quickSpinInitEx=wrapper(lib.quickSpinInitEx)
        # #  ctypes.c_int quickSpinTLDeviceInit(spinCamera hCamera, ctypes.POINTER(quickSpinTLDevice) pQuickSpinTLDevice)
        # self.quickSpinTLDeviceInit=wrapper(lib.quickSpinTLDeviceInit)
        # #  ctypes.c_int quickSpinTLStreamInit(spinCamera hCamera, ctypes.POINTER(quickSpinTLStream) pQuickSpinTLStream)
        # self.quickSpinTLStreamInit=wrapper(lib.quickSpinTLStreamInit)
        # #  ctypes.c_int quickSpinTLInterfaceInit(spinInterface hInterface, ctypes.POINTER(quickSpinTLInterface) pQuickSpinTLInterface)
        # self.quickSpinTLInterfaceInit=wrapper(lib.quickSpinTLInterfaceInit)
        # #  ctypes.c_int quickSpinTLSystemInit(spinSystem hSystem, ctypes.POINTER(quickSpinTLSystem) pQuickSpinTLSystem)
        # self.quickSpinTLSystemInit=wrapper(lib.quickSpinTLSystemInit)
        
        # #  ctypes.c_int spinSystemSetLoggingLevel(spinSystem hSystem, ctypes.c_int logLevel)
        # self.spinSystemSetLoggingLevel=wrapper(lib.spinSystemSetLoggingLevel)
        # #  ctypes.c_int spinSystemGetLoggingLevel(spinSystem hSystem, ctypes.POINTER(ctypes.c_int) pLogLevel)
        # self.spinSystemGetLoggingLevel=wrapper(lib.spinSystemGetLoggingLevel)
        # #  ctypes.c_int spinSystemRegisterLogEventHandler(spinSystem hSystem, spinLogEventHandler hLogEventHandler)
        # self.spinSystemRegisterLogEventHandler=wrapper(lib.spinSystemRegisterLogEventHandler)
        # #  ctypes.c_int spinSystemUnregisterLogEventHandler(spinSystem hSystem, spinLogEventHandler hLogEventHandler)
        # self.spinSystemUnregisterLogEventHandler=wrapper(lib.spinSystemUnregisterLogEventHandler)
        # #  ctypes.c_int spinSystemUnregisterAllLogEventHandlers(spinSystem hSystem)
        # self.spinSystemUnregisterAllLogEventHandlers=wrapper(lib.spinSystemUnregisterAllLogEventHandlers)

        # #  ctypes.c_int spinImageProcessorCreate(ctypes.POINTER(spinImageProcessor) phImageProcessor)
        # self.spinImageProcessorCreate=wrapper(lib.spinImageProcessorCreate)
        # #  ctypes.c_int spinImageProcessorDestroy(spinImageProcessor hImageProcessor)
        # self.spinImageProcessorDestroy=wrapper(lib.spinImageProcessorDestroy)
        # #  ctypes.c_int spinImageProcessorSetColorProcessing(spinImageProcessor hImageProcessor, ctypes.c_int colorAlgorithm)
        # self.spinImageProcessorSetColorProcessing=wrapper(lib.spinImageProcessorSetColorProcessing)
        # #  ctypes.c_int spinImageProcessorGetColorProcessing(spinImageProcessor hImageProcessor, ctypes.POINTER(ctypes.c_int) pColorAlgorithm)
        # self.spinImageProcessorGetColorProcessing=wrapper(lib.spinImageProcessorGetColorProcessing)
        # #  ctypes.c_int spinImageProcessorSetNumDecompressionThreads(spinImageProcessor hImageProcessor, ctypes.c_uint numThreads)
        # self.spinImageProcessorSetNumDecompressionThreads=wrapper(lib.spinImageProcessorSetNumDecompressionThreads)
        # #  ctypes.c_int spinImageProcessorGetNumDecompressionThreads(spinImageProcessor hImageProcessor, ctypes.POINTER(ctypes.c_uint) pNumThreads)
        # self.spinImageProcessorGetNumDecompressionThreads=wrapper(lib.spinImageProcessorGetNumDecompressionThreads)
        # #  ctypes.c_int spinImageProcessorConvert(spinImageProcessor hImageProcessor, spinImage hSrcImage, spinImage hDestImage, ctypes.c_int destFormat)
        # self.spinImageProcessorConvert=wrapper(lib.spinImageProcessorConvert)
        # #  ctypes.c_int spinImageProcessorConvertImageList(spinImageProcessor hImageProcessor, spinImageList hSrcImageList, spinImage hDestImage, ctypes.c_int destFormat)
        # self.spinImageProcessorConvertImageList=wrapper(lib.spinImageProcessorConvertImageList)
        # #  ctypes.c_int spinImageProcessorApplyGamma(spinImageProcessor hImageProcessor, spinImage hSrcImage, spinImage hDestImage, ctypes.c_float gamma, bool8_t applyGammaInverse)
        # self.spinImageProcessorApplyGamma=wrapper(lib.spinImageProcessorApplyGamma)

        # #  ctypes.c_int spinImageStatisticsCreate(ctypes.POINTER(spinImageStatistics) phStatistics)
        # self.spinImageStatisticsCreate=wrapper(lib.spinImageStatisticsCreate)
        # #  ctypes.c_int spinImageStatisticsDestroy(spinImageStatistics hStatistics)
        # self.spinImageStatisticsDestroy=wrapper(lib.spinImageStatisticsDestroy)
        # #  ctypes.c_int spinImageStatisticsEnableAll(spinImageStatistics hStatistics)
        # self.spinImageStatisticsEnableAll=wrapper(lib.spinImageStatisticsEnableAll)
        # #  ctypes.c_int spinImageStatisticsDisableAll(spinImageStatistics hStatistics)
        # self.spinImageStatisticsDisableAll=wrapper(lib.spinImageStatisticsDisableAll)
        # #  ctypes.c_int spinImageStatisticsEnableGreyOnly(spinImageStatistics hStatistics)
        # self.spinImageStatisticsEnableGreyOnly=wrapper(lib.spinImageStatisticsEnableGreyOnly)
        # #  ctypes.c_int spinImageStatisticsEnableRgbOnly(spinImageStatistics hStatistics)
        # self.spinImageStatisticsEnableRgbOnly=wrapper(lib.spinImageStatisticsEnableRgbOnly)
        # #  ctypes.c_int spinImageStatisticsEnableHslOnly(spinImageStatistics hStatistics)
        # self.spinImageStatisticsEnableHslOnly=wrapper(lib.spinImageStatisticsEnableHslOnly)
        # #  ctypes.c_int spinImageStatisticsGetChannelStatus(spinImageStatistics hStatistics, ctypes.c_int channel, ctypes.POINTER(bool8_t) pbEnabled)
        # self.spinImageStatisticsGetChannelStatus=wrapper(lib.spinImageStatisticsGetChannelStatus)
        # #  ctypes.c_int spinImageStatisticsSetChannelStatus(spinImageStatistics hStatistics, ctypes.c_int channel, bool8_t bEnable)
        # self.spinImageStatisticsSetChannelStatus=wrapper(lib.spinImageStatisticsSetChannelStatus)
        # #  ctypes.c_int spinImageStatisticsGetRange(spinImageStatistics hStatistics, ctypes.c_int channel, ctypes.POINTER(ctypes.c_uint) pMin, ctypes.POINTER(ctypes.c_uint) pMax)
        # self.spinImageStatisticsGetRange=wrapper(lib.spinImageStatisticsGetRange)
        # #  ctypes.c_int spinImageStatisticsGetPixelValueRange(spinImageStatistics hStatistics, ctypes.c_int channel, ctypes.POINTER(ctypes.c_uint) pMin, ctypes.POINTER(ctypes.c_uint) pMax)
        # self.spinImageStatisticsGetPixelValueRange=wrapper(lib.spinImageStatisticsGetPixelValueRange)
        # #  ctypes.c_int spinImageStatisticsGetNumPixelValues(spinImageStatistics hStatistics, ctypes.c_int channel, ctypes.POINTER(ctypes.c_uint) pNumValues)
        # self.spinImageStatisticsGetNumPixelValues=wrapper(lib.spinImageStatisticsGetNumPixelValues)
        # #  ctypes.c_int spinImageStatisticsGetMean(spinImageStatistics hStatistics, ctypes.c_int channel, ctypes.POINTER(ctypes.c_float) pMean)
        # self.spinImageStatisticsGetMean=wrapper(lib.spinImageStatisticsGetMean)
        # #  ctypes.c_int spinImageStatisticsGetHistogram(spinImageStatistics hStatistics, ctypes.c_int channel, ctypes.POINTER(ctypes.POINTER(ctypes.c_int)) ppHistogram)
        # self.spinImageStatisticsGetHistogram=wrapper(lib.spinImageStatisticsGetHistogram)
        # #  ctypes.c_int spinImageStatisticsGetAll(spinImageStatistics hStatistics, ctypes.c_int channel, ctypes.POINTER(ctypes.c_uint) pRangeMin, ctypes.POINTER(ctypes.c_uint) pRangeMax, ctypes.POINTER(ctypes.c_uint) pPixelValueMin, ctypes.POINTER(ctypes.c_uint) pPixelValueMax, ctypes.POINTER(ctypes.c_uint) pNumPixelValues, ctypes.POINTER(ctypes.c_float) pPixelValueMean, ctypes.POINTER(ctypes.POINTER(ctypes.c_int)) ppHistogram)
        # self.spinImageStatisticsGetAll=wrapper(lib.spinImageStatisticsGetAll)

    _branch_node_name="_branch"
    def collect_nodes(self, node, pfx="", tree=None, add_branch=True):
        if tree is None:
            tree={}
        name=py3.as_str(self.spinNodeGetName(node))
        if pfx:
            name=pfx+"/"+name
        if self.spinNodeGetType(node)==spinNodeType.CategoryNode:
            if add_branch:
                tree[name+"/"+self._branch_node_name]=node
            for i in range(self.spinCategoryGetNumFeatures(node)):
                self.collect_nodes(self.spinCategoryGetFeatureByIndex(node,i),pfx=name,tree=tree,add_branch=add_branch)
        else:
            tree[name]=node
        return tree

wlib=TeledyneSpinnakerCLib()