Initial commit

This commit is contained in:
XANTRONIX Development 2017-11-21 00:59:27 +00:00
commit 5302ea3190
3 changed files with 107 additions and 0 deletions

23
include/skipstone.h Normal file
View 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
View 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
View 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) {
}