Ejemplo n.º 1
0
def esgabout():
    global esgbench
    message = []
    status = ESG.model(esgbench) # model
    message += ['Model: %s (%s)' % (status[1], status[0])]
    status = ESG.frequency(esgbench) # frequency
    message += ['Frequency: %s (%s)' % (status[1], status[0])]
    status = ESG.power(esgbench) # power
    message += ['Power: %s (%s)' % (status[1], status[0])]
    status = ESG.output(esgbench) # output
    message += ['RF output: %s (%s)' % (output_code(status[1]), status[0])]
    return jsonify(message=message)
Ejemplo n.º 2
0
def esgsettings():
    global esgbench
    message = []
    freq = request.args.get('freq')
    stat = ESG.frequency(esgbench, action=['Set',float(freq)])
    message += ['frequency (GHz): %s <%s>' %(stat[1], stat[0])]
    powa = request.args.get('powa')
    stat = ESG.power(esgbench, action=['Set',float(powa)])
    message += ['power (dBm): %s <%s>' %(stat[1], stat[0])]
    oupt = request.args.get('oupt')
    stat = ESG.output(esgbench, action=['Set',int(oupt)])
    message += ['RF output: %s <%s>' %(stat[1], stat[0])]
    return jsonify(message=message)
Ejemplo n.º 3
0
def esgreset():
    global esgbench
    try:
        esgbench = ESG.Initiate()
        status = "Success"
    except: status = "Error"
    return jsonify(message=status)
Ejemplo n.º 4
0
def show():
    global session
    status, ans, mark = None, None, {}

    if request.form.get('model'):
        stat = AWG.model(session)
        ans = stat[1]

    if request.form.get('gemarker'):
        stat = AWG.active_marker(session)
        mark = dict(active=stat[1])
        stat = AWG.marker_delay(session)
        mark.update(delay=stat[1])

    if request.form.get('reset'):
        status = AWG.InitWithOptions()
        session = status[1]
        return redirect('/')

    if request.form.get('semarker'):
        active = request.form.get('active')
        AWG.active_marker(session, action=['Set', active])
        delay = request.form.get('delay')
        AWG.marker_delay(session, action=['Set', float(delay)])
        return redirect('/')

    if request.form.get('closeawg'):  # or x == 1:
        AWG.close(session)
        return redirect('/')

    if request.form.get('esgon'):
        freq = request.form.get('frequency')
        powa = request.form.get('power')
        ESG.control(True, freq, powa)
        return redirect('/')

    if request.form.get('esgoff'):
        ESG.control(False)
        return redirect('/')

    return render_template('blog/combo.html', ans=ans,
                           mark=mark)  #this is where it really goes
Ejemplo n.º 5
0
def esgclose():
    global esgbench
    status = ESG.close(esgbench)
    return jsonify(message=status)