Skip to content

Commit

Permalink
Merge pull request #58 from mdave/master
Browse files Browse the repository at this point in the history
Add support for raw value types
  • Loading branch information
ekarak committed Jan 24, 2016
2 parents 1dffedc + 9a555cf commit 3a21b2f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/openzwave-values.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ namespace OZW {
break;
}
case OpenZWave::ValueID::ValueType_Raw: {
checkType(Buffer::HasInstance(info[validx]));
uint8 *val = (uint8*)Buffer::Data(info[validx]);
uint8 len = Buffer::Length(info[validx]);
OpenZWave::Manager::Get()->SetValue(*vit, val, len);
break;
}
}
Expand Down
7 changes: 7 additions & 0 deletions src/utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,13 @@ namespace OZW {
break;
}
case OpenZWave::ValueID::ValueType_Raw: {
uint8 *val, len;
OpenZWave::Manager::Get()->GetValueAsRaw(value, &val, &len);
Nan::Set(valobj,
Nan::New<String>("value").ToLocalChecked(),
Nan::CopyBuffer((char *)val, len).ToLocalChecked()
);
delete [] val;
break;
}
default: {
Expand Down

0 comments on commit 3a21b2f

Please sign in to comment.