From ebb2715c2cf541a7f9a3b0a93f9d381df5553a2b Mon Sep 17 00:00:00 2001 From: Milanka Ringwald Date: Wed, 20 Mar 2019 09:22:18 +0100 Subject: [PATCH] map_client_text: proof of concept, msg notification server --- test/map_client/map_client_test.c | 39 ++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/test/map_client/map_client_test.c b/test/map_client/map_client_test.c index d9a588baa..c58933abd 100644 --- a/test/map_client/map_client_test.c +++ b/test/map_client/map_client_test.c @@ -60,6 +60,7 @@ #include "btstack_event.h" #include "bluetooth_sdp.h" #include "classic/goep_client.h" +#include "classic/obex.h" #include "map_client.h" #include "map_server.h" #include "classic/sdp_client.h" @@ -70,6 +71,8 @@ #include "btstack_stdin.h" #endif +static const uint8_t map_client_notification_service_uuid[] = {0xbb, 0x58, 0x2b, 0x41, 0x42, 0xc, 0x11, 0xdb, 0xb0, 0xde, 0x8, 0x0, 0x20, 0xc, 0x9a, 0x66}; + static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size); static bd_addr_t remote_addr; @@ -145,6 +148,39 @@ static void stdin_process(char c){ } } +static void obex_server_success_response(uint16_t rfcomm_cid){ + uint8_t event[30]; + int pos = 0; + event[pos++] = OBEX_RESP_SUCCESS; + // store len + pos += 2; + // obex version num + event[pos++] = OBEX_VERSION; + // flags + // Bit 0 should be used by the receiving client to decide how to multiplex operations + // to the server (should it desire to do so). If the bit is 0 the client should serialize + // the operations over a single TTP connection. If the bit is set the client is free to + // establish multiple TTP connections to the server and concurrently exchange its objects. + event[pos++] = 0; + + // Maximum OBEX packet length + big_endian_store_16(event, pos, 0x0400); + pos += 2; + + event[pos++] = OBEX_HEADER_CONNECTION_ID; + big_endian_store_32(event, pos, 0x1234); + pos += 4; + + event[pos++] = OBEX_HEADER_WHO; + big_endian_store_16(event, pos, 16 + 3); + pos += 2; + memcpy(event+pos, map_client_notification_service_uuid, 16); + pos += 16; + + big_endian_store_16(event, 1, pos); + rfcomm_send(rfcomm_cid, event, pos); +} + // packet handler for interactive console static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ UNUSED(channel); @@ -216,7 +252,8 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe for (i=0;i