feat: expand companion platform, device controls, and memoir workflows
ci / verify (push) Canceled after 0s
ci / verify (push) Canceled after 0s
Add customer and operator login, BLE provisioning, device fleet controls, call memory, memoir generation, and refreshed family and maintenance portals. Include API contracts, migrations, firmware sources, tests, assets, and deployment documentation.
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
package deviceconfig
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"unicode"
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
// Empty restores the default label. The byte limit fits the firmware NVS buffer.
|
||||
func ValidDisplayName(name string) bool {
|
||||
return len(name) <= 96 && utf8.ValidString(name) && strings.TrimSpace(name) == name &&
|
||||
strings.IndexFunc(name, unicode.IsControl) < 0
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package deviceconfig
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestDisplayName(t *testing.T) {
|
||||
for _, name := range []string{"", "客厅陪伴设备", strings.Repeat("名", 32), "卧室 · EchoEar"} {
|
||||
if !ValidDisplayName(name) {
|
||||
t.Fatalf("rejected %q", name)
|
||||
}
|
||||
}
|
||||
for _, name := range []string{strings.Repeat("名", 33), " leading", "trailing ", "\u3000名称", "a\x00b", "a\nb", "a\u0085b", string([]byte{0xff})} {
|
||||
if ValidDisplayName(name) {
|
||||
t.Fatalf("accepted %q", name)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user