Skip to content

Commit 39ab465

Browse files
Thirsrinrzr
authored andcommitted
UIC-3437: Report callback Schedule Entry Lock CC
Merge in UIC/uic from feature/UIC-3437-Report-callback-Schedule-Entry-Lock-CC to feature/UIC-3271-Schedule-Entry-Lock-CC
1 parent 2243fc1 commit 39ab465

File tree

4 files changed

+491
-62
lines changed

4 files changed

+491
-62
lines changed

applications/zpc/components/zcl_cluster_servers/src/schedule_entry_lock_server.h renamed to applications/zpc/components/zcl_cluster_servers/include/schedule_entry_lock_server.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@
1414
#ifndef SCHEDULE_ENTRY_LOCK_SERVER_H
1515
#define SCHEDULE_ENTRY_LOCK_SERVER_H
1616

17+
// Includes from other Unify Components
18+
#include "dotdot_mqtt.h"
19+
#include "dotdot_mqtt_generated_commands.h"
20+
#include "attribute_store_helper.h"
21+
#include "attribute_resolver.h"
22+
#include "attribute_timeouts.h"
23+
#include "sl_log.h"
24+
25+
// Cpp include
26+
#include "zwave_frame_generator.hpp"
27+
#include "zwave_frame_parser.hpp"
28+
1729
#ifdef __cplusplus
1830
extern "C" {
1931
#endif
@@ -27,6 +39,22 @@ extern "C" {
2739
*/
2840
sl_status_t schedule_entry_lock_cluster_server_init(void);
2941

42+
sl_status_t zwave_command_class_publish_generated_week_day_report_command(
43+
dotdot_unid_t unid,
44+
dotdot_endpoint_id_t endpoint,
45+
attribute_store_node_t endpoint_node);
46+
47+
sl_status_t zwave_command_class_publish_generated_year_day_report_command(
48+
dotdot_unid_t unid,
49+
dotdot_endpoint_id_t endpoint,
50+
attribute_store_node_t endpoint_node);
51+
52+
sl_status_t
53+
zwave_command_class_publish_generated_daily_repeating_report_command(
54+
dotdot_unid_t unid,
55+
dotdot_endpoint_id_t endpoint,
56+
attribute_store_node_t endpoint_node);
57+
3058
#ifdef __cplusplus
3159
}
3260
#endif

applications/zpc/components/zcl_cluster_servers/src/schedule_entry_lock_server.cpp

Lines changed: 108 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,8 @@
2626
#include "attribute_store_defined_attribute_types.h"
2727
#include "ZW_classcmd.h"
2828

29-
// Includes from other Unify Components
30-
#include "dotdot_mqtt.h"
31-
#include "dotdot_mqtt_generated_commands.h"
32-
#include "attribute_store_helper.h"
33-
#include "attribute_resolver.h"
34-
#include "attribute_timeouts.h"
35-
#include "sl_log.h"
36-
37-
// Cpp include
3829
#include "attribute.hpp"
39-
#include "zwave_frame_generator.hpp"
40-
#include "zwave_frame_parser.hpp"
30+
4131

4232
// Attribute macro, shortening those long defines for attribute types:
4333
#define ATTRIBUTE(type) ATTRIBUTE_COMMAND_CLASS_SCHEDULE_ENTRY_LOCK_##type
@@ -230,10 +220,12 @@ static sl_status_t
230220
uint8_t user_identifier,
231221
uint8_t schedule_slotid,
232222
uint8_t start_year,
223+
uint8_t start_month,
233224
uint8_t start_day,
234225
uint8_t start_hour,
235226
uint8_t start_minute,
236227
uint8_t stop_year,
228+
uint8_t stop_month,
237229
uint8_t stop_day,
238230
uint8_t stop_hour,
239231
uint8_t stop_minute)
@@ -251,10 +243,12 @@ static sl_status_t
251243
const std::map<attribute_store_type_t, uint8_t> attribute_map
252244
= {{ATTRIBUTE(YEAR_DAY_SCHEDULE_SET_ACTION), set_action},
253245
{ATTRIBUTE(YEAR_DAY_SCHEDULE_START_YEAR), start_year},
246+
{ATTRIBUTE(YEAR_DAY_SCHEDULE_START_MONTH), start_month},
254247
{ATTRIBUTE(YEAR_DAY_SCHEDULE_START_DAY), start_day},
255248
{ATTRIBUTE(YEAR_DAY_SCHEDULE_START_HOUR), start_hour},
256249
{ATTRIBUTE(YEAR_DAY_SCHEDULE_START_MINUTE), start_minute},
257250
{ATTRIBUTE(YEAR_DAY_SCHEDULE_STOP_YEAR), stop_year},
251+
{ATTRIBUTE(YEAR_DAY_SCHEDULE_STOP_MONTH), stop_month},
258252
{ATTRIBUTE(YEAR_DAY_SCHEDULE_STOP_DAY), stop_day},
259253
{ATTRIBUTE(YEAR_DAY_SCHEDULE_STOP_HOUR), stop_hour},
260254
{ATTRIBUTE(YEAR_DAY_SCHEDULE_STOP_MINUTE), stop_minute}};
@@ -440,6 +434,109 @@ sl_status_t zwave_command_class_schedule_entry_lock_write_attributes_callback(
440434
return SL_STATUS_OK;
441435
}
442436

437+
sl_status_t zwave_command_class_publish_generated_week_day_report_command(dotdot_unid_t unid, dotdot_endpoint_id_t endpoint, attribute_store_node_t ep_node){
438+
attribute_store::attribute endpoint_node(ep_node);
439+
440+
uic_mqtt_dotdot_unify_schedule_entry_lock_command_week_day_report_fields_t fields;
441+
attribute_store::attribute user_id_node
442+
= endpoint_node.child_by_type(ATTRIBUTE(USER_IDENTIFIER));
443+
attribute_store::attribute week_day_slot_id_node
444+
= user_id_node.child_by_type(ATTRIBUTE(WEEK_DAY_SCHEDULE_SLOT_ID));
445+
attribute_store::attribute day_of_week_node
446+
= week_day_slot_id_node.child_by_type(ATTRIBUTE(WEEK_DAY_SCHEDULE_DAY_OF_WEEK));
447+
attribute_store::attribute start_hour_node
448+
= week_day_slot_id_node.child_by_type(ATTRIBUTE(WEEK_DAY_SCHEDULE_START_HOUR));
449+
attribute_store::attribute start_minute_node
450+
= week_day_slot_id_node.child_by_type(ATTRIBUTE(WEEK_DAY_SCHEDULE_START_MINUTE));
451+
attribute_store::attribute stop_hour_node
452+
= week_day_slot_id_node.child_by_type(ATTRIBUTE(WEEK_DAY_SCHEDULE_STOP_HOUR));
453+
attribute_store::attribute stop_minute_node
454+
= week_day_slot_id_node.child_by_type(ATTRIBUTE(WEEK_DAY_SCHEDULE_STOP_MINUTE));
455+
fields.user_identifier = user_id_node.reported<uint8_t>();
456+
fields.schedule_slotid = week_day_slot_id_node.reported<uint8_t>();
457+
fields.day_of_week = day_of_week_node.reported<uint8_t>();
458+
fields.start_hour = start_hour_node.reported<uint8_t>();
459+
fields.start_minute = start_minute_node.reported<uint8_t>();
460+
fields.stop_hour = stop_hour_node.reported<uint8_t>();
461+
fields.stop_minute = stop_minute_node.reported<uint8_t>();
462+
uic_mqtt_dotdot_unify_schedule_entry_lock_publish_generated_week_day_report_command(unid, endpoint, &fields);
463+
return SL_STATUS_OK;
464+
}
465+
466+
sl_status_t zwave_command_class_publish_generated_year_day_report_command(dotdot_unid_t unid, dotdot_endpoint_id_t endpoint, attribute_store_node_t ep_node){
467+
attribute_store::attribute endpoint_node(ep_node);
468+
469+
uic_mqtt_dotdot_unify_schedule_entry_lock_command_year_day_report_fields_t fields;
470+
attribute_store::attribute user_id_node
471+
= endpoint_node.child_by_type(ATTRIBUTE(USER_IDENTIFIER));
472+
attribute_store::attribute year_day_slot_id_node
473+
= user_id_node.child_by_type(ATTRIBUTE(YEAR_DAY_SCHEDULE_SLOT_ID));
474+
attribute_store::attribute start_year_node
475+
= year_day_slot_id_node.child_by_type(ATTRIBUTE(YEAR_DAY_SCHEDULE_START_YEAR));
476+
attribute_store::attribute start_month_node
477+
= year_day_slot_id_node.child_by_type(ATTRIBUTE(YEAR_DAY_SCHEDULE_START_MONTH));
478+
attribute_store::attribute start_day_node
479+
= year_day_slot_id_node.child_by_type(ATTRIBUTE(YEAR_DAY_SCHEDULE_START_DAY));
480+
attribute_store::attribute start_hour_node
481+
= year_day_slot_id_node.child_by_type(ATTRIBUTE(YEAR_DAY_SCHEDULE_START_HOUR));
482+
attribute_store::attribute start_minute_node
483+
= year_day_slot_id_node.child_by_type(ATTRIBUTE(YEAR_DAY_SCHEDULE_START_MINUTE));
484+
attribute_store::attribute stop_year_node
485+
= year_day_slot_id_node.child_by_type(ATTRIBUTE(YEAR_DAY_SCHEDULE_STOP_YEAR));
486+
attribute_store::attribute stop_month_node
487+
= year_day_slot_id_node.child_by_type(ATTRIBUTE(YEAR_DAY_SCHEDULE_STOP_MONTH));
488+
attribute_store::attribute stop_day_node
489+
= year_day_slot_id_node.child_by_type(ATTRIBUTE(YEAR_DAY_SCHEDULE_STOP_DAY));
490+
attribute_store::attribute stop_hour_node
491+
= year_day_slot_id_node.child_by_type(ATTRIBUTE(YEAR_DAY_SCHEDULE_STOP_HOUR));
492+
attribute_store::attribute stop_minute_node
493+
= year_day_slot_id_node.child_by_type(ATTRIBUTE(YEAR_DAY_SCHEDULE_STOP_MINUTE));
494+
fields.user_identifier = user_id_node.reported<uint8_t>();
495+
fields.schedule_slotid = year_day_slot_id_node.reported<uint8_t>();
496+
fields.start_year = start_year_node.reported<uint8_t>();
497+
fields.start_month = start_month_node.reported<uint8_t>();
498+
fields.start_day= start_day_node.reported<uint8_t>();
499+
fields.start_hour = start_hour_node.reported<uint8_t>();
500+
fields.start_minute = start_minute_node.reported<uint8_t>();
501+
fields.stop_year = stop_year_node.reported<uint8_t>();
502+
fields.stop_month = stop_month_node.reported<uint8_t>();
503+
fields.stop_day= stop_day_node.reported<uint8_t>();
504+
fields.stop_hour = stop_hour_node.reported<uint8_t>();
505+
fields.stop_minute = stop_minute_node.reported<uint8_t>();
506+
507+
uic_mqtt_dotdot_unify_schedule_entry_lock_publish_generated_year_day_report_command(unid, endpoint, &fields);
508+
return SL_STATUS_OK;
509+
}
510+
511+
sl_status_t zwave_command_class_publish_generated_daily_repeating_report_command(dotdot_unid_t unid, dotdot_endpoint_id_t endpoint, attribute_store_node_t ep_node){
512+
attribute_store::attribute endpoint_node(ep_node);
513+
514+
uic_mqtt_dotdot_unify_schedule_entry_lock_command_daily_repeating_report_fields_t fields;
515+
attribute_store::attribute user_id_node
516+
= endpoint_node.child_by_type(ATTRIBUTE(USER_IDENTIFIER));
517+
attribute_store::attribute daily_repeating_slot_id_node
518+
= user_id_node.child_by_type(ATTRIBUTE(DAILY_REPEATING_SCHEDULE_SLOT_ID));
519+
attribute_store::attribute week_day_node
520+
= daily_repeating_slot_id_node.child_by_type(ATTRIBUTE(DAILY_REPEATING_WEEK_DAY));
521+
attribute_store::attribute start_hour_node
522+
= daily_repeating_slot_id_node.child_by_type(ATTRIBUTE(DAILY_REPEATING_START_HOUR));
523+
attribute_store::attribute start_minute_node
524+
= daily_repeating_slot_id_node.child_by_type(ATTRIBUTE(DAILY_REPEATING_START_MINUTE));
525+
attribute_store::attribute duartion_hour_node
526+
= daily_repeating_slot_id_node.child_by_type(ATTRIBUTE(DAILY_REPEATING_DURATION_HOUR));
527+
attribute_store::attribute duration_minute_node
528+
= daily_repeating_slot_id_node.child_by_type(ATTRIBUTE(DAILY_REPEATING_DURATION_MINUTE));
529+
fields.user_identifier = user_id_node.reported<uint8_t>();
530+
fields.schedule_slotid = daily_repeating_slot_id_node.reported<uint8_t>();
531+
fields.week_day_bitmask = week_day_node.reported<uint8_t>();
532+
fields.start_hour = start_hour_node.reported<uint8_t>();
533+
fields.start_minute = start_minute_node.reported<uint8_t>();
534+
fields.duration_hour= duartion_hour_node.reported<uint8_t>();
535+
fields.duration_minute = duration_minute_node.reported<uint8_t>();
536+
uic_mqtt_dotdot_unify_schedule_entry_lock_publish_generated_daily_repeating_report_command(unid, endpoint, &fields);
537+
return SL_STATUS_OK;
538+
}
539+
443540
///////////////////////////////////////////////////////////////////////////////
444541
// Init and teardown functions.
445542
//////////////////////////////////////////////////////////////////////////////

applications/zpc/components/zwave_command_classes/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ target_link_libraries(zwave_command_classes
129129
zpc_utils
130130
zpc_scripts
131131
unify
132+
zcl_cluster_servers
132133
zwave_definitions)
133134

134135
if(BUILD_TESTING)

0 commit comments

Comments
 (0)