Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/openzwave.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ struct OZW: ObjectWrap {
static Handle<Value> New(const Arguments& args);
static Handle<Value> Connect(const Arguments& args);
static Handle<Value> Disconnect(const Arguments& args);
static Handle<Value> SetConfigParam(const Arguments& args);
static Handle<Value> SetValue(const Arguments& args);
static Handle<Value> SetLevel(const Arguments& args);
static Handle<Value> SetLocation(const Arguments& args);
Expand Down Expand Up @@ -479,6 +480,28 @@ Handle<Value> OZW::Disconnect(const Arguments& args)
return scope.Close(Undefined());
}

/*
* Set Config Parameters
*/
Handle<Value> 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.
*/
Expand Down Expand Up @@ -709,6 +732,7 @@ extern "C" void init(Handle<Object> 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);
Expand Down