type: types_.ENUM,
values: Object.values(HWType),
optional: false
+ },
+ {
+ name: 'customRequirement',
+ type: types_.STRING,
+ optional: true
}
]);
var callArgs = {
nnfw: args.nnfw,
- hw: args.hw
+ hw: args.hw,
+ customRequirement: args.customRequirement || null
};
var result = native_.callSync('MLCheckNNFWAvailability', callArgs);
const std::string kModelPath = "modelPath";
const std::string kName = "name";
const std::string kNnfw = "nnfw";
+const std::string kCustomRequirement = "customRequirement";
const std::string kNodeName = "nodeName";
const std::string kOpen = "open";
const std::string kOtherId = "otherId";
ScopeLogger("args: %s", args.serialize().c_str());
CHECK_EXIST(args, kNnfw, out)
CHECK_EXIST(args, kHw, out)
+ CHECK_EXIST(args, kCustomRequirement, out)
std::string nnfw = args.get(kNnfw).get<std::string>();
std::string hw = args.get(kHw).get<std::string>();
- bool availability_val = util::CheckNNFWAvailability(nnfw, hw);
+ optional<std::string> customRequirement;
+ if (args.get(kCustomRequirement).is<std::string>()) {
+ customRequirement = args.get(kCustomRequirement).get<std::string>();
+ }
+ bool availability_val = util::CheckNNFWAvailability(nnfw, hw, customRequirement);
picojson::value available = picojson::value{availability_val};
ReportSuccess(available, out);
}
}
-bool CheckNNFWAvailability(const std::string& nnfw, const std::string& hw) {
+bool CheckNNFWAvailability(const std::string& nnfw, const std::string& hw,
+ optional<std::string> customRequirement) {
ScopeLogger();
ml_nnfw_type_e nnfw_e = ML_NNFW_TYPE_ANY;
ml_nnfw_hw_e hw_e = ML_NNFW_HW_ANY;
LoggerE("HWTypeEnum.getValue() failed, error: %s", result.message().c_str());
return false;
}
+ const char* customRequirementPtr = customRequirement ? customRequirement->c_str() : nullptr;
bool available = false;
- int ret = ml_check_nnfw_availability(nnfw_e, hw_e, &available);
+ int ret = ml_check_nnfw_availability_full(nnfw_e, hw_e, customRequirementPtr, &available);
if (ML_ERROR_NONE != ret) {
- LoggerE("ml_check_nnfw_availability failed: %d (%s)", ret, get_error_message(ret));
+ LoggerE("ml_check_nnfw_availability_full failed: %d (%s)", ret, get_error_message(ret));
return false;
}
- LoggerD("ml_check_nnfw_availability: %s", available ? "true" : "false");
+ LoggerD("ml_check_nnfw_availability_full: %s", available ? "true" : "false");
return available;
}
#include <nnstreamer/nnstreamer.h>
+#if __cplusplus > 201402L
+#include <optional>
+using std::optional;
+#else
+#include "common/optional.h"
+using common::optional;
+#endif
+
#include "common/picojson.h"
#include "common/platform_enum.h"
#include "common/platform_result.h"
PlatformResult ToPlatformResult(int ml_error_code, const std::string& error_message);
-bool CheckNNFWAvailability(const std::string& nnfw, const std::string& hw);
+bool CheckNNFWAvailability(const std::string& nnfw, const std::string& hw,
+ const optional<std::string> customRequirement);
PlatformResult GetDimensionsFromJsonArray(const picojson::array& dim,
unsigned int dimensions[ML_TENSOR_RANK_LIMIT]);