Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
The CoreBluetooth pattern of saving a discovered peripheral's UUID for future reconnection using [CBCentralManager retrievePeripherals] is a bit clunky given the current MonoTouch API surface. It appears that I either have to p/invoke CFUUIDCreateString() or do string fiddling along the lines of:
var uuidString = CBUUID.FromCFUUID(e.peripheral.UUID).ToString ();
var start = uuidString.IndexOf ("<");
var end = uuidString.IndexOf (">");
var guid = uuidString.Substring(start + 1, end - start - 1).Replace (" ","");
var validGuid = guid.Insert (8, "-").Insert (13,"-").Insert (18,"-").Insert (23,"-");
It would be convenient to have a built-in way of getting a string from a CBUUID that can be fed right back into CBUUID.FromString().
I'm not sure CFUUIDCreateString would help. Apple documentation does not state that CBUUID and CFUUID are tool-free bridged.
It could be missing (documentation) but CFUUID and NSUUID are documented not to be toll free _and_ there's an API to create a CBUUID from a CFUUID (which would not be needed).
OTOH easy roundtripping is something we should provide.
I mentioned CFUUIDCreateString because that is how Apple does it with their TemperatureSensor example:
Thanks for responding and considering it!
ToString was overriden so it can be used to roundtrip. The old string value is still available with the `Description` property.
There's also a ToString overload that takes a boolean, when using `true` it will "promote" a 16bits UUID into a 128bits UUID, otherwise (false, default), the original size will be kept.