Example #1
0
 public ColorService(IMQTTService mqttService,
                     IConfigService configService,
                     IXWebRepo <UserColor> colorsRepo)
 {
     _mqttService   = mqttService;
     _configService = configService;
     _colorsRepo    = colorsRepo;
 }
Example #2
0
        internal MQTTClient(IMQTTService mqttService, ITopicFilter [] topicFilters)
        {
            _mqttService  = mqttService as MQTTService;
            _topicFilters = topicFilters;

            var factory = new MqttFactory();

            _mqttClient = factory.CreateMqttClient();
        }
Example #3
0
        private void Button_OnClick(object sender, RoutedEventArgs e)
        {
            _mqttService = new MQTTService();

            var mqttClientOptions = new Options
            {
                Server = "test.mosquitto.org",
                //Server = "192.168.0.41",
                Port           = 1883,
                ConnectionType = ConnectionType.Tcp,
                CleanSession   = true,
                ClientId       = Guid.NewGuid().ToString().Replace("-", string.Empty),
                UseTls         = false
            };

            var topic1 = new TopicFilter
            {
                QualityOfServiceLevel = QoSLevel.AtLeastOnce,
                //Topic = "PP/#"
                Topic = "/#"
            };

            ITopicFilter[] topicFilters =
            {
                topic1,
            };

            var MQTTService = _mqttService.CreateObservableMQTTService(mqttClientOptions, topicFilters);

            _disposable = MQTTService
                          .observableMessage
                          .SubscribeOnDispatcher()
                          //.Throttle(TimeSpan.FromMilliseconds(100), Scheduler.Default)
                          .ObserveOnDispatcher().Subscribe(
                msg =>
            {
                textBlock.Text = Encoding.UTF8.GetString(msg.Payload);
            },
                ex =>
            {
                textBlock.Text = "Exception";
            },
                () => { });

            //var MQTTService = await mqttService.CreateObservableMQTTServiceAsync(mqttClientOptions, topicFilters);
        }
Example #4
0
        public ColorSelectViewModel(IColorService colorService, IConfigService configService, IMQTTService mqttService)
        {
            _colorService         = colorService;
            _configService        = configService;
            _mqttService          = mqttService;
            SaveCommand           = new XCommand(_onSave);
            StartSaveCommand      = new XCommand(_onStartSave);
            SaveSettingsCommand   = new XCommand(_saveSettings);
            CancelSettingsCommand = new XCommand(_cancelSettings);

            AutoplayOffCommand = new XCommand(_onAutoplayOff);
            AutoplayOnCommand  = new XCommand(_onAutoplayOn);


            //  _attractTimer();
            this.Register <ResetMessage>(_onReset);
            this.Register <SettingsMessage>(_onSettings);
            this.Register <DebugMessage>(_onDebugMessage);

            this.Register <SpecialColorSelectedMessage>(_onSpecialColorSelected);
        }
Example #5
0
 public SystemStatusService(ILogService logService, IMQTTService mqttService)
 {
     _logService  = logService;
     _mqttService = mqttService;
     _mqttService.EventReceived += _mqttService_EventReceived;
 }
 public PublishClientsService(IMQTTService mqttService, IMemoryDiscoveryPeerRepository discoveryPeerRepository)
 {
     _mqttService             = mqttService;
     _discoveryPeerRepository = discoveryPeerRepository;
 }
Example #7
0
 public PublishChangesService(IMQTTService mqttService, IMemoryDiscoveryPeerRepository peersRepository)
 {
     _mqttService             = mqttService;
     _discoveryPeerRepository = peersRepository;
 }
Example #8
0
 internal MQTTClient(IMqttClient client, IMQTTService mqttService)
 {
     _mqttClient  = client;
     _mqttService = mqttService;
 }