#
# 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:=ble
PKG_VERSION:=1.0.1
PKG_RELEASE:=1
PKG_MAINTAINER:=Andy Gelme
PKG_LICENSE:=AGPLv3

PKG_NAME:=ble

include $(INCLUDE_DIR)/package.mk

define Package/ble
	ECTION:=DYIOT
	CATEGORY:=DYIOT Software
	TITLE:=$(PKG_NAME)
	DEPENDS:=+bluez-libs +libuci +libdyutils +libubox +glib2 +dbus +libreadline +libipc_session
endef

define Package/ble/description
  ble support python, each adapter start one process to handle, it will waste CPU, because one process need receive all dbus messange and filter out other adapters' data
endef

define Build/Prepare
	mkdir -p $(PKG_BUILD_DIR)
	$(CP) ./src/* $(PKG_BUILD_DIR)/
endef

define Package/ble/install
	$(INSTALL_DIR) $(1)/app/
	$(INSTALL_DIR) $(1)/app/bluetooth/
	$(INSTALL_DIR) $(1)/etc/init.d
	$(INSTALL_BIN) ./files/ble_* $(1)/etc/init.d
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/ble $(1)/app/
	$(INSTALL_BIN) ./files/*.py $(1)/app/bluetooth/
	$(INSTALL_BIN) ./files/*.lua $(1)/app/bluetooth/
endef

$(eval $(call BuildPackage,ble))
