Skip to content

Commit

Permalink
Merge branch 'master' into audio-visualization
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertBeekman committed Mar 5, 2021
2 parents 97ccb8f + e569599 commit 6dc45bf
Show file tree
Hide file tree
Showing 1,043 changed files with 17,596 additions and 9,019 deletions.
7 changes: 0 additions & 7 deletions src/Artemis.Plugins.sln
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Artemis.Plugins.Devices.Nov
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Artemis.Plugins.Devices.Razer", "Devices\Artemis.Plugins.Devices.Razer\Artemis.Plugins.Devices.Razer.csproj", "{5516A899-7FD3-4CDC-A0E9-7BBBB8F8F50D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Artemis.Plugins.Devices.Roccat", "Devices\Artemis.Plugins.Devices.Roccat\Artemis.Plugins.Devices.Roccat.csproj", "{8E3F1894-2C20-4219-B058-DB65BA21EE45}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Artemis.Plugins.Devices.SteelSeries", "Devices\Artemis.Plugins.Devices.SteelSeries\Artemis.Plugins.Devices.SteelSeries.csproj", "{3D5119CB-82BA-4A9D-988E-E7E3B27BEACF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Artemis.Plugins.Devices.Wooting", "Devices\Artemis.Plugins.Devices.Wooting\Artemis.Plugins.Devices.Wooting.csproj", "{A4293C66-0246-4488-9B4C-C10303B92ECF}"
Expand Down Expand Up @@ -111,10 +109,6 @@ Global
{5516A899-7FD3-4CDC-A0E9-7BBBB8F8F50D}.Debug|x64.Build.0 = Debug|x64
{5516A899-7FD3-4CDC-A0E9-7BBBB8F8F50D}.Release|x64.ActiveCfg = Release|x64
{5516A899-7FD3-4CDC-A0E9-7BBBB8F8F50D}.Release|x64.Build.0 = Release|x64
{8E3F1894-2C20-4219-B058-DB65BA21EE45}.Debug|x64.ActiveCfg = Debug|x64
{8E3F1894-2C20-4219-B058-DB65BA21EE45}.Debug|x64.Build.0 = Debug|x64
{8E3F1894-2C20-4219-B058-DB65BA21EE45}.Release|x64.ActiveCfg = Release|x64
{8E3F1894-2C20-4219-B058-DB65BA21EE45}.Release|x64.Build.0 = Release|x64
{3D5119CB-82BA-4A9D-988E-E7E3B27BEACF}.Debug|x64.ActiveCfg = Debug|x64
{3D5119CB-82BA-4A9D-988E-E7E3B27BEACF}.Debug|x64.Build.0 = Debug|x64
{3D5119CB-82BA-4A9D-988E-E7E3B27BEACF}.Release|x64.ActiveCfg = Release|x64
Expand Down Expand Up @@ -186,7 +180,6 @@ Global
{928CAC1C-0394-40FB-8740-5FA5AAB0DAA1} = {4CB7B38C-1B36-4213-BE70-B7BF3B9E839A}
{14613E9E-1F69-4F30-9952-5D7FDB5C3906} = {4CB7B38C-1B36-4213-BE70-B7BF3B9E839A}
{5516A899-7FD3-4CDC-A0E9-7BBBB8F8F50D} = {4CB7B38C-1B36-4213-BE70-B7BF3B9E839A}
{8E3F1894-2C20-4219-B058-DB65BA21EE45} = {4CB7B38C-1B36-4213-BE70-B7BF3B9E839A}
{3D5119CB-82BA-4A9D-988E-E7E3B27BEACF} = {4CB7B38C-1B36-4213-BE70-B7BF3B9E839A}
{A4293C66-0246-4488-9B4C-C10303B92ECF} = {4CB7B38C-1B36-4213-BE70-B7BF3B9E839A}
{E12EA7BE-5413-4468-B930-E19C4E8C98FF} = {4CB7B38C-1B36-4213-BE70-B7BF3B9E839A}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<AssemblyName>Artemis.Plugins.PhilipsHue</AssemblyName>
<RootNamespace>Artemis.Plugins.PhilipsHue</RootNamespace>
<UseWPF>true</UseWPF>
<Platforms>x64</Platforms>
<GenerateDependencyFile>False</GenerateDependencyFile>
<Platforms>x64</Platforms>
<GenerateDependencyFile>False</GenerateDependencyFile>
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
Expand All @@ -30,7 +30,8 @@
</ItemGroup>

<ItemGroup>
<Page Include="Properties\DesignTimeResources.xaml" Condition="'$(DesignTime)'=='true' OR ('$(SolutionPath)'!='' AND Exists('$(SolutionPath)') AND '$(BuildingInsideVisualStudio)'!='true' AND '$(BuildingInsideExpressionBlend)'!='true')">
<Page Include="Properties\DesignTimeResources.xaml"
Condition="'$(DesignTime)'=='true' OR ('$(SolutionPath)'!='' AND Exists('$(SolutionPath)') AND '$(BuildingInsideVisualStudio)'!='true' AND '$(BuildingInsideExpressionBlend)'!='true')">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<ContainsDesignTimeResources>true</ContainsDesignTimeResources>
Expand All @@ -40,11 +41,11 @@
<ItemGroup>
<Reference Include="Artemis.Core">
<HintPath>..\..\..\..\Artemis\src\Artemis.UI\bin\x64\Debug\net5.0-windows\Artemis.Core.dll</HintPath>
<Private>false</Private>
<Private>false</Private>
</Reference>
<Reference Include="Artemis.UI.Shared">
<HintPath>..\..\..\..\Artemis\src\Artemis.UI\bin\x64\Debug\net5.0-windows\Artemis.UI.Shared.dll</HintPath>
<Private>false</Private>
<Private>false</Private>
</Reference>
<Reference Include="RGB.NET.Core">
<HintPath>..\..\..\..\RGB.NET\bin\net5.0\RGB.NET.Core.dll</HintPath>
Expand Down Expand Up @@ -85,9 +86,9 @@
<!-- This may trigger another build (something related to the obj folder) so only run it if building inside VS -->
<Target Name="PostBuildPublish" AfterTargets="PostBuildEvent" Condition="'$(BuildingInsideVisualStudio)' == 'true'">
<Message Text="------ Artemis plugin publish ------" Importance="High" />
<Exec Command="dotnet publish --verbosity q --output &quot;%25ProgramData%25\Artemis\Plugins\$(ProjectName)&quot;" />
<Message Text="Published $(ProjectName) at file:\\$(ProgramData)\Artemis\Plugins\$(ProjectName)" Importance="High" />
<Message Text="If distributing outside the workshop, share this folder." Importance="High" />
<Exec Command="dotnet publish --verbosity q --output &quot;%25ProgramData%25\Artemis\Plugins\$(ProjectName)&quot;" />
<Message Text="Published $(ProjectName) at file:\\$(ProgramData)\Artemis\Plugins\$(ProjectName)" Importance="High" />
<Message Text="If distributing outside the workshop, share this folder." Importance="High" />
</Target>

<!-- Override the published DLLs with the built DLLs to enable edit & continue -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@ public override void Enable()
foreach (PhilipsHueBridge bridge in _hueService.Bridges)
HueRGBDeviceProvider.Instance.ClientDefinitions.Add(new HueClientDefinition(bridge.IpAddress, bridge.AppKey, bridge.StreamingClientKey));

HueRGBDeviceProvider.Instance.Initialize();

_rgbService.AddDeviceProvider(RgbDeviceProvider);
}

public override void Disable()
{
_rgbService.RemoveDeviceProvider(RgbDeviceProvider);
RgbDeviceProvider.Dispose();
}
}
}
52 changes: 21 additions & 31 deletions src/Collections/Artemis.Plugins.PhilipsHue/RGB.NET/Hue/HueDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,49 +18,39 @@ public void Initialize(HueUpdateQueue updateQueue)
UpdateQueue = updateQueue;
InitializeLayout();

Rectangle ledRectangle = new Rectangle(this.Select(x => x.LedRectangle));
Size = ledRectangle.Size + new Size(ledRectangle.Location.X, ledRectangle.Location.Y);
Rectangle ledBoundary = new Rectangle(this.Select(x => x.Boundary));
Size = ledBoundary.Size + new Size(ledBoundary.Location.X, ledBoundary.Location.Y);
}

private void InitializeLayout()
{
// Models based on https://developers.meethue.com/develop/hue-api/supported-devices/#Supported-lights
switch (DeviceInfo.Model)
Led led = DeviceInfo.Model switch
{
// Hue bulb A19 (E27)
case "LCA001":
case "LCA007":
case "LCA0010":
case "LCA0014":
case "LCA0015":
case "LCA0016":
InitializeLed(LedId.Custom1, new Point(0, 0), new Size(62)).Shape = Shape.Circle;
break;
"LCA001" => AddLed(LedId.Custom1, new Point(0, 0), new Size(62)),
"LCA007" => AddLed(LedId.Custom1, new Point(0, 0), new Size(62)),
"LCA0010" => AddLed(LedId.Custom1, new Point(0, 0), new Size(62)),
"LCA0014" => AddLed(LedId.Custom1, new Point(0, 0), new Size(62)),
"LCA0015" => AddLed(LedId.Custom1, new Point(0, 0), new Size(62)),
"LCA0016" => AddLed(LedId.Custom1, new Point(0, 0), new Size(62)),
// Hue Spot BR30 (quick Google search makes it seem like an older generation)
case "LCT002":
case "LCT011":
InitializeLed(LedId.Custom1, new Point(0, 0), new Size(62)).Shape = Shape.Circle;
break;
"LCT002" => AddLed(LedId.Custom1, new Point(0, 0), new Size(62)),
"LCT011" => AddLed(LedId.Custom1, new Point(0, 0), new Size(62)),
// Hue Spot GU10
case "LCT003":
InitializeLed(LedId.Custom1, new Point(0, 0), new Size(50)).Shape = Shape.Circle;
break;
"LCT003" => AddLed(LedId.Custom1, new Point(0, 0), new Size(50)),
// Hue Go
case "LLC020":
InitializeLed(LedId.Custom1, new Point(0, 0), new Size(150)).Shape = Shape.Circle;
break;
"LLC020" => AddLed(LedId.Custom1, new Point(0, 0), new Size(150)),
// Hue LightStrips Plus
case "LCL001":
InitializeLed(LedId.LedStripe1, new Point(0, 0), new Size(2000, 14));
break;
"LCL001" => AddLed(LedId.LedStripe1, new Point(0, 0), new Size(2000, 14)),
// Hue color candle
case "LCT012":
InitializeLed(LedId.Custom1, new Point(0, 0), new Size(39)).Shape = Shape.Circle;
break;
default:
InitializeLed(LedId.Custom1, new Point(0, 0), new Size(10));
break;
}
"LCT012" => AddLed(LedId.Custom1, new Point(0, 0), new Size(39)),
_ => AddLed(LedId.Custom1, new Point(0, 0), new Size(50))
};

// Everything but the LED strip represents a light bulb of some sort and can be a circle
if (led != null && DeviceInfo.Model != "LCL001")
led.Shape = Shape.Circle;
}

public HueUpdateQueue UpdateQueue { get; private set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public HueDeviceInfo(Group entertainmentGroup, string lightId, IEnumerable<Light
public string DeviceName { get; }
public string Manufacturer { get; }
public string Model { get; }
public RGBDeviceLighting Lighting => RGBDeviceLighting.Device;
public object LayoutMetadata { get; set; }

// This is possible but requires a bit more effort
public bool SupportsSyncBack => false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ public HueRGBDeviceProvider()
public List<HueClientDefinition> ClientDefinitions { get; } = new List<HueClientDefinition>();

public bool IsInitialized { get; private set; }
public IEnumerable<IRGBDevice> Devices { get; private set; }
public IEnumerable<IRGBDevice> Devices { get; private set; } = new List<IRGBDevice>();
public bool HasExclusiveAccess { get; } = false;

public bool Initialize(RGBDeviceType loadFilter = RGBDeviceType.All, bool exclusiveAccessIfPossible = false, bool throwExceptions = false)
public bool Initialize(RGBDeviceType loadFilter = RGBDeviceType.All, bool throwExceptions = false)
{
IsInitialized = false;

Expand Down Expand Up @@ -87,6 +87,7 @@ public bool Initialize(RGBDeviceType loadFilter = RGBDeviceType.All, bool exclus

public void Dispose()
{
Devices = Enumerable.Empty<IRGBDevice>();
UpdateTrigger.Dispose();
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:s="https://github.com/canton7/Stylet"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800" d:DataContext="{d:DesignInstance viewModels:PhilipsHueConfigurationViewModel}">
d:DesignHeight="450" d:DesignWidth="800"
d:DataContext="{d:DesignInstance viewModels:PhilipsHueConfigurationViewModel}">
<Grid>

<materialDesign:Transitioner SelectedIndex="{Binding WizardPage}" AutoApplyTransitionOrigins="True" >
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,20 @@ public override void Enable()
DataModel.JsonString2 = s;
return "la lu lo";
});
_webServerService.AddJsonEndPoint<RemoteData>(this, "JsonEndPoint", d => DataModel.JsonData = d);
JsonPluginEndPoint<RemoteData> jsonPluginEndPoint = _webServerService.AddJsonEndPoint<RemoteData>(this, "JsonEndPoint", d => DataModel.JsonData = d);
jsonPluginEndPoint.RequestException += JsonPluginEndPointOnRequestException;
_webServerService.AddResponsiveJsonEndPoint<RemoteData>(this, "JsonEndPointWithResponse", d =>
{
DataModel.JsonData2 = d;
return new List<string> {"la", "lu", "lo"};
});
}

private void JsonPluginEndPointOnRequestException(object sender, EndpointExceptionEventArgs e)
{
throw e.Exception;
}


public override void Disable()
{
Expand Down
11 changes: 7 additions & 4 deletions src/Devices/Artemis.Plugins.Devices.Asus/AsusDeviceProvider.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using Artemis.Core;
using Artemis.Core.DeviceProviders;
using Artemis.Core.Services;
using RGB.NET.Core;
using RGB.NET.Devices.Asus;

namespace Artemis.Plugins.Devices.Asus
{
// ReSharper disable once UnusedMember.Global
Expand All @@ -18,9 +17,13 @@ public AsusDeviceProvider(IRgbService rgbService) : base(RGB.NET.Devices.Asus.As

public override void Enable()
{
PathHelper.ResolvingAbsolutePath += (sender, args) => ResolveAbsolutePath(typeof(AsusRGBDevice<>), sender, args);
RGB.NET.Devices.Asus.AsusDeviceProvider.Instance.Initialize(RGBDeviceType.All, false, true);
_rgbService.AddDeviceProvider(RgbDeviceProvider);
}

public override void Disable()
{
_rgbService.RemoveDeviceProvider(RgbDeviceProvider);
RGB.NET.Devices.Asus.AsusDeviceProvider.Instance.Dispose();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
<Height>135</Height>
<LedUnitWidth>9</LedUnitWidth>
<LedUnitHeight>27</LedUnitHeight>
<ImageBasePath>Images\Asus\Drams</ImageBasePath>
<DeviceImage>TridentZ.PNG</DeviceImage>
<Leds>
<Led Id="DRAM1">
<X>0</X>
Expand All @@ -34,4 +32,7 @@
<Y>+</Y>
</Led>
</Leds>
<CustomData>
<DeviceImage>Trident Z RGB.png</DeviceImage>
</CustomData>
</Device>
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
<?xml version="1.0"?>

<Device xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Name>Asus Maximus X Hero</Name>
<Description>Asus Maximus X Hero</Description>
<Type>None</Type>
<Type>Mainboard</Type>
<Lighting>Device</Lighting>
<Vendor>Asus</Vendor>
<Model>Maximus X Hero</Model>
<Width>555</Width>
<Height>690</Height>
<LedUnitWidth>150</LedUnitWidth>
<LedUnitHeight>150</LedUnitHeight>
<ImageBasePath>Images\Asus\Mainboards</ImageBasePath>
<DeviceImage>MAXIMUS-X-HERO.png</DeviceImage>
<Leds>
<Led Id="Logo">
<Shape> M0.241,0.804 L0.276,0.871 L0.285,0.861 L0.264,0.824 L0.273,0.812 L0.269,0.797 L0.273,0.788 L0.29,0.818 L0.295,0.802 L0.258,0.734 L0.264,0.796z M0.312,0.736 L0.272,0.668 L0.258,0.718 L0.298,0.798 L0.301,0.778 L0.283,0.747 L0.293,0.723 L0.307,0.748z M0.328,0.66 L0.303,0.648 L0.288,0.589 L0.287,0.613 L0.294,0.641 L0.278,0.636 L0.275,0.652 L0.3,0.668 L0.313,0.723 L0.318,0.709 L0.31,0.673 L0.317,0.672 L0.324,0.679z M0.296,0.564 L0.292,0.584 L0.33,0.651 L0.334,0.633z M0.318,0.494 L0.321,0.545 L0.3,0.553 L0.336,0.623 L0.339,0.607 L0.319,0.57 L0.331,0.563 L0.327,0.534 L0.347,0.569 L0.351,0.555z M0.331,0.416 L0.367,0.481 L0.358,0.535 L0.351,0.542 L0.315,0.472 L0.318,0.462 L0.354,0.521 L0.362,0.493 L0.327,0.427z M0.347,0.349 L0.334,0.394 L0.334,0.405 L0.354,0.446 L0.366,0.401 L0.378,0.42 L0.367,0.466 L0.372,0.467 L0.383,0.423 L0.382,0.409 L0.364,0.376 L0.351,0.419 L0.34,0.397 L0.347,0.364z M0.398,0.354 L0.4,0.322 L0.395,0.307 L0.409,0.311 L0.415,0.296 L0.39,0.282 L0.381,0.249 L0.374,0.237 L0.378,0.275 L0.363,0.27 L0.361,0.289 L0.385,0.301 L0.387,0.303z </Shape>
Expand All @@ -38,40 +35,7 @@
<Y>423.4</Y>
</Led>
</Leds>
<LedImageLayouts>
<LedImageLayout>
<LedImages />
</LedImageLayout>
<LedImageLayout>
<LedImages />
</LedImageLayout>
<LedImageLayout>
<LedImages />
</LedImageLayout>
<LedImageLayout>
<LedImages>
<LedImage Id="Logo" />
</LedImages>
</LedImageLayout>
<LedImageLayout>
<LedImages>
<LedImage Id="Logo" />
</LedImages>
</LedImageLayout>
<LedImageLayout>
<LedImages>
<LedImage Id="Mainboard2" />
</LedImages>
</LedImageLayout>
<LedImageLayout>
<LedImages>
<LedImage Id="Mainboard3" />
</LedImages>
</LedImageLayout>
<LedImageLayout>
<LedImages>
<LedImage Id="Mainboard1" />
</LedImages>
</LedImageLayout>
</LedImageLayouts>
<CustomData>
<DeviceImage>Maximus X Hero.png</DeviceImage>
</CustomData>
</Device>
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>

<?xml version="1.0" encoding="utf-8"?>
<Device xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Name>Asus Prime X370-PRO</Name>
<Description>Asus Prime X370-PRO Mainboard</Description>
Expand All @@ -10,8 +9,6 @@
<Model>Prime X370-PRO</Model>
<Width>252</Width>
<Height>305</Height>
<ImageBasePath>Images\Asus\Mainboards</ImageBasePath>
<DeviceImage>PRIMEX370-PRO.png</DeviceImage>
<Leds>
<Led Id="Mainboard1">
<X>0</X>
Expand Down Expand Up @@ -51,4 +48,7 @@
<Height>13mm</Height>
</Led>
</Leds>
<CustomData>
<DeviceImage>Prime X370-PRO.png</DeviceImage>
</CustomData>
</Device>
Loading

0 comments on commit 6dc45bf

Please sign in to comment.