Initial commit
This commit is contained in:
commit
5302ea3190
3 changed files with 107 additions and 0 deletions
23
include/skipstone.h
Normal file
23
include/skipstone.h
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#ifndef _SKIPSTONE_H
|
||||||
|
#define _SKIPSTONE_H
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define SKIPSTONE_MESSAGE_MAX_PAYLOAD 4096
|
||||||
|
|
||||||
|
typedef struct _skipstone_message {
|
||||||
|
uint16_t size, endpoint;
|
||||||
|
} skipstone_message;
|
||||||
|
|
||||||
|
typedef struct _skipstone_watch_link skipstone_watch_link;
|
||||||
|
|
||||||
|
skipstone_watch_link *skipstone_watch_link_open_serial(const char *device);
|
||||||
|
|
||||||
|
void skipstone_watch_close(skipstone_watch_link *link);
|
||||||
|
|
||||||
|
int16_t skipstone_send(skipstone_watch_link *link, void *buf, uint16_t size);
|
||||||
|
|
||||||
|
int16_t skipstone_recv(skipstone_watch_link *link, void *buf, uint16_t size);
|
||||||
|
|
||||||
|
#endif /* _SKIPSTONE_H */
|
42
src/skipstone.c
Normal file
42
src/skipstone.c
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <skipstone.h>
|
||||||
|
|
||||||
|
enum skipstone_watch_link_type {
|
||||||
|
SKIPSTONE_WATCH_LINK_SERIAL = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _skipstone_watch_link {
|
||||||
|
enum skipstone_watch_link_type link_type;
|
||||||
|
|
||||||
|
union {
|
||||||
|
int serial_fd;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
skipstone_watch_link *skipstone_watch_link_open_serial(const char *device) {
|
||||||
|
skipstone_watch_link *link;
|
||||||
|
|
||||||
|
if ((link = malloc(sizeof(*link))) == NULL) {
|
||||||
|
goto error_malloc_link;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return link;
|
||||||
|
|
||||||
|
error_malloc_link:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void skipstone_watch_close(skipstone_watch_link *link) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int16_t skipstone_send(skipstone_watch_link *link, void *buf, uint16_t size) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int16_t skipstone_recv(skipstone_watch_link *link, void *buf, uint16_t size) {
|
||||||
|
|
||||||
|
}
|
42
src/skipstone.c-e
Normal file
42
src/skipstone.c-e
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <skipstone.h>
|
||||||
|
|
||||||
|
enum skipstone_watch_link_type {
|
||||||
|
SKIPSTONE_WATCH_LINK_SERIAL = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _skipstone_watch_link {
|
||||||
|
enum skipstone_watch_link_type link_type;
|
||||||
|
|
||||||
|
union {
|
||||||
|
int serial_fd;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
skipstone_watch_link *skipstone_watch_link_open_serial(const char *device) {
|
||||||
|
skipstone_watch_link *link;
|
||||||
|
|
||||||
|
if ((link = malloc(sizeof(*link))) == NULL) {
|
||||||
|
goto error_malloc_link;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return link;
|
||||||
|
|
||||||
|
error_malloc_link:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void skipstone_watch_close(skipstone_watch_link *link) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int16_t skipstone_send(skipstone_watch_link *link, void *buf, uint16_t size) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int16_t skipstone_recv(skipstone_watch_link *link, void *buf, uint16_t size) {
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue