@@ -128,25 +128,14 @@ void setValObj(Local<Object> &valobj, OpenZWave::ValueID &value)
128128 }
129129 case OpenZWave::ValueID::ValueType_List:
130130 {
131- int32 val;
132- ::std::vector <::std::string > items;
133- ::std::vector <int32> itemsvalues;
134- v8::Local<v8::Object> values = Nan::New<v8::Object>();
135-
131+ ::std::string val;
132+ ::std::vector<::std::string> items;
136133 // populate array of all available items in the list
137- OZWManager ( GetValueListItems, value, &items);
138- OZWManager ( GetValueListValues, value, &itemsvalues);
139-
140- // popolate the object value: item
141- for (int i = 0 ; (unsigned )i < items.size (); i++) {
142- Nan::Set (values, Nan::New<v8::String>(::std::to_string (itemsvalues[i])).ToLocalChecked (), Nan::New<v8::String>(items[i].c_str ()).ToLocalChecked ());
143- }
144-
145- Nan::Set (valobj, Nan::New<v8::String>(" values" ).ToLocalChecked (), values);
134+ OZWManager (GetValueListItems, value, &items);
135+ AddArrayOfStringProp (valobj, values, items);
146136 // populated selected element
147- OZWManager ( GetValueListSelection, value, &val);
148- AddIntegerProp (valobj, value, val);
149- break ;
137+ OZWManager (GetValueListSelection, value, &val);
138+ AddStringProp (valobj, value, val.c_str ()) break ;
150139 }
151140 case OpenZWave::ValueID::ValueType_Short:
152141 {
0 commit comments