CDI_Register_Object_Attribute

Registers device attributes with NWPA, which then makes these attributes visible to the application layer.

Thread Context:Non-Blocking

Syntax

    LONG CDI_Register_Object_Attribute (
       LONG                        npaHandle,
       LONG                        cdmBindHandle,
       struct AttributeInfoStruct *info,
       LONG                      (*getRoutine)(),
       LONG                      (*setRoutine)()
       );
    
    

Parameters

npaHandle
(IN) The CDM's handle for using the NPA APIs. Its value was assigned during NPA_Register_CDM_Module.
cdmBindHandle
(IN) Handle generated by the CDM to uniquely identify the device. This is the handle the CDM passed to CDI_Bind_CDM_To_Object when it bound to the device.
info
(IN) Points to an AttributeInfoStruct structure. This structure contains specific information about an attribute.
getRoutine
(IN) Points to a local CDM entry point, CDM_Get_Attribute, which is responsible for returning attribute information.

For a given attribute, the CDM indicates the expected data type of the infoBuffer input parameter by the value it places in the attributeType field of the attribute's AttributeInfoStruct at registration. A pointer to this structure is passed to the attribute registration function, CDM_Get_Attribute places the return attribute information in the location pointed to by the infoBuffer input parameter and the byte-length of the return information in the location pointed to by the infoBufferLength input parameter.

setRoutine
(IN) If the attribute is not settable, this field is set to zero. If the attribute is settable, this field contains a pointer to a local CDM entry point, CDM_Set_Attribute, which is responsible for setting attribute information.

CDM_Set_Attribute sets the attribute to the information contained in the infoBuffer input parameter. The length of this buffer is specified in the infoBufferLength input parameter. If the attribute change affects any of the information that the CDM originally reported to NWPA during its bind to the device, it must update these changes to NWPA by filling out the appropriate fields of an UpdateInfoStruct and calling CDI_Object_Update. The context of the set function is blocking; therefore, the CDM can issue any necessary commands to set the mode of the device.

Return Values

The following table lists return values and descriptions.

zero

Successful

nonzero

Unsuccessful

Remarks

CDI_Register_Object_Attribute allows a CDM to present attribute information about a device it manages to the application layer. To present the information, a CDM must register a get-function, such as CDM_Get_Attribute, that returns attribute information into a buffer provided by the calling process. If a device attribute can be changed by an application, then the CDM must register a set-function, such as CDM_Set_Attribute.