10-19-2010 12:04 AM
Hi!
Could anyone please tell me how to get a response code using FBUS? I tried to get items such as variables, records and arrays from DD files using DDS, looing into the flat_variable, flat_record structures, their response-code-attribute all equal to 0. Does it mean the original DDL files do not contain any response code items or I failed the correct dd information retrieving? Could anyone help to explain?
have already tried the foundation forum, no response yet. have to try my luck here!
10-20-2010 03:07 AM
Hi,
Do you use NI-FBUS Communications Manager C API to access the device parameters? If so, you can get response code using nifGetObjectAttributes() method.
First, you need to know the type of the objects. Here is the typical pseudo-code. The example use Flat Variable type.
You can find all definition of all the data structures mentioned above in <NI-FBUS Installation Directory>\MS Visual C\includes\
nifAttributes_t attrib; // nifAttributes_t is mapped to DDS structure, DDI_GENERIC_ITEM
...
err = nifGetObjectAttributes(blkDesc, "[parameter_name]", &attrib); // The raw data of attribute is stored in attrib.
// Map raw attribute data to corresponsing object type
FLAT_VAR *flatVar; // FLAT_VAR and other object types are defined in flats.h
ITEM_ID resp_code;
flatVar = (FLAT_VAR *)attrib.item;
resp_code = flatVar->resp_codes; // FLAT_VAR has a member called resp_codes, which stores the response code
10-21-2010 09:38 PM
thanks Vince That's very helpful.