Skip to content

Commit

Permalink
Complete merge of launcher and controller server
Browse files Browse the repository at this point in the history
-Move contents into launcher
  • Loading branch information
afiolmahon committed Aug 6, 2018
1 parent afa64ef commit d185f6e
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 118 deletions.
52 changes: 0 additions & 52 deletions controller_server/index.js

This file was deleted.

36 changes: 0 additions & 36 deletions controller_server/launcher_client.js

This file was deleted.

15 changes: 0 additions & 15 deletions controller_server/package.json

This file was deleted.

26 changes: 15 additions & 11 deletions launcher/ControllerServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
*/

const express = require('express');
const launcher_client = require('./launcher_client.js');
const electron = require('electron');
const ChildUtils = require('./ChildUtils.js');

module.exports = function ControllerServer(port, app_list) {

Expand All @@ -18,6 +19,7 @@ const launcher_client = require('./launcher_client.js');
this.webapp.set('view engine', 'pug');
this.webapp.use(express.static('public'));

// Configure route behavior
this.webapp.get('/controller/:app_id', (req, res) => {
let app_id = req.params['app_id'];
let open_app = app_list[app_id];
Expand All @@ -28,25 +30,27 @@ const launcher_client = require('./launcher_client.js');

this.webapp.get('/open/:app_id', (req, res) => {
let app_id = req.params['app_id'];
let view_code = launcherClient.open_app(app_id);
if (view_code == -1) {
res.redirect('/launcher');
} else {
res.redirect(`/controller/${view_code}`);
}
console.log("no return!");
ChildUtils.openApp(app_id);
res.redirect(`/controller/${app_id}`);
});

this.webapp.get('/close', (req, res) => {
ChildUtils.closeApp();
res.redirect('/launcher');
});

this.webapp.get('/launcher', (req, res) => {
res.render('launcher', {title: 'Launcher', appList: app_list});
});

this.webapp.get('/', (req, res) => {
res.redirect('/launcher');
});


this.webapp.listen(PORT, () => {
console.log(`Server listening on port ${PORT}`);
// Start the webserver
this.webapp.listen(this.port, () => {
console.log(`Controller Server running on port ${this.port}`);
});

}
8 changes: 5 additions & 3 deletions launcher/launcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
'use strict';

// Imports
const path = require('path')
const path = require('path');
const HCI = require('campfire-hci-2');
const electron = require('electron');
const ChildUtils = require('./ChildUtils.js');
const ControllerServer = require('./ControllerServer.js');

// Constant definitions
const FLOOR_URL = path.join('file://', __dirname, 'docs', 'floor.html');
Expand All @@ -27,7 +28,6 @@ console.log(`Demo Mode: ${DEMO_MODE}`);
var launcherRotation = 0; // Current Launcher UI offset (in degrees)
global.childps = {'app': null};


// Create instance of HCI library
var hci = new HCI({
'fullscreen': true,
Expand All @@ -36,9 +36,11 @@ var hci = new HCI({
'centermode': true,
'floorURL': FLOOR_URL,
'wallURL': WALL_URL,
'mousewrangler': true
'mousewrangler': false
});

var webcontroller = new ControllerServer(4000, ChildUtils.appList);

// Bind keyboard input to IPC events so that the UI Thread can handle them appropriately
hci.inputManager.bindForward(() => {
if (!ChildUtils.isChildOpen()) {
Expand Down
2 changes: 2 additions & 0 deletions launcher/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"dependencies": {
"campfire-hci-2": "../campfire-hci-2",
"electron": "^1.8.6",
"express": "^4.16.3",
"pug": "^2.0.3",
"request": "^2.87.0"
},
"author": "Antonio Fiol-Mahon",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ html
th
a(
class="btn btn-danger"
href="/launcher"
href="/close"
) Close Demo
if displayurl != undefined
iframe(
Expand Down
File renamed without changes.

0 comments on commit d185f6e

Please sign in to comment.