예제 #1
0
파일: controllers.py 프로젝트: jietang/dbrc
def post_screen():
    assert flask.request.method == 'POST', \
        'must POST a new screen'
    device_id = flask.request.json.get('device_id')
    device_name = flask.request.json.get('device_name')
    assert device_id, 'must provide a device id'
    assert device_name, 'must provide a device name'
    screen_id = generate_random_id()

    pairing_info = flask.request.json.get('pairing_info')
    return {"screen_id": model.register_device(device_id, device_name, screen_id, pairing_info)}
예제 #2
0
파일: controllers.py 프로젝트: jietang/dbrc
def post_broadcast():
    assert flask.request.method == 'POST', \
        'must use POST to start a broadcast, got %s' \
        % flask.request.method

    remote_id = flask.request.json and flask.request.json.get('remote_id')
    assert remote_id != None, 'must post with remote_id'
    broadcast_id = generate_random_id()
    model.start_broadcast(broadcast_id, remote_id)

    if flask.request.json:
        connected = flask.request.json.get('connected')
        if connected:
            model.set_broadcast_pairing_info(broadcast_id, connected)

    return {"broadcast_id": broadcast_id}