Return-Path: MIME-Version: 1.0 In-Reply-To: References: <20120910235838.GA26986@samus> Date: Thu, 13 Sep 2012 14:59:56 -0700 Message-ID: Subject: Re: Dropping connection (bit off-topic) From: John Tobias To: Anderson Lizardo Cc: Vinicius Costa Gomes , linux-bluetooth@vger.kernel.org Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-bluetooth-owner@vger.kernel.org List-ID: Hi Anderson, I added these line of codes in gatttool: listen_start: g_attrib_register(attrib, ATT_OP_READ_BY_TYPE_RESP, events_handler, attrib, NULL); Then, in events_handler I dumped the handles for ATT_OP_READ_BY_TYPE_REQ and ATT_OP_READ_BY_TYPE_RESP: ATT_OP_READ_BY_TYPE_REQ: handle = 0x1 value: ff ff 00 2a ATT_OP_READ_BY_TYPE_RESP: handle = 0x207 value: 00 02 03 00 00 2a 04 00 02 05 00 01 2a 07 00 20 08 00 05 2a ATT_OP_READ_BY_TYPE_RESP: handle = 0xb15 value: 00 02 0c 00 31 3d 35 06 1e 60 70 a3 8d 4e 58 9c 2d 6a 3c 16 ATT_OP_READ_BY_TYPE_RESP: handle = 0xd15 value: 00 8a 0e 00 32 3d 35 06 1e 60 70 a3 8d 4e 58 9c 2d 6a 3c 16 ATT_OP_READ_BY_TYPE_RESP: handle = 0x1015 value: 00 88 11 00 33 3d 35 06 1e 60 70 a3 8d 4e 58 9c 2d 6a 3c 16 ATT_OP_READ_BY_TYPE_RESP: handle = 0x1315 value: 00 9a 14 00 52 72 3a 71 ae 82 0c ae e0 49 1d 18 c2 b4 d8 37 ATT_OP_READ_BY_TYPE_RESP: handle = 0x1715 value: 00 9a 18 00 36 72 3a 71 ae 82 0c ae e0 49 1d 18 c2 b4 d8 37 ATT_OP_READ_BY_TYPE_RESP: handle = 0x1b15 value: 00 9a 1c 00 37 72 3a 71 ae 82 0c ae e0 49 1d 18 c2 b4 d8 37 ATT_OP_READ_BY_TYPE_RESP: handle = 0x1f15 value: 00 8a 20 00 38 72 3a 71 ae 82 0c ae e0 49 1d 18 c2 b4 d8 37 ATT_OP_READ_BY_TYPE_RESP: handle = 0x2215 value: 00 98 23 00 40 72 3a 71 ae 82 0c ae e0 49 1d 18 c2 b4 d8 37 ATT_OP_READ_BY_TYPE_RESP: handle = 0x2615 value: 00 9a 27 00 41 72 3a 71 ae 82 0c ae e0 49 1d 18 c2 b4 d8 37 ATT_OP_READ_BY_TYPE_RESP: handle = 0x2a15 value: 00 98 2b 00 42 72 3a 71 ae 82 0c ae e0 49 1d 18 c2 b4 d8 37 ATT_OP_READ_BY_TYPE_RESP: handle = 0x2e15 value: 00 88 2f 00 60 72 3a 71 ae 82 0c ae e0 49 1d 18 c2 b4 d8 37 ATT_OP_READ_BY_TYPE_RESP: handle = 0x3115 value: 00 88 32 00 61 72 3a 71 ae 82 0c ae e0 49 1d 18 c2 b4 d8 37 ATT_OP_READ_BY_TYPE_RESP: handle = 0x3415 value: 00 12 35 00 62 72 3a 71 ae 82 0c ae e0 49 1d 18 c2 b4 d8 37 ATT_OP_READ_BY_TYPE_RESP: handle = 0x3715 value: 00 8a 38 00 39 72 3a 71 ae 82 0c ae e0 49 1d 18 c2 b4 d8 37 In hcidump: ACL data: handle 76 flags 0x02 dlen 9 ATT: Error (0x01) Error: Attribute not found (10) Read By Type req (0x08) on handle 0x0039 In hcidump, the error was the attribute for handle 0x0039. How I can respond to that request if the I did not receive the said handle? Regards, John On Thu, Sep 13, 2012 at 1:18 PM, Anderson Lizardo wrote: > Hi John, > > On Thu, Sep 13, 2012 at 4:11 PM, John Tobias wrote: >> Hi Anderson, >> >> If I add a simple GATT/GAP server on gatttool, should I still use the >> DBUS to listen or I can communicate directly to the kernel?. > > You either talk to bluetoothd (using D-Bus, like those test-* python > scripts do), which will handle connections for you, or you talk > directly to kernel using bluetooth socket (like gatttool does). You > have more flexibility talking to the kernel directly, but your app > will not be interoperable with other apps running at the same time, > specially if they try to call connect() at the same time (one of them > will get a EBUSY error). > > Using D-Bus, on the other hand, bluetoothd queues the connections properly. > > So you should use what is more appropriate for your use case. > > Best Regards, > -- > Anderson Lizardo > Instituto Nokia de Tecnologia - INdT > Manaus - Brazil