Hi Marcin, On Wed, Dec 18, 2013, Marcin Kraglak wrote: > On 18 December 2013 09:40, Johan Hedberg <johan.hedberg@xxxxxxxxx> wrote: > > Hi Marcin, > > > > On Tue, Dec 17, 2013, Marcin wrote: > >> +void bthost_l2cap_set_data_handler(struct bthost *bthost, > >> + bthost_l2cap_data_cb handler, > >> + uint16_t psm) > >> +{ > >> + bthost->read_data_psm = psm; > >> + bthost->l2cap_data_cb = handler; > >> +} > > > > The function is called just "data handler" but it applies to a more > > specific read_data_psm. Should this perhaps be simply called data_psm? > > > > > >> +typedef void (*bthost_l2cap_data_cb) (const void *data, uint16_t len); > >> + > >> +void bthost_l2cap_set_data_handler(struct bthost *bthost, > >> + bthost_l2cap_data_cb handler, > >> + uint16_t psm); > >> + > > > > The problem with your approach is that it will not be usable for > > protocols that have multiple channels to the same PSM such as AVDTP. > > To cover this I'd suggest you to consider having something like the > > following: > > > > typedef void (*bthost_l2cap_connect_cb) (uint16_t handle, uint16_t cid); > > > > void bthost_add_l2cap_server(struct bthost *bthost, uint16_t psm, > > bthost_l2cap_connect_cb func); > > /* the above could replace the existing bthost_set_server_psm */ > > > > void bthost_connect_l2cap(struct bthost *bthost, uint16_t handle, uint16_t psm, > > bthost_l2cap_connect_cb func); > > > > For sending and receiving data you wouldn't then need any new functions > > but you could use the already existing bthost_add_cid_hook (for > > receiving data) and bthost_send_cid (for sending data). > > > > Thoughts? > > > > Johan > > So first is to extend existing method bthost_add_l2cap_server and call > back after connect, and create method bthost_connect_l2cap (instead of > calling bthost_l2cap_req())? Maybe you can skip adding this higher level bthost_connect_l2cap for now and just use the existing bthost_l2cap_req. What I was thinking is that this new feature is kind of above the existing lower-level access functions but it's fine to try to keep using them as long as things don't get too messy. Johan -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html