return ret;
}
-static void transfer_get_req_first(struct transfer *transfer,
- guint8 first_hdr_id, va_list args)
+static void transfer_get_req_first(struct transfer *transfer, GObexPacket *rsp)
{
GError *err = NULL;
- GObexPacket *rsp;
g_obex_debug(G_OBEX_DEBUG_TRANSFER, "transfer %u", transfer->id);
- rsp = g_obex_packet_new_valist(G_OBEX_RSP_CONTINUE, TRUE,
- first_hdr_id, args);
g_obex_packet_add_body(rsp, get_get_data, transfer);
if (!g_obex_send(transfer->obex, rsp, &err)) {
}
}
-guint g_obex_get_rsp(GObex *obex, GObexDataProducer data_func,
- GObexFunc complete_func, gpointer user_data,
- GError **err, guint8 first_hdr_id, ...)
+guint g_obex_get_rsp_pkt(GObex *obex, GObexPacket *rsp,
+ GObexDataProducer data_func, GObexFunc complete_func,
+ gpointer user_data, GError **err)
{
struct transfer *transfer;
- va_list args;
guint id;
g_obex_debug(G_OBEX_DEBUG_TRANSFER, "obex %p", obex);
transfer = transfer_new(obex, G_OBEX_OP_GET, complete_func, user_data);
transfer->data_producer = data_func;
- va_start(args, first_hdr_id);
- transfer_get_req_first(transfer, first_hdr_id, args);
- va_end(args);
+ transfer_get_req_first(transfer, rsp);
if (!g_slist_find(transfers, transfer))
return 0;
return transfer->id;
}
+guint g_obex_get_rsp(GObex *obex, GObexDataProducer data_func,
+ GObexFunc complete_func, gpointer user_data,
+ GError **err, guint8 first_hdr_id, ...)
+{
+ GObexPacket *rsp;
+ va_list args;
+
+ g_obex_debug(G_OBEX_DEBUG_TRANSFER, "obex %p", obex);
+
+ va_start(args, first_hdr_id);
+ rsp = g_obex_packet_new_valist(G_OBEX_RSP_CONTINUE, TRUE,
+ first_hdr_id, args);
+ va_end(args);
+
+ return g_obex_get_rsp_pkt(obex, rsp, data_func, complete_func,
+ user_data, err);
+}
+
gboolean g_obex_cancel_transfer(guint id)
{
struct transfer *transfer = NULL;
GObexFunc complete_func, gpointer user_data,
GError **err, guint8 first_hdr_id, ...);
+guint g_obex_get_rsp_pkt(GObex *obex, GObexPacket *rsp,
+ GObexDataProducer data_func, GObexFunc complete_func,
+ gpointer user_data, GError **err);
+
gboolean g_obex_cancel_transfer(guint id);
const char *g_obex_strerror(guint8 err_code);