cwIoFlowCtl.h/cpp : Added program_apply_preset(), send_ui_updates().

This commit is contained in:
kevin 2024-12-20 13:23:22 -05:00
parent 1b0cec7535
commit fefbe68309
2 changed files with 45 additions and 0 deletions

View File

@ -21,6 +21,7 @@
#include "cwDspTypes.h"
#include "cwFlowDecl.h"
#include "cwFlow.h"
#include "cwFlowValue.h"
#include "cwFlowTypes.h"
#include "cwIo.h"
@ -804,6 +805,35 @@ bool cw::io_flow_ctl::program_is_initialized( handle_t h )
return p->init_fl;
}
cw::rc_t cw::io_flow_ctl::program_apply_preset( handle_t h, unsigned preset_idx )
{
rc_t rc = kOkRC;
const char* preset_label = nullptr;
io_flow_ctl_t* p = _handleToPtr(h);
if( !p->init_fl )
{
rc = cwLogError(kInvalidStateRC,"The preset cannot be applied because the program is not initialized.");
goto errLabel;
}
if((preset_label = flow::preset_label(p->flowH,preset_idx)) == nullptr )
{
rc = cwLogError(kInvalidArgRC,"The preset index '%i' is invalid.",preset_idx);
goto errLabel;
}
if((rc = apply_preset(p->flowH,preset_label)) != kOkRC )
{
rc = cwLogError(rc,"Application of the preset '%s' failed.",preset_label);
goto errLabel;
}
errLabel:
return rc;
}
const cw::flow::ui_net_t* cw::io_flow_ctl::program_ui_net( handle_t h )
{
io_flow_ctl_t* p = _handleToPtr(h);
@ -881,6 +911,17 @@ bool cw::io_flow_ctl::is_exec_complete( handle_t h )
return p->done_fl;
}
cw::rc_t cw::io_flow_ctl::send_ui_updates( handle_t h )
{
rc_t rc = kOkRC;
io_flow_ctl_t* p = _handleToPtr(h);
if( program_is_initialized(h) )
rc = send_ui_updates(p->flowH);
return rc;
}
cw::rc_t cw::io_flow_ctl::get_variable_value( handle_t h, const flow::ui_var_t* ui_var, bool& value_ref )
{ return get_variable_value( _handleToPtr(h)->flowH, ui_var, value_ref ); }

View File

@ -36,6 +36,8 @@ namespace cw
rc_t program_initialize( handle_t h, unsigned preset_idx=kInvalidIdx );
bool program_is_initialized( handle_t h );
rc_t program_apply_preset( handle_t h, unsigned preset_idx );
// Get the UI description data structures for the current program.
const flow::ui_net_t* program_ui_net( handle_t h );
@ -52,6 +54,8 @@ namespace cw
// The current program has completed.
bool is_exec_complete( handle_t h );
rc_t send_ui_updates( handle_t h );
rc_t get_variable_value( handle_t h, const flow::ui_var_t* ui_var, bool& value_ref );
rc_t get_variable_value( handle_t h, const flow::ui_var_t* ui_var, int& value_ref );
rc_t get_variable_value( handle_t h, const flow::ui_var_t* ui_var, unsigned& value_ref );