From: Nils Faerber Date: Mon, 18 Jul 2011 20:33:40 +0000 (+0200) Subject: Initial edits... X-Git-Url: https://git.kernelconcepts.de/?p=metawatch.git;a=commitdiff_plain;h=5c3d6461a1e52a6741efe989f8f1170edd6111a5 Initial edits... --- 5c3d6461a1e52a6741efe989f8f1170edd6111a5 diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e605bc2 --- /dev/null +++ b/Makefile @@ -0,0 +1,29 @@ +# Copyright (C) 2011 Nils Faerber +# prefix for installation and search path (like icons) +PREFIX = /usr/local/ +CFLAGS = $(CCFLAGS) + +PRGNAME = metawatch + +MEMBERS = metawatch + +# no need to change anything below this line +# ------------------------------------------ +.SUFFIXES: .d .c + +CFLAGS += -MD -DPREFIX=\"$(PREFIX)\" $(OPTIONS) +LDFLAGS = $(CLDFLAGS) $(SQLITELDFLAGS) + +SOURCES = $(patsubst %,%.c,$(MEMBERS)) +OBJS = $(patsubst %,%.o,$(MEMBERS)) +DEPS = $(patsubst %,%.d,$(MEMBERS)) + +all: $(PRGNAME) + +$(PRGNAME): $(OBJS) + $(CC) -o $@ $^ $(LDFLAGS) + +clean: + rm -f *.o *.d $(PRGNAME) + +-include $(DEPS) diff --git a/metawatch.c b/metawatch.c new file mode 100644 index 0000000..7305b03 --- /dev/null +++ b/metawatch.c @@ -0,0 +1,29 @@ +/* + * (c) 2011 Siegen, Germany by Nils Faerber + * + * license GPL + */ +#include +#include +#include +#include + +#include "metawatch_protocol.h" + +int main(int argc, char **argv) +{ + int mwfd; + + if (argc != 2) { + fprintf(stderr, "Usage:\n\t%s \n", argv[0]); + return 1; + }; + + mwfd = open(argv[1], O_RDWR); + if (mwfd < 0) { + perror("open"); + return 1; + }; + + return 0; +}; diff --git a/metawatch_protocol.h b/metawatch_protocol.h new file mode 100644 index 0000000..cae11c9 --- /dev/null +++ b/metawatch_protocol.h @@ -0,0 +1,43 @@ +#ifndef _MW_PROT_H +#define _MW_PROT_H + +#define MW_SOF 0x01 + +#define MW_GET_DEVICE_TYPE 0x01 +#define MW_GET_DEVICE_TYPE_RSP 0x02 +#define MW_GET_INFORMATION_STRING 0x03 +#define MW_GET_INFORMATION_STRING_RSP 0x04 + +#define MW_ADVANCE_WATCH_HANDS 0x20 +#define MW_SET_VIBRATE_MODE 0x23 + +#define MW_SET_REAL_TIME_CLOCK 0x26 +#define MW_GET_REAL_TIME_CLOCK 0x27 +#define MW_GET_REAL_TIME_CLOCK_RSP 0x28 + +#define MW_RESERVED 0x32 +#define MW_STATUS_CHANGE_EVENT 0x33 +#define MW_BUTTON_EVENT_MESSAGE 0x34 + +#define MW_WRITE_BUFFER 0x40 +#define MW_CONFIGURE_MODE 0x41 +#define MW_CONFIGURE_IDLE_BUFFER_SIZE 0x42 +#define MW_UPDATE_DISPLAY 0x43 +#define MW_LOAD_TEMPLATE 0x44 +#define MW_RESERVED2 0x45 +#define MW_ENABLE_BUTTON 0x46 +#define MW_DISABLE_BUTTON 0x47 +#define MW_READ_BUTTON_CONFIG 0x48 +#define MW_READ_BUTTON_CONFIG_RSP 0x49 +#define MW_RESERVED3 0x4a + +#define MW_BATTERY_CONFIG_MSG 0x53 +#define MW_LOW_BATTERY_WARNING_MSG 0x54 +#define MW_LOW_BATTERY_BT_OFF_MSG 0x55 +#define MW_READ_BATTERY_VOLTAGE_MSG 0x56 +#define MW_READ_BATTERY_VOLTAGE_RSP 0x57 + +#define MW_ACCELEROMETER 0xea + + +#endif