Asset Parameter Initialization

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:
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

  • mstocummstocum Junior Member Posts: 119
    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!
Sign In or Register to comment.