summaryrefslogtreecommitdiff
path: root/altosui/libaltos/libaltos.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-04-19 08:43:40 -0700
committerKeith Packard <keithp@keithp.com>2011-04-19 08:43:40 -0700
commit17f38e045fcd8ca0224095c0b2b7b098df77a8d8 (patch)
tree07c49d1151a54d3176f2356b55b6f9f129305b9c /altosui/libaltos/libaltos.c
parentf249e5926f5fd9f86c41e7f0a414193533d4d8b0 (diff)
altosui: Use persistent list of bluetooth devices for device dialogs
Store a list of known bluetooth devices as preferences. Always include those in device dialogs with an option to go browse for more devices in both the device dialog and the Configure AltosUI dialog. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosui/libaltos/libaltos.c')
-rw-r--r--altosui/libaltos/libaltos.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/altosui/libaltos/libaltos.c b/altosui/libaltos/libaltos.c
index 13635a0d..2c47f3e5 100644
--- a/altosui/libaltos/libaltos.c
+++ b/altosui/libaltos/libaltos.c
@@ -591,10 +591,9 @@ struct altos_bt_list {
};
#define INQUIRY_MAX_RSP 255
-#define INQUIRY_LEN 8
struct altos_bt_list *
-altos_bt_list_start(void)
+altos_bt_list_start(int inquiry_time)
{
struct altos_bt_list *bt_list;
@@ -614,7 +613,7 @@ altos_bt_list_start(void)
goto no_sock;
bt_list->num_rsp = hci_inquiry(bt_list->dev_id,
- INQUIRY_LEN,
+ inquiry_time,
INQUIRY_MAX_RSP,
NULL,
&bt_list->ii,
@@ -665,6 +664,15 @@ altos_bt_list_finish(struct altos_bt_list *bt_list)
free(bt_list);
}
+void
+altos_bt_fill_in(char *name, char *addr, struct altos_bt_device *device)
+{
+ strncpy(device->name, name, sizeof (device->name));
+ device->name[sizeof(device->name)-1] = '\0';
+ strncpy(device->addr, addr, sizeof (device->addr));
+ device->addr[sizeof(device->addr)-1] = '\0';
+}
+
struct altos_file *
altos_bt_open(struct altos_bt_device *device)
{
@@ -768,7 +776,7 @@ get_number(io_object_t object, CFStringRef entry, int *result)
}
struct altos_list *
-altos_list_start(void)
+altos_list_start(int time)
{
struct altos_list *list = calloc (sizeof (struct altos_list), 1);
CFMutableDictionaryRef matching_dictionary = IOServiceMatching("IOUSBDevice");