Bluetooth SmartMesh Controller
Implemented with the Ionic framework, the Bluetooth SmartMesh Controller lets you interact with the smart mesh from your iPhone, Android, or from Chrome. For limited time, you can try the app from our server in Chrome Canary on OSX or Chrome DEV on Android.
Just click here: Run
sudo npm install -g cordova ionic gulp bower
We use several other software packages to support the application.
- ionic material
- RobotoDraft, font face kit
- ionic material input plugin
- angular slider
- material design icons
bower install ionic-material bower install robotodraft bower install ion-md-input bower install --save angularjs-slider bower install material-design-icons
Many icons are used and modified from Google Icons. These are SGV file and preloaded.
The following Ionic and [Cordova] plugins are used. Specifically the ble-central plugin has to be modified to allow processing of scan results in arrays.
ionic plugin add email@example.com ionic plugin add firstname.lastname@example.org ionic plugin add email@example.com ionic plugin add firstname.lastname@example.org ionic plugin add email@example.com ionic plugin add firstname.lastname@example.org ionic plugin add email@example.com ionic plugin add com.unarin.cordova.beacon ionic plugin add cordova-plugin-ble-central ionic plugin add cordova-plugin-x-toast
Install the iBeacon plugin and the angular wrapper.
cordova plugin add https://github.com/petermetz/cordova-plugin-ibeacon cordova plugin add https://github.com/nraboy/ng-cordova-beacon
Fix ble.js in plugin cordova-plugin-ble-central. Modify, so that stringToArrayBuffer return Uint8Array and not ArrayBuffer.
npm install mqtt browserify mqtt.js -s mqtt > ../../SmartMesh/www/js/mqtt.js
Run your own MQTT server, or install is via brew on OSX. Building your MQTT server can be a bit challenging. See Compiling Mosquitto.
/usr/local/opt/mosquitto/sbin/mosquitto -c /usr/local/etc/mosquitto/mqtt.conf
Splash Screen and App Icon
Ionic automatically makes all icon and splash screen files for publication of the native app on iOS. Use the icon.psd and splash.psd files and run:
ionic resources --icon --splash
Running on IOS
We often get into debugging issues when running the app on the device via Ionic. Like that:
ionic run ios -device -debug
I recommend to prepare the app with Ionic and then run it on Xcode
Run with Xcode
ionic prepare ios --minify
Open the project in Xcode using the generated Xcode project file. Minify compresses all the files and images to make a smaller image for distribution and faster runtime.
Serve for Chrome browser
In order to be able to use Web Bluetooth, the app must be served through a secure web server. There are two ways to do that.
ionic platform add browser ionic build browser --minify
Then deploy on your web server. The second option is to run the app under Ionic Lab with debug.
ionic serve -lc
This is a build-in web server that opens up a screen with iOS and Android screen simulations, but it is not a secure server. To do that, use a https proxy redirector. See file httpsproxy.js and run it with node, after the ionic serve is running.
Building Native App
Here are some resources how to publish app in the iTune Connect using XCode. It is the usual detail work Apple wants you to do for screenshots, permissions, entitelements. We found that the app needs PUSH to be enabled. We have not tried to publish on Google Play.
For more information consult the Documentation.