Skip to content
Open
Show file tree
Hide file tree
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
12 changes: 9 additions & 3 deletions src/main/cpp/org_zwave4j_Manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,12 +348,18 @@ jobject getValueId(JNIEnv * env, OpenZWave::ValueID const * ozwValueId)
jobject getNotification(JNIEnv * env, OpenZWave::Notification const * ozwNotification)
{
jclass clazz = findClass(env, "org/zwave4j/Notification");
OpenZWave::Notification::NotificationType type = ozwNotification->GetType();
uint8 event = 0;
if (type == OpenZWave::Notification::Type_NodeEvent || type == OpenZWave::Notification::Type_ControllerCommand) {
event = ozwNotification->GetEvent();
}
return env->NewObject(
clazz,
env->GetMethodID(clazz, "<init>", "(Lorg/zwave4j/NotificationType;Lorg/zwave4j/ValueId;S)V"),
getNotificationType(env, ozwNotification->GetType()),
env->GetMethodID(clazz, "<init>", "(Lorg/zwave4j/NotificationType;Lorg/zwave4j/ValueId;SS)V"),
getNotificationType(env, type),
getValueId(env, &ozwNotification->GetValueID()),
getJshort(ozwNotification->GetByte())
getJshort(ozwNotification->GetByte()),
getJshort(event)
);
}

Expand Down
6 changes: 4 additions & 2 deletions src/main/java/org/zwave4j/Notification.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ public class Notification {
private NotificationType type;
private ValueId valueId;
private short aByte;
private short event;

public Notification(NotificationType type, ValueId valueId, short aByte) {
public Notification(NotificationType type, ValueId valueId, short aByte, short event) {
this.type = type;
this.valueId = valueId;
this.aByte = aByte;
this.event = event;
}

public NotificationType getType() {
Expand All @@ -38,7 +40,7 @@ public short getGroupIdx() {

public short getEvent() {
assert NotificationType.NODE_EVENT.equals(type);
return aByte;
return event;
}

public short getButtonId() {
Expand Down