/* * Function obex_deliver_event () * * Deliver an event to app. * */ void obex_deliver_event(obex_t *self, int event, int cmd, int rsp, int del) { if(self->state & MODE_SRV) self->eventcb(self, self->object, OBEX_SERVER, event, cmd, rsp); else self->eventcb(self, self->object, OBEX_CLIENT, event, cmd, rsp); if(del == TRUE && self->object != NULL) { obex_object_delete(self->object); self->object = NULL; } }
/* * Function obex_deliver_event () * * Deliver an event to app. * */ void obex_deliver_event(obex_t *self, int event, int cmd, int rsp, int del) { obex_object_t *object = self->object; if (del == TRUE) self->object = NULL; if (self->state & MODE_SRV) self->eventcb(self, object, OBEX_MODE_SERVER, event, cmd, rsp); else self->eventcb(self, object, OBEX_MODE_CLIENT, event, cmd, rsp); if (del == TRUE) obex_object_delete(object); }
obex_object_t * CALLAPI OBEX_ObjectNew(obex_t *self, uint8_t cmd) { obex_object_t *object; obex_return_val_if_fail(self != NULL, NULL); object = obex_object_new(); if (object == NULL) return NULL; obex_object_setcmd(object, cmd, (uint8_t) (cmd | OBEX_FINAL)); /* Need some special woodoo magic on connect-frame */ if (cmd == OBEX_CMD_CONNECT) { if (obex_insert_connectframe(self, object) < 0) { obex_object_delete(object); object = NULL; } } return object; }
/** Delete an OBEX object. \param self OBEX handle \param object object to delete. \return -1 on error Note that as soon as you have passed an object to the lib using OBEX_Request(), you shall not delete it yourself. */ LIB_SYMBOL int CALLAPI OBEX_ObjectDelete(obex_t *self, obex_object_t *object) { obex_return_val_if_fail(object != NULL, -1); return obex_object_delete(object); }