Code Monkey home page Code Monkey logo

sensorconnectdemo's Introduction

About

This is a simple demo using node.js and Cordova (PhoneGap) to create a communication channel between an iOS device and a web application. The example demonstrates how to send iOS sensor data and custom messages to a web application and how to send commands from the web app to the iOS device.

Currently this demo only works for iOS devices. It could be made to work with Android as well if you add a Cordova websocket plugin for Android. I just don't have an Anroid device to test with.

Setup

Install and setup node.js and the required npm modules (note that the modules are not included in the distribution so you'll need to install them yourself):

  1. Install node.js if you have not already.
  2. Install the following npm modules. Navigate to Sensorconnect/sensor_connect_server in your terminal:
  • type: 'npm install websocket' and hit enter
  • type: 'npm install websocket-server' and hit enter
  • type: 'npm install express' and hit enter

If you have trouble and are unfamiliar with node.js and npm, please read up on those topics.

Install and setup Cordova (PhoneGap):

  1. Download and install Cordova (PhoneGap) (This demo is using Cordova 1.8.0)
  2. Follow the Cordova setup instruction for iOS (use the instruction in the download, not the Cordova website because it's typically out of date).
  3. Change line 55 of main.js to the hostname of your computer. You can alternatively use the IP address of you're computer but the hostname is better if you're using a mac since your IP address could change.
  4. Open the SensorConnect XCode project and compile for you iOS device.

If this is your first time using Cordova (PhoneGap) first make sure you can run the Cordova demo application before trying to run this demo.

Running

Once node.js and Cordova are installed and setup you can run the demo:

  1. Open Terminal and navigate the SensorConnect/sensor_connect_server/
  2. Type 'node server.js' to startup the server (you should see 'Server is listening on port 8080' if successful).
  3. Open SensorConnect/server_connect_client in your browser (I've only tested with Chrome... should also work in Firefox and Safari)
  4. Open SensorConnect on your iOS device (either directly if you've already installed it, or run it via Xcode)

sensorconnectdemo's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.