diff options
author | Santiago Carot-Nemesio <sancane@gmail.com> | 2010-10-19 09:45:45 +0200 |
---|---|---|
committer | Jose Antonio Santos Cadenas <santoscadenas@gmail.com> | 2010-10-21 09:44:58 +0200 |
commit | b55676bd78c5ef8ffe91f93b4356d5ab0e0554f4 (patch) | |
tree | cb030dad7682d21d677f6a8de3255ab147106c91 /health | |
parent | 6732965eb18e9abd6be71d89b34d2fdde5e779ea (diff) | |
download | bluez-b55676bd78c5ef8ffe91f93b4356d5ab0e0554f4.tar.gz |
Change data channel mode for incoming connections
Diffstat (limited to 'health')
-rw-r--r-- | health/hdp.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/health/hdp.c b/health/hdp.c index 8a153104..fc8829ef 100644 --- a/health/hdp.c +++ b/health/hdp.c @@ -970,11 +970,18 @@ static void hdp_mcap_mdl_aborted_cb(struct mcap_mdl *mdl, void *data) dev->ndc = NULL; } +static uint8_t hdp2l2cap_mode(uint8_t hdp_mode) +{ + return hdp_mode == HDP_STREAMING_DC ? L2CAP_MODE_STREAMING : + L2CAP_MODE_ERTM; +} + static uint8_t hdp_mcap_mdl_conn_req_cb(struct mcap_mcl *mcl, uint8_t mdepid, uint16_t mdlid, uint8_t *conf, void *data) { struct hdp_device *dev = data; struct hdp_application *app; + GError *err = NULL; GSList *l; DBG("Data channel request"); @@ -996,6 +1003,13 @@ static uint8_t hdp_mcap_mdl_conn_req_cb(struct mcap_mcl *mcl, uint8_t mdepid, return MCAP_CONFIGURATION_REJECTED; /* not processed */ } + if (!mcap_set_data_chan_mode(dev->hdp_adapter->mi, + L2CAP_MODE_ERTM, &err)) { + error("Error: %s", err->message); + g_error_free(err); + return MCAP_MDL_BUSY; + } + dev->ndc = create_channel(dev, *conf, NULL, mdlid, NULL, NULL); return MCAP_SUCCESS; } @@ -1042,6 +1056,13 @@ static uint8_t hdp_mcap_mdl_conn_req_cb(struct mcap_mcl *mcl, uint8_t mdepid, g_free(path); } + if (!mcap_set_data_chan_mode(dev->hdp_adapter->mi, + hdp2l2cap_mode(*conf), &err)) { + error("Error: %s", err->message); + g_error_free(err); + return MCAP_MDL_BUSY; + } + dev->ndc = create_channel(dev, *conf, NULL, mdlid, app, NULL); if (!dev->ndc) return MCAP_MDL_BUSY; @@ -1053,6 +1074,7 @@ static uint8_t hdp_mcap_mdl_reconn_req_cb(struct mcap_mdl *mdl, void *data) { struct hdp_device *dev = data; struct hdp_channel *chan; + GError *err = NULL; GSList *l; l = g_slist_find_custom(dev->channels, mdl, cmp_chan_mdl); @@ -1065,6 +1087,13 @@ static uint8_t hdp_mcap_mdl_reconn_req_cb(struct mcap_mdl *mdl, void *data) (chan->mdep != HDP_MDEP_ECHO)) return MCAP_UNSPECIFIED_ERROR; + if (!mcap_set_data_chan_mode(dev->hdp_adapter->mi, + hdp2l2cap_mode(chan->config), &err)) { + error("Error: %s", err->message); + g_error_free(err); + return MCAP_MDL_BUSY; + } + dev->ndc = chan; return MCAP_SUCCESS; |