diff --git a/src/openzwave.cc b/src/openzwave.cc index 0939480..234ec92 100644 --- a/src/openzwave.cc +++ b/src/openzwave.cc @@ -37,6 +37,7 @@ struct OZW: ObjectWrap { static Handle New(const Arguments& args); static Handle Connect(const Arguments& args); static Handle Disconnect(const Arguments& args); + static Handle SetConfigParam(const Arguments& args); static Handle SetValue(const Arguments& args); static Handle SetLevel(const Arguments& args); static Handle SetLocation(const Arguments& args); @@ -479,6 +480,28 @@ Handle OZW::Disconnect(const Arguments& args) return scope.Close(Undefined()); } +/* + * Set Config Parameters + */ +Handle OZW::SetConfigParam(const Arguments& args) +{ + HandleScope scope; + + uint32_t homeid = args[0]->ToNumber()->Value(); + uint8_t nodeid = args[1]->ToNumber()->Value(); + uint8_t param = args[2]->ToNumber()->Value(); + int32_t value = args[3]->ToNumber()->Value(); + + if (args.Length() < 5) { + OpenZWave::Manager::Get()->SetConfigParam(homeid, nodeid, param, value); + } else { + uint8_t size = args[4]->ToNumber()->Value(); + OpenZWave::Manager::Get()->SetConfigParam(homeid, nodeid, param, value, size); + } + + return scope.Close(Undefined()); +} + /* * Generic value set. */ @@ -709,6 +732,7 @@ extern "C" void init(Handle target) NODE_SET_PROTOTYPE_METHOD(t, "connect", OZW::Connect); NODE_SET_PROTOTYPE_METHOD(t, "disconnect", OZW::Disconnect); + NODE_SET_PROTOTYPE_METHOD(t, "setConfigParam", OZW::SetConfigParam); NODE_SET_PROTOTYPE_METHOD(t, "setValue", OZW::SetValue); NODE_SET_PROTOTYPE_METHOD(t, "setLevel", OZW::SetLevel); NODE_SET_PROTOTYPE_METHOD(t, "setLocation", OZW::SetLocation);