Get discovered Bluetooth devices.
()
| 8444 | iface_addrs = netifaces.ifaddresses(gw_tuple[1]).get(netifaces.AF_INET) |
| 8445 | if iface_addrs: |
| 8446 | my_ip = iface_addrs[0]['addr'] |
| 8447 | mask = iface_addrs[0]['netmask'] |
| 8448 | cidr_bits = sum(bin(int(x)).count('1') for x in mask.split('.')) |
| 8449 | primary = str(_ip.ip_network(f"{my_ip}/{cidr_bits}", strict=False)) |
| 8450 | except Exception: |
| 8451 | pass |
| 8452 | |
| 8453 | if request.method == 'GET': |
| 8454 | return jsonify({'subnets': subnets, 'primary': primary}) |
| 8455 | |
| 8456 | data = request.get_json() or {} |
| 8457 | raw = str(data.get('cidr', '')).strip() |
| 8458 | if not raw: |
| 8459 | return jsonify({'error': 'Missing cidr field'}), 400 |
| 8460 | |
| 8461 | # Validate |
| 8462 | try: |
| 8463 | net = _ip.ip_network(raw, strict=False) |
| 8464 | normalised = str(net) |
nothing calls this directly
no test coverage detected