Skip to content

Commit

Permalink
Make timedInvokeTimeoutMs optional (#30099)
Browse files Browse the repository at this point in the history
  • Loading branch information
yufengwangca authored and pull[bot] committed May 22, 2024
1 parent 62198f5 commit 1480268
Show file tree
Hide file tree
Showing 100 changed files with 2,920 additions and 3,155 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,40 +93,27 @@ class {{cluster.name}}Cluster(private val endpointId: UShort) {
{%- endif -%}
{% endfor -%}

{%- for command in cluster.commands | sort(attribute='code') -%}
{%- set callbackName = command | javaCommandCallbackName() -%}
{%- if not command.is_timed_invoke %}
suspend fun {{command.name | lowfirst_except_acronym}}(
{%- if command.input_param -%}
{%- for field in (cluster.structs | named(command.input_param)).fields -%}
{{field.name | lowfirst_except_acronym}}: {{encode_value(cluster, field | asEncodable(typeLookup), 0)}}
{%- if not loop.last -%}, {% endif %}
{%- endfor -%}
{%- endif -%}
)
{%- if command | hasResponse -%}
: {{callbackName}} {
{%- else %} {
{%- endif %}
// Implementation needs to be added here
}
{%- endif %}

{% for command in cluster.commands | sort(attribute='code') -%}
{%- set callbackName = command | javaCommandCallbackName() %}
suspend fun {{command.name | lowfirst_except_acronym}}(
{%- if command.input_param -%}
{%- for field in (cluster.structs | named(command.input_param)).fields -%}
{{field.name | lowfirst_except_acronym}}: {{encode_value(cluster, field | asEncodable(typeLookup), 0)}}
{%- if not loop.last -%}, {% endif %}
{%- endfor -%}
, timedInvokeTimeoutMs: Int)
, timedInvokeTimeoutMs: Int? = null)
{%- else -%}
timedInvokeTimeoutMs: Int)
timedInvokeTimeoutMs: Int? = null)
{%- endif -%}
{%- if command | hasResponse -%}
: {{callbackName}} {
{%- else %} {
{%- endif %}
// Implementation needs to be added here
if (timedInvokeTimeoutMs != null) {
// Do the action with timedInvokeTimeoutMs
} else {
// Do the action without timedInvokeTimeoutMs
}
}
{% endfor -%}

Expand Down
22 changes: 17 additions & 5 deletions scripts/py_matter_idl/matter_idl/generators/kotlin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,25 @@ def FieldToGlobalName(field: Field, context: TypeLookupContext) -> Optional[str]


def GlobalNameToJavaName(name: str) -> str:
if name in {'Int8u', 'Int8s', 'Int16u', 'Int16s'}:
return 'Integer'

if name.startswith('Int'):
if name == 'Int8s':
return 'Byte'
if name == 'Int8u':
return 'UByte'
if name == 'Int16s':
return 'Short'
if name == 'Int16u':
return 'UShort'

if name == 'Int32s':
return 'Int'
if name == 'Int32u':
return 'UInt'
if name == 'Int64s':
return 'Long'
if name == 'Int64u':
return 'ULong'

# Double/Float/Booleans/CharString/OctetString
# Double/Float/Boolean/CharString/OctetString
return name


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,36 +88,36 @@ class AccessControlCluster(private val endpointId: UShort) {
// Implementation needs to be added here
}

suspend fun readSubjectsPerAccessControlEntryAttribute(): Integer {
suspend fun readSubjectsPerAccessControlEntryAttribute(): UShort {
// Implementation needs to be added here
}

suspend fun subscribeSubjectsPerAccessControlEntryAttribute(
minInterval: Int,
maxInterval: Int
): Integer {
): UShort {
// Implementation needs to be added here
}

suspend fun readTargetsPerAccessControlEntryAttribute(): Integer {
suspend fun readTargetsPerAccessControlEntryAttribute(): UShort {
// Implementation needs to be added here
}

suspend fun subscribeTargetsPerAccessControlEntryAttribute(
minInterval: Int,
maxInterval: Int
): Integer {
): UShort {
// Implementation needs to be added here
}

suspend fun readAccessControlEntriesPerFabricAttribute(): Integer {
suspend fun readAccessControlEntriesPerFabricAttribute(): UShort {
// Implementation needs to be added here
}

suspend fun subscribeAccessControlEntriesPerFabricAttribute(
minInterval: Int,
maxInterval: Int
): Integer {
): UShort {
// Implementation needs to be added here
}

Expand Down Expand Up @@ -162,19 +162,19 @@ class AccessControlCluster(private val endpointId: UShort) {
// Implementation needs to be added here
}

suspend fun readFeatureMapAttribute(): Long {
suspend fun readFeatureMapAttribute(): UInt {
// Implementation needs to be added here
}

suspend fun subscribeFeatureMapAttribute(minInterval: Int, maxInterval: Int): Long {
suspend fun subscribeFeatureMapAttribute(minInterval: Int, maxInterval: Int): UInt {
// Implementation needs to be added here
}

suspend fun readClusterRevisionAttribute(): Integer {
suspend fun readClusterRevisionAttribute(): UShort {
// Implementation needs to be added here
}

suspend fun subscribeClusterRevisionAttribute(minInterval: Int, maxInterval: Int): Integer {
suspend fun subscribeClusterRevisionAttribute(minInterval: Int, maxInterval: Int): UShort {
// Implementation needs to be added here
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,33 @@ class AccountLoginCluster(private val endpointId: UShort) {

suspend fun getSetupPIN(
tempAccountIdentifier: String,
timedInvokeTimeoutMs: Int
timedInvokeTimeoutMs: Int? = null
): GetSetupPINResponse {
// Implementation needs to be added here
if (timedInvokeTimeoutMs != null) {
// Do the action with timedInvokeTimeoutMs
} else {
// Do the action without timedInvokeTimeoutMs
}
}

suspend fun login(tempAccountIdentifier: String, setupPIN: String, timedInvokeTimeoutMs: Int) {
// Implementation needs to be added here
suspend fun login(
tempAccountIdentifier: String,
setupPIN: String,
timedInvokeTimeoutMs: Int? = null
) {
if (timedInvokeTimeoutMs != null) {
// Do the action with timedInvokeTimeoutMs
} else {
// Do the action without timedInvokeTimeoutMs
}
}

suspend fun logout(timedInvokeTimeoutMs: Int) {
// Implementation needs to be added here
suspend fun logout(timedInvokeTimeoutMs: Int? = null) {
if (timedInvokeTimeoutMs != null) {
// Do the action with timedInvokeTimeoutMs
} else {
// Do the action without timedInvokeTimeoutMs
}
}

suspend fun readGeneratedCommandListAttribute(): GeneratedCommandListAttribute {
Expand Down Expand Up @@ -86,19 +102,19 @@ class AccountLoginCluster(private val endpointId: UShort) {
// Implementation needs to be added here
}

suspend fun readFeatureMapAttribute(): Long {
suspend fun readFeatureMapAttribute(): UInt {
// Implementation needs to be added here
}

suspend fun subscribeFeatureMapAttribute(minInterval: Int, maxInterval: Int): Long {
suspend fun subscribeFeatureMapAttribute(minInterval: Int, maxInterval: Int): UInt {
// Implementation needs to be added here
}

suspend fun readClusterRevisionAttribute(): Integer {
suspend fun readClusterRevisionAttribute(): UShort {
// Implementation needs to be added here
}

suspend fun subscribeClusterRevisionAttribute(minInterval: Int, maxInterval: Int): Integer {
suspend fun subscribeClusterRevisionAttribute(minInterval: Int, maxInterval: Int): UShort {
// Implementation needs to be added here
}

Expand Down
Loading

0 comments on commit 1480268

Please sign in to comment.