Exemple #1
0
def init_ly_zi(dso_hostname):
    """Initialize ly_zi DSO. *dso_hostname* is the IP address or resolvable network name

    Returns ly_zi_id"""
    # Initialize TCP link
    link = vicp.device()
    link.deviceAddress = dso_hostname
    if not link.connect():
        submod.setres(0,"ly_zi: Error initializing TCP link <- %s" % (link.LastErrorMsg))
        return
    # Turn on error logging
    if not link.write("CHLP EO\n",True,True):
        link.disconnect()
        submod.setres(0,"ly_zi: Error setting up error logging <- VICP error")
        return
    # Flush error queue
    retcode,res = get_error_queue(link)
    if retcode == 0:
        submod.setres(0,"ly_zi: %s" % (res))
        return
    # Turn on headers in responses
    if not link.write("CHDR SHORT\n"):
        submod.setres(0,"ly_zi: Error turning on headers in responses")
        return
    # Set datapoints to be recovered
    if not link.write("WFSU SP,0,NP,0,SN,0,FP,0\n"):
        submod.setres(0,"ly_zi: Error setting up waveform")
        return
    ly_zi_id=ly_zi_pool.new({"link":link})
    submod.setres(1,ly_zi_id)
def init_ly_lt344(dso_hostname):
    """Initialize ly_lt344 DSO. *dso_hostname* is the IP address or resolvable network name

    Returns ly_lt344_id"""
    # Initialize TCP link
    link = vicp.device()
    link.deviceAddress = dso_hostname
    if not link.connect():
        submod.setres(0,"ly_lt344: Error initializing TCP link <- %s" % (link.LastErrorMsg))
        return
    # Turn on error logging
    if not link.write("CHLP EO\n",True,True):
        link.disconnect()
        submod.setres(0,"ly_lt344: Error setting up error logging <- VICP error")
        return
    # Turn on headers in responses
    if not link.write("CHDR SHORT\n"):
        submod.setres(0,"ly_lt344: Error turning on headers in responses <- VICP error")
        return
    ly_lt344_id=ly_lt344_pool.new({"link":link})
    submod.setres(1,ly_lt344_id)