Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ThingsDiscoveryLink.cs
4
6{
11 {
16 {
17 }
18
24 public Grade Supports(Uri Link)
25 {
26 return Link.Scheme.Equals(Constants.UriSchemes.IotDisco, StringComparison.OrdinalIgnoreCase) ? Grade.Ok : Grade.NotAtAll;
27 }
28
35 public async Task<bool> TryOpenLink(Uri Link, bool ShowErrorIfUnable)
36 {
37 string Url = Link.OriginalString;
38
39 if (ServiceRef.XmppService.IsIoTDiscoClaimURI(Url))
40 await ServiceRef.ThingRegistryOrchestratorService.OpenClaimDevice(Url);
41 else if (ServiceRef.XmppService.IsIoTDiscoSearchURI(Url))
42 await ServiceRef.ThingRegistryOrchestratorService.OpenSearchDevices(Url);
43 else if (ServiceRef.XmppService.IsIoTDiscoDirectURI(Url))
44 await ServiceRef.ThingRegistryOrchestratorService.OpenDeviceReference(Url);
45 else
46 {
47 if (ShowErrorIfUnable)
48 {
49 await ServiceRef.UiService.DisplayAlert(ServiceRef.Localizer[nameof(AppResources.ErrorTitle)],
50 ServiceRef.Localizer[nameof(AppResources.InvalidIoTDiscoveryCode)] + Environment.NewLine + Environment.NewLine + Url);
51 }
52
53 return false;
54 }
55
56 ServiceRef.TagProfile.HasThing = true;
57
58 return true;
59 }
60 }
61}
const string IotDisco
The IoT Discovery URI Scheme (iotdisco)
Definition: Constants.cs:104
A set of never changing property constants and helpful values.
Definition: Constants.cs:7
Base class that references services in the app.
Definition: ServiceRef.cs:31
static IUiService UiService
Service serializing and managing UI-related tasks.
Definition: ServiceRef.cs:55
static IStringLocalizer Localizer
Localization service
Definition: ServiceRef.cs:235
static IThingRegistryOrchestratorService ThingRegistryOrchestratorService
Thing Registry orchestrator service.
Definition: ServiceRef.cs:127
static IXmppService XmppService
The XMPP service for XMPP communication.
Definition: ServiceRef.cs:67
Grade
Grade enumeration
Definition: Grade.cs:7