Skip to content

Commit

Permalink
adecuacion de pantalla de estaciones
Browse files Browse the repository at this point in the history
  • Loading branch information
yhyenifer committed Apr 17, 2018
2 parents bd745a3 + 00295f8 commit 4676658
Show file tree
Hide file tree
Showing 28 changed files with 470 additions and 69 deletions.
9 changes: 4 additions & 5 deletions ATOME/config.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.ionic.starter" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>ATOME</name>
<name>AToME</name>
<description>An awesome Ionic/Cordova app.</description>
<author email="hi@ionicframework" href="http://ionicframework.com/">Yenifer H. - Mauricio Uribe</author>
<content src="index.html" />
Expand Down Expand Up @@ -81,8 +81,7 @@
<plugin name="cordova-plugin-splashscreen" spec="^5.0.2" />
<plugin name="cordova-plugin-ionic-webview" spec="^1.1.16" />
<plugin name="cordova-plugin-ionic-keyboard" spec="^2.0.5" />
<engine name="android" spec="7.0.0" />
<allow-navigation href="http://192.168.56.1:8100" />
<allow-navigation href="http://192.168.0.5:8100" />
<allow-navigation href="http://192.168.42.1:8100" />
<plugin name="cordova-plugin-bluetooth-serial" spec="^0.4.7" />
<engine name="android" spec="~7.0.0" />
<allow-navigation href="http://192.168.0.6:8100" />
</widget>
10 changes: 10 additions & 0 deletions ATOME/package-lock.json

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

5 changes: 4 additions & 1 deletion ATOME/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@
"@angular/http": "5.2.9",
"@angular/platform-browser": "5.2.9",
"@angular/platform-browser-dynamic": "5.2.9",
"@ionic-native/bluetooth-serial": "^4.7.0",
"@ionic-native/core": "4.6.0",
"@ionic-native/splash-screen": "4.6.0",
"@ionic-native/status-bar": "4.6.0",
"@ionic/pro": "1.0.20",
"@ionic/storage": "2.1.3",
"angularfire2": "^5.0.0-rc.6.0",
"cordova-android": "7.0.0",
"cordova-plugin-bluetooth-serial": "^0.4.7",
"cordova-plugin-device": "^2.0.1",
"cordova-plugin-ionic-keyboard": "^2.0.5",
"cordova-plugin-ionic-webview": "^1.2.0",
Expand All @@ -52,7 +54,8 @@
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-ionic-keyboard": {}
"cordova-plugin-ionic-keyboard": {},
"cordova-plugin-bluetooth-serial": {}
},
"platforms": [
"android"
Expand Down
Binary file modified ATOME/resources/android/splash/drawable-land-hdpi-screen.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 modified ATOME/resources/android/splash/drawable-land-ldpi-screen.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 modified ATOME/resources/android/splash/drawable-land-mdpi-screen.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 modified ATOME/resources/android/splash/drawable-land-xhdpi-screen.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 modified ATOME/resources/android/splash/drawable-land-xxhdpi-screen.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 modified ATOME/resources/android/splash/drawable-land-xxxhdpi-screen.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 modified ATOME/resources/android/splash/drawable-port-hdpi-screen.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 modified ATOME/resources/android/splash/drawable-port-ldpi-screen.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 modified ATOME/resources/android/splash/drawable-port-mdpi-screen.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 modified ATOME/resources/android/splash/drawable-port-xhdpi-screen.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 modified ATOME/resources/android/splash/drawable-port-xxhdpi-screen.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 modified ATOME/resources/android/splash/drawable-port-xxxhdpi-screen.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 modified ATOME/resources/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion ATOME/resources/splash.png.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2412a8324a656ec5993eb50b3b293c69
7e3b573755e88839777a7c5dcb54f271
25 changes: 8 additions & 17 deletions ATOME/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,12 @@ import { AngularFireModule } from 'angularfire2';
import { AngularFireDatabaseModule } from 'angularfire2/database';
import { AngularFireAuthModule } from 'angularfire2/auth';
import { AuthProvider } from '../providers/auth/auth';
import { BluetoothArduinoService } from '../services/bluetoothArduino/bluetoothArduino.service';
import { BluetoothSerial } from '@ionic-native/bluetooth-serial';

export const firebaseConfig = {
apiKey: "AIzaSyDNRoAfBGD15BUvZyw2bIWhrD57naFCoxI",
authDomain: "atome-77ef6.firebaseapp.com",
databaseURL: "https://atome-77ef6.firebaseio.com",
projectId: "atome-77ef6",
storageBucket: "",
messagingSenderId: "825006961025"
import { FIREBASE_CONFIG } from './firebase.credentials';
import { EstacionesListService } from '../services/estaciones-list/estaciones-list.service';

};

export const config = {
apiKey: "AIzaSyDUz7IJOCgsz5Zk9HBoU0cwF9z2Q229LtI",
authDomain: "tiendq-3d47a.firebaseapp.com",
databaseURL: "https://tiendq-3d47a.firebaseio.com",
storageBucket: "tiendq-3d47a.appspot.com",
messagingSenderId: "12950516640"
};


@NgModule({
Expand All @@ -40,7 +28,7 @@ export const config = {
imports: [
BrowserModule,
IonicModule.forRoot(MyApp),
AngularFireModule.initializeApp(firebaseConfig),
AngularFireModule.initializeApp(FIREBASE_CONFIG),
AngularFireDatabaseModule,
AngularFireAuthModule
],
Expand All @@ -52,6 +40,9 @@ export const config = {
providers: [
StatusBar,
SplashScreen,
BluetoothArduinoService,
BluetoothSerial,
EstacionesListService,
{provide: ErrorHandler, useClass: IonicErrorHandler},
AuthProvider,
]
Expand Down
17 changes: 17 additions & 0 deletions ATOME/src/app/firebase.credentials.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export const FIREBASE_CONFIG = {
apiKey: "AIzaSyDNRoAfBGD15BUvZyw2bIWhrD57naFCoxI",
authDomain: "atome-77ef6.firebaseapp.com",
databaseURL: "https://atome-77ef6.firebaseio.com",
projectId: "atome-77ef6",
storageBucket: "",
messagingSenderId: "825006961025"
}

// export const FIREBASE_CONFIG = {
// apiKey: "AIzaSyDUz7IJOCgsz5Zk9HBoU0cwF9z2Q229LtI",
// authDomain: "tiendq-3d47a.firebaseapp.com",
// databaseURL: "https://tiendq-3d47a.firebaseio.com",
// projectId: "tiendq-3d47a",
// storageBucket: "tiendq-3d47a.appspot.com",
// messagingSenderId: "12950516640"
// }
6 changes: 5 additions & 1 deletion ATOME/src/app/models/estacion.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
export interface Estacion {
key?: string;
nombre: string;
descripcion: string
descripcion: string;
id: string;
mac: string;
clase: string;
}
51 changes: 42 additions & 9 deletions ATOME/src/pages/crear-bitacora/crear-bitacora.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,52 @@
<ion-content padding>

<ion-item>
<ion-label>Estacion de Trabajo:<br></ion-label>
<ion-select [(ngModel)]="selectedvalue" (change)="onChange()" >
<ion-option *ngFor="let item of items | async" >
<h2> {{item.nombre}}</h2>
</ion-option>
</ion-select>
<!-- <ion-label>Estación de Trabajo: <b>xxxxx</b><br></ion-label> -->
<ion-label>Estacion de Trabajo: <b>{{device.name}}</b><br></ion-label>


</ion-item>
<ion-row>
<button ion-button><ion-icon name="bluetooth"></ion-icon></button>
<ion-row >

<button *ngIf="!isenabled" ion-button icon-end (click)="conectar(device)">
Conectar
<ion-icon name="bluetooth"></ion-icon>
</button>

<button *ngIf="isenabled" ion-button icon-end color="danger" (click)="desconectar()">
Desconectar
<ion-icon name="bluetooth"></ion-icon>
</button>



</ion-row>
<ion-row>
<ion-label>Indicaciones de la Práctica:</ion-label>

<ion-item>
<ion-textarea class="area">{{device.descripcion}}</ion-textarea>
<!-- <ion-textarea class="area">tttt</ion-textarea> -->
</ion-item>
</ion-row>
<ion-row>
<ion-item>
<ion-label>Altura: {{altura}}</ion-label>
<ion-input></ion-input>
</ion-item>
<ion-item>
<ion-label>Tiempo: {{tiempo}}</ion-label>
<ion-input></ion-input>
</ion-item>
<ion-item>
<button ion-button (click)="pedirAltura()">Obtener Altura</button>
</ion-item>
</ion-row>

<ion-fab right bottom>
<button ion-fab color="atome" (click)="iniciarPractica()"><ion-icon name="play"></ion-icon></button>
<button ion-fab color="atome" [disabled]="!isenabled" (click)="iniciarPractica()"><ion-icon name="play"></ion-icon></button>

</ion-fab>


</ion-content>
9 changes: 9 additions & 0 deletions ATOME/src/pages/crear-bitacora/crear-bitacora.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,13 @@ page-crear-bitacora {
{
color : black
}

.right{
text-align: right;
}

.area{
max-width: 98%;
}

}
129 changes: 125 additions & 4 deletions ATOME/src/pages/crear-bitacora/crear-bitacora.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams, MenuController } from 'ionic-angular';
import { IonicPage, NavController, NavParams, MenuController, Platform, AlertController } from 'ionic-angular';
import { AngularFireObject , AngularFireList } from 'angularfire2/database';
import { AngularFireDatabase } from 'angularfire2/database';
import { Observable } from 'rxjs/Observable';
import { BluetoothArduinoService } from '../../services/bluetoothArduino/bluetoothArduino.service';

/**
* Generated class for the CrearBitacoraPage page.
Expand All @@ -17,18 +18,38 @@ import { Observable } from 'rxjs/Observable';
templateUrl: 'crear-bitacora.html',
})
export class CrearBitacoraPage {
tiempo: any;
altura: any;
recibido: string = "";
mensaje: string = "";
device: any;
items: Observable<any[]>;
estadoConexion:string;
isenabled: boolean;
public selectedvalue;
constructor(public navCtrl: NavController, public navParams: NavParams,
constructor(public navCtrl: NavController,
public navParams: NavParams,
private database: AngularFireDatabase,
public menu: MenuController,
private bluetooth: BluetoothArduinoService,
private platform: Platform,
private alertCtrl: AlertController
) {
this.device = this.navParams.get('deviceConectado');
console.log('carga estaciones');
this.items = database.list('estacion').valueChanges();
console.log('selecciona');
console.log(this.selectedvalue);
}

ionViewDidEnter() {
this.device = this.navParams.get('deviceConectado');
console.log('carga');
console.log(this.device);


this.estadoConexion = "No Conectado";
this.isenabled =false;
}
menu1Active() {
this.menu.enable(true, 'menu1');
}
Expand All @@ -37,9 +58,109 @@ export class CrearBitacoraPage {
console.log(this.selectedvalue);
}

conectar(seleccion){

this.bluetooth.bluetoothSerial.isConnected().then(
isConnected => {
let alert = this.alertCtrl.create({
title: 'Reconectar',
message: '¿Desea reconectar a este dispositivo?',
buttons: [
{
text: 'Cancelar',
role: 'cancel',
handler: () => {
console.log('Cancel clicked');
}
},
{
text: 'Aceptar',
handler: () => {
this.bluetooth.desconectar();
this.bluetooth.conectar(seleccion.id).then(success => {
this.bluetooth.presentToast(success);
}, fail => {
this.bluetooth.presentToast(fail);
});
}
}
]
});
alert.present();
}, notConnected => {
let alert = this.alertCtrl.create({
title: 'Conectar',
message: '¿Desea conectar el dispositivo?',
buttons: [
{
text: 'Cancelar',
role: 'cancel',
handler: () => {
console.log('Cancel clicked');
}
},
{
text: 'Aceptar',
handler: () => {
this.bluetooth.conectar(seleccion.id).then(success => {
this.bluetooth.presentToast(success);
this.estadoConexion = "conectada";
this.isenabled = true;
this.bluetooth.mensaje = "2";
this.enviarMensajes();

}, fail => {
this.bluetooth.presentToast(fail);
});
}
}
]
});
alert.present();
});

// this.isenabled = true;
}

enviarMensajes() {
this.bluetooth.conexionMensajes = this.bluetooth.dataInOut(this.mensaje).subscribe(data => {
let entrada = data.substr(0, data.length - 1);
if (entrada != ">") {
if (entrada != "") {
this.recibido = entrada;
if(entrada.substr(0,2)==="a:"){
this.altura = entrada.substr(2,entrada.length - 1);
//this.altura = entrada.length;
}else if(entrada.substr(0,2)==="t:"){
this.tiempo = entrada.substr(2,entrada.length - 1);
}else if(entrada==="PRACTICA NO LISTA"){
//HAZ LO TUYO;
}

console.log(`Entrada: ${entrada}`);
this.bluetooth.presentToast(entrada);
}
} else {
this.bluetooth.conexionMensajes.unsubscribe();
}
this.mensaje = "";
//this.recibido = "";
});
}

desconectar(){
this.bluetooth.desconectar();

}

iniciarPractica(){
console.log('inicia la practica');

this.mensaje = "1"
this.enviarMensajes();
}
pedirAltura(){
this.mensaje = "2"
this.enviarMensajes();
}

ionViewDidLoad() {
Expand Down
Loading

0 comments on commit 4676658

Please sign in to comment.