Skip to content

Commit

Permalink
Project code
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiazheng committed Nov 10, 2016
1 parent 367b14e commit 6bcd017
Show file tree
Hide file tree
Showing 46 changed files with 1,377 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
Binary file added greener-house-app/.DS_Store
Binary file not shown.
Binary file added greener-house-app/assets/.DS_Store
Binary file not shown.
Binary file added greener-house-app/assets/airflow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added greener-house-app/assets/back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added greener-house-app/assets/big_sun_b.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added greener-house-app/assets/core-button-2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added greener-house-app/assets/core-button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added greener-house-app/assets/core-glyph-strip.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added greener-house-app/assets/core-slide-button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added greener-house-app/assets/fan.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added greener-house-app/assets/fan_g.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added greener-house-app/assets/home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added greener-house-app/assets/home_g.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added greener-house-app/assets/humidity.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added greener-house-app/assets/irrigation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added greener-house-app/assets/irrigation_g.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added greener-house-app/assets/main.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added greener-house-app/assets/settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added greener-house-app/assets/sun.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added greener-house-app/assets/sun_b.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added greener-house-app/assets/sun_diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added greener-house-app/assets/sun_g.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added greener-house-app/assets/temp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added greener-house-app/assets/temp_b.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added greener-house-app/assets/temp_g.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added greener-house-app/assets/toggle-switch.png
10 changes: 10 additions & 0 deletions greener-house-app/buttons.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 62 additions & 0 deletions greener-house-app/drawer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { Greenhouses } from "greenhouses_around";
import { name_h, naviBar_h, padding, drawerScreen,
currentScreen, Home, adjustFanIcons, adjustNavButtons } from "main";

// Skinslet blackSkin = new Skin ({fill: 'black'});let whiteSkin = new Skin ({fill: 'white'});
let graySkin = new Skin ({fill: '#6c6c6c'});
let greenSkin = new Skin ({fill: '#71e28b'});

// Fontsvar titleW = new Style({font: 'bold 20px', color: 'white'});
var titleB = new Style({font: 'bold 20px', color: 'black'});
var titleG = new Style({font: 'bold 20px', color: '#71e28b'});
var regularW = new Style({font: '20px', color: 'white'});
var regularB = new Style({font: '20px', color: 'black'});
var regularG = new Style({font: '20px', color: '#71e28b'});

// Greenhouses buttons
export let greenhouseBtn = Container.template($ => ({ left: 0, right: 0, top: 0, bottom: undefined,
height: 50, active: true,

behavior: Behavior({ onCreate: function(content){ this.upSkin = new Skin({ fill: "transparent", borders: {left: 0, right: 0, top: 0, bottom: 1},
stroke: "black", }); this.downSkin = new Skin({ fill: "#71e28b", borders: {left: 0, right: 0, top: 1, bottom: 1},
stroke: "black", }); content.skin = this.upSkin; }, onTouchBegan: function(content){ content.skin = this.downSkin; }, onTouchEnded: function(content){ content.skin = this.upSkin;
application.remove(currentScreen);
currentScreen = new Home();
application.add(currentScreen);
application.distribute("updateState");
adjustFanIcons();
adjustNavButtons(0);
application.distribute("updateNavButtons");
application.distribute("updateInfo", 1);
}, }), contents: [ Label($, {
top: 0, bottom: 0, left: 10, right: undefined,
style: regularW, string: $.text,
}) ]}));

var drawerWidth = 200;
export var gh = [];
gh[0] = new greenhouseBtn({text: "Greenhouse 1", id: 1});

export var Drawer = Container.template($ => ({ left: 0, right: undefined, top: name_h, bottom: naviBar_h,
width: drawerWidth, skin: graySkin, contents: [ Column($, {
left: 0, right: 0, top: 0, bottom: 0,
contents: [
gh,
new addBtn({}),
]
}), ]}));

// Add greenhous button
let addBtn = Container.template($ => ({ left: 0, right: 0, top: 0, bottom: undefined,
height: 50, active: true,

behavior: Behavior({ onCreate: function(content){ this.upSkin = new Skin({ fill: "transparent", borders: {left: 0, right: 0, top: 0, bottom: 1},
stroke: "black", }); this.downSkin = new Skin({ fill: "#71e28b", borders: {left: 0, right: 0, top: 0, bottom: 1},
stroke: "black", }); content.skin = this.upSkin; }, onTouchBegan: function(content){ content.skin = this.downSkin; }, onTouchEnded: function(content){ content.skin = this.upSkin;
application.distribute("updateDrawer");
application.add(ghAroundScreen);
}, }),
contents: [ new Label({ top: 0, bottom: 0, left: padding, right: undefined,
style: regularW, string: "Add" }) ] }));

export var ghAroundScreen = new Greenhouses();
Expand Down
10 changes: 10 additions & 0 deletions greener-house-app/field.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

64 changes: 64 additions & 0 deletions greener-house-app/greenhouses_around.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { gh, greenhouseBtn, ghAroundScreen } from "drawer";
import { fanState } from "ventilation";
import { padding, drawerScreen, currentScreen, Home,
adjustFanIcons, adjustNavButtons, greenhouseNum,
currTemperature, currSunlight, currHumidity, currAirFlow } from "main";

// Skinslet blackSkin = new Skin ({fill: 'black'});let whiteSkin = new Skin ({fill: 'white'});
let graySkin = new Skin ({fill: '#6c6c6c'});
let greenSkin = new Skin ({fill: '#71e28b'});

// Fontsvar titleW = new Style({font: 'bold 20px', color: 'white'});
var titleB = new Style({font: 'bold 20px', color: 'black'});
var titleG = new Style({font: 'bold 20px', color: '#71e28b'});
var regularW = new Style({font: '20px', color: 'white'});
var regularB = new Style({font: '20px', color: 'black'});
var regularG = new Style({font: '20px', color: '#71e28b'});

var conWH = 200;

export var Greenhouses = Container.template($ => ({ left: undefined, right: undefined, top: undefined, bottom: undefined,
width: conWH, height: conWH, skin: graySkin, contents: [ Column($, {
left: 0, right: 0, top: 0, bottom: 0,
contents: [
new ghABtn({text: "Greenhouse 1", id: 1}),
new ghABtn({text: "XYZ_123-%PO", id: 2}),
]
}), ]}));

// Greenhouses buttons
let ghABtn = Container.template($ => ({ left: 0, right: 0, top: 0, bottom: undefined,
height: 50, active: true,

behavior: Behavior({ onCreate: function(content){ this.upSkin = new Skin({ fill: "transparent", borders: {left: 0, right: 0, top: 0, bottom: 1},
stroke: "black", }); this.downSkin = new Skin({ fill: "#71e28b", borders: {left: 0, right: 0, top: 1, bottom: 1},
stroke: "black", }); content.skin = this.upSkin; }, onTouchBegan: function(content){ content.skin = this.downSkin; }, onTouchEnded: function(content){
content.skin = this.upSkin;
application.remove(ghAroundScreen);
application.remove(currentScreen);
currentScreen = new Home();
application.add(currentScreen);
application.distribute("updateState");
adjustFanIcons();
adjustNavButtons(0);
application.distribute("updateNavButtons");
if ($.id == 1) {
//application.distribute("updateInfo", 1);
} else if ($.id == 2) {
gh[1] = new greenhouseBtn({text: "Greenhouse 2", id: 2});
//application.distribute("updateInfo", 2);
greenhouseNum = 2;
currTemperature = 62;
currSunlight = 34;
currHumidity = 45;
currAirFlow = 5;
fanState = [0,0,0,0,0,0];
application.distribute("updateGhNum");
application.distribute("updateState");
application.distribute("updateFanString");
application.distribute("updateNavButtons");

} }, }), contents: [ Label($, {
top: 0, bottom: 0, left: 10, right: undefined,
style: regularW, string: $.text,
}) ]}));
Expand Down
14 changes: 14 additions & 0 deletions greener-house-app/irrigation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {name_h, naviBar_h} from "main";

// Skinslet blackSkin = new Skin ({fill: 'black'});let whiteSkin = new Skin ({fill: 'white'});
let graySkin = new Skin ({fill: '#999999'});
let greenSkin = new Skin ({fill: '#71e28b'});

// Fontsvar titleW = new Style({font: 'bold 20px', color: 'white'});
var titleB = new Style({font: 'bold 20px', color: 'black'});
var titleG = new Style({font: 'bold 20px', color: '#71e28b'});
var regularW = new Style({font: '20px', color: 'white'});
var regularB = new Style({font: '20px', color: 'black'});
var regularG = new Style({font: '20px', color: '#71e28b'});

export var IrrigationScreen = Column.template($ => ({ left: 0, right: 0, top: name_h, bottom: naviBar_h, skin: whiteSkin, contents: [ Label($, { left: 0, right: 0, top: 10, bottom: undefined, style: titleG, string: "Irrigation" }), ]}));
Expand Down
1 change: 1 addition & 0 deletions greener-house-app/keyboard.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6bcd017

Please sign in to comment.