Skip to content

Commit

Permalink
Merge branches 'dev' and 'dev' of https://github.com/milk-org/milk in…
Browse files Browse the repository at this point in the history
…to dev
  • Loading branch information
oguyon committed Sep 22, 2023
2 parents e125edc + 68e28b2 commit 57ef928
Showing 1 changed file with 48 additions and 1 deletion.
49 changes: 48 additions & 1 deletion python_module/CacaoProcessTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@ int fps_value_to_key(pyFps &cls,
const FPS_type fps_type,
py::object value)
{
switch(fps_type)
FPS_type switch_fps_type = fps_type == FPS_type::AUTO ? cls.keys(key) : fps_type;

switch(switch_fps_type)
{
case FPS_type::ONOFF:
return functionparameter_SetParamValue_ONOFF(cls,
key.c_str(), py::bool_(value));
case FPS_type::INT32:
case FPS_type::UINT32:
case FPS_type::INT64:
Expand All @@ -36,6 +41,11 @@ int fps_value_to_key(pyFps &cls,
key.c_str(),
py::float_(value));
case FPS_type::STRING:
case FPS_type::STREAMNAME:
case FPS_type::DIRNAME:
case FPS_type::EXECFILENAME:
case FPS_type::FILENAME:
case FPS_type::FITSFILENAME:
return functionparameter_SetParamValue_STRING(
cls,
key.c_str(),
Expand All @@ -50,6 +60,8 @@ fps_value_from_key(pyFps &cls, const std::string &key, const FPS_type fps_type)
{
switch(fps_type)
{
case FPS_type::ONOFF:
return py::bool_(functionparameter_GetParamValue_ONOFF(cls, key.c_str()));
case FPS_type::INT32:
case FPS_type::UINT32:
case FPS_type::INT64:
Expand All @@ -63,6 +75,11 @@ fps_value_from_key(pyFps &cls, const std::string &key, const FPS_type fps_type)
return py::float_(
functionparameter_GetParamValue_FLOAT64(cls, key.c_str()));
case FPS_type::STRING:
case FPS_type::STREAMNAME:
case FPS_type::DIRNAME:
case FPS_type::EXECFILENAME:
case FPS_type::FILENAME:
case FPS_type::FITSFILENAME:
return py::str(functionparameter_GetParamPtr_STRING(cls, key.c_str()));
default:
return py::none();
Expand Down Expand Up @@ -404,6 +421,20 @@ If entry already exists, do not modify it

.def("get_levelKeys", &pyFps::get_levelKeys)

.def(
"get_param_value_onoff",
[](pyFps &cls, std::string key) {
return functionparameter_GetParamValue_ONOFF(cls, key.c_str());
},
R"pbdoc(Get the boolean value of the FPS key
Parameters:
key [in]: Parameter name
Return:
ret [out]: parameter value
)pbdoc",
py::arg("key"))

.def(
"get_param_value_int",
[](pyFps &cls, std::string key) {
Expand Down Expand Up @@ -460,7 +491,23 @@ If entry already exists, do not modify it
ret [out]: parameter value
)pbdoc",
py::arg("key"))
.def(
"set_param_value_onoff",
[](pyFps &cls, std::string key, std::string value) {
return functionparameter_SetParamValue_ONOFF(cls,
key.c_str(),
std::stol(value));
},
R"pbdoc(Set the boolean value of the FPS key
Parameters:
key [in]: Parameter name
value [in]: Parameter value
Return:
ret [out]: error code
)pbdoc",
py::arg("key"),
py::arg("value"))
.def(
"set_param_value_int",
[](pyFps &cls, std::string key, std::string value) {
Expand Down

0 comments on commit 57ef928

Please sign in to comment.