From: Santiago Carot-Nemesio <sancane@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Santiago Carot-Nemesio <sancane@gmail.com>
Subject: [PATCH 25/26] Initial support for clock synchronization protocol
Date: Fri, 4 Jun 2010 10:27:18 +0200 [thread overview]
Message-ID: <1275640039-7245-26-git-send-email-sancane@gmail.com> (raw)
In-Reply-To: <1275640039-7245-25-git-send-email-sancane@gmail.com>
---
Makefile.am | 4 +-
mcap/mcap.c | 3 +-
mcap/sync.c | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 88 insertions(+), 4 deletions(-)
create mode 100644 mcap/sync.c
diff --git a/Makefile.am b/Makefile.am
index 93566b6..f96d556 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -170,8 +170,8 @@ builtin_sources += plugins/service.c
endif
if MCAP
-mcap_sources += mcap/mcap_internal.h \
- mcap/mcap_lib.h \
+mcap_sources += mcap/mcap_internal.h \
+ mcap/mcap_lib.h mcap/sync.c \
mcap/mcap.h mcap/mcap.c
endif
diff --git a/mcap/mcap.c b/mcap/mcap.c
index 656b254..d907eca 100644
--- a/mcap/mcap.c
+++ b/mcap/mcap.c
@@ -1511,8 +1511,7 @@ static void proc_cmd(struct mcap_mcl *mcl, uint8_t *cmd, uint32_t len)
{
if ((cmd[0] >= MCAP_MD_SYNC_CAP_REQ) &&
(cmd[0] <= MCAP_MD_SYNC_INFO_IND)) {
- send4B_cmd(mcl, cmd[0], MCAP_REQUEST_NOT_SUPPORTED,
- MCAP_MDLID_RESERVED);
+ proc_sync_cmd(mcl, cmd, len);
return;
}
diff --git a/mcap/sync.c b/mcap/sync.c
new file mode 100644
index 0000000..76f1377
--- /dev/null
+++ b/mcap/sync.c
@@ -0,0 +1,85 @@
+/*
+ *
+ * MCAP for BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 2010 GSyC/LibreSoft, Universidad Rey Juan Carlos.
+ *
+ * Authors:
+ * Santiago Carot-Nemesio <sancane at gmail.com>
+ * Jose Antonio Santos-Cadenas <santoscadenas at gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include <stdint.h>
+#include <netinet/in.h>
+
+#include "log.h"
+
+#include "mcap.h"
+#include "mcap_lib.h"
+#include "mcap_internal.h"
+
+static int send_unsupported_req(struct mcap_mcl *mcl, uint8_t oc)
+{
+ uint8_t *rsp;
+ mcap4B_rsp *rsp_err;
+ int sent;
+
+
+ rsp = g_malloc0(sizeof(mcap4B_rsp));
+
+ rsp_err = (mcap4B_rsp *)rsp;
+ rsp_err->op = oc;
+ rsp_err->rc = MCAP_REQUEST_NOT_SUPPORTED;
+ rsp_err->mdl = htons (MCAP_MDLID_RESERVED);
+
+ sent = mcap_send_data(g_io_channel_unix_get_fd(mcl->cc),
+ rsp,
+ sizeof(mcap4B_rsp));
+ g_free(rsp);
+ return sent;
+}
+
+void proc_sync_cmd(struct mcap_mcl *mcl, uint8_t *cmd, uint32_t len)
+{
+ switch (cmd[0]) {
+ case MCAP_MD_SYNC_CAP_REQ:
+ DBG("TODO: received MCAP_MD_SYNC_CAP_REQ: %d",
+ MCAP_MD_SYNC_CAP_REQ);
+ /* Not implemented yet. Reply with unsupported request */
+ send_unsupported_req(mcl, cmd[0]);
+ break;
+ case MCAP_MD_SYNC_CAP_RSP:
+ DBG("TODO: received MCAP_MD_SYNC_CAP_RSP: %d",
+ MCAP_MD_SYNC_CAP_RSP);
+ break;
+ case MCAP_MD_SYNC_SET_REQ:
+ DBG("TODO: received MCAP_MD_SYNC_SET_REQ: %d",
+ MCAP_MD_SYNC_SET_REQ);
+ /* Not implemented yet. Reply with unsupported request */
+ send_unsupported_req(mcl, cmd[0]);
+ break;
+ case MCAP_MD_SYNC_SET_RSP:
+ DBG("TODO: received MCAP_MD_SYNC_SET_RSP: %d",
+ MCAP_MD_SYNC_SET_RSP);
+ break;
+ case MCAP_MD_SYNC_INFO_IND:
+ DBG("TODO: received MCAP_MD_SYNC_INFO_IND :%d",
+ MCAP_MD_SYNC_INFO_IND);
+ break;
+ }
+}
--
1.6.3.3
next prev parent reply other threads:[~2010-06-04 8:27 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-04 8:26 Patches for MCAP Santiago Carot-Nemesio
2010-06-04 8:26 ` [PATCH 01/26] Initial support " Santiago Carot-Nemesio
2010-06-04 8:26 ` [PATCH 02/26] Initial work to create MCAP instances Santiago Carot-Nemesio
2010-06-04 8:26 ` [PATCH 03/26] Initial work to process incomming connection of MCLs Santiago Carot-Nemesio
2010-06-04 8:26 ` [PATCH 04/26] Process events over Control Channels Santiago Carot-Nemesio
2010-06-04 8:26 ` [PATCH 05/26] Save and restore state of MCLs Santiago Carot-Nemesio
2010-06-04 8:26 ` [PATCH 06/26] Release MCAP instances Santiago Carot-Nemesio
2010-06-04 8:27 ` [PATCH 07/26] Process md_create_mdl_req in CONNECTED state Santiago Carot-Nemesio
2010-06-04 8:27 ` [PATCH 08/26] Process md_reconnect_mdl_req " Santiago Carot-Nemesio
2010-06-04 8:27 ` [PATCH 09/26] Process md_delete_mdl_req " Santiago Carot-Nemesio
2010-06-04 8:27 ` [PATCH 10/26] Process md_abort_mdl_req in PENDING state Santiago Carot-Nemesio
2010-06-04 8:27 ` [PATCH 11/26] Process commands in ACTIVE state Santiago Carot-Nemesio
2010-06-04 8:27 ` [PATCH 12/26] Managing connection of Data Channels Santiago Carot-Nemesio
2010-06-04 8:27 ` [PATCH 13/26] Enable connect operation to a remote MCAP instances Santiago Carot-Nemesio
2010-06-04 8:27 ` [PATCH 14/26] Implement set callbacks operation over MCLs Santiago Carot-Nemesio
2010-06-04 8:27 ` [PATCH 15/26] Implement function to send md_create_mdl_req Santiago Carot-Nemesio
2010-06-04 8:27 ` [PATCH 16/26] Implement function to send md_reconnect_mdl_req Santiago Carot-Nemesio
2010-06-04 8:27 ` [PATCH 17/26] Implement function to send md_delete_mdl_req Santiago Carot-Nemesio
2010-06-04 8:27 ` [PATCH 18/26] Implement function to send md_abort_mdl_req Santiago Carot-Nemesio
2010-06-04 8:27 ` [PATCH 19/26] Process response to std. op. codes Santiago Carot-Nemesio
2010-06-04 8:27 ` [PATCH 20/26] Process md_create_mdl_rsp Santiago Carot-Nemesio
2010-06-04 8:27 ` [PATCH 21/26] Process md_reconnect_mdl_rsp Santiago Carot-Nemesio
2010-06-04 8:27 ` [PATCH 22/26] Process md_abort_mdl_rsp Santiago Carot-Nemesio
2010-06-04 8:27 ` [PATCH 23/26] Process md_delete_mdl_rsp Santiago Carot-Nemesio
2010-06-04 8:27 ` [PATCH 24/26] Enable connection of Data Channel with remote MCAP instances Santiago Carot-Nemesio
2010-06-04 8:27 ` Santiago Carot-Nemesio [this message]
2010-06-04 8:27 ` [PATCH 26/26] Free memory when a unref operation happens over a cached MCL Santiago Carot-Nemesio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1275640039-7245-26-git-send-email-sancane@gmail.com \
--to=sancane@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).