Bluez Programming

Da Wikipedia, l'enciclopedia libera.


Discoverable mode

struct hci_dev_req dr;
dr.dev_id  = hdev;

// The adapter is not detectable by other Bluetooth devices,
// and will not accept any incoming connections.
dr.dev_opt = SCAN_DISABLED;

// The adapter is detectable by other Bluetooth devices, but
// it wil not accept any incoming connections.
dr.dev_opt = SCAN_INQUIRY;

// Although not detectable by other Bluetooth devices, the
// adapter still accepts incoming connection requests by devices
// that already know the Bluetooth address of the adapter.
dr.dev_opt = SCAN_PAGE;

// Default: The adapter is detectable by other Bluetooth devices,
// and will accept incoming connection requests
dr.dev_opt = SCAN_PAGE | SCAN_INQUIRY;

ioctl(ctl, HCISETSCAN, (unsigned long)&dr);
Personal tools