Beispiel #1
0
 public RoonApiStatus(RoonApi api, string message = "", bool isError = false)
 {
     _api = api;
     _subscriptionHandler = new RoonApiSubscriptionHandler();
     _currentStatus       = new RoonStatus {
         Message = message, IsError = isError
     };
     _api.AddService(RoonApi.ServiceStatus, OnStatus);
 }
Beispiel #2
0
 public RoonApiControlVolume(RoonApi api, bool simulateFeedback)
 {
     _id  = 0;
     _api = api;
     _simulateFeedback    = simulateFeedback;
     _subscriptionHandler = new RoonApiSubscriptionHandler();
     _api.AddService(RoonApi.ControlVolume, OnVolumeControl);
     _controls  = new List <Volume>();
     _functions = new List <VolumeFunctions>();
 }
Beispiel #3
0
        public RoonApiSettings(RoonApi api, List <LayoutBase> layout, Dictionary <string, string> values, Functions functions)
        {
            _api    = api;
            _layout = layout;
            _values = values;

            _subscriptionHandler = new RoonApiSubscriptionHandler();
            _api.AddService(RoonApi.ServiceSettings, OnSettings);
            _functions = new List <Functions>();
            _functions.Add(functions);
        }
Beispiel #4
0
        public RoonApi(Func <string, Task> onPaired, Func <string, Task> onUnPaired, string configPath = "C:\\Temp\\", ILogger logger = null)
        {
            _onPaired   = onPaired;
            _onUnPaired = onUnPaired;
            _logger     = logger == null ? NullLogger.Instance : logger;
            _requestId  = 0;
            if (!configPath.EndsWith("\\"))
            {
                configPath += "\\";
            }
            _configPath   = configPath;
            _coreId       = null;
            _requests     = new Dictionary <int, RoonRequest>();
            _jsonSettings = new JsonSerializerSettings();
            _jsonSettings.NullValueHandling = NullValueHandling.Ignore;
            _lock                = new AsyncLock();
            _services            = new Dictionary <string, OnRoonReceived>();
            _subscriptions       = new Dictionary <int, OnRoonReceived>();
            _subscriptionHandler = new RoonApiSubscriptionHandler();
            _configuration       = new Dictionary <string, object>();

            _savings = LoadRoonSettings();
        }