6 SMIRTL Description

SMIRTL implements the routines used by a proxy in order to connect, receive commands and transmit state changes to its associated object in a SM. These routines are:

Parameters:

char *obj_name The name of the associated object to connect to. In the form <domain_name>::<object_name>

void (*command_handler)() The routine to be called when a command arrives from the SM, handle_command is called with no parameters.

Description:

smi_attach should be called by a proxy at startup in order to connect to its associated object in the SM.

Parameters:

char *par The parameter name.

void *value The value of the parameter (passed by reference).

int type The parameter type: (STRING, INTEGER or FLOAT).

Description:

Smi_set_par should be used in order to set object parameters for associated objects. If an associated objects has parameters, smi_set_par should be called once for each parameter before the first smi_set_state. Further parameter setting can be done by the proxy at any time but they will only take effect at the next smi_set_state.

Parameters:

char *state The state of the proxy.

Description:

Set the initial or new state of the proxy by sending it to its associated object in the SM. An smi_set_state should be done at start-up in order to communicate the proxy's initial state.

Parameters:

char *state The state of the proxy.

Description:

Set the new state of the proxy after executing an action, by sending it to its associated object in the SM.

Parameters:

char *cmnd The command just received

Description:

When inside the comman_handler the user can use this routine to get the command, the command is composed of the action name and any parameters in the form action/par0=val0/par1=val1… .

Parameters:

char *action The last action received

int n_params Number of parameters with this action

Description:

When inside the comman_handler the user can use this routine to get the action name and nr. of parameters.

Parameters:

char *action Action name to compare with the received action.

Description:

Test if the action received is "action". The function returns 1 if it is, 0 if not.

Parameters:

char *param The name of the parameter

int *type The type of the parameter (STRING, INTEGER, FLOAT)

int *size The size of the parameter

Description:

When inside the command handler this routine can be used to retrieve the parameters present on a received command. The function will return 0 when all parameters have been read, otherwise it returns the parameter name, the parameter type and the size necessary to store the parameter.

Parameters:

char *param The name of the parameter

void *value The parameter value

Description:

When inside the command handler this routine can be used to retrieve the parameter value for the parameter returned by smi_get_next_par. The value argument will be filled with either an integer, a double float or a string (the size was specified in the previous routine) depending on the parameter type. This function can also be used directly if the user knows the parameter name, type and size. The function will return 0 if the specified parameter does not exist.

Parameters:

none

Description:

Smi_volatile() makes a proxy live only while its associated SMI Domain is active, i.e., a proxy can call smi_volatile() (normally at start-up) in order to die whenever the SMI domain the proxy is attached to dies.