Split event code value into major and minor components
This commit is contained in:
parent
65769a7442
commit
8f49752bab
3
events.h
3
events.h
|
@ -9,7 +9,8 @@ typedef uint32_t EventNamespace;
|
|||
|
||||
typedef struct {
|
||||
EventNamespace ns;
|
||||
uint32_t value;
|
||||
uint16_t major;
|
||||
uint16_t minor;
|
||||
} EventCode;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -46,7 +46,8 @@ handle_io(EventPositionBase * self, int fd, bool is_output)
|
|||
EventData data = {
|
||||
.code = {
|
||||
.ns = 1,
|
||||
.value = (((int32_t) buf.type) << 16) | buf.code,
|
||||
.major = buf.type,
|
||||
.minor = buf.code,
|
||||
},
|
||||
.ttl = 100,
|
||||
.priority = 10,
|
||||
|
|
|
@ -22,7 +22,8 @@ handle_io(EventPositionBase * self, int fd, bool is_output)
|
|||
EventData data = {
|
||||
.code = {
|
||||
.ns = 0,
|
||||
.value = 1,
|
||||
.major = 0,
|
||||
.minor = 1,
|
||||
},
|
||||
.ttl = 100,
|
||||
.priority = 10,
|
||||
|
@ -32,7 +33,7 @@ handle_io(EventPositionBase * self, int fd, bool is_output)
|
|||
};
|
||||
if (status == 0) {
|
||||
node->subscription.enabled = false;
|
||||
data.code.value = 2;
|
||||
data.code.minor = 2;
|
||||
data.payload = 0;
|
||||
}
|
||||
for (size_t i = 0; i < node->as_GraphNode.outputs.length; ++i) {
|
||||
|
|
|
@ -9,7 +9,8 @@ handle_event(EventPositionBase * self, EventNode * event)
|
|||
EventData data = event->data;
|
||||
printf("Event from connector %ld:\n", event->input_index);
|
||||
PRINT_FIELD("%d", code.ns);
|
||||
PRINT_FIELD("%d", code.value);
|
||||
PRINT_FIELD("%d", code.major);
|
||||
PRINT_FIELD("%d", code.minor);
|
||||
PRINT_FIELD("%d", ttl);
|
||||
PRINT_FIELD("%d", priority);
|
||||
PRINT_FIELD("%ld", payload);
|
||||
|
|
Loading…
Reference in New Issue