diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 21 | ||||
-rw-r--r-- | README.md | 21 | ||||
-rw-r--r-- | build/artifacts/main.o | bin | 0 -> 2144 bytes | |||
-rwxr-xr-x | build/osm-interplayd | bin | 0 -> 20608 bytes | |||
-rw-r--r-- | src/main.c | 35 |
6 files changed, 77 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..14ab9b5 --- /dev/null +++ b/Makefile @@ -0,0 +1,21 @@ + +SRC_DIR = src +BUILD_DIR = build +OBJ_DIR = $(BUILD_DIR)/artifacts +INCLUDE_DIR = ./include + +SRCS = $(notdir $(wildcard $(SRC_DIR)/*.c)) +OBJS = $(addsuffix .o, $(basename $(SRCS))) + +CFLAGS ?= -Werror -Wall + +build: build_dir $(OBJS) + $(CC) -lopensmarts -o $(BUILD_DIR)/osm-interplayd $(addprefix $(OBJ_DIR)/, $(OBJS)) + +%.o: $(SRC_DIR)/%.c + $(CC) $(CFLAGS) -c -I$(INCLUDE_DIR) -o $(BUILD_DIR)/artifacts/$@ $< + +build_dir: + mkdir -p $(BUILD_DIR) + mkdir -p $(OBJ_DIR) + @@ -1,3 +1,22 @@ # Interconnect -Interconnect daemon for OpenSmarts. Manages all connected devices, and stores settings/user scripts.
\ No newline at end of file +Interconnect daemon for OpenSmarts. This is an implementation of the logical hub for OpenSmarts devices. + +Its responsabilities are (in *hub mode*): +- Maintain an internal graph of the network (uuids, keys, and *endpoints*) +- Keep and run all the *automation scripts* as required +- Manage/push new state information to smart home devices as required by users or scripts +- Store/forward state information from smart home devices as requested by users or scripts +- Pair new devices when requested by users + +Its responsabilities are (in *endpoint mode*): +- Present all onboard logical endpoints as iot devices +- Pair and maintain keys with other smart home software +- Forward commands from the paired hub to underlying onboard devices +- Forward new data from underlying onboard devices to other smart home software + +This daemon is meant to run as the underlying logical smart home hub for a given network. +Current focus is on the basic features of device management, automation, and extensability, but +future work will be done on different setup modes to run a "hub device" as a bridge or endpoint +so that it can be managed (and expose its connected devices) to/from other smart home software +such as HomeAssistant or AppleHomeKit. diff --git a/build/artifacts/main.o b/build/artifacts/main.o Binary files differnew file mode 100644 index 0000000..e49ffdb --- /dev/null +++ b/build/artifacts/main.o diff --git a/build/osm-interplayd b/build/osm-interplayd Binary files differnew file mode 100755 index 0000000..fba6f0f --- /dev/null +++ b/build/osm-interplayd diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..d929499 --- /dev/null +++ b/src/main.c @@ -0,0 +1,35 @@ +#include <osm/discover.h> + +#include <stddef.h> +#include <stdio.h> + +#include <sys/socket.h> +#include <sys/un.h> +#include <unistd.h> + +int main(int argc, char **argv) +{ + // connect to socket + int fd = socket(AF_UNIX, SOCK_SEQPACKET, 0); + struct sockaddr_un addr = {0}; + addr.sun_family = AF_UNIX; + strcpy(addr.sun_path, "/run/osm/onboard/0"); + + int ret = connect(fd, (struct sockaddr *) &addr, sizeof(addr)); + if (ret == -1) + { + perror("connect"); + return 1; + } + + double temp = 0; + read(fd, &temp, sizeof(temp)); + + close(fd); + + printf("%f\n", temp); + + return 0; +} + + |