OpenZWave / node-openzwave-shared

OpenZWave addon for Node.js (all versions) including management and security functions
Other
199 stars 113 forks source link

[BUG] ValueID type list Breaking Change since version 1.5.0 #316

Closed robertsLando closed 5 years ago

robertsLando commented 5 years ago

I have notices that there is a big breaking change with values type list, seems that now valueID value is not the string metching the list value but is the index of the values array and also values array labels are prefixed with "<index>|". This is such a breaking change for me, did you do it on purpose or is it a bug?

Here: https://github.com/OpenZWave/node-openzwave-shared/blob/master/src/utils.cc#L125

Before 1.5.x:

case OpenZWave::ValueID::ValueType_List: {
                ::std::string val;
                ::std::vector < ::std::string > items;
                // populate array of all available items in the list
                OZWManager( GetValueListItems, value, &items);
                AddArrayOfStringProp(valobj, values, items);
                // populated selected element
                OZWManager( GetValueListSelection, value, &val);
                AddStringProp(valobj, value, val.c_str())
                break;
}

After 1.5.x

case OpenZWave::ValueID::ValueType_List: {
                std::string val;
                int32 val;
                std::vector < std::string > items;
                std::vector < int32> itemsvalues;

                // populate array of all available items in the list
                OpenZWave::Manager::Get()->GetValueListItems(value, &items);
                OpenZWave::Manager::Get()->GetValueListValues(value, &itemsvalues);

                for (int i = 0; i != items.size(); i++){
                    items[i]=std::to_string(itemsvalues[i])+"|"+items[i];
                }

                AddArrayOfStringProp(valobj, values, items);
                // populated selected element
                OpenZWave::Manager::Get()->GetValueListSelection(value, &val);
                AddStringProp(valobj, value, val.c_str())
                AddIntegerProp(valobj, value, val);
                break;
            }

Can you revert this change?