diff --git a/Utilities/HSDPython_SDK/st_pnpl/st_pnpl/DTDL/device_template_manager.py b/Utilities/HSDPython_SDK/st_pnpl/st_pnpl/DTDL/device_template_manager.py index 5d76958a..cdb82c1c 100644 --- a/Utilities/HSDPython_SDK/st_pnpl/st_pnpl/DTDL/device_template_manager.py +++ b/Utilities/HSDPython_SDK/st_pnpl/st_pnpl/DTDL/device_template_manager.py @@ -114,15 +114,18 @@ def query_dtdl_model(board_id, fw_id): usb_device_catalog_path = os.path.join(os.path.dirname(sys.modules[__name__].__file__),"usb_device_catalog.json") with open(usb_device_catalog_path, "r") as catalog: temp = json.load(catalog) + dtdl_model_ids = [] for entry in temp: if entry["board_id"] == board_id and entry["fw_id"] == fw_id: if "custom_dtmi" in entry and entry["custom_dtmi"] != "": print("DeviceTemplateManager - ALERT - CUSTOM User dtmi Overwrites the base supported model. Call remove_custom_dtdl_model(...) to restore the original one.") dtdl_model_id = entry["custom_dtmi"] + dtdl_model_ids.append(dtdl_model_id) print("dtmi: {}".format(dtdl_model_id)) elif "local_dtmi" in entry and entry["local_dtmi"] != "": print("dtmi found in locally in base supported models") dtdl_model_id = entry["local_dtmi"] + dtdl_model_ids.append(dtdl_model_id) print("dtmi: {}".format(dtdl_model_id)) #NOTE for the next version # print("Searching the corresponding Device Template model in Azure Device Models repository...") @@ -152,7 +155,15 @@ def query_dtdl_model(board_id, fw_id): # print("dtmi found in locally in base supported models") # dtdl_model_id = entry["local_dtmi"] # print("dtmi: {}".format(dtdl_model_id)) - dtdl_json_path = os.path.join(os.path.dirname(sys.modules[__name__].__file__), dtdl_model_id) + if len(dtdl_model_ids) == 1: + dtdl_json_path = os.path.join(os.path.dirname(sys.modules[__name__].__file__), dtdl_model_id) + with open(dtdl_json_path, "r") as device_model: + return json.load(device_model) + else: + device_models = {} + for dtm_id in dtdl_model_ids: + dtdl_json_path = os.path.join(os.path.dirname(sys.modules[__name__].__file__), dtm_id) with open(dtdl_json_path, "r") as device_model: - return json.load(device_model) + device_models[dtm_id] = json.load(device_model) + return device_models return "" \ No newline at end of file diff --git a/Utilities/HSDPython_SDK/st_pnpl/st_pnpl/DTDL/usb_device_catalog.json b/Utilities/HSDPython_SDK/st_pnpl/st_pnpl/DTDL/usb_device_catalog.json index 88db5e90..b7388be7 100644 --- a/Utilities/HSDPython_SDK/st_pnpl/st_pnpl/DTDL/usb_device_catalog.json +++ b/Utilities/HSDPython_SDK/st_pnpl/st_pnpl/DTDL/usb_device_catalog.json @@ -13,12 +13,26 @@ "st_cloud_dtmi": "", "local_dtmi": "dtmi/appconfig/steval_mkboxpro/fpSnsDatalog2_datalog2-2.json" }, + { + "board_id": "0xd", + "fw_id": "0xa", + "az_cloud_dtmi": "", + "st_cloud_dtmi": "", + "local_dtmi": "dtmi/appconfig/steval_mkboxpro/fpSnsDatalog2_datalog2-2.json" + }, + { + "board_id": "0xd", + "fw_id": "0xff", + "az_cloud_dtmi": "", + "st_cloud_dtmi": "", + "local_dtmi": "dtmi/appconfig/steval_mkboxpro/fpSnsDatalog2_datalog2-3.json" + }, { "board_id": "0xe", "fw_id": "0xff", "az_cloud_dtmi": "", "st_cloud_dtmi": "", - "local_dtmi": "dtmi/appconfig/steval_stwinbx1/fp_motor_control-3.json" + "local_dtmi": "dtmi/appconfig/steval_stwinbx1/fp_motor_control-4.json" }, { "board_id": "0xe", @@ -96,6 +110,19 @@ "st_cloud_dtmi": "", "local_dtmi": "dtmi/appconfig/steval_stwinbx1/fpSnsDatalog2_ultrasoundFft-3.json" }, + { + "board_id": "0xe", + "fw_id": "0x17", + "az_cloud_dtmi": "", + "st_cloud_dtmi": "", + "local_dtmi": "dtmi/appconfig/steval_stwinbx1/fpSnsDatalog2_datalog2-3.json" + }, + { + "board_id": "0xe", + "fw_id": "0x18", + "st_cloud_dtmi": "", + "local_dtmi": "dtmi/appconfig/steval_stwinbx1/fpSnsDatalog2_datalog2Ispu-3.json" + }, { "board_id": "0xe", "fw_id": "0x2", @@ -111,7 +138,7 @@ }, { "board_id": "0x10", - "fw_id": "0x01", + "fw_id": "0x1", "az_cloud_dtmi": "", "st_cloud_dtmi": "", "local_dtmi": "dtmi/appconfig/nucleo_u575zi_q/x_nucleo_iks02a1/fpSnsDatalog2_datalog2-1.json" @@ -125,16 +152,23 @@ }, { "board_id": "0x20", - "fw_id": "0x01", + "fw_id": "0x1", "az_cloud_dtmi": "", "st_cloud_dtmi": "", "local_dtmi": "dtmi/appconfig/b_u585i_iot02a/fpSnsDatalog2_datalog2-1.json" }, { "board_id": "0x30", - "fw_id": "0x01", + "fw_id": "0x1", "az_cloud_dtmi": "", "st_cloud_dtmi": "", "local_dtmi": "dtmi/appconfig/nucleo_h7a3zi_q/x_nucleo_iks02a1/fpSnsDatalog2_datalog2-1.json" + }, + { + "board_id": "0x9", + "fw_id": "0xff", + "az_cloud_dtmi": "", + "st_cloud_dtmi": "", + "local_dtmi": "dtmi/appconfig/steval_stwinkt1b/fpSnsDatalog2_datalog2-1.json" } ]