Echelon ISI User Manual

Page 91

Advertising
background image

89

ISI Programmer’s Guide


msg_out.code = NM_opcode_base | (NM_query_nv_cnfg &
NM_opcode_mask);
msg_out.service = REQUEST;
msg_out.tag = nvTag;
msg_send();
}


// Handle receipt of the network variable configuration response, and
// build a network variable update message that copies the value of the
// local network variable to the remote network variable. This example
// does not ensure that the remote network variable is an input, or
// that the both network variables share the same type.
when (resp_arrives(nvTag)) {
NM_query_nv_cnfg_response queryNvResponse;
unsigned localNvLength;
const unsigned* pLocalNvValue;

if (resp_in.code == (NM_resp_success | NM_query_nv_cnfg)) {
memcpy(&queryNvResponse, resp_in.data,

sizeof(NM_query_nv_cnfg_response));
// queryNvResponse now holds the remote network variable's selector,
// which will be used to build the acknowledged network variable update

memset(&(msg_out.dest_addr.snode), 0, sizeof(struct
snode_struct));

// Use Subnet/Node ID addressing
msg_out.dest_addr.snode.type = SUBNET_NODE;
msg_out.dest_addr.snode.subnet = nvUpdateJob.subnetId;
msg_out.dest_addr.snode.node = nvUpdateJob.nodeId;

// Construct the network variable update message

msg_out.code = NV_UPDATE_MESSAGE |
queryNvResponse.nv_selector_hi;
msg_out.data[0] = queryNvResponse.nv_selector_lo;

// Copy the value of the local variable
pLocalNvValue = IsiGetNvValue(nvUpdateJob.localNvIndex,
&localNvLength);
memcpy(&msg_out.data[1], pLocalNvValue, localNvLength);

msg_out.dest_addr.snode.retry = RETRY_COUNT;
msg_out.dest_addr.snode.tx_timer = ENCODED_TX_TIMER;
msg_out.service = ACKD;

msg_send();
}
}

Monitoring Data from a Controller
and Designing Devices for Monitoring

There are three common methods for a controller to monitor network variables in
an ISI network:

polling

,

controlled enrollment

, and

automatic enrollment

. The

advantage of polling is that it does not require any additional code in the
monitored devices, but the disadvantage is that the controller may require a long

time to poll all network variables in a network—this may cause the controller to

appear to have a poor response time after a network variable value on a

Advertising