Processing changes to a scptnvtype cp – Echelon Neuron C User Manual

Page 83

Advertising
background image

Neuron C Programmer’s Guide

71

property automatically assumes the size and type of the network variable it

applies to, and is governed by the same initial type and maximum size.

Processing Changes to a SCPTnvType CP

When a plug-in or the LonMaker browser changes the type of a network variable,

it informs your application of the change by writing a new value to the

SCPTnvType configuration property associated with the network variable. The
definition of the SCPTnvType type is provided below:

typedef struct {

unsigned short type_program_ID[8];

unsigned short type_scope;

unsigned long type_index;

nv_type_category_t

type_category;

unsigned short type_length;

signed long

scaling_factor_a;

signed long

scaling_factor_b;

signed long

scaling_factor_c;

} SCPTnvType;

By default, a SCPTnvType configuration property is initialized to the following

values:

• Program ID = {0, 0, 0, 0, 0, 0, 0, 0}
• Scope = 0
• Index = 1
• Category = NVT_CAT_INITIAL (see

Validating a Type Change

on page

72)

• Type length = 1 byte
• Scaling factor A = 0
• Scaling factor B = 0
• Scaling factor C = 0

Important: Because LNS sets network-variable values through the SCPTnvType
configuration property, your application must initialize the SCPTnvType

configuration property to a meaningful value for the application. This initialized
value also becomes the “last-known good value” for the application, in case a

type-change request must be rejected (see

Rejecting a Type Change

on page 75).

When your application detects a change to the SCPTnvType value, it must
determine if the change is valid, as described in

Validating a Type Change

on

page 72. If it is valid, the application must process the change, as described in

Processing a Type Change

on page 73. On the other hand, if the application

determines that the change is not valid or supported, it must report an error, as

described in

Rejecting a Type Change

on page 75. If the change is valid and

supported by your application, and the change also changes the size of the
network variable, your application must implement the size change, as described

in

Processing a Size Change

on page 74.

Advertising