Skip to content

Commit

Permalink
Extend DoorLock Cluster, add zap-generated files for command GetAllPI…
Browse files Browse the repository at this point in the history
…NCodes

This is a contribution per the CLA

Signed-off-by: Nenad Kljajic <[email protected]>
  • Loading branch information
nkljajic committed Jan 23, 2024
1 parent 9116c1b commit 3524e9e
Show file tree
Hide file tree
Showing 22 changed files with 713 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7274,6 +7274,13 @@ export let ClusterTypeAttrs: any = {
isArray: false,
}
]
},
{
id: 128,
name: "GetAllPINCodes",
required: false,
fields: [
]
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2272,6 +2272,30 @@ void zigpc_command_mapper_bygroup_door_lock_clear_allrfid_codes_handler(

}

/**
* @brief DotDot MQTT by-group handler for DoorLock/GetAllPINCodes command.
*
* @param group_id UCL group identifier.
*/
void zigpc_command_mapper_bygroup_door_lock_get_allpin_codes_handler(
const dotdot_group_id_t group_id
) {




zigpc_command_mapper_send_multicast(
group_id,
ZIGPC_ZCL_FRAME_TYPE_CMD_TO_SERVER,
ZIGPC_ZCL_CLUSTER_DOOR_LOCK,
ZIGPC_ZCL_CLUSTER_DOOR_LOCK_COMMAND_GET_ALLPIN_CODES,
0,
nullptr
);

}

void zigpc_command_mapper_bygroup_thermostat_write_attributes_handler(
const dotdot_group_id_t group_id,
uic_mqtt_dotdot_thermostat_state_t values,
Expand Down Expand Up @@ -4051,6 +4075,7 @@ sl_status_t zigpc_command_mapper_mqtt_bygroup_handlers_init(void)
uic_mqtt_dotdot_by_group_door_lock_getrfid_code_callback_set(zigpc_command_mapper_bygroup_door_lock_getrfid_code_handler);
uic_mqtt_dotdot_by_group_door_lock_clearrfid_code_callback_set(zigpc_command_mapper_bygroup_door_lock_clearrfid_code_handler);
uic_mqtt_dotdot_by_group_door_lock_clear_allrfid_codes_callback_set(zigpc_command_mapper_bygroup_door_lock_clear_allrfid_codes_handler);
uic_mqtt_dotdot_by_group_door_lock_get_allpin_codes_callback_set(zigpc_command_mapper_bygroup_door_lock_get_allpin_codes_handler);
uic_mqtt_dotdot_by_group_thermostat_write_attributes_callback_set(zigpc_command_mapper_bygroup_thermostat_write_attributes_handler);
uic_mqtt_dotdot_by_group_thermostat_setpoint_raise_or_lower_callback_set(zigpc_command_mapper_bygroup_thermostat_setpoint_raise_or_lower_handler);
uic_mqtt_dotdot_by_group_thermostat_set_weekly_schedule_callback_set(zigpc_command_mapper_bygroup_thermostat_set_weekly_schedule_handler);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4252,6 +4252,50 @@ sl_status_t zigpc_command_mapper_door_lock_clear_allrfid_codes_handler(
return SL_STATUS_OK;
}

/**
* @brief DotDot MQTT translator handler for DoorLock/GetAllPINCodes command.
*
* @param unid Unify device identifier string
* @param endpoint Unify device endpoint identifier
* @param callback_type Callback type
* @return SL_STATUS_OK if callback_type == UIC_MQTT_DOTDOT_CALLBACK_TYPE_NORMAL and call is successful
* @return SL_STATUS_OK if callback_type == UIC_MQTT_DOTDOT_CALLBACK_TYPE_SUPPORT_CHECK and command is supported by the unid/endpoint
* @return SL_STATUS_NOT_AVAILABLE if callback_type == UIC_MQTT_DOTDOT_CALLBACK_TYPE_SUPPORT_CHECK and command is not supported by the unid/endpoint
*/
sl_status_t zigpc_command_mapper_door_lock_get_allpin_codes_handler(
const dotdot_unid_t unid,
const dotdot_endpoint_id_t endpoint,
uic_mqtt_dotdot_callback_call_type_t callback_type
) {
sl_status_t status = SL_STATUS_OK;

if (callback_type == UIC_MQTT_DOTDOT_CALLBACK_TYPE_SUPPORT_CHECK) {
status = zigpc_command_mapper_cluster_support_check(unid, endpoint, ZIGPC_ZCL_CLUSTER_DOOR_LOCK);
if (status != SL_STATUS_OK) {
status = SL_STATUS_NOT_AVAILABLE;
}
return status;
}




if (status == SL_STATUS_OK) {
zigpc_command_mapper_send_unicast(
unid,
endpoint,
ZIGPC_ZCL_FRAME_TYPE_CMD_TO_SERVER,
ZIGPC_ZCL_CLUSTER_DOOR_LOCK,
ZIGPC_ZCL_CLUSTER_DOOR_LOCK_COMMAND_GET_ALLPIN_CODES,
0,
nullptr
);
}

// Always return SL_STATUS_OK if being called normally.
return SL_STATUS_OK;
}

/******************
* DotDot MQTT Command Handlers for Thermostat cluster
******************/
Expand Down Expand Up @@ -8054,6 +8098,9 @@ sl_status_t zigpc_command_mapper_register_dotdot_mqtt_handlers(void)
uic_mqtt_dotdot_door_lock_clear_allrfid_codes_callback_set(
zigpc_command_mapper_door_lock_clear_allrfid_codes_handler
);
uic_mqtt_dotdot_door_lock_get_allpin_codes_callback_set(
zigpc_command_mapper_door_lock_get_allpin_codes_handler
);
uic_mqtt_dotdot_set_thermostat_write_attributes_callback(
zigpc_command_mapper_thermostat_write_attributes_handler
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,7 @@ typedef enum {
ZIGPC_ZCL_CLUSTER_DOOR_LOCK_COMMAND_CLEAR_ALLRFID_CODES_RESPONSE = 0x19,
ZIGPC_ZCL_CLUSTER_DOOR_LOCK_COMMAND_OPERATING_EVENT_NOTIFICATION = 0x20,
ZIGPC_ZCL_CLUSTER_DOOR_LOCK_COMMAND_PROGRAMMING_EVENT_NOTIFICATION = 0x21,
ZIGPC_ZCL_CLUSTER_DOOR_LOCK_COMMAND_GET_ALLPIN_CODES = 0x80,
} zigpc_zcl_door_lock_command_type_t;

/*****************************************************************
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
#define DOTDOT_DOOR_LOCK_CLEAR_ALLRFID_CODES_RESPONSE_COMMAND_ID (0x19)
#define DOTDOT_DOOR_LOCK_OPERATING_EVENT_NOTIFICATION_COMMAND_ID (0x20)
#define DOTDOT_DOOR_LOCK_PROGRAMMING_EVENT_NOTIFICATION_COMMAND_ID (0x21)
#define DOTDOT_DOOR_LOCK_GET_ALLPIN_CODES_COMMAND_ID (0x80)

// Commands for cluster: WindowCovering
#define DOTDOT_WINDOW_COVERING_UP_OR_OPEN_COMMAND_ID (0x0)
Expand Down
44 changes: 42 additions & 2 deletions components/uic_dotdot/zap-generated/readme_ucl_mqtt_reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -14083,6 +14083,7 @@ ucl/by-unid/<UNID>/<EP>/DoorLock/Attributes/ClusterRevision/Reported { "value":
"ClearAllRFIDCodesResponse",
"OperatingEventNotification",
"ProgrammingEventNotification",
"GetAllPINCodes",
"WriteAttributes",
"ForceReadAttributes"
]
Expand All @@ -14103,15 +14104,15 @@ To see supported commands for DoorLock cluster under the by-unid topic space:
```console
mosquitto_sub -t 'ucl/by-unid/<UNID>/<EP>/DoorLock/SupportedCommands'
# Example output
ucl/by-unid/<UNID>/<EP>/DoorLock/SupportedCommands { "value": ["LockDoor","UnlockDoor","Toggle","UnlockWithTimeout","GetLogRecord","SetPINCode","GetPINCode","ClearPINCode","ClearAllPINCodes","SetUserStatus","GetUserStatus","SetWeekdaySchedule","GetWeekdaySchedule","ClearWeekdaySchedule","SetYearDaySchedule","GetYearDaySchedule","ClearYearDaySchedule","SetHolidaySchedule","GetHolidaySchedule","ClearHolidaySchedule","SetUserType","GetUserType","SetRFIDCode","GetRFIDCode","ClearRFIDCode","ClearAllRFIDCodes",] }
ucl/by-unid/<UNID>/<EP>/DoorLock/SupportedCommands { "value": ["LockDoor","UnlockDoor","Toggle","UnlockWithTimeout","GetLogRecord","SetPINCode","GetPINCode","ClearPINCode","ClearAllPINCodes","SetUserStatus","GetUserStatus","SetWeekdaySchedule","GetWeekdaySchedule","ClearWeekdaySchedule","SetYearDaySchedule","GetYearDaySchedule","ClearYearDaySchedule","SetHolidaySchedule","GetHolidaySchedule","ClearHolidaySchedule","SetUserType","GetUserType","SetRFIDCode","GetRFIDCode","ClearRFIDCode","ClearAllRFIDCodes","GetAllPINCodes","WriteAttributes", "ForceReadAttributes"] }
```

To see supported generated commands for DoorLock cluster under the by-unid topic space:

```console
mosquitto_sub -t 'ucl/by-unid/<UNID>/<EP>/DoorLock/SupportedGeneratedCommands'
# Example output
ucl/by-unid/<UNID>/<EP>/DoorLock/SupportedGeneratedCommands { "value": ["LockDoorResponse","UnlockDoorResponse","ToggleResponse","UnlockWithTimeoutResponse","GetLogRecordResponse","SetPINCodeResponse","GetPINCodeResponse","ClearPINCodeResponse","ClearAllPINCodesResponse","SetUserStatusResponse","GetUserStatusResponse","SetWeekdayScheduleResponse","GetWeekdayScheduleResponse","ClearWeekdayScheduleResponse","SetYearDayScheduleResponse","GetYearDayScheduleResponse","ClearYearDayScheduleResponse","SetHolidayScheduleResponse","GetHolidayScheduleResponse","ClearHolidayScheduleResponse","SetUserTypeResponse","GetUserTypeResponse","SetRFIDCodeResponse","GetRFIDCodeResponse","ClearRFIDCodeResponse","ClearAllRFIDCodesResponse","OperatingEventNotification","ProgrammingEventNotification"] }
ucl/by-unid/<UNID>/<EP>/DoorLock/SupportedGeneratedCommands { "value": ["LockDoorResponse","UnlockDoorResponse","ToggleResponse","UnlockWithTimeoutResponse","GetLogRecordResponse","SetPINCodeResponse","GetPINCodeResponse","ClearPINCodeResponse","ClearAllPINCodesResponse","SetUserStatusResponse","GetUserStatusResponse","SetWeekdayScheduleResponse","GetWeekdayScheduleResponse","ClearWeekdayScheduleResponse","SetYearDayScheduleResponse","GetYearDayScheduleResponse","ClearYearDayScheduleResponse","SetHolidayScheduleResponse","GetHolidayScheduleResponse","ClearHolidayScheduleResponse","SetUserTypeResponse","GetUserTypeResponse","SetRFIDCodeResponse","GetRFIDCodeResponse","ClearRFIDCodeResponse","ClearAllRFIDCodesResponse","OperatingEventNotification","ProgrammingEventNotification",] }
```

<!-- -->
Expand Down Expand Up @@ -16705,6 +16706,45 @@ mosquitto_sub -t 'ucl/by-unid/<UNID>/<EP>/DoorLock/GeneratedCommands/Programming

<br><br>

\subsection door_lock_get_allpin_codes_cmd DoorLock/GetAllPINCodes Command

**MQTT Topic Pattern:**

```
[PREFIX]/DoorLock/Commands/GetAllPINCodes
[PREFIX]/DoorLock/GeneratedCommands/GetAllPINCodes
```

**MQTT Payload JSON Schema:**

```json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "DoorLock Cluster GetAllPINCodes Command Properties",
"type": "object",
"properties": {
},
"required": [
]
}
```

**Example Mosquitto CLI Tool Usage**

To send a DoorLock/GetAllPINCodes command under the by-unid topic space:

```console
mosquitto_pub -t 'ucl/by-unid/<UNID>/<EP>/DoorLock/Commands/GetAllPINCodes' -m '{ }'
```

To receive a DoorLock/GetAllPINCodes generated command from a UNID/endpoint:

```console
mosquitto_sub -t 'ucl/by-unid/<UNID>/<EP>/DoorLock/GeneratedCommands/GetAllPINCodes'
```

<br><br>

\subsection door_lock_write_attr_cmd DoorLock/WriteAttributes Command

**MQTT Topic Pattern:**
Expand Down
45 changes: 45 additions & 0 deletions components/uic_dotdot_mqtt/zap-generated/include/dotdot_mqtt.h
Original file line number Diff line number Diff line change
Expand Up @@ -9931,6 +9931,11 @@ typedef sl_status_t (*uic_mqtt_dotdot_door_lock_programming_event_notification_c
const char* data

);
typedef sl_status_t (*uic_mqtt_dotdot_door_lock_get_allpin_codes_callback_t)(
dotdot_unid_t unid,
dotdot_endpoint_id_t endpoint,
uic_mqtt_dotdot_callback_call_type_t call_type
);

typedef struct {
uint8_t lock_state;
Expand Down Expand Up @@ -12697,6 +12702,46 @@ void uic_mqtt_dotdot_door_lock_generated_programming_event_notification_callback
* +/DoorLock/GeneratedCommands/programming_event_notification is received.
*/
void uic_mqtt_dotdot_door_lock_generated_programming_event_notification_callback_clear();
/**
* @brief Setup callback to be called when a
* DoorLock/Commands/get_allpin_codes is received.
*
* Setting this callback will not overwrite the previous set callback
* @param callback Function to be called on command reception
*/
void uic_mqtt_dotdot_door_lock_get_allpin_codes_callback_set(const uic_mqtt_dotdot_door_lock_get_allpin_codes_callback_t callback);
/**
* @brief Unsets callback to be called when a
* DoorLock/Commands/get_allpin_codes is received.
*
* @param callback Function to be no longer called on command reception
*/
void uic_mqtt_dotdot_door_lock_get_allpin_codes_callback_unset(const uic_mqtt_dotdot_door_lock_get_allpin_codes_callback_t callback);
/**
* @brief Clears all callbacks registered for when
* DoorLock/Commands/get_allpin_codes is received.
*/
void uic_mqtt_dotdot_door_lock_get_allpin_codes_callback_clear();

/**
* @brief Setup callback to be called when a
* +/DoorLock/GeneratedCommands/get_allpin_codes is received.
*
* Setting this callback will not overwrite the previous set callback
* @param callback Function to be called on command reception
*/
void uic_mqtt_dotdot_door_lock_generated_get_allpin_codes_callback_set(const uic_mqtt_dotdot_door_lock_get_allpin_codes_callback_t callback);
/**
* @brief Unsets callback to be called when a
* +/DoorLock/GeneratedCommands/get_allpin_codes is received.
* @param callback Function to be no longer called on command reception
*/
void uic_mqtt_dotdot_door_lock_generated_get_allpin_codes_callback_unset(const uic_mqtt_dotdot_door_lock_get_allpin_codes_callback_t callback);
/**
* @brief Clears all callbacks registered for when
* +/DoorLock/GeneratedCommands/get_allpin_codes is received.
*/
void uic_mqtt_dotdot_door_lock_generated_get_allpin_codes_callback_clear();

/**
* @brief Setup a callback for WriteAttribute to be called when a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2642,6 +2642,23 @@ void uic_mqtt_dotdot_door_lock_publish_generated_programming_event_notification_
const uic_mqtt_dotdot_door_lock_command_programming_event_notification_fields_t *fields

);
/**
* @brief Publishes an incoming/generated GetAllPINCodes command for
* the DoorLock cluster.
*
* Publication will be made at the following topic
* ucl/by-unid/UNID/epID/DoorLock/GeneratedCommands/GetAllPINCodes
*
* @param unid The UNID of the node that sent us the command.
*
* @param endpoint The Endpoint ID of the node that sent us the command.
*
*
*/
void uic_mqtt_dotdot_door_lock_publish_generated_get_allpin_codes_command(
const dotdot_unid_t unid,
const dotdot_endpoint_id_t endpoint
);

/**
* @brief Publishes an incoming/generated WriteAttributes command for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2054,6 +2054,21 @@ typedef void (*uic_mqtt_dotdot_by_group_door_lock_programming_event_notification
*/
void uic_mqtt_dotdot_by_group_door_lock_programming_event_notification_callback_set(const uic_mqtt_dotdot_by_group_door_lock_programming_event_notification_callback_t callback);

/**
* @brief Callback signature for by-group DoorLock::GetAllPINCodes command.
*/
typedef void (*uic_mqtt_dotdot_by_group_door_lock_get_allpin_codes_callback_t)(
const dotdot_group_id_t group_id
);

/**
* Setup handler to be called when a
* ucl/by-group/+/DoorLock/get_allpin_codes is received.
* Setting this callback will overwrite the previous set callback.
*
*/
void uic_mqtt_dotdot_by_group_door_lock_get_allpin_codes_callback_set(const uic_mqtt_dotdot_by_group_door_lock_get_allpin_codes_callback_t callback);

typedef void (*uic_mqtt_dotdot_by_group_door_lock_write_attributes_callback_t)(
const dotdot_group_id_t group_id,
uic_mqtt_dotdot_door_lock_state_t,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4370,6 +4370,37 @@ void uic_mqtt_dotdot_door_lock_publish_programming_event_notification_command_to
const uic_mqtt_dotdot_door_lock_command_programming_event_notification_fields_t *fields

);
/**
* @brief Sends/Publishes a GetAllPINCodes command for
* the DoorLock cluster to a destination.
*
* Publication will be made at the following topic
* ucl/by-unid/UNID/epID/DoorLock/Commands/GetAllPINCodes
*
* @param destination_unid The UNID of the node that should receive the command.
*
* @param destination_endpoint The Endpoint ID of the node that should receive the command.
*
*
*/
void uic_mqtt_dotdot_door_lock_publish_get_allpin_codes_command(
const dotdot_unid_t destination_unid,
const dotdot_endpoint_id_t destination_endpoint
);

/**
* @brief Sends/Publishes a GetAllPINCodes command for
* the DoorLock cluster to a group.
*
* Publication will be made at the following topic
* ucl/by-group/GroupID/DoorLock/Commands/GetAllPINCodes
*
* @param destination_group_id The GroupID that should receive the command.
*
*/
void uic_mqtt_dotdot_door_lock_publish_get_allpin_codes_command_to_group(
uint16_t destination_group_id
);
/**
* @brief Sends/Publishes a UpOrOpen command for
* the WindowCovering cluster to a destination.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ typedef struct _uic_mqtt_dotdot_door_lock_supported_commands_ {
bool clear_allrfid_codes_response;
bool operating_event_notification;
bool programming_event_notification;
bool get_allpin_codes;
bool write_attributes;
} uic_mqtt_dotdot_door_lock_supported_commands_t;

Expand Down
Loading

0 comments on commit 3524e9e

Please sign in to comment.