Date: Sat, 17 Jun 2006 20:08:06 +0100 (BST) From: Iain Hibbert <plunky@rya-online.net> To: Maksim Yevmenkin <maksim.yevmenkin@savvis.net> Cc: freebsd-bluetooth@freebsd.org Subject: Re: SDP Message-ID: <1150571287.231614.2893.nullmailer@galant.ukfsn.org> In-Reply-To: <44931C12.7020805@savvis.net> References: <1150200307.649295.228.nullmailer@galant.ukfsn.org> <44904A60.6080105@savvis.net> <1150322381.757072.1713.nullmailer@galant.ukfsn.org> <4492E9FA.2030708@savvis.net> <1150486990.380039.25644.nullmailer@galant.ukfsn.org> <44931C12.7020805@savvis.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 16 Jun 2006, Maksim Yevmenkin wrote: > i'm not sure why is it required to parse all the data and re-pack it into the > linked list, just to have another api that would search and extract data from > the linked list. I agree, and I dont like the plethora of functions that they use. Better I think to have a generic function and pass it an argument telling it what to look for, that way its easily extensible. > i had a chance to work with csr bluelab sdk recently and develop the I guess this is a proprietary system, but do they have a public API? My thought for a parse function would be to pass an array of some kind, describing the attributes and possible values that are wanted, plus the address of the storage location, so to find the HID control and interrupt PSM values you just go something like this: uint16_t control_psm, interrupt_psm; sdp_parse_t values[] = { { SDP_ATTR_PROTOCOL_DESCRIPTOR_LIST, { UUID, SDP_UUID_PROTOCOL_L2CAP }, { UINT16, &control_psm } }, { SDP_ATTR_ADDITIONAL_PROTOCOL_DESCRIPTOR_LIST, { UUID, SDP_UUID_PROTOCOL_L2CAP }, { UINT16, &interrupt_psm } } }; nvalues = 2; control_psm = 0; interrupt_psm = 0; err = sdp_parse(pdu, &values, nvalues); if (err || control_psm == 0 || interrupt_psm == 0) ... and this should be easily extensible for whatever you want to extract. The array can be static and const. It could be that you could specify mandatory/optional values and have the sdp_parse fail if mandatory fields are not accounted for. I didnt think about it too deeply, just the general concept. There can no doubt be a bunch of complications.. and thinking about it, if the same concept could be used to *construct* a PDU I would be especially pleased.. iain
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1150571287.231614.2893.nullmailer>