Contact an Expert

Thread: UtaHwModDeclareParm and UtaHwModDeclarePrivateParm


Permlink Replies: 4 - Pages: 1 - Last Post: Mar 27, 2012 1:59 PM Last Post By: salochoa Threads: [ Previous | Next ]
quimio

Posts: 4
Registered: 01/06/10
UtaHwModDeclareParm and UtaHwModDeclarePrivateParm
Posted: Feb 1, 2012 10:09 AM
Click to report abuse...   Click to reply to this thread Reply
Hello,
I am (re)writing a handler in MS Visual C++ 6.0 for some specific cards. I used to have all the parameters available for all cards, even though it didn't apply for an specific card. I used the msginst.dll approach of using a Dialog Box to select the type of card prior the definition of Parameters, and now I have only the ones I need.
In order for the init and the rest of the function to work, I need to know which type of card it is and act accordingly. I found the UtaHwModDeclarePrivateParm so I can fill this up whenever the user selects the type of card when registering. Documentation shows that this function works just as UtaHwModDeclareParm but its hidden to the user in the topology editor.
If I declare any parm with the Private one, the Parm will not be found through UtaPbGetString.
I wonder if there are special functions that have to be called to read Parms that are declared Private, or there is something I am doing wrong, or that is not the use for the UtaHwModDeclarePrivateParm function, or its just broken in the UTA version I have?


uta.h ver 1.92
UtaCore.h ver 1.116


PS I compared the uta.h version from txsl 4, 5 6 and 7, they all have the same version number although the length is different, also the .lib for utacore has different sizes among the 4 versions.
Cynthia

Posts: 51
Registered: 08/27/07
Re: UtaHwModDeclareParm and UtaHwModDeclarePrivateParm
Posted: Feb 29, 2012 7:27 PM   in response to: quimio in response to: quimio
Click to report abuse...   Click to reply to this thread Reply
Hi Quimio,

I cannot quite get you when you mention that UtaHwModDeclareParm is hidden to the user at topology. Perhaps you could give us some snapshot or show us some portion of ur codes that you were working on with this function " UtaHwModDeclareParm".
quimio

Posts: 4
Registered: 01/06/10
Re: UtaHwModDeclareParm and UtaHwModDeclarePrivateParm
Posted: Feb 29, 2012 9:46 PM   in response to: quimio in response to: quimio
Click to report abuse...   Click to reply to this thread Reply
Hello Cynthia,
Please see the definition of both functions in uta.h below
/* Used when writing the DeclareParms instrument/switch handler routine.
This API defines a parameter by providing its name, the data type and,
optionally, its description. The hModule and hPbDef is passed into
the DeclareParms and is to be passed on unchanged Parameters
and their meanings are defined by the instrument/switch handler writer.
The topology editor will prompt the user to provide the parameters values
when adding a module to the topology.

Valid Data Types
----------------

CUtaReal64 64 bit real
CUtaInt32 32 bit integer
CUtaString String
CUtaComplex Complex (imag, real)
CUtaInst Instrument data structure
CUtaRange Range (start, stop, steps)
CUtaPoint Point (x, y)
CUtaReal64Array 64 bit real array
CUtaInt32Array 32 bit integer array
CUtaStringArray String Array
CUtaPointArray Point Array
CUtaRangeArray Range Array
CUtaWaveform Waveform (start, stop)

/
HUTADATA UTAAPI UtaHwModDeclareParm (HUTAHWMOD hModule,
HUTAPBDEF hPbDef,
LPCSTR lpszParmName,
LPCSTR lpszType,
LPCSTR lpszDescription UTACPP_DEFAULT(NULL));


/
Same as above but parms are not presented to user in Topology Editor */
HUTADATA UTAAPI UtaHwModDeclarePrivateParm (HUTAHWMOD hModule,
HUTAPBDEF hPbDef,
LPCSTR lpszParmName,
LPCSTR lpszType,
LPCSTR lpszDescription UTACPP_DEFAULT(NULL));


What I want to do is have a Hardware handler for different cards that are similar, although I need them to have a parameter that is not shown to the user in the topology editor. I just want to have it automatically filled when the instrument is created in the topology editor, and use it when the instrument is initialized and closed.
Cynthia

Posts: 51
Registered: 08/27/07
Re: UtaHwModDeclareParm and UtaHwModDeclarePrivateParm
Posted: Feb 29, 2012 10:58 PM   in response to: quimio in response to: quimio
Click to report abuse...   Click to reply to this thread Reply
Hi Quimio,

I would suggest you to use "UtaHwModDeclareParm" instead of using "UtaHwModDeclarePrivateParm". It should works for your request. Let us know if you have any difficulties using "UtaHwModDeclareParm".

We are still checking on the function "UtaHwModDeclarePrivateParm".
salochoa

Posts: 1
Registered: 03/27/12
Re: UtaHwModDeclareParm and UtaHwModDeclarePrivateParm
Posted: Mar 27, 2012 1:59 PM   in response to: quimio in response to: quimio
Click to report abuse...   Click to reply to this thread Reply
Hi quimio, Here's a code snippet that should help.
/*
void UTADLL DeclareParms(HUTAHWMOD hModule, HUTAPBDEF hPBDef)
{
HUTADATA hData;
hData = UtaHwModDeclareParm(hModule, hPBDef, "PublicParameter", "CUtaString", "Visible in topology editor.");
UtaStringSetValue((HUTASTRING)hData, "Public");

hData = UtaHwModDeclarePrivateParm(hModule, hPBDef, "PrivateParameter", "CUtaString","Not visible in topology editor");
UtaStringSetValue((HUTASTRING)hData, "Invisible");

return;
}

void UTADLL AccessPrivateParm(HUTAPB hPB)
{
UTAUINT32 viSession;

// Action passes in an instrument, so retrieve that first
HUTAINST hInst = UtaPbGetInst (hPB, "Instrument", &viSession );
// From instrument get access to the module handle
HUTAHWMOD hModule = UtaInstGetModule(hInst);

// The UtaHwModDeclarePrivateParm function adds parameters to a private ParameterBlock object, so retrieve that first.
HUTAPBDEF hPrivatePB = UtaHwModGetPrivateParmBlock(hModule);
// Find the parameter you are looking for in the private parameter block definition (HUTAPBDEF)
HUTAPARM hPrivateParm = UtaPbDefFindParm(hPrivatePB, "PrivateParameter");
// The HUTAPARM data type contains the real, underlying data, so extract it using UtaParmGetData.
HUTASTRING hPrivString = (HUTASTRING) UtaParmGetData(hPrivateParm);
// Now you can use the standard Uta functions
UtaPbSetString(hPB, "PrivateParameter", UtaStringGetValue(hPrivString));
}

Point your RSS reader here for a feed of the latest messages in all forums