Exemplo n.º 1
0
        public Task GetStatus()
        {
            StatusViewModel vm = new StatusViewModel();

            vm.bpm        = StreamingSetup.GetBPM();
            vm.IsAutoMode = EffectService.IsAutoModeRunning();

            return(Clients.All.SendAsync("Status", vm));
        }
Exemplo n.º 2
0
        public async Task <List <Dictionary <string, LightLocation> > > ExportJson([FromRoute] string groupName)
        {
            var locations = await StreamingSetup.GetLocationsAsync(groupName);

            return(locations.GroupBy(x => x.Bridge)
                   .Select(x => x.ToDictionary(l => l.Id, loc => new LightLocation()
            {
                loc.X, loc.Y, 0
            })).ToList());
        }
Exemplo n.º 3
0
        public async Task Disconnect()
        {
            EffectService.CancelAllEffects();

            StreamingSetup.Disconnect();
            await Clients.All.SendAsync("effects", new EffectsVM());

            await Clients.All.SendAsync("StatusMsg", "DISCONNECTED...");

            GetStatus();
        }
Exemplo n.º 4
0
        public async Task GetStatus()
        {
            var configs = await StreamingSetup.GetGroupConfigurationsAsync();

            StatusViewModel vm = new StatusViewModel();

            vm.bpm        = StreamingSetup.GetBPM();
            vm.IsAutoMode = EffectService.IsAutoModeRunning();
            vm.AutoModeHasRandomEffects = EffectService.AutoModeHasRandomEffects;
            vm.ShowDisconnect           = !(StreamingSetup.CurrentConnection?.HideDisconnect ?? false);
            vm.GroupNames   = configs.Select(x => x.Name).ToList();
            vm.CurrentGroup = StreamingSetup.CurrentConnection?.Name;

            await Clients.All.SendAsync("Status", vm);
        }
Exemplo n.º 5
0
        public async Task Connect(string groupName)
        {
            await Clients.All.SendAsync("StatusMsg", $"Connecting to bridge for group {groupName}...");

            try
            {
                //Connect
                await StreamingSetup.SetupAndReturnGroupAsync(groupName);

                await Clients.All.SendAsync("StatusMsg", "Connected to bridge");

                await GetEffects(true);
                await GetStatus();
            }
            catch (Exception ex)
            {
                await Clients.All.SendAsync("StatusMsg", $"Failed to connect to bridge for group {groupName}, " + ex);
            }
        }
Exemplo n.º 6
0
 public Task <List <MultiBridgeLightLocation> > FullExportJson([FromRoute] string groupName)
 {
     return(StreamingSetup.GetLocationsAsync(groupName));
 }
Exemplo n.º 7
0
        public async Task <IActionResult> Configure()
        {
            var config = await StreamingSetup.GetGroupConfigurationsAsync();

            return(View(config));
        }
Exemplo n.º 8
0
 public Task Locate(MultiBridgeLightLocation light)
 {
     return(StreamingSetup.AlertLight(light));
 }
Exemplo n.º 9
0
 public Task SetLocations(List <MultiBridgeLightLocation> locations)
 {
     return(StreamingSetup.SetLocations(locations));
 }
Exemplo n.º 10
0
        public async Task GetLocations(string groupName)
        {
            var locations = await StreamingSetup.GetLocationsAsync(groupName);

            Clients.Caller.SendAsync("newLocations", locations);
        }
Exemplo n.º 11
0
        public void SetBri(double value)
        {
            StreamingSetup.SetBrightnessFilter(value);

            Clients.Others.SendAsync("Bri", value);
        }
Exemplo n.º 12
0
 public Task SetBPM(int value)
 {
     StreamingSetup.SetBPM(value);
     return(GetStatus());
 }
Exemplo n.º 13
0
 public Task IncreaseBPM(int value)
 {
     StreamingSetup.IncreaseBPM(value);
     return(GetStatus());
 }
Exemplo n.º 14
0
        public IActionResult Configure()
        {
            var config = StreamingSetup.GetGroupConfigurations();

            return(View(config));
        }