OpenZWave / node-openzwave-shared

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

Missing Function SetValueLabel - Implementation proposal #209

Closed vibr77-zz closed 6 years ago

vibr77-zz commented 6 years ago

Hello the SetValueLabel is missing on the lib and it is a useful one

I have written the following function File open-zwave-values.cc

// =================================================================
    NAN_METHOD(OZW::SetValueLabel)
    // =================================================================
    {

        OpenZWave::Manager* mgr = OpenZWave::Manager::Get();

        Nan::HandleScope scope;
        CheckMinArgs(1, "valueid, label");
        uint8 nodeid = info[0]->ToNumber()->Value();
        OpenZWave::ValueID* vit = populateValueId(info);
        uint8 validx  =  (info[0]->IsObject()) ? 1 : 4;
        std::string location = (*String::Utf8Value(info[validx]->ToString()));

        if (vit) {
            OpenZWave::Manager::Get()->SetValueLabel(*vit, location);
            //cout << location << endl
        }
    }

in openzwave.hpp: static NAN_METHOD(SetValueLabel);

in openzwave.cc: Nan::SetPrototypeMethod(t, "setValueLabel", OZW::SetValueLabel);

Could you please integrate this code in the master branch ?

Thanks Vincent

ekarak commented 6 years ago

good point, I'll add that shortly.

ekarak commented 6 years ago

thanks, resolving