def radioChannel(): try: ips = get_radio_ip() except (ValueError, subprocess.CalledProcessError): return jsonify(status = 'error') if request.method == 'POST': coap.post('coap://[%s]/config?param=channel' % (ips['addrs'][0]), request.json['channel']) load_radio() return jsonify(status = 'ok') else: # GET return coap.get('coap://[%s]/config?param=channel' % (ips['addrs'][0]))
def radioChannel(): try: ip = get_radio_not_local_ip() except (ValueError, subprocess.CalledProcessError): return jsonify(status='error') if request.method == 'POST': coap.post('coap://[%s]/config?param=channel' % (ip), request.json['channel']) load_radio() return jsonify(status='ok') else: # GET return str(get_radio_channel)
def setSerial(serial): ip = get_radio_not_local_ip() coap.post('coap://[%s]/config?param=serial' % (ip), serial)