#
# Copyright (C) 2015 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=s5_dtutype
VERSION_YEAR=$(shell date +%Y)
VERSION_MAJOR=$(shell expr $(VERSION_YEAR) - 2018)
VERSION_MINOR=$(shell date +%V%u)
VERSION_REVISION=0000
PKG_VERSION:=$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_REVISION)
PKG_RELEASE:=1
PKG_MAINTAINER:=Andy Gelme
PKG_LICENSE:=AGPLv3

PKG_INSTALL:=1

include $(INCLUDE_DIR)/package.mk

define Package/s5_dtutype
  SECTION:=DYIOT
  CATEGORY:=DYIOT Software
  TITLE:=s5_dtutype
  DEPENDS:=+lua-rs232 +lua-libutils
endef

define Package/s5_dtutype/description
  Read message from /dev/ttymxc1: {"RTUS5_Request":"DTU_Type"}
  Reply with message: {"RTUS5_Request":"DTU_Type"}
endef

define Build/Configure
endef

define Build/Install
endef

define Build/Compile
endef

define Package/s5_dtutype/install
	$(INSTALL_DIR) $(1)/app
	$(INSTALL_DIR) $(1)/etc/init.d
	$(INSTALL_BIN) ./files/s5_dtutype.init $(1)/etc/init.d/s5_dtutype
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/s5_dtutype.lua $(1)/app/s5_dtutype.lua
endef

$(eval $(call BuildPackage,s5_dtutype))
