mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-16 16:54:38 +08:00
gobex: Use opcode instead of entire req in g_obex_response
This commit is contained in:
parent
0fb35029cf
commit
2e49852cce
@ -801,14 +801,14 @@ static void prepare_connect_rsp(GObex *obex, GObexPacket *rsp)
|
||||
g_obex_packet_prepend_header(rsp, connid);
|
||||
}
|
||||
|
||||
gboolean g_obex_response(GObex *obex, GObexPacket *req, guint8 rspcode,
|
||||
gboolean g_obex_response(GObex *obex, guint8 opcode, guint8 rspcode,
|
||||
GSList *headers, GError **err)
|
||||
{
|
||||
GObexPacket *rsp;
|
||||
|
||||
rsp = g_obex_packet_new(rspcode, TRUE, headers);
|
||||
|
||||
if (g_obex_packet_get_operation(req, NULL) == G_OBEX_OP_CONNECT)
|
||||
if (opcode == G_OBEX_OP_CONNECT)
|
||||
prepare_connect_rsp(obex, rsp);
|
||||
|
||||
return g_obex_send(obex, rsp, err);
|
||||
|
@ -64,7 +64,8 @@ void g_obex_unref(GObex *obex);
|
||||
guint g_obex_connect(GObex *obex, void *target, gsize target_len,
|
||||
GObexResponseFunc func, gpointer user_data,
|
||||
GError **err);
|
||||
gboolean g_obex_response(GObex *obex, GObexPacket *req, guint8 rspcode,
|
||||
|
||||
gboolean g_obex_response(GObex *obex, guint8 opcode, guint8 rspcode,
|
||||
GSList *headers, GError **err);
|
||||
|
||||
#endif /* __GOBEX_H */
|
||||
|
@ -63,9 +63,12 @@ static void disconn_func(GObex *obex, GError *err, gpointer user_data)
|
||||
|
||||
static void req_func(GObex *obex, GObexPacket *req, gpointer user_data)
|
||||
{
|
||||
g_print("Request 0x%02x\n", g_obex_packet_get_operation(req, NULL));
|
||||
gboolean final;
|
||||
guint8 op = g_obex_packet_get_operation(req, &final);
|
||||
|
||||
g_obex_response(obex, req, G_OBEX_RSP_SUCCESS, NULL, NULL);
|
||||
g_print("Request 0x%02x%s\n", op, final ? " (final)" : "");
|
||||
|
||||
g_obex_response(obex, op, G_OBEX_RSP_SUCCESS, NULL, NULL);
|
||||
}
|
||||
|
||||
static gboolean unix_accept(GIOChannel *chan, GIOCondition cond, gpointer data)
|
||||
|
Loading…
Reference in New Issue
Block a user