int main() { slog_init(NULL, 18); int count = 5; int ret; struct aura_node *n = aura_open("dummy", NULL); aura_wait_status(n, AURA_STATUS_ONLINE); struct aura_buffer *retbuf; const struct aura_object *o; aura_enable_sync_events(n, 5); while (count--) { ret = aura_get_next_event(n, &o, &retbuf); slog(0, SLOG_DEBUG, "evt get ret %d", ret); aura_hexdump("Out buffer", retbuf->data, retbuf->size); aura_buffer_release(retbuf); } aura_close(n); return 0; }
void calldonecb(struct aura_node *dev, int status, struct aura_buffer *retbuf, void *arg) { printf("Call done with result %d arg %lld!\n", status, (long long unsigned int) arg); if (arg != (void *) ARG) exit(1); aura_hexdump("Out buffer", retbuf->data, retbuf->size); }
void test_bin(struct aura_node *n) { char buf[64]; int ret; FILE *fd = fopen("/dev/urandom", "r+"); fread(buf, 64, 1, fd); fclose(fd); struct aura_buffer *retbuf; ret = aura_call(n, "echobin", &retbuf, buf); if (ret != 0) BUG(n, "Call failed!"); if (0 != memcmp(buf, retbuf->data, 64)) slog(0, SLOG_ERROR, "BIN test NOT ok"); aura_hexdump("Out buffer", buf, 64); aura_hexdump("In buffer", retbuf->data, 64); slog(0, SLOG_INFO, "BIN test passed"); }
void pingcb(struct aura_node *dev, int status, struct aura_buffer *retbuf, void *arg) { numevt++; printf("Event number %d with result %d arg %lld!\n", numevt, status, (long long unsigned int) arg); if (arg != (void *) ARG2) exit(1); aura_hexdump("Out buffer", retbuf->data, retbuf->size); if (numevt==4) { printf("Breaking the loop\n"); aura_eventloop_loopexit(aura_node_eventloop_get(dev), NULL); } }
int main() { slog_init(NULL, 18); int ret; struct aura_node *n = aura_open("dummy", NULL); struct aura_buffer *retbuf; ret = aura_call(n, "echo_u16", &retbuf, 0x0102); slog(0, SLOG_DEBUG, "call ret %d", ret); aura_hexdump("Out buffer", retbuf->data, retbuf->size); aura_buffer_release(n, retbuf); aura_close(n); return 0; }