Guardian Programmer's Guide

Table Of Contents
Communicating With Devices
Guardian Programmer’s Guide 421922-014
9 - 10
Additional Device Information (G-series Only)
To support the interface for CONFIG_GETINFO_BYNAME2_ procedure or
CONFIG_GETINFO_BYLDEV2_ procedure, a device must be coded to handle a new
system message from $RECEIVE (-147: ZSYS_VAL_SMSG_CONFIGINFO). The
format of this system message is defined in zsysc by the
zsys_ddl_smsg_configinfo2_def type. The reply from a device that supports these
procedures is expected to have a zsys_ddl_smsg_confinf_reply_def format.
The following code fragment demonstrates how a subsystem might be enhanced to
support the CONFIG_GETINFO calls in its $RECEIVE message-handling code.
Effectively, the code simply receives a message from $RECEIVE, and branches to the
code to handle specific types of system messages. To handle the
ZSYS_VAL_SMSG_CONFIGINFO request, the fields of a
zsys_ddl_smsg_confinf_reply_def are filled with appropriate values for the device, and
REPLYX is called to reply to the request. For more information on processing system
messages, see Processing System Messages and Section 9, Communicating With
Devices.
{
short replyerr;
zsys_ddl_smsg_configinfo2_def *ci2req;
zsys_ddl_smsg_confinf_reply_def cireply;
_cc_status cc;
/* ... code to receive system messages */
cc = READUPDATEX( recv_fnum, (char *)message, (short)sizeof(message),&len);
/* ... */
switch(message[0]) {
case ZSYS_VAL . . . :
/* ... other system message types */
case ZSYS_VAL . . . :
/* ... other system message types */
case ZSYS_VAL_SMSG_CONFIGINFO: /* CONFIG_GETINFO_ request */
ci2req = (zsys_ddl_smsg_configinfo2_def *)message;
if(ci2req->z_msgversion != ZSYS_VAL_SMSG_CONFIGINFO_VERS2){
cc = REPLYX(,,,,FEBADOP);
/* . . . */
}
else {
cireply.z_msgnumber = ci2req->z_msgnumber;
cireply.z_msgversion = ci2req->z_msgversion;
cireply.z_device_type = /* --<-- */ ;
cireply.z_device_subtype = /* --<-- */ ;
cireply.z_device_record_size = /* --<-- */ ;
cireply.z_logical_status = 0 /* --<-- */ ;
strcpy(cireply.z_config_name, "CONFIG_EXAMPLE_PROC");
cireply.z_config_name_len = strlen(cireply.z_config_name);
strcpy(cireply.z_subsys_manager = "$MANAGR";
cireply.z_subsys_manager_len = strlen(cireply.z_subsys_manager);
PROCESSHANDLE_GETMINE_((short *)&cireply.z_primary_phandle);
PROCESSHANDLE_NULLIT_((short *)&cireply.z_backup_phandle);
cireply.z_specific_info_len = 0;
cc = REPLYX( (char *)&cireply /* buffer */
, sizeof(cireply) /* write_count */
, /* count_written */
, /* message tag */
, FEOK