#ifndef C8_RFKILL_H
#define C8_RFKILL_H

/*
 * The radios through /dev/rfkill (the active session's user may use it):
 * Airplane mode blocks every one of them, Wi-Fi, Bluetooth and mobile
 * broadband alike; NetworkManager and BlueZ follow.
 */
#include <stdbool.h>

typedef void (*rfkill_fn)(void *data);

/* fn runs whenever a radio comes, goes, or is blocked or unblocked */
void rfkill_listen(rfkill_fn fn, void *data);
void rfkill_unlisten(rfkill_fn fn, void *data);

bool rfkill_any(void); // there are radios
bool rfkill_airplane(void); // every one is off
bool rfkill_switched_off(void); // a hardware switch holds one off
void rfkill_set_airplane(bool on);

/* One kind (RFKILL_TYPE_BLUETOOTH, …) */
bool rfkill_blocked(int type);
void rfkill_block(int type, bool blocked);

#endif
