ncGetDriverAttr (Get Driver Attribute)

NI-DNET Programmer

ncGetDriverAttr (Get Driver Attribute)

Purpose

Get the value of an attribute in the NI-DNET driver.

Format

LabVIEW

C

NCTYPE_STATUS
ncGetDriverAttr	(NCTYPE_OBJH	ObjHandle,
		NCTYPE_ATTRID	AttrId,
		NCTYPE_UINT32	SizeofAttr,
		NCTYPE_ANY_P	Attr)

Input

ObjHandle Object handle of an open Explicit Messaging Object, I/O Object, or Interface Object
AttrId Identifier of the attribute to get
SizeofAttr Size of the Attr buffer in bytes (C only)

Output

Attr Returned attribute value

Function Description

ncGetDriverAttr gets the value of an attribute in the NI-DNET driver software. Within NI-DNET objects, attributes represent configuration settings, status, and other information.

Since you only need to access NI-DNET driver attributes under special circumstances, ncGetDriverAttr is seldom used. For information about the attributes of each NI-DNET object, refer to NI-DNET Objects.

ncGetDriverAttr only applies to the NI-DNET software on your computer and cannot be used to get an attribute from a remote DeviceNet device. To get an attribute from a remote DeviceNet device, use the ncGetDnetAttribute function.

Parameter Descriptions

ObjHandle

Description ObjHandle must contain an object handle returned from ncOpenDnetExplMsg, ncOpenDnetIntf, or ncOpenDnetIO.

In LabVIEW, ObjHandle passes through the VI as an output so that it can be used for subsequent function calls for the object.
Values The encoding of ObjHandle is internal to NI-DNET.

AttrId

Description Identifier of the NI-DNET attribute. Supported attribute identifiers for each NI-DNET object are listed in NI-DNET Objects.
Values 80000000 to 8000FFFF hex (high bit differentiates from DeviceNet IDs)

SizeofAttr

Description For C, this is the size of the buffer referenced by Attr. It is used to verify that you have enough bytes available to store the attribute's value. This size is normally obtained using the C language sizeof function.

For LabVIEW, since the buffer for Attr is allocated automatically by NI-DNET, this size is not needed.
Values sizeof (buffer referenced by Attr)

Attr

Description Returned attribute value. The value is usually returned in an unsigned 32-bit integer (and thus Attr is of type NCTYPE_UINT32_P).
Values Value of NI-DNET attribute

Examples

LabVIEW

Get the DeviceNet protocol version supported by NI-DNET.

C

Get the version of the NI-DNET software using the Interface Object referenced by objh.

NCTYPE_STATUS	status;
NCTYPE_OBJH	objh;
NCTYPE_VERSION	swver;
status = ncGetDriverAttr(objh, NC_ATTR_SOFTWARE_VERSION, 
			sizeof(swver), &swver);