Ejemplo n.º 1
0
def api_move_i_indexvalue(indexvalue):
    args = map(int, indexvalue.split('/'))
    if len(args) % 2 == 0:
        return jsonify(
            {'move': {
                'i': serial.write(SerialCommand('i', *args))
            }})
    else:
        return links(['/api/move/i/%s/<int:value>' % indexvalue], False)
Ejemplo n.º 2
0
def api_move_l_valueofindex(valueofindex):
    args = map(int, valueofindex.split('/'))
    if len(args) == 16:
        return jsonify(
            {'move': {
                'l': serial.write(SerialCommand('l', *args))
            }})
    else:
        return links([
            '/api/move/l/%s%s<int:valueofindex15>' %
            (valueofindex, '/' if len(args) == 15 else '.../')
        ], False)
Ejemplo n.º 3
0
def api_communicate_b_note_duration(note, duration):
    return jsonify({
        'communicate': {
            'b': serial.write(SerialCommand('b', note, duration))
        }
    })
Ejemplo n.º 4
0
def api_communicate_u_repeat_tempo(repeat, tempo):
    return jsonify({
        'communicate': {
            'u': serial.write(SerialCommand('u', repeat, tempo))
        }
    })
Ejemplo n.º 5
0
def api_command_value(name):
    return jsonify({'command': {name: serial.write(SerialCommand(name))}})
Ejemplo n.º 6
0
def api_status_j():
    return jsonify({'status': {'j': serial.write(SerialCommand('j'))}})
Ejemplo n.º 7
0
def api_stop_r():
    return jsonify({'stop': {'r': serial.write(SerialCommand('r'))}})
Ejemplo n.º 8
0
def api_stop_d():
    return jsonify({'stop': {'d': serial.write(SerialCommand('d'))}})
Ejemplo n.º 9
0
def api_move_m_index_value(index, value):
    return jsonify(
        {'move': {
            'm': serial.write(SerialCommand('m', index, int(value)))
        }})