/* * Function obex_response_request (self, opcode) * * Send a response to peer device * */ void obex_response_request(obex_t *self, uint8_t opcode) { buf_t *msg; obex_return_if_fail(self != NULL); msg = buf_reuse(self->tx_msg); obex_data_request(self, msg, opcode | OBEX_FINAL); }
/* * Function obex_response_request (self, opcode) * * Send a response to peer device * */ void obex_response_request(obex_t *self, uint8_t opcode) { GNetBuf *msg; obex_return_if_fail(self != NULL); msg = g_netbuf_recycle(self->tx_msg); g_netbuf_reserve(msg, sizeof(obex_common_hdr_t)); obex_data_request(self, msg, opcode | OBEX_FINAL); }
/** Change user callback on an OBEX handle. \param self OBEX handle \param eventcb Function pointer to your new event callback. \param data Pointer to the new user data to pass to the new callback (optional) */ LIB_SYMBOL void CALLAPI OBEX_SetUserCallBack(obex_t *self, obex_event_t eventcb, void * data) { obex_return_if_fail(self != NULL); /* The callback can't be NULL */ if (eventcb != NULL) { self->eventcb = eventcb; /* Optionaly change the user data */ if (data != NULL) self->userdata = data; } }
/** Close down an OBEX instance. \param self OBEX handle Disconnects the transport and frees the interface (see #OBEX_FreeInterfaces). */ LIB_SYMBOL void CALLAPI OBEX_Cleanup(obex_t *self) { obex_return_if_fail(self != NULL); obex_transport_disconnect_request(self); obex_transport_disconnect_server(self); if (self->tx_msg) buf_free(self->tx_msg); if (self->rx_msg) buf_free(self->rx_msg); OBEX_FreeInterfaces(self); free(self); }
/** Free memory allocated to OBEX interface structures. \param self OBEX handle Frees memory allocated to OBEX interface structures after it has been allocated by OBEX_EnumerateInterfaces. */ LIB_SYMBOL void CALLAPI OBEX_FreeInterfaces(obex_t *self) { DEBUG(4, "\n"); obex_return_if_fail(self != NULL); switch (self->trans.type) { case OBEX_TRANS_USB: #ifdef HAVE_USB usbobex_free_interfaces(self->interfaces_number, self->interfaces); self->interfaces = NULL; #endif break; default: break; } self->interfaces_number = 0; }
/** Set customdata of an OBEX handle. \param self OBEX handle \param data Custom Transport data Note : this call is *reserved* to the Custom Transport and should not be use by the user/client. It allow to update the Custom Transport data originally set via OBEX_RegisterCTransport(). The Custom Transport data (or instance handle) is used to store data relative to the specific instance (i.e. connection), such as file descriptors, offsets and others, so that the Custom Transport can manage multiple connections transparently (i.e. without a lookup table). - Jean II */ LIB_SYMBOL void CALLAPI OBEX_SetCustomData(obex_t *self, void *data) { obex_return_if_fail(self != NULL); self->ctrans.customdata = data; }
/** Set userdata of an OBEX handle. \param self OBEX handle \param data It's all up to you! */ LIB_SYMBOL void CALLAPI OBEX_SetUserData(obex_t *self, void * data) { obex_return_if_fail(self != NULL); self->userdata=data; }