├── LICENSE ├── README.md ├── blynk └── Makefile ├── node-blynk-library └── Makefile └── python-blynk-library └── Makefile /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Volodymyr Shymanskyy 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Blynk OpenWRT package 2 | 3 | Build from source: 4 | 5 | ```bash 6 | echo "src-git blynk git://github.com/vshymanskyy/blynk-library-openwrt.git" >> ./feeds.conf 7 | ./scripts/feeds update -a 8 | ./scripts/feeds install -p blynk -a 9 | make menuconfig 10 | ``` 11 | 12 | ### Node.js client 13 | You need [nxhack openwrt-node](https://github.com/nxhack/openwrt-node-packages) for this. 14 | 15 | Select in menuconfig: ```Languages -> Node.js -> node-blynk-library``` 16 | 17 | **Node.js** example: 18 | ```js 19 | const Blynk = require('blynk-library'); 20 | 21 | // Initialize Blynk 22 | let AUTH = 'YourAuthToken'; 23 | let blynk = new Blynk.Blynk(AUTH); 24 | let v1 = new blynk.VirtualPin(1); 25 | 26 | // Register virtual pin handler 27 | v1.on('write', function(param) { 28 | console.log('Got a value:', param); 29 | }); 30 | ``` 31 | 32 | ### Python 2.7 client 33 | 34 | Select in menuconfig: ```Languages -> Python -> python-blynk-library``` 35 | 36 | **Python** example: 37 | ```python 38 | import BlynkLib 39 | 40 | # Initialize Blynk 41 | AUTH = 'YourAuthToken' 42 | blynk = BlynkLib.Blynk(AUTH) 43 | 44 | # Register virtual pin handler 45 | @blynk.VIRTUAL_WRITE(1) 46 | def v1_write_handler(value): 47 | print('Got a value: {}'.format(value)) 48 | 49 | # Start Blynk (this call should never return) 50 | blynk.run() 51 | ``` 52 | 53 | ### C++ client 54 | 55 | Select in menuconfig: ```Network -> Blynk -> blynk``` 56 | 57 | **C++** example: 58 | ```cpp 59 | #include 60 | static BlynkTransportSocket blynkTransport; 61 | BlynkSocket Blynk(blynkTransport); 62 | 63 | const char* AUTH = "YourAuthToken"; 64 | 65 | BLYNK_WRITE(V1) { 66 | printf("Got a value: %s\n", param[0].asStr()); 67 | } 68 | 69 | int main(int argc, char* argv[]) { 70 | Blynk.begin(AUTH); 71 | 72 | while (true) { 73 | Blynk.run(); 74 | } 75 | 76 | return 0; 77 | } 78 | ``` 79 | 80 | ## Build OpenWRT image: 81 | ```bash 82 | make -j 5 83 | ``` 84 | 85 | ## Build just Blynk: 86 | ``` 87 | make package/blynk/compile V=s 88 | make package/node-blynk-library/compile V=s 89 | make package/python-blynk-library/compile V=s 90 | ``` 91 | 92 | For a rebuild: 93 | ``` 94 | make package/blynk/{clean,compile,install} V=s 95 | ``` 96 | -------------------------------------------------------------------------------- /blynk/Makefile: -------------------------------------------------------------------------------- 1 | include $(TOPDIR)/rules.mk 2 | 3 | PKG_NAME:=blynk 4 | PKG_VERSION:=0.5.2 5 | PKG_RELEASE:=1 6 | 7 | PKG_MAINTAINER:=Volodymyr Shymanskyy 8 | PKG_LICENSE:=MIT 9 | 10 | PKG_BUILD_PARALLEL:=1 11 | 12 | PKG_SOURCE_PROTO:=git 13 | PKG_SOURCE_URL:=git://github.com/blynkkk/blynk-library.git 14 | PKG_SOURCE_VERSION:=v0.5.2 15 | PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) 16 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz 17 | 18 | include $(INCLUDE_DIR)/uclibc++.mk 19 | include $(INCLUDE_DIR)/package.mk 20 | 21 | #define Build/Prepare 22 | # mkdir -p $(PKG_BUILD_DIR) 23 | # $(CP) -r /data2/Projects/blynk-library-arduino/* $(PKG_BUILD_DIR)/ 24 | #endef 25 | 26 | define Package/blynk 27 | SUBMENU:=Blynk 28 | SECTION:=net 29 | CATEGORY:=Network 30 | TITLE:=Blynk App builder for IoT 31 | URL:=http://www.blynk.cc 32 | DEPENDS:=+libpthread +librt $(CXX_DEPENDS) 33 | endef 34 | 35 | define Package/blynk/description 36 | Blynk is a platform with iOS and Android apps to control Arduino, 37 | Raspberry Pi and the likes over the Internet. 38 | You can easily build graphic interfaces for all your projects 39 | by simply dragging and dropping widgets. 40 | endef 41 | 42 | MAKE_PATH:=linux 43 | 44 | MAKE_FLAGS += LD="$(TARGET_CXX)" 45 | #TODO: add -fno-rtti 46 | 47 | define Package/blynk/install 48 | $(INSTALL_DIR) $(1)/usr/bin 49 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/linux/blynk $(1)/usr/bin/ 50 | endef 51 | 52 | $(eval $(call BuildPackage,blynk)) 53 | -------------------------------------------------------------------------------- /node-blynk-library/Makefile: -------------------------------------------------------------------------------- 1 | include $(TOPDIR)/rules.mk 2 | 3 | PKG_NPM_NAME:=blynk-library 4 | PKG_NAME:=node-$(PKG_NPM_NAME) 5 | PKG_VERSION:=0.4.7 6 | PKG_RELEASE:=1 7 | 8 | PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz 9 | PKG_SOURCE_URL:=http://registry.npmjs.org/$(PKG_NPM_NAME)/-/ 10 | PKG_MD5SUM:=7e90c28befe0eae9a18b7c6cab966804 11 | 12 | PKG_BUILD_DEPENDS:=node/host 13 | PKG_USE_MIPS16:=0 14 | 15 | PKG_MAINTAINER:=Volodymyr Shymanskyy 16 | PKG_LICENSE:=MIT 17 | 18 | include $(INCLUDE_DIR)/package.mk 19 | 20 | define Package/node-blynk-library 21 | SUBMENU:=Node.js 22 | SECTION:=lang 23 | CATEGORY:=Languages 24 | TITLE:=Blynk client for Node.js 25 | URL:=https://www.npmjs.com/package/blynk-library 26 | DEPENDS:=+node 27 | endef 28 | 29 | define Package/node-blynk-library/description 30 | Blynk is a platform with iOS and Android apps to control Arduino, 31 | Raspberry Pi and the likes over the Internet. 32 | You can easily build graphic interfaces for all your projects 33 | by simply dragging and dropping widgets. 34 | endef 35 | 36 | NODEJS_CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH))))) 37 | 38 | define Build/Prepare 39 | $(INSTALL_DIR) $(PKG_BUILD_DIR) 40 | endef 41 | 42 | define Build/Compile 43 | $(MAKE_VARS) \ 44 | $(MAKE_FLAGS) \ 45 | npm_config_arch=$(NODEJS_CPU) \ 46 | npm_config_nodedir=$(STAGING_DIR)/usr/ \ 47 | npm_config_cache=$(TMP_DIR)/npm-cache \ 48 | PREFIX="$(PKG_INSTALL_DIR)/usr/" \ 49 | npm install --no-optional --build-from-source --target_arch=$(NODEJS_CPU) -g $(DL_DIR)/$(PKG_SOURCE) 50 | endef 51 | 52 | define Package/node-blynk-library/install 53 | $(INSTALL_DIR) $(1)/usr/lib/node 54 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/* $(1)/usr/lib/node/ 55 | endef 56 | 57 | $(eval $(call BuildPackage,node-blynk-library)) 58 | 59 | -------------------------------------------------------------------------------- /python-blynk-library/Makefile: -------------------------------------------------------------------------------- 1 | include $(TOPDIR)/rules.mk 2 | 3 | PKG_NAME:=python-blynk-library 4 | PKG_VERSION:=0.1.0 5 | PKG_RELEASE:=1 6 | PKG_MAINTAINER:=Volodymyr Shymanskyy 7 | PKG_LICENSE:=MIT 8 | 9 | PKG_SOURCE:=blynk-library-python-$(PKG_VERSION).tar.gz 10 | PKG_SOURCE_URL:=https://pypi.python.org/packages/40/8d/ca3721c7f2a8c4305a1dbbefc4d22b3221c28042e94bb4a2aa91169b4943 11 | PKG_MD5SUM:=3fa1bc0b98d270a95876d772c6906239 12 | 13 | PKG_BUILD_DIR:=$(BUILD_DIR)/blynk-library-python-$(PKG_VERSION) 14 | PKG_BUILD_DEPENDS:=python python-setuptools 15 | 16 | include $(INCLUDE_DIR)/package.mk 17 | $(call include_mk, python-package.mk) 18 | 19 | define Package/python-blynk-library 20 | SUBMENU:=Python 21 | SECTION:=lang 22 | CATEGORY:=Languages 23 | TITLE:=Blynk client for Python 24 | URL:=https://github.com/vshymanskyy/blynk-library-python 25 | DEPENDS:=+python-light +python-codecs 26 | endef 27 | 28 | define Package/python-blynk-library/description 29 | Blynk is a platform with iOS and Android apps to control Arduino, 30 | Raspberry Pi and the likes over the Internet. 31 | You can easily build graphic interfaces for all your projects 32 | by simply dragging and dropping widgets. 33 | endef 34 | 35 | define Build/Compile 36 | $(call Build/Compile/PyMod,,install --prefix="$(PKG_INSTALL_DIR)/usr") 37 | endef 38 | 39 | define Package/python-blynk-library/install 40 | $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) 41 | $(CP) \ 42 | $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ 43 | $(1)$(PYTHON_PKG_DIR) 44 | endef 45 | 46 | $(eval $(call PyPackage,python-blynk-library)) 47 | $(eval $(call BuildPackage,python-blynk-library)) 48 | 49 | --------------------------------------------------------------------------------