예제 #1
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="iotHubConnectionManager">マネージャ</param>
        /// <param name="logger">ロガー</param>
        /// <param name="configuration">設定</param>
        public IotHubApiHandler(IotHubConnectionManager iotHubConnectionManager, ILogger <IotHubApiHandler> logger, IConfiguration configuration) : base(iotHubConnectionManager, logger, configuration)
        {
            var sensorTimeSpanMinutes = Configuration["SensorTimeSpanMinutes"];

            try
            {
                SensorTimeSpanMinutes = double.Parse(sensorTimeSpanMinutes);
            }
            catch (Exception)
            {
                SensorTimeSpanMinutes = SENSOR_TIMESPAN_MINUTES;
            }
            MessageTrash = Configuration["MessageTrash"];
            if (string.IsNullOrWhiteSpace(MessageTrash))
            {
                MessageTrash = MESSAGE_TRASH;
            }
            MessagePot = Configuration["MessagePot"];
            if (string.IsNullOrWhiteSpace(MessagePot))
            {
                MessagePot = MESSAGE_POT;
            }

            _logger.LogWarning(LoggingEvents.Default, ToStringConfig());

            _pushToNotificationHub = new PushToNotificationHub(Configuration);
        }
        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="iotHubConnectionManager">IoT HUB 接続マネージャ</param>
        /// <param name="logger">ロガー</param>
        public IotHubHandler(IotHubConnectionManager iotHubConnectionManager, ILogger logger, IConfiguration configuration)
        {
            _iotHubConnectionManager = iotHubConnectionManager;
            _logger       = logger;
            Configuration = configuration;

            EventHubsCompatibleEndpoint = Configuration["EventHubsCompatibleEndpoint"] ?? s_eventHubsCompatibleEndpoint;
            EventHubsCompatiblePath     = Configuration["EventHubsCompatiblePath"] ?? s_eventHubsCompatiblePath;
            IotHubSasKey     = Configuration["IotHubSasKey"] ?? s_iotHubSasKey;
            IotHubSasKeyName = Configuration["IotHubSasKeyName"] ?? s_iotHubSasKeyName;
        }