beautypg.com

Echelon ISI User Manual

Page 80

background image

ISI Programmer’s Guide

78

request, and then repeats the process on the remaining devices. To accelerate

device discovery, follow these steps:

1. Broadcast a Respond to Query message with a parameter of MODE_ON

to the primary domain. This enables all devices to respond to the Query

ID message.

2. Broadcast a Query ID message to the primary domain.

3. If there are no responses, exit the procedure.

4. For each response, save the Neuron ID in the device table and then send

a Respond to Query message with a parameter of 0 addressed to the

Neuron ID. This disables the device from responding to subsequent

Query ID messages.

5. Repeat steps 2 – 4.

E

XAMPLE

The following example uses 709.1 Query ID messages to discover all devices

in the primary domain.


#include
#include

msg_tag bind_info(nonbind) discoveryTag;

#define RETRY_COUNT 3

#define ENCODED_RPT_TIMER 8 // 256ms
#define ENCODED_TX_TIMER 8 // 256ms
#define PRIMARY_DOMAIN 0

// The function broadcases a respond_to_query(MODE_ON) command,
// requesting that every receiving device shall respond to query
// ID requests.
void RespondOn(void) {
msg_out.code = NM_opcode_base | NM_respond_to_query;
msg_out.service = UNACKD_RPT;
msg_out.dest_addr.bcast.type = BROADCAST;
msg_out.dest_addr.bcast.domain = PRIMARY_DOMAIN;
msg_out.dest_addr.bcast.rpt_timer = ENCODED_RPT_TIMER;

msg_out.dest_addr.bcast.retry = RETRY_COUNT;
msg_out.dest_addr.bcast.tx_timer = ENCODED_TX_TIMER;
msg_out.dest_addr.bcast.subnet = 0;
msg_out.tag = discoveryTag;
msg_out.data[0] = MODE_ON;
msg_send();
}

// Issue a single Query ID request. This function
// gets called repeatedly as long as positive
// responses to this request are received.
void QueryNetwork(void) {
NM_query_id_request queryIdRequest;


msg_out.code = NM_opcode_base | NM_query_id;
msg_out.service = REQUEST;
msg_out.dest_addr.bcast.type = BROADCAST;
msg_out.dest_addr.bcast.domain = PRIMARY_DOMAIN;