Expand|Select|Wrap|Line Numbers
- IAdapter adapter;
- IDevice device;
- IService AppService;
- ObservableCollection<IService> services;
- adapter.DeviceConnected += (s, e) => {
- device = e.Device;
- // when services are discovered
- device.ServicesDiscovered += (object se, EventArgs ea) => {
- if (services.Count == 0)
- Device.BeginInvokeOnMainThread (() => {
- foreach (var service in device.Services) {
- if (service.ID == 0x2A37.UuidFromPartial ()) {
- AppService = service as IService;
- } else {
- services.Add (service);
- }
- }
- } );
- } ;
- // start looking for services
- device.DiscoverServices ();
- };
I could also have a function, to `SearchFor(x)`, and set up a ubiquitous `ObservableCollection`, and just throw x into it? Not sure if it could deal with both `IService` and `ICharacteristic`, unless I just has 2 if statements and defined different behaviour for each. Still, it would be god to see some suggestions for the best way to move forward.
Any thoughts / suggestions would be much appreciated. Thanks.