html5sdkithub客户端,GitHub - siemens/cityhub-sdk: CityHub SDK

City Hub SDK

Last update: November 2016, Authors: Marcos Rocha, Tobias Aigner

The City Hub SDK provides an emulation environment for the City Hub devices and their sensors (available parking spaces, available bikes (bike-sharing), temperature, humidity, ambient noise, traffic density, etc). Sensor values are be basically set through REST APIs. Sensor values can be queried through REST APIs (sample web application provided), or directly acquired through a pub/sub middleware (MQTT topics). Moreover, this SDK provides a sample transaction API for booking parking spaces and bikes.

This SDK provides:

A web application for emulating and getting/setting the status of City Hub devices (based on Node.js, AngularJS and Mosca MQTT Broker)

A web application for displaying a map with markers providing infos about the City Hubs their sensor values.

A command line tool for setting sensor values in a automated way (Node.js command line application)

Installation

How to setup the NodeJS/JavaScript development environment required for this project (tested on Ubuntu 16.04 LTS / Windows 7 64-Bit).

Windows-only Prerequisites (npm binary build dependencies)

Install Microsoft Visual Studio Community 2015 https://www.visualstudio.com/ (Custom install, Select Visual C++ during the installation)

Config npm for VS2015: npm config set msvs_version 2015 --global

Install Development Environment & Dependencies

Install Node.js and npm

Download and install Node.js v6.x for your platform (at least npm v6.3.1 has been tested and works fine, the warnings can be ignored)

Make sure node and npm are installed properly. Check this by typing:

node --version

npm --version

(Optional) If you are connected to the internet through e.g. a corporate proxy, set npm proxy if required (e.g. by using the config scripts config_proxy.sh or config_proxy.bat)

Install Grunt and Bower using npm (executing shell commands with administrator rights, i.e. under Linux: sudo, might be required)

Type the following commands to install grunt and bower:

npm install -g bower grunt grunt-cli

bower --version

grunt --version

(Optional) Install Mosca MQTT broker

Type the following commands (executing with Administrator rights, i.e. under Linux: sudo, might be required):

npm install -g mosca bunyan

mosca --version

Automatically install project npm & bower dependencies excluding MQTT Mosca (executing with administrator rights, i.e. under Linux: sudo, might be required)

npm install

bower install

Make sure that a modern web browser is installed (tested on Chrome v54). Consider installing some plugins, e.g.:

(Optional) Install GIT

Make sure that GIT is on the system path (e.g. for Windows add "C:\Program Files\Git\cmd" to your PATH environment variable)

Start the Application

Start node application

Type the following command in the console for starting the application:

grunt serve

OR

npm start

Open the web browser with the URL http://localhost:9000

(Optional) Start MQTT Broker Mosca (if installed), by typing:

npm run start-mqtt

Check/set sensor values

Using the command line application, check script usage:

node cli/sensor.js --help

Technologies

Links to the technologies used by the SDK:

Project / Source Code Structure

Overview of the project structure

Path

Contents

.

README.md, LICENSE.txt, installation/helper scripts, etc.

./client

HTML5 / JavaScript web client (based on AngularJS)

./client/main

Main web client for querying/setting City Hub devices and their sensor values

./client/map

Sample City Hub application: displays map with markers for all City Hub devices

./client/mqtt

MQTT web client

./client/rest

REST web client (for test purposes)

./server

Node.js web application server

./server/config/sensors.js

Default values for City Hub devices (device coordinates, info, sensor values, etc.)

./cli

Command line application for setting sensor values (through REST APIs), either single values or values scheduled via day-of-the-week-based timestamps

./values

JSON files containing sample/forecast values for sensors (array of {dayOfWeek: 0-6, time: 0-24:0-59:0-59, value: 1234})

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值