diff --git a/android/mcaptest.c b/android/mcaptest.c
index 9869abb..642dbf4 100644
--- a/android/mcaptest.c
+++ b/android/mcaptest.c
static int control_mode = MODE_LISTEN;
static int data_mode = MODE_LISTEN;
+static gboolean send_synccap_req = FALSE;
static gboolean mcl_disconnect = FALSE;
static gboolean mdl_disconnect = FALSE;
static int mcl_disconnect_timeout = -1;
static struct mcap_mcl *mcl = NULL;
+#define REQ_CLOCK_ACC 0x1400
+
static void mdl_connected_cb(struct mcap_mdl *mdl, void *data)
{
int fd = -1;
}
}
+static void sync_cap_cb(struct mcap_mcl *mcl, uint8_t mcap_err,
+ uint8_t btclockres, uint16_t synclead,
+ uint16_t tmstampres, uint16_t tmstampacc, GError *err,
+ gpointer data)
+{
+ /* TODO */
+ printf("%s\n", __func__);
+}
+
static void trigger_mdl_action(int mode)
{
GError *gerr = NULL;
g_error_free(gerr);
}
}
+
+ if (send_synccap_req && mcap->csp_enabled) {
+ mcap_sync_init(mcl);
+
+ mcap_sync_cap_req(mcl, REQ_CLOCK_ACC, sync_cap_cb, NULL, &gerr);
+ if (gerr) {
+ printf("MCAP Sync req error: %s\n", gerr->message);
+ g_error_free(gerr);
+ }
+ }
}
static void mcl_connected(struct mcap_mcl *mcap_mcl, gpointer data)
{
printf("%s\n", __func__);
- if (mcl)
+ if (mcl) {
+ mcap_sync_stop(mcl);
mcap_mcl_unref(mcl);
+ }
mcl = mcap_mcl_ref(mcap_mcl);
trigger_mdl_action(data_mode);
return;
}
- if (mcl)
+ if (mcl) {
+ mcap_sync_stop(mcl);
mcap_mcl_unref(mcl);
+ }
mcl = mcap_mcl_ref(mcap_mcl);
trigger_mdl_action(data_mode);
"\tmcaptest <control_mode> <data_mode> [options]\n");
printf("Control Link Mode:\n"
"\t-c connect <dst_addr>\n"
- "\t-e <timeout> disconnect MCL and quit after MDL is closed\n");
+ "\t-e <timeout> disconnect MCL and quit after MDL is closed\n"
+ "\t-g send clock sync capability request if MCL connected\n");
printf("Data Link Mode:\n"
"\t-d connect\n"
"\t-f <timeout> disconnect MDL after it's connected\n");
{ "device", 1, 0, 'i' },
{ "connect_cl", 1, 0, 'c' },
{ "disconnect_cl", 1, 0, 'e' },
+ { "synccap_req", 0, 0, 'g' },
{ "connect_dl", 0, 0, 'd' },
{ "disconnect_dl", 1, 0, 'f' },
{ "control_ch", 1, 0, 'C' },
exit(1);
}
- while ((opt = getopt_long(argc, argv, "+i:c:C:D:e:f:hd",
+ while ((opt = getopt_long(argc, argv, "+i:c:C:D:e:f:dgh",
main_options, NULL)) != EOF) {
switch (opt) {
case 'i':
break;
+ case 'g':
+ send_synccap_req = TRUE;
+
+ break;
+
case 'C':
ccpsm = atoi(optarg);
exit(1);
}
+ mcap_enable_csp(mcap);
+
switch (control_mode) {
case MODE_CONNECT:
ba2str(&dst, bdastr);