Ejemplo n.º 1
0
        public App(string dataPath)
        {
            DataPath = dataPath;

#if DEBUG
            // Debug logging
            Locator.RegisterConstant <ILogger>(new MyDebugLogger {
                Level = LogLevel.Debug
            });
#endif

            // Register logger for all require generic uses of Microsoft.Extensions.Logging.ILogger<T>
            //services.RegisterLogger<OicService>()
            //    .RegisterLogger<OICNet.OicClient>()
            //    .RegisterLogger<OICNet.OicResourceDiscoverClient>();

            // Ensure coap related schemas are supported
            CoapStyleUriParser.Register();

            // App-wide services
            Locator
            .RegisterLogger <CoapUdpTransportFactory>();

            Locator.Register <IDiscoveryService>(() => new DiscoveryService());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Supports CoAP scheme <see cref="Uri"/> for comparing to each other.
        /// See <see cref="Uri.Compare(Uri, Uri, UriComponents, UriFormat, StringComparison)"/>
        /// </summary>
        /// <param name="uri1"></param>
        /// <param name="uri2"></param>
        /// <param name="partsToCompare"></param>
        /// <param name="compareFormat"></param>
        /// <param name="comparisonType"></param>
        /// <returns></returns>
        public static int Compare(Uri uri1, Uri uri2, UriComponents partsToCompare, UriFormat compareFormat, StringComparison comparisonType)
        {
#if !NETSTANDARD1_3 && !NETSTANDARD1_4 && !NETSTANDARD1_5
            CoapStyleUriParser.Register();

            return(Uri.Compare(uri1, uri2, partsToCompare, compareFormat, comparisonType));
#else
            // Setup Default ports before performing comparasons.
            if (_schemes.Contains(uri1.Scheme.ToLower()) && uri1.Port == -1)
            {
                uri1 = new UriBuilder(uri1)
                {
                    Port = uri1.Scheme == "coap"
                        ? Coap.Port
                        : Coap.PortDTLS
                }
            }
 static CoapEndpointFactory()
 {
     CoapStyleUriParser.Register();
 }
Ejemplo n.º 4
0
 public void Setup()
 {
     CoapStyleUriParser.Register();
 }