Mercurial > louis > mq > lightsd
changeset 425:6477afd705d1
wip, the network discovery fix is ready for release
author | Louis Opter <kalessin@kalessin.fr> |
---|---|
date | Thu, 07 Jan 2016 11:20:14 +0100 |
parents | ebee80bcca5a |
children | 691e2b709489 |
files | add_power_transition.patch network_discovery.patch optional_jsonrpc_args.patch |
diffstat | 3 files changed, 25 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/add_power_transition.patch Thu Jan 07 00:59:07 2016 +0100 +++ b/add_power_transition.patch Thu Jan 07 11:20:14 2016 +0100 @@ -1,7 +1,19 @@ # HG changeset patch -# Parent 730f00acf23dd91cf19f36f0118bc4844ab368cc +# Parent e591834e9fcbb5dd6428b186273d405c4269e98f Add a transition argument to the power functions +Unlike LIFX's implementation, lightsd will properly get the bulbs to +update their brightness state during the transition. That is: if you +call get_light_state during the transition you will see the brightness +of the bulb being updated. + +This is achieved by combining SET_LIGHT_COLOR and SET_POWER_STATE +commands in a compatible way with the official LIFX mobile apps. + +This feature doesn't work for Original bulbs still running firmware 1.1 +since you can't set their color while they are off. The oldest firmware +version tested for the Original bulbs is 1.5. + diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -368,7 +380,7 @@ false ), LGTD_JSONRPC_NODE( -@@ -801,7 +790,7 @@ +@@ -804,7 +793,7 @@ "target", offsetof(struct lgtd_jsonrpc_set_waveform_args, target), offsetof(struct lgtd_jsonrpc_set_waveform_args, target_ntokens), @@ -377,7 +389,7 @@ false ), LGTD_JSONRPC_NODE( -@@ -942,6 +931,89 @@ +@@ -946,6 +935,89 @@ } static bool @@ -467,7 +479,7 @@ lgtd_jsonrpc_extract_target_list(struct lgtd_proto_target_list *targets, struct lgtd_client *client) { -@@ -954,7 +1026,7 @@ +@@ -958,7 +1030,7 @@ "target", offsetof(struct lgtd_jsonrpc_target_args, target), offsetof(struct lgtd_jsonrpc_target_args, target_ntokens), @@ -476,7 +488,7 @@ false ) }; -@@ -975,25 +1047,19 @@ +@@ -979,25 +1051,19 @@ ); } @@ -513,7 +525,7 @@ static void lgtd_jsonrpc_check_and_call_proto_tag_or_untag_or_set_label( struct lgtd_client *client, -@@ -1012,7 +1078,7 @@ +@@ -1016,7 +1082,7 @@ "target", offsetof(struct lgtd_jsonrpc_target_args, target), offsetof(struct lgtd_jsonrpc_target_args, target_ntokens), @@ -544,7 +556,7 @@ diff --git a/core/lightsd.h b/core/lightsd.h --- a/core/lightsd.h +++ b/core/lightsd.h -@@ -121,9 +121,9 @@ +@@ -137,9 +137,9 @@ extern struct event_base *lgtd_ev_base; extern const char *lgtd_progname; @@ -1214,15 +1226,15 @@ - def power_off(self, target): - return self._jsonrpc_call("power_off", {"target": target}) + def power_on(self, target, transition=None): -+ return self._jsonrpc_call("power_on", target, transition) ++ return self._power_call("power_on", target, transition) - def power_toggle(self, target): - return self._jsonrpc_call("power_toggle", {"target": target}) + def power_off(self, target, transition=None): -+ return self._jsonrpc_call("power_off", target, transition) ++ return self._power_call("power_off", target, transition) + + def power_toggle(self, target, transition=None): -+ return self._jsonrpc_call("power_toggle", target, transition) ++ return self._power_call("power_toggle", target, transition) def get_light_state(self, target): return self._jsonrpc_call("get_light_state", [target])
--- a/network_discovery.patch Thu Jan 07 00:59:07 2016 +0100 +++ b/network_discovery.patch Thu Jan 07 11:20:14 2016 +0100 @@ -1,9 +1,7 @@ # HG changeset patch -# Parent 415b476115e83c2f0d5ac5ec61920037f3c20f8a +# Parent f434982d40b06deb54a81294952159fabac079cc Properly broadcast LIFX discovery packets on all networks (closes GH-2) -It does solve the issue but only is half the solution I'd like to have. - This is really the proper way of achieving the same semantic as broadcasting to 255.255.255.255 and is kinda half the solution only. What I'd like to add is: @@ -518,7 +516,7 @@ new file mode 100644 --- /dev/null +++ b/tests/lifx/broadcast/test_broadcast_write_callback.c -@@ -0,0 +1,374 @@ +@@ -0,0 +1,368 @@ +#include <sys/types.h> +#include <sys/socket.h> +#include <ifaddrs.h> @@ -548,12 +546,6 @@ + +enum { MOCK_SOCKET_FD = 32 }; +static struct event *MOCK_WRITE_EV = (struct event *)0x7061726973; -+static const struct sockaddr_in LIFX_BROADCAST_ADDR = { -+ .sin_family = AF_INET, -+ .sin_addr = { INADDR_BROADCAST }, -+ .sin_port = LGTD_STATIC_HTONS(LGTD_LIFX_PROTOCOL_PORT), -+ .sin_zero = { 0 } -+}; + +// /24 +#define TEST_IPV4_NETMASK_ADDR_24 LGTD_STATIC_HTONL(0xffffff00)
--- a/optional_jsonrpc_args.patch Thu Jan 07 00:59:07 2016 +0100 +++ b/optional_jsonrpc_args.patch Thu Jan 07 11:20:14 2016 +0100 @@ -5,7 +5,7 @@ Passing too many arguments as an array also properly fails now. While we are at it, put the correct argument names in the documentation -so that it works for poepl passing argument by name. +so that it works for people passing argument by name. diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt