From 8411d9dba82841647096bc207f4130f7fca5efd7 Mon Sep 17 00:00:00 2001 From: NADAL Jean-Baptiste Date: Tue, 1 May 2018 22:26:04 +0200 Subject: [PATCH] wip --- src/prog/domod/src/main.cpp | 21 +++++++++++++++------ src/prog/domod/src/sequences/sequence.cpp | 2 +- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/prog/domod/src/main.cpp b/src/prog/domod/src/main.cpp index 2b351a9b..b6e63f1e 100644 --- a/src/prog/domod/src/main.cpp +++ b/src/prog/domod/src/main.cpp @@ -162,13 +162,22 @@ int main(int argc, char *argv[]) { return -1; } - +printf("ctx: %p\n", the_ctx); /* Add the UBus to the model exposed. */ - ubus_add_object(the_ctx, &the_capabilities); - ubus_add_object(the_ctx, &the_lights); - ubus_add_object(the_ctx, &the_shutters); - ubus_add_object(the_ctx, &the_sprinklers); - ubus_add_object(the_ctx, &the_sequences); + the_ret = ubus_add_object(the_ctx, &the_capabilities); + if (the_ret != UBUS_STATUS_OK) + { + fprintf (stderr, "Failed to register: %d\n", the_ret); + return -2; + } + if (ubus_add_object(the_ctx, &the_lights) != UBUS_STATUS_OK) + return -2; + if (ubus_add_object(the_ctx, &the_shutters) != UBUS_STATUS_OK) + return -2; + if (ubus_add_object(the_ctx, &the_sprinklers) != UBUS_STATUS_OK) + return -2; + if (ubus_add_object(the_ctx, &the_sequences) != UBUS_STATUS_OK) + return -2; /* Main Event Loop. */ uloop_run(); diff --git a/src/prog/domod/src/sequences/sequence.cpp b/src/prog/domod/src/sequences/sequence.cpp index 5dfa2808..1cfdcb48 100644 --- a/src/prog/domod/src/sequences/sequence.cpp +++ b/src/prog/domod/src/sequences/sequence.cpp @@ -237,7 +237,7 @@ void Sequence::stop(void) bool Sequence::switch_to_next_action(DevicesManager *a_device_manager) { printf("switch_to_next_action current: %d, size: %ld\n", m_current_action, m_actions.size()); - if ((m_current_action + 1) >= m_actions.size()) + if ((m_current_action + 1) >= (uint16_t)m_actions.size()) { printf("sequence is done.\n"); return false;