mirror of
https://github.com/espressif/openthread.git
synced 2026-10-03 22:37:36 +00:00
[meshcop] simplify processing of Commissioner ID TLV (#9543)
This commit updates CommissionerIdTlv to be defined as `StringTlvInfo` (a TLV with a UTF-8 string value with a specified maximum length). This allows us to use `Tlv` helper methods to `Find` and `Append` this TLV, simplifying the code. This commit also adds a helper `StringCopy()` method that copies a C string into a given target string buffer array if it fits in the array. This method can also optionally perform an encoding check on the string, such as a UTF-8 encoding check. This helper method is used to simplify setting different strings, such as Commissioner ID, Provisioning URL, Vendor Name, etc.
This commit is contained in:
@@ -52,9 +52,9 @@ expect_line "Done"
|
||||
send "commissioner id\n"
|
||||
expect "OpenThread Commissioner"
|
||||
expect_line "Done"
|
||||
send "commissioner id reallyAndUnnecessaryLongOpenthreadComisionerCustomIdShouldNotFit\n"
|
||||
send "commissioner id 12345678901234567890123456789012345678901234567890123456789012345\n"
|
||||
expect "Error 7: InvalidArgs"
|
||||
send "commissioner id reallyAndUnnecessaryLongOpenthreadCommissionerCustomIdShouldFit\n"
|
||||
send "commissioner id 1234567890123456789012345678901234567890123456789012345678901234\n"
|
||||
expect "Done"
|
||||
send "commissioner id customId\n"
|
||||
expect "Done"
|
||||
|
||||
Reference in New Issue
Block a user