return "Insufficient Resources to complete the request";
case ATT_ECODE_IO:
return "Internal application error: I/O";
+ case ATT_ECODE_TIMEOUT:
+ return "A timeout occured";
+ case ATT_ECODE_ABORTED:
+ return "The operation was aborted";
default:
return "Unexpected error code";
}
#define ATT_ECODE_INSUFF_RESOURCES 0x11
/* Application error */
#define ATT_ECODE_IO 0xFF
+#define ATT_ECODE_TIMEOUT 0xFE
+#define ATT_ECODE_ABORTED 0xFD
/* Characteristic Property bit field */
#define ATT_CHAR_PROPER_BROADCAST 0x01
guint next_evt_id;
GDestroyNotify destroy;
gpointer destroy_user_data;
+ gboolean stale;
};
struct command {
static gboolean disconnect_timeout(gpointer data)
{
struct _GAttrib *attrib = data;
+ struct command *c;
- attrib_destroy(attrib);
+ c = g_queue_pop_head(attrib->requests);
+ if (c == NULL)
+ goto done;
+
+ if (c->func)
+ c->func(ATT_ECODE_TIMEOUT, NULL, 0, c->user_data);
+
+ command_destroy(c);
+
+ while ((c = g_queue_pop_head(attrib->requests))) {
+ if (c->func)
+ c->func(ATT_ECODE_ABORTED, NULL, 0, c->user_data);
+ command_destroy(c);
+ }
+
+done:
+ attrib->stale = TRUE;
return FALSE;
}
GIOStatus iostat;
GQueue *queue;
+ if (attrib->stale)
+ return FALSE;
+
if (cond & (G_IO_HUP | G_IO_ERR | G_IO_NVAL))
return FALSE;
GIOStatus iostat;
gboolean norequests, noresponses;
+ if (attrib->stale)
+ return FALSE;
+
if (attrib->timeout_watch > 0) {
g_source_remove(attrib->timeout_watch);
attrib->timeout_watch = 0;
struct command *c;
GQueue *queue;
+ if (attrib->stale)
+ return 0;
+
c = g_try_new0(struct command, 1);
if (c == NULL)
return 0;