Skip to content

Commit

Permalink
initialize project
Browse files Browse the repository at this point in the history
  • Loading branch information
anchetaWern committed Jul 31, 2016
0 parents commit 2d1e656
Show file tree
Hide file tree
Showing 83 changed files with 159,532 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"directory": "www/lib"
}
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
insert_final_newline = false
trim_trailing_whitespace = false
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Specifies intentionally untracked files to ignore when using Git
# http://git-scm.com/docs/gitignore

node_modules/
platforms/
plugins/
hooks/
7 changes: 7 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "HelloIonic",
"private": "true",
"devDependencies": {
"ionic": "driftyco/ionic-bower#1.3.1"
}
}
22 changes: 22 additions & 0 deletions config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.ionicframework.ionicbleattendance962192" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>ionicBLEAttendance</name>
<description>
An Ionic Framework and Cordova project.
</description>
<author email="[email protected]" href="http://example.com.com/">
Your Name Here
</author>
<content src="index.html" />
<access origin="*" />
<preference name="webviewbounce" value="false" />
<preference name="UIWebViewBounce" value="false" />
<preference name="DisallowOverscroll" value="true" />
<preference name="SplashScreenDelay" value="2000" />
<preference name="FadeSplashScreenDuration" value="2000" />
<preference name="android-minSdkVersion" value="16" />
<preference name="BackupWebStorage" value="none" />
<feature name="StatusBar">
<param name="ios-package" onload="true" value="CDVStatusBar" />
</feature>
</widget>
51 changes: 51 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
var gulp = require('gulp');
var gutil = require('gulp-util');
var bower = require('bower');
var concat = require('gulp-concat');
var sass = require('gulp-sass');
var minifyCss = require('gulp-minify-css');
var rename = require('gulp-rename');
var sh = require('shelljs');

var paths = {
sass: ['./scss/**/*.scss']
};

gulp.task('default', ['sass']);

gulp.task('sass', function(done) {
gulp.src('./scss/ionic.app.scss')
.pipe(sass())
.on('error', sass.logError)
.pipe(gulp.dest('./www/css/'))
.pipe(minifyCss({
keepSpecialComments: 0
}))
.pipe(rename({ extname: '.min.css' }))
.pipe(gulp.dest('./www/css/'))
.on('end', done);
});

gulp.task('watch', function() {
gulp.watch(paths.sass, ['sass']);
});

gulp.task('install', ['git-check'], function() {
return bower.commands.install()
.on('log', function(data) {
gutil.log('bower', gutil.colors.cyan(data.id), data.message);
});
});

gulp.task('git-check', function(done) {
if (!sh.which('git')) {
console.log(
' ' + gutil.colors.red('Git is not installed.'),
'\n Git, the version control system, is required to download Ionic.',
'\n Download git here:', gutil.colors.cyan('http://git-scm.com/downloads') + '.',
'\n Once git is installed, run \'' + gutil.colors.cyan('gulp install') + '\' again.'
);
process.exit(1);
}
done();
});
4 changes: 4 additions & 0 deletions ionic.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "ionicBLEAttendance",
"app_id": ""
}
27 changes: 27 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "ionicbleattendance",
"version": "1.1.1",
"description": "ionicBLEAttendance: An Ionic project",
"dependencies": {
"gulp": "^3.5.6",
"gulp-sass": "^2.0.4",
"gulp-concat": "^2.2.0",
"gulp-minify-css": "^0.3.0",
"gulp-rename": "^1.2.0"
},
"devDependencies": {
"bower": "^1.3.3",
"gulp-util": "^2.2.14",
"shelljs": "^0.3.0"
},
"cordovaPlugins": [
"cordova-plugin-device",
"cordova-plugin-console",
"cordova-plugin-whitelist",
"cordova-plugin-splashscreen",
"cordova-plugin-statusbar",
"ionic-plugin-keyboard",
"cordova-plugin-ble-central"
],
"cordovaPlatforms": []
}
23 changes: 23 additions & 0 deletions scss/ionic.app.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
To customize the look and feel of Ionic, you can override the variables
in ionic's _variables.scss file.
For example, you might change some of the default colors:
$light: #fff !default;
$stable: #f8f8f8 !default;
$positive: #387ef5 !default;
$calm: #11c1f3 !default;
$balanced: #33cd5f !default;
$energized: #ffc900 !default;
$assertive: #ef473a !default;
$royal: #886aea !default;
$dark: #444 !default;
*/

// The path for our ionicons font files, relative to the built CSS in www/css
$ionicons-font-path: "../lib/ionic/fonts" !default;

// Include all of Ionic
@import "www/lib/ionic/scss/ionic";

41 changes: 41 additions & 0 deletions server/bleno.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
var bleno = require('bleno');

var attendees = [];
var settings = {
service_id: '24ui',
characteristic_id: '70xz'
};

bleno.on('stateChange', function(state){
if(state === 'poweredOn'){
bleno.startAdvertising('AttendanceApp', ['24ui']);
}else{
bleno.stopAdvertising();
}
});

bleno.on('advertisingStart', function(error){
if(error){
// error on advertise start
}else{
bleno.setServices([
new bleno.PrimaryService({
uuid : settings.service_id,
characteristics : [
new bleno.Characteristic({
value : null,
uuid : settings.characteristic_id,
properties : ['read', 'write'],
onWriteRequest : function(data, offset, withoutResponse, callback){
var attendee = JSON.parse(data.toString());
attendee.time_entered = Date.now();
attendees.push(attendee);
console.log(attendees);
callback(this.RESULT_SUCCESS);
}
})
]
})
]);
}
});
14 changes: 14 additions & 0 deletions server/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "ble-server",
"version": "1.0.0",
"description": "",
"main": "bleno.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Wern Ancheta",
"license": "ISC",
"dependencies": {
"bleno": "^0.4.0"
}
}
1 change: 1 addition & 0 deletions www/css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* Empty. Add your own CSS if you like */
Binary file added www/img/ionic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions www/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title></title>

<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">

<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
<link href="css/ionic.app.css" rel="stylesheet">
-->

<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>

<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js"></script>

<!-- your app's js -->
<script src="js/app.js"></script>
<script src="js/factories/DeviceFactory.js"></script>
<script src="js/controllers/HomeController.js"></script>
<script src="js/controllers/DeviceController.js"></script>
</head>
<body ng-app="starter">
<ion-nav-view></ion-nav-view>
</body>
</html>
58 changes: 58 additions & 0 deletions www/js/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Ionic Starter App

// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'
angular.module('starter', ['ionic'])

.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
if(window.cordova && window.cordova.plugins.Keyboard) {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);

ble.isEnabled(
function(){
// Bluetooth is enabled
},
function(){
// Bluetooth not yet enabled so we try to enable it
ble.enable(
function(){
// bluetooth now enabled
},
function(err){
alert('Cannot enable bluetooth');
}
);
}
);


// Don't remove this line unless you know what you are doing. It stops the viewport
// from snapping when text inputs are focused. Ionic handles this internally for
// a much nicer keyboard experience.
cordova.plugins.Keyboard.disableScroll(true);

}
if(window.StatusBar) {
StatusBar.styleDefault();
}
});
})
.config(function($stateProvider, $urlRouterProvider) {
$stateProvider

.state('home', {
url: '/home',
templateUrl: 'templates/home.html'
})

.state('device', {
url: '/device/:id',
templateUrl: 'templates/device.html'
});

$urlRouterProvider.otherwise('/home');
});
47 changes: 47 additions & 0 deletions www/js/controllers/DeviceController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
(function(){
angular.module('starter')
.controller('DeviceController', ['$scope', '$state', '$stateParams', 'DeviceFactory', DeviceController]);

function DeviceController($scope, $state, $stateParams, DeviceFactory){

var me = this;

var service_id = '24ui';
var characteristic_id = '70xz';

me.attendee = {
firstname: '',
lastname: ''
}

$scope.init = function(){
$scope.device = DeviceFactory.getDevice($stateParams.id);
}

$scope.attend = function(){
ble.write(
$stateParams.id,
service_id,
characteristic_id,
btoa(JSON.stringify(me.attendee)),
function(response){
if(response == 'OK'){
alert("Your attendance is recorded!");
ble.disconnect($stateParams.id);
$state.go('home');
}
},
function(err){
alert("Error occured while trying to record your attendance. Please try again.");
}
);
}

$scope.backToHome = function(){
$state.go('home');
ble.disconnect($stateParams.id);
}

}

})();
Loading

0 comments on commit 2d1e656

Please sign in to comment.