Skip to content

Commit

Permalink
Add optional attributes ProductLabel and PartNumber to Nordic factory…
Browse files Browse the repository at this point in the history
… data scripts (#23254)
  • Loading branch information
markus-becker-tridonic-com authored and pull[bot] committed Oct 14, 2023
1 parent f895082 commit 5638105
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,8 @@ def generate_json(self):
self._add_entry("product_id", self._args.product_id)
self._add_entry("vendor_name", self._args.vendor_name)
self._add_entry("product_name", self._args.product_name)
self._add_entry("product_label", self._args.product_label)
self._add_entry("part_number", self._args.part_number)
self._add_entry("date", self._args.date)
self._add_entry("hw_ver", self._args.hw_ver)
self._add_entry("hw_ver_str", self._args.hw_ver_str)
Expand Down Expand Up @@ -438,6 +440,10 @@ def base64_str(s): return base64.b64decode(s)
the setup code. Discriminator is used during a discovery process.")

# optional keys
optional_arguments.add_argument("--product_label", type=str,
help="[string] provide human-readable product label")
optional_arguments.add_argument("--part_number", type=str,
help="[string] provide human-readable product number")
optional_arguments.add_argument("--chip_cert_path", type=str,
help="Generate DAC and PAI certificates instead giving a path to .der files. This option requires a path to chip-cert executable."
"By default You can find spake2p in connectedhomeip/src/tools/chip-cert directory and build it there.")
Expand Down
12 changes: 11 additions & 1 deletion scripts/tools/nrfconnect/nrfconnect_factory_data.schema
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@
"type": "string",
"maxLength": 32
},
"product_label": {
"description": "more user-friendly human-readable product name",
"type": "string",
"maxLength": 64
},
"part_number": {
"description": "human-readable vendor assigned part number",
"type": "string",
"maxLength": 32
},
"date": {
"description": "Manufacturing date according to ISO 8601 in notation YYYY-MM-DD",
"type": "string",
Expand Down Expand Up @@ -144,4 +154,4 @@
"type": "object"
}
}
}
}
8 changes: 6 additions & 2 deletions scripts/tools/nrfconnect/tests/test_generate_factory_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ def test_generate_factory_data_all_specified(self):
'--vendor_id', '0x127F',
'--product_id', '0xABCD',
'--vendor_name', 'Nordic Semiconductor ASA',
'--product_name', 'Lock',
'--product_name', 'Lock Gen2',
'--product_label', 'Lock',
'--part_number', 'PCA10056',
'--date', '2022-07-20',
'--hw_ver', '101',
'--hw_ver_str', 'v1.1',
Expand All @@ -177,7 +179,9 @@ def test_generate_factory_data_all_specified(self):
self.assertEqual(factory_data.get('vendor_id'), 0x127F)
self.assertEqual(factory_data.get('product_id'), 0xABCD)
self.assertEqual(factory_data.get('vendor_name'), 'Nordic Semiconductor ASA')
self.assertEqual(factory_data.get('product_name'), 'Lock')
self.assertEqual(factory_data.get('product_name'), 'Lock Gen2')
self.assertEqual(factory_data.get('product_label'), 'Lock')
self.assertEqual(factory_data.get('part_number'), 'PCA10056')
self.assertEqual(factory_data.get('date'), '2022-07-20')
self.assertEqual(factory_data.get('hw_ver'), 101)
self.assertEqual(factory_data.get('hw_ver_str'), 'v1.1')
Expand Down

0 comments on commit 5638105

Please sign in to comment.