User manual

97
opt_name parameter the name of configuration option to check and in the opt_val_idx the
index of option value to check (from 0 to opt_vals_count - 1). The procedure is invoked as
follows assuming that described in the previous chapter options are added during the
loadable module initialization:
// Define option storage somewhere in loadable component implementation
int my_int_opt;
bool my_bool_opt[3];
char my_str_opt[256];
const chapi_in * ci = …;
if (ci->is_option_value_specified) {
// Check if all values are specified and setup default values if not
for(int idx = 0; idx < 3; idx++) {
if(!ci->is_option_value_specified(ci, “bool_opt”, idx)) {
my_bool_opt[idx] = false;
ci->set_option_value(ci, “bool_opt”, idx, &my_bool_opt[idx]);
ci->commit_option_value(ci, “bool_opt”, idx);
ci->option_value_change_ack(ci, “bool_opt”, idx);
}
}
}
The example above shows that the CHARON core is not obliged to support the indicated
operation. It indicates why the device instance must remember the chapi_in descriptor.
4.19.6 Checking if configuration option value is changed
Checking if configuration option value is changed belongs to the “A request to process
loadable component defined configuration options” class of operations. Such an operation
is initiated by the device instance. The CHARON core is defined as a target of the
operation. This operation is commonly used in routine identified by the set_configuration_ex
entry in chapi_out communication context in order to identify the change in configuration
parameter and update internal configuration option buffers.
To perform the operation, the initiator invokes a routine identified by the
is_option_value_changed field of the chapi_in descriptor. The initiator provides in the opt_name
parameter the name of configuration option to check and in the opt_val_idx parameter the
index of option value to check (from 0 to opt_vals_count - 1). The procedure is invoked as
follows assuming that described in the previous chapter options are added during the
loadable module initialization:
// Define option storage somewhere in loadable component implementation
int my_int_opt;
bool my_bool_opt[3];
char my_str_opt[256];
const chapi_in * ci = …;
if (ci->is_option_value_changed) {