aura  0.1
 All Data Structures Functions Variables Modules Pages
test-susb.c
1 #include <aura/aura.h>
2 
3 int main() {
4  int ret;
5  int i = 1632;
6  init_slog(NULL, 88);
7  struct aura_node *n = aura_open("simpleusb", "simpleusbconfigs/phototurntable.conf");
8  if (!n) {
9  printf("err\n");
10  return -1;
11  }
12  aura_wait_status(n, AURA_STATUS_ONLINE);
13 
14  struct aura_buffer *retbuf;
15  ret = aura_call(n, "turnTheLedOn", &retbuf, 0x1);
16  slog(0, SLOG_DEBUG, "call ret %d", ret);
17  if (0 == ret) {
18  printf("====> buf pos %d len %d\n", retbuf->pos, retbuf->size);
19  ret = aura_buffer_get_u8(retbuf);
20  }
21  printf("====> GOT %d from device\n", ret);
22  aura_buffer_release(n, retbuf);
23  while(i--) {
24  aura_loop_once(n);
25  usleep(10000);
26  }
27  aura_close(n);
28  return 0;
29 }
void aura_wait_status(struct aura_node *node, int status)
Definition: aura.c:607
int pos
Definition: aura.h:339
int aura_call(struct aura_node *node, const char *name, struct aura_buffer **retbuf,...)
Definition: aura.c:666
uint8_t aura_buffer_get_u8(struct aura_buffer *buf)
Get an unsigned 8 bit integer from aura buffer.
struct aura_node * aura_open(const char *name, const char *opts)
Definition: aura.c:34
int size
Definition: aura.h:337
void aura_buffer_release(struct aura_buffer *buf)
Definition: buffer.c:80
void aura_close(struct aura_node *node)
Definition: aura.c:102