* [PATCH 1/2] Extend Characteristic Write to support Write Without Response
@ 2011-03-09 19:03 Claudio Takahasi
2011-03-09 19:03 ` [PATCH 2/2] gatttool: Add Write Without Response option Claudio Takahasi
2011-03-10 9:21 ` [PATCH 1/2] Extend Characteristic Write to support Write Without Response Johan Hedberg
0 siblings, 2 replies; 3+ messages in thread
From: Claudio Takahasi @ 2011-03-09 19:03 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Claudio Takahasi
If callback is not informed, Write Command will be used to execute
a Write Without Response sub-procedure. Error is not returned by the
server no matter the result of the operation.
---
attrib/gatt.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/attrib/gatt.c b/attrib/gatt.c
index ae482f1..2b0d827 100644
--- a/attrib/gatt.c
+++ b/attrib/gatt.c
@@ -502,8 +502,12 @@ guint gatt_write_char(GAttrib *attrib, uint16_t handle, uint8_t *value,
uint8_t pdu[ATT_DEFAULT_LE_MTU];
guint16 plen;
- plen = enc_write_req(handle, value, vlen, pdu, sizeof(pdu));
- return g_attrib_send(attrib, 0, ATT_OP_WRITE_REQ, pdu, plen, func,
+ if (func)
+ plen = enc_write_req(handle, value, vlen, pdu, sizeof(pdu));
+ else
+ plen = enc_write_cmd(handle, value, vlen, pdu, sizeof(pdu));
+
+ return g_attrib_send(attrib, 0, pdu[0], pdu, plen, func,
user_data, NULL);
}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] gatttool: Add Write Without Response option
2011-03-09 19:03 [PATCH 1/2] Extend Characteristic Write to support Write Without Response Claudio Takahasi
@ 2011-03-09 19:03 ` Claudio Takahasi
2011-03-10 9:21 ` [PATCH 1/2] Extend Characteristic Write to support Write Without Response Johan Hedberg
1 sibling, 0 replies; 3+ messages in thread
From: Claudio Takahasi @ 2011-03-09 19:03 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Claudio Takahasi
Sub-procedure used to write a Characteristic Value to a server when
the client knows the Characteristic Value Handle and the client does
not need acknowledgement.
---
attrib/interactive.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/attrib/interactive.c b/attrib/interactive.c
index 5fc0af5..d92caa8 100644
--- a/attrib/interactive.c
+++ b/attrib/interactive.c
@@ -530,7 +530,7 @@ static void char_write_req_cb(guint8 status, const guint8 *pdu, guint16 plen,
printf("Characteristic value was written successfully\n");
}
-static void cmd_char_write_req(int argcp, char **argvp)
+static void cmd_char_write(int argcp, char **argvp)
{
uint8_t *value;
size_t plen;
@@ -542,7 +542,7 @@ static void cmd_char_write_req(int argcp, char **argvp)
}
if (argcp < 3) {
- printf("Usage: char-write-req <handle> <new value>\n");
+ printf("Usage: %s <handle> <new value>\n", argvp[0]);
return;
}
@@ -558,7 +558,11 @@ static void cmd_char_write_req(int argcp, char **argvp)
return;
}
- gatt_write_char(attrib, handle, value, plen, char_write_req_cb, NULL);
+ if (g_strcmp0("char-write-req", argvp[0]) == 0)
+ gatt_write_char(attrib, handle, value, plen,
+ char_write_req_cb, NULL);
+ else
+ gatt_write_char(attrib, handle, value, plen, NULL, NULL);
g_free(value);
}
@@ -629,8 +633,10 @@ static struct {
"Characteristics Value/Descriptor Read by handle" },
{ "char-read-uuid", cmd_read_uuid, "<UUID> [start hnd] [end hnd]",
"Characteristics Value/Descriptor Read by UUID" },
- { "char-write-req", cmd_char_write_req, "<handle> <new value>",
+ { "char-write-req", cmd_char_write, "<handle> <new value>",
"Characteristic Value Write (Write Request)" },
+ { "char-write-cmd", cmd_char_write, "<handle> <new value>",
+ "Characteristic Value Write (No response)" },
{ "sec-level", cmd_sec_level, "[low | medium | high]",
"Set security level. Default: low" },
{ NULL, NULL, NULL}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] Extend Characteristic Write to support Write Without Response
2011-03-09 19:03 [PATCH 1/2] Extend Characteristic Write to support Write Without Response Claudio Takahasi
2011-03-09 19:03 ` [PATCH 2/2] gatttool: Add Write Without Response option Claudio Takahasi
@ 2011-03-10 9:21 ` Johan Hedberg
1 sibling, 0 replies; 3+ messages in thread
From: Johan Hedberg @ 2011-03-10 9:21 UTC (permalink / raw)
To: Claudio Takahasi; +Cc: linux-bluetooth
Hi Claudio,
On Wed, Mar 09, 2011, Claudio Takahasi wrote:
> If callback is not informed, Write Command will be used to execute
> a Write Without Response sub-procedure. Error is not returned by the
> server no matter the result of the operation.
> ---
> attrib/gatt.c | 8 ++++++--
> 1 files changed, 6 insertions(+), 2 deletions(-)
Both patches have been pushed upstream. Thanks.
Johan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-03-10 9:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-09 19:03 [PATCH 1/2] Extend Characteristic Write to support Write Without Response Claudio Takahasi
2011-03-09 19:03 ` [PATCH 2/2] gatttool: Add Write Without Response option Claudio Takahasi
2011-03-10 9:21 ` [PATCH 1/2] Extend Characteristic Write to support Write Without Response Johan Hedberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).