Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
50f43e1
Update gitignore
d8ahazard Feb 13, 2021
a7c0ae8
Refactor "Color" to "LifxColor" to avoid constant confusion with syst…
d8ahazard Feb 13, 2021
6295e08
Add state extended color zones message response...
d8ahazard Feb 13, 2021
820be00
Add multizone partial class
d8ahazard Feb 13, 2021
279c3ff
Code cleanup!
d8ahazard Feb 13, 2021
dafc945
Add remainder of multi-zone messages
d8ahazard Feb 14, 2021
1e46c28
Add "ToBytes()" for LifxColor
d8ahazard Feb 14, 2021
01ded40
Allow direct serialization of Colors to payload using LifxColor.ToByt…
d8ahazard Feb 14, 2021
2d26ba5
Type adjustments, code cleanup
d8ahazard Feb 14, 2021
5c18611
Massive Updates
d8ahazard Feb 15, 2021
ebd98ca
Cleanup, fixes, add remaining device "stuff".
d8ahazard Feb 16, 2021
a95448c
Re-rename methods...
d8ahazard Feb 16, 2021
cc3c82c
Add remaining missing messages
d8ahazard Feb 16, 2021
6946648
Fix return type for GetColorZonesAsync
d8ahazard Feb 16, 2021
7c791c4
Update net core test app to enumerate device-specific info
d8ahazard Feb 16, 2021
7cd6aba
Use generic device for tile/switch/multizone ops, not "bulb".
d8ahazard Feb 22, 2021
0578c00
Update documentation
d8ahazard Feb 22, 2021
e169159
Update logging in sampleapp, fix device calls
d8ahazard Feb 22, 2021
aeea25f
Fix Multizone request
d8ahazard Mar 9, 2021
7c71e03
Use ushort for LifxColor constructor
d8ahazard Mar 9, 2021
9d65e8c
Various LifxResponse fixes
d8ahazard Mar 9, 2021
209a32f
Add datetime, tile support to payload
d8ahazard Mar 9, 2021
9f0feea
Update TileGroup
d8ahazard Mar 9, 2021
7540ae0
Add LifxEmulator Test App
d8ahazard Mar 9, 2021
d14436a
Update sample apps
d8ahazard Mar 9, 2021
0813a3b
Fix Tile Chain Response Parsing
d8ahazard Mar 10, 2021
622aec6
Update payload
d8ahazard Mar 10, 2021
6d21da2
Add apply option to multizone setters
d8ahazard Mar 10, 2021
ddd6b42
Cleanup
d8ahazard Mar 10, 2021
630ee74
Add app to test color sending
d8ahazard Mar 10, 2021
47f1952
Update logging, add proper ToString() method for LifxColor
d8ahazard Mar 10, 2021
21cfa42
Fix color send test app
d8ahazard Mar 10, 2021
ecf9c2e
Update Lifx Emulator
d8ahazard Mar 10, 2021
9262286
LifxColor Improvements
d8ahazard Mar 11, 2021
0d9abed
Add shorter SetColorAsync method
d8ahazard Mar 11, 2021
8d923dc
Improve Color Send Test logging.
d8ahazard Mar 11, 2021
7a28c52
Improve logging
d8ahazard Mar 11, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*.user
*.userosscache
*.sln.docstates
.idea/

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

# LifxNet

A .NET Standard 1.3 library for LIFX.
Supports .NET, UWP, Xamarin iOS, Xamarin Android, and any other .NET Platform that has implemented .NET Standard 1.3+.
A .NET Standard 2.0 library for LIFX.
Supports .NET, UWP, Xamarin iOS, Xamarin Android, and any other .NET Platform that has implemented .NET Standard 2.0+.

For Cloud Protocol based implementation, check out [isaacrlevin's repo](https://github.com/isaacrlevin/LifxCloudClient)

Expand All @@ -22,14 +22,14 @@ PM> Install-Package LifxNet

Tested with LIFX 2.0 Firmware.

Based on the official [LIFX protocol docs](https://github.com/LIFX/lifx-protocol-docs)
Based on the official [LIFX protocol docs](https://lan.developer.lifx.com/docs)

####Usage

```csharp
client = await LifxNet.LifxClient.CreateAsync();
client.DeviceDiscovered += Client_DeviceDiscovered;
client.DeviceLost += Client_DeviceLost;
client = new LifxClient();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is wrong, the only LifxClient constructor is marked as Private

client.Discovered += Client_DeviceDiscovered;
client.Lost += Client_DeviceLost;
client.StartDeviceDiscovery();

...
Expand Down
38 changes: 38 additions & 0 deletions src/LifxNet.sln
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleApp.netcore", "Sample
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleApp.Universal", "SampleApps\SampleApp.Universal\SampleApp.Universal.csproj", "{9072BB5D-AF63-4E60-98A6-86AE8CF898B1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LifxEmulator", "SampleApps\LifxEmulator\LifxEmulator.csproj", "{35655608-57DD-43AB-9D2E-81B329CC6473}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ColorSendTest", "SampleApps\ColorSendTest\ColorSendTest.csproj", "{EBB918D2-1614-43A8-B7F9-AD4F1285C9A7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -83,12 +87,46 @@ Global
{9072BB5D-AF63-4E60-98A6-86AE8CF898B1}.Release|x86.ActiveCfg = Release|x86
{9072BB5D-AF63-4E60-98A6-86AE8CF898B1}.Release|x86.Build.0 = Release|x86
{9072BB5D-AF63-4E60-98A6-86AE8CF898B1}.Release|x86.Deploy.0 = Release|x86
{35655608-57DD-43AB-9D2E-81B329CC6473}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{35655608-57DD-43AB-9D2E-81B329CC6473}.Debug|Any CPU.Build.0 = Debug|Any CPU
{35655608-57DD-43AB-9D2E-81B329CC6473}.Debug|ARM.ActiveCfg = Debug|Any CPU
{35655608-57DD-43AB-9D2E-81B329CC6473}.Debug|ARM.Build.0 = Debug|Any CPU
{35655608-57DD-43AB-9D2E-81B329CC6473}.Debug|x64.ActiveCfg = Debug|Any CPU
{35655608-57DD-43AB-9D2E-81B329CC6473}.Debug|x64.Build.0 = Debug|Any CPU
{35655608-57DD-43AB-9D2E-81B329CC6473}.Debug|x86.ActiveCfg = Debug|Any CPU
{35655608-57DD-43AB-9D2E-81B329CC6473}.Debug|x86.Build.0 = Debug|Any CPU
{35655608-57DD-43AB-9D2E-81B329CC6473}.Release|Any CPU.ActiveCfg = Release|Any CPU
{35655608-57DD-43AB-9D2E-81B329CC6473}.Release|Any CPU.Build.0 = Release|Any CPU
{35655608-57DD-43AB-9D2E-81B329CC6473}.Release|ARM.ActiveCfg = Release|Any CPU
{35655608-57DD-43AB-9D2E-81B329CC6473}.Release|ARM.Build.0 = Release|Any CPU
{35655608-57DD-43AB-9D2E-81B329CC6473}.Release|x64.ActiveCfg = Release|Any CPU
{35655608-57DD-43AB-9D2E-81B329CC6473}.Release|x64.Build.0 = Release|Any CPU
{35655608-57DD-43AB-9D2E-81B329CC6473}.Release|x86.ActiveCfg = Release|Any CPU
{35655608-57DD-43AB-9D2E-81B329CC6473}.Release|x86.Build.0 = Release|Any CPU
{EBB918D2-1614-43A8-B7F9-AD4F1285C9A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EBB918D2-1614-43A8-B7F9-AD4F1285C9A7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EBB918D2-1614-43A8-B7F9-AD4F1285C9A7}.Debug|ARM.ActiveCfg = Debug|Any CPU
{EBB918D2-1614-43A8-B7F9-AD4F1285C9A7}.Debug|ARM.Build.0 = Debug|Any CPU
{EBB918D2-1614-43A8-B7F9-AD4F1285C9A7}.Debug|x64.ActiveCfg = Debug|Any CPU
{EBB918D2-1614-43A8-B7F9-AD4F1285C9A7}.Debug|x64.Build.0 = Debug|Any CPU
{EBB918D2-1614-43A8-B7F9-AD4F1285C9A7}.Debug|x86.ActiveCfg = Debug|Any CPU
{EBB918D2-1614-43A8-B7F9-AD4F1285C9A7}.Debug|x86.Build.0 = Debug|Any CPU
{EBB918D2-1614-43A8-B7F9-AD4F1285C9A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EBB918D2-1614-43A8-B7F9-AD4F1285C9A7}.Release|Any CPU.Build.0 = Release|Any CPU
{EBB918D2-1614-43A8-B7F9-AD4F1285C9A7}.Release|ARM.ActiveCfg = Release|Any CPU
{EBB918D2-1614-43A8-B7F9-AD4F1285C9A7}.Release|ARM.Build.0 = Release|Any CPU
{EBB918D2-1614-43A8-B7F9-AD4F1285C9A7}.Release|x64.ActiveCfg = Release|Any CPU
{EBB918D2-1614-43A8-B7F9-AD4F1285C9A7}.Release|x64.Build.0 = Release|Any CPU
{EBB918D2-1614-43A8-B7F9-AD4F1285C9A7}.Release|x86.ActiveCfg = Release|Any CPU
{EBB918D2-1614-43A8-B7F9-AD4F1285C9A7}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{9165A342-4844-4655-8D1E-D607CD3AA2BD} = {41199DCE-DF15-4BD2-B5A4-1836B3A5BF54}
{9072BB5D-AF63-4E60-98A6-86AE8CF898B1} = {41199DCE-DF15-4BD2-B5A4-1836B3A5BF54}
{35655608-57DD-43AB-9D2E-81B329CC6473} = {41199DCE-DF15-4BD2-B5A4-1836B3A5BF54}
{EBB918D2-1614-43A8-B7F9-AD4F1285C9A7} = {41199DCE-DF15-4BD2-B5A4-1836B3A5BF54}
EndGlobalSection
EndGlobal
23 changes: 0 additions & 23 deletions src/LifxNet/Color.cs

This file was deleted.

50 changes: 50 additions & 0 deletions src/LifxNet/Device.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
using System;
using System.Linq;

namespace LifxNet {
/// <summary>
/// LIFX Generic Device
/// </summary>
public abstract class Device {
internal Device(string hostname, byte[] macAddress, byte service, uint port) {
if (hostname == null)
throw new ArgumentNullException(nameof(hostname));
if (string.IsNullOrWhiteSpace(hostname))
throw new ArgumentException(nameof(hostname));
HostName = hostname;
MacAddress = macAddress;
Service = service;
Port = port;
LastSeen = DateTime.MinValue;
}

/// <summary>
/// Hostname for the device
/// </summary>
public string HostName { get; internal set; }

/// <summary>
/// Service ID
/// </summary>
public byte Service { get; }

/// <summary>
/// Service port
/// </summary>
public uint Port { get; }

internal DateTime LastSeen { get; set; }

/// <summary>
/// Gets the MAC address
/// </summary>
public byte[] MacAddress { get; }

/// <summary>
/// Gets the MAC address
/// </summary>
public string MacAddressName {
get { return string.Join(":", MacAddress.Take(6).Select(tb => tb.ToString("X2")).ToArray()); }
}
}
}
Loading