Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First working firmware and interface
- Loading branch information
Showing
45 changed files
with
845 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { RouterModule, Routes } from '@angular/router'; | ||
|
||
import { DashboardComponent } from '../dashboard/dashboard.component'; | ||
|
||
const routes: Routes = [ | ||
{ path: '', redirectTo: '/', pathMatch: 'full' }, | ||
{ path: 'dashboard', component: DashboardComponent } | ||
]; | ||
|
||
@NgModule({ | ||
imports: [ RouterModule.forRoot(routes) ], | ||
exports: [ RouterModule ] | ||
}) | ||
export class AppRoutingModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,44 @@ | ||
<!--The content below is only a placeholder and can be replaced.--> | ||
<div style="text-align:center"> | ||
<h1> | ||
Welcome to {{title}}! | ||
</h1> | ||
<img width="300" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg=="> | ||
</div> | ||
<h2>Here are some links to help you start: </h2> | ||
<ul> | ||
<li> | ||
<h2><a target="_blank" href="https://angular.io/tutorial">Tour of Heroes</a></h2> | ||
</li> | ||
<li> | ||
<h2><a target="_blank" href="https://github.com/angular/angular-cli/wiki">CLI Documentation</a></h2> | ||
</li> | ||
<li> | ||
<h2><a target="_blank" href="https://blog.angular.io/">Angular blog</a></h2> | ||
</li> | ||
</ul> | ||
<div id="main"> | ||
<div> | ||
<mat-toolbar color="primary"> | ||
<mat-toolbar-row> | ||
<span><mat-icon>{{isConnected}}</mat-icon></span> | ||
<span>GovindaRC</span> | ||
<button mat-icon-button [matMenuTriggerFor]="menu"> | ||
<mat-icon>more_vert</mat-icon> | ||
</button> | ||
</mat-toolbar-row> | ||
</mat-toolbar> | ||
|
||
<mat-menu #menu="matMenu"> | ||
<button mat-menu-item (click)="openDialogOptions()"> | ||
<mat-icon>dialpad</mat-icon> | ||
<span>Options</span> | ||
</button> | ||
<button mat-menu-item (click)="openAbout()"> | ||
<mat-icon>info</mat-icon> | ||
<span>About</span> | ||
</button> | ||
</mat-menu> | ||
|
||
<span class="btnConnect"> | ||
<button mat-fab (click)="btnConnectClick()"> | ||
<mat-icon>autorenew</mat-icon> | ||
</button> | ||
</span> | ||
<span class="btnEye"> | ||
<button mat-fab (click)="btnEyeClick()"> | ||
<mat-icon>report problem</mat-icon> | ||
</button> | ||
</span> | ||
|
||
<div id="ultrasonic"> | ||
<div [ngClass]="{'ultrasonic-danger': ultrasonic<=15}" class="ultrasonic-content">{{ultrasonic}}</div> | ||
</div> | ||
|
||
<router-outlet></router-outlet> | ||
<app-pan-controller></app-pan-controller> | ||
|
||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,88 @@ | ||
import { Component } from '@angular/core'; | ||
import { Component, OnInit, Inject } from '@angular/core'; | ||
import { Subscription } from 'rxjs/Subscription'; | ||
import { ServerSocketService } from './server-socket.service'; | ||
import {MatDialog, MatDialogRef, MAT_DIALOG_DATA, MatSnackBarConfig, MatSnackBarModule} from '@angular/material'; | ||
import {MatSnackBar, MAT_SNACK_BAR_DATA} from '@angular/material'; | ||
import { MatChipsModule } from '@angular/material'; | ||
import { DialogOptionsComponent } from './dialog-options/dialog-options.component'; | ||
import { SnackbarComponent } from './snackbar/snackbar.component'; | ||
|
||
@Component({ | ||
selector: 'app-root', | ||
templateUrl: './app.component.html', | ||
styleUrls: ['./app.component.css'] | ||
}) | ||
export class AppComponent { | ||
title = 'app'; | ||
title = 'GovindaRC'; | ||
public ultrasonic = 0; | ||
public isConnected = 'gps_not_fixed'; | ||
public ipAddress = '18.9.70.23'; | ||
private socketSubscription: Subscription; | ||
|
||
constructor( | ||
private socket: ServerSocketService, | ||
public dialog: MatDialog, | ||
public snackbar: MatSnackBar | ||
) {} | ||
|
||
ngOnInit() { | ||
|
||
} | ||
|
||
openDialogOptions(): void { | ||
let dialogRef = this.dialog.open(DialogOptionsComponent, { | ||
width: '250px', | ||
data: { ipAddress: this.ipAddress } | ||
}); | ||
|
||
dialogRef.afterClosed().subscribe(data => { | ||
this.ipAddress = data.ipAddress; | ||
}); | ||
} | ||
|
||
openAbout(): void{ | ||
let mySnackBar = this.snackbar.open('GovindaRC App v0.1.0','OK', { | ||
duration: 15000, | ||
data: {message: 'GovindaRC App v0.1.0', action: 'OK'}, | ||
verticalPosition: 'top', | ||
horizontalPosition: 'center', | ||
panelClass: 'snackbar' | ||
}); | ||
|
||
|
||
} | ||
|
||
websocketConnect(){ | ||
this.socket.ipAddress = this.ipAddress; | ||
this.socket.connect(); | ||
this.socketSubscription = this.socket.messages.subscribe((message: string) => { | ||
try { | ||
var obj = JSON.parse(message); | ||
} catch (e) { | ||
obj = {}; | ||
} | ||
|
||
this.isConnected = 'gps_fixed'; | ||
if(obj.type == 'scan'){ | ||
this.ultrasonic = Math.round(obj.data); | ||
} | ||
}); | ||
this.socket.messages.retryWhen(errors => errors.delay(1000)).subscribe(message => { | ||
this.isConnected = 'gps_fixed'; | ||
}); | ||
this.socket.send('{"cmd": "P"}'); | ||
} | ||
|
||
ngOnDestroy() { | ||
this.socketSubscription.unsubscribe(); | ||
this.isConnected = "gps_not_fixed"; | ||
} | ||
|
||
btnConnectClick(){ | ||
this.websocketConnect(); | ||
} | ||
|
||
btnEyeClick(){ | ||
this.socket.send('{"cmd": "scan", "arg": 0}'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
div#dashboard { | ||
|
||
} |
Empty file.
25 changes: 25 additions & 0 deletions
25
GovindaRC-App/src/app/dashboard/dashboard.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { DashboardComponent } from './dashboard.component'; | ||
|
||
describe('DashboardComponent', () => { | ||
let component: DashboardComponent; | ||
let fixture: ComponentFixture<DashboardComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ DashboardComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(DashboardComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { Subscription } from 'rxjs/Subscription'; | ||
import { ServerSocketService } from '../server-socket.service'; | ||
|
||
@Component({ | ||
selector: 'app-dashboard', | ||
templateUrl: './dashboard.component.html', | ||
styleUrls: ['./dashboard.component.css'] | ||
}) | ||
export class DashboardComponent implements OnInit { | ||
private socketSubscription: Subscription; | ||
|
||
constructor(private socket: ServerSocketService) { } | ||
|
||
ngOnInit() { | ||
|
||
} | ||
|
||
|
||
} |
Oops, something went wrong.