Asset Parameter Initialization
mstocum
Junior Member
What exactly is the correct way to set the correct initial values for a parameter? I'm currently using the ONLINE DATA_EVENT and DATA_INITIALIZED CHANNEL_EVENTS to query the module, and store them using KeySetValue() in the COMMAND DATA_EVENT.
Then in SynchronizeAssetParameters() I'm trying to synchronize the values like this:
The problem I'm seeing is that everything is being set with a zero value, and nothing gets initialized until I query the module after RMS has started up. What is the "correct" way to set initial values after a reboot?
Then in SynchronizeAssetParameters() I'm trying to synchronize the values like this:
RmsAssetParameterEnqueueSetValue(assetClientKey, 'filter.consumption', KeyGetValue('filter.consumption'));
The problem I'm seeing is that everything is being set with a zero value, and nothing gets initialized until I query the module after RMS has started up. What is the "correct" way to set initial values after a reboot?
Comments
-
I think I may have found the issue in RmsNlSnapiComponents.axi:
DEFINE_FUNCTION KeySetValue(CHAR cKey[30], CHAR cValue[30]) STACK_VAR INTEGER nIdx { nIdx = keyLookup (cKey) IF(nIdx = 0) RETURN; uKeys[nIdx].cValue = cValue }
uKeys[nIdx].cName is never set, so KeySetValue() doesn't actually accomplish anything. Changing the code to this:DEFINE_FUNCTION KeySetValue(CHAR cKey[30], CHAR cValue[30]) STACK_VAR INTEGER nIdx { nIdx = keyLookup (cKey) IF(nIdx = 0) RETURN; uKeys[nIdx].cName = cKey uKeys[nIdx].cValue = cValue }
gets things working better. Things still aren't setting properly, but at least it's sending the right commands. I think there may be an issue with queued parameter updates not being set.
ETA: I solved the last issue I had, see this thread http://www.amxforums.com/showthread.php?9575-RmsAssetParameterEnqueueSetValue()-doesn-t-work -
Judging from the comments in the code, it looks like the key is getting added inside the keyLookup() function. An index position is being allocated for the new key, but the key name is not getting assigned to the structure element in the array.
// Add it
IF(nKeyCount < MAX_KEYS)
{
nKeyCount++
uKeys[nKeyCount].cName = cKey <<< THIS LINE IS MISSING
RETURN(nKeyCount)
}
I will report this to the development team for further investigation and fix.
Thanks!
Categories
- All Categories
- 2.5K AMX General Discussion
- 922 AMX Technical Discussion
- 514 AMX Hardware
- 502 AMX Control Products
- 3 AMX Video Distribution Products
- 9 AMX Networked AV (SVSI) Products
- AMX Workspace & Collaboration Products
- 3.4K AMX Software
- 151 AMX Resource Management Suite Software
- 386 AMX Design Tools
- 2.4K NetLinx Studio
- 135 Duet/Cafe Duet
- 248 NetLinx Modules & Duet Modules
- 57 AMX RPM Forum
- 228 MODPEDIA - The Public Repository of Modules for Everyone
- 943 AMX Specialty Forums
- 2.6K AMXForums Archive
- 2.6K AMXForums Archive Threads
- 1.5K AMX Hardware
- 432 AMX Applications and Solutions
- 249 Residential Forum
- 182 Tips and Tricks
- 146 AMX Website/Forums