Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
-- Copyright 2026 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

local data_types = require "st.matter.data_types"
local TLVParser = require "st.matter.TLV.TLVParser"

Expand Down Expand Up @@ -41,11 +44,18 @@ GetCredentialStatusResponse.field_defs = {
is_optional = false,
data_type = require "st.matter.data_types.Uint16",
},
{
name = "credential_data",
field_id = 5,
is_nullable = true,
is_optional = true,
data_type = require "st.matter.data_types.OctetString1",
},
}

function GetCredentialStatusResponse:augment_type(base_type_obj)
local elems = {}
for _, v in ipairs(base_type_obj.elements) do
for _, v in ipairs(base_type_obj.elements or {}) do
for _, field_def in ipairs(self.field_defs) do
if field_def.field_id == v.field_id and
field_def.is_nullable and
Expand All @@ -55,7 +65,7 @@ function GetCredentialStatusResponse:augment_type(base_type_obj)
(field_def.is_optional and v.value == nil) then
elems[field_def.name] = data_types.validate_or_build_type(v, field_def.data_type, field_def.field_name)
if field_def.element_type ~= nil then
for i, e in ipairs(elems[field_def.name].elements) do
for i, e in ipairs(elems[field_def.name].elements or {}) do
elems[field_def.name].elements[i] = data_types.validate_or_build_type(e, field_def.element_type)
end
end
Expand All @@ -65,10 +75,10 @@ function GetCredentialStatusResponse:augment_type(base_type_obj)
base_type_obj.elements = elems
end

function GetCredentialStatusResponse:build_test_command_response(device, endpoint_id, credential_exists, user_index, creator_fabric_index, last_modified_fabric_index, next_credential_index, interaction_status)
local function init(self, device, endpoint_id, credential_exists, user_index, creator_fabric_index, last_modified_fabric_index, next_credential_index)
function GetCredentialStatusResponse:build_test_command_response(device, endpoint_id, credential_exists, user_index, creator_fabric_index, last_modified_fabric_index, next_credential_index, credential_data, interaction_status)
local function init(self, device, endpoint_id, credential_exists, user_index, creator_fabric_index, last_modified_fabric_index, next_credential_index, credential_data)
local out = {}
local args = {credential_exists, user_index, creator_fabric_index, last_modified_fabric_index, next_credential_index}
local args = {credential_exists, user_index, creator_fabric_index, last_modified_fabric_index, next_credential_index, credential_data}
if #args > #self.field_defs then
error(self.NAME .. " received too many arguments")
end
Expand All @@ -95,10 +105,12 @@ function GetCredentialStatusResponse:build_test_command_response(device, endpoin
out,
endpoint_id,
self._cluster.ID,
self.ID
self.ID,
false,
true
)
end
local self_request = init(self, device, endpoint_id, credential_exists, user_index, creator_fabric_index, last_modified_fabric_index, next_credential_index)
local self_request = init(self, device, endpoint_id, credential_exists, user_index, creator_fabric_index, last_modified_fabric_index, next_credential_index, credential_data)
return self._cluster:build_test_command_response(
device,
endpoint_id,
Expand All @@ -113,17 +125,17 @@ function GetCredentialStatusResponse:init()
return nil
end

function GetCredentialStatusResponse:set_parent_cluster(cluster)
self._cluster = cluster
return self
end

function GetCredentialStatusResponse:deserialize(tlv_buf)
local data = TLVParser.decode_tlv(tlv_buf)
self:augment_type(data)
return data
end

function GetCredentialStatusResponse:set_parent_cluster(cluster)
self._cluster = cluster
return self
end

setmetatable(GetCredentialStatusResponse, {__call = GetCredentialStatusResponse.init})

return GetCredentialStatusResponse
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
-- Copyright 2026 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

local data_types = require "st.matter.data_types"
local TLVParser = require "st.matter.TLV.TLVParser"

Expand Down Expand Up @@ -81,7 +84,7 @@ GetUserResponse.field_defs = {

function GetUserResponse:augment_type(base_type_obj)
local elems = {}
for _, v in ipairs(base_type_obj.elements) do
for _, v in ipairs(base_type_obj.elements or {}) do
for _, field_def in ipairs(self.field_defs) do
if field_def.field_id == v.field_id and
field_def.is_nullable and
Expand All @@ -91,7 +94,7 @@ function GetUserResponse:augment_type(base_type_obj)
(field_def.is_optional and v.value == nil) then
elems[field_def.name] = data_types.validate_or_build_type(v, field_def.data_type, field_def.field_name)
if field_def.element_type ~= nil then
for i, e in ipairs(elems[field_def.name].elements) do
for i, e in ipairs(elems[field_def.name].elements or {}) do
elems[field_def.name].elements[i] = data_types.validate_or_build_type(e, field_def.element_type)
end
end
Expand Down Expand Up @@ -131,7 +134,9 @@ function GetUserResponse:build_test_command_response(device, endpoint_id, user_i
out,
endpoint_id,
self._cluster.ID,
self.ID
self.ID,
false,
true
)
end
local self_request = init(self, device, endpoint_id, user_index, user_name, user_uniqueid, user_status, user_type, credential_rule, credentials, creator_fabric_index, last_modified_fabric_index, next_user_index)
Expand All @@ -149,17 +154,17 @@ function GetUserResponse:init()
return nil
end

function GetUserResponse:set_parent_cluster(cluster)
self._cluster = cluster
return self
end

function GetUserResponse:deserialize(tlv_buf)
local data = TLVParser.decode_tlv(tlv_buf)
self:augment_type(data)
return data
end

function GetUserResponse:set_parent_cluster(cluster)
self._cluster = cluster
return self
end

setmetatable(GetUserResponse, {__call = GetUserResponse.init})

return GetUserResponse

This file was deleted.

Loading
Loading