Created
November 25, 2011 01:40
-
-
Save eatnumber1/1392623 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uint64_t zigbees[3]; // This somehow gets initialized (list of zigbee IDs) | |
int xbfd; | |
xbapi_op op_structs[3]; | |
xbfd = xbapi_init("path to fd"); | |
for (int i = 0; i < 3; i++) { | |
xbapi_initi_op(op_structs[i]); | |
xbapi_transmit(op_structs[i], "Hello Zigbee", zigbees[i]); // Should return error codes | |
} | |
// select/poll/epoll on xbfd | |
// if readable | |
xbapi_result ret = xbapi_process_data(xbfd, op_structs); // Uses malloc internally to build structs | |
for (xbapi_op *op = ret.completed_ops; op != NULL; op++) { | |
// Use op->result to do something | |
} | |
for (xbapi_msg *message = ret.messages; message != NULL; message++) { | |
printf("Got a message (%s) from %s\n", message->data, message->origin); | |
} | |
xbapi_free_result(ret); | |
// endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment