51 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/app.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed } from '@angular/core/testing';
2 | import { AppComponent } from './app.component';
3 |
4 | describe('AppComponent', () => {
5 | beforeEach(async () => {
6 | await TestBed.configureTestingModule({
7 | imports: [AppComponent],
8 | }).compileComponents();
9 | });
10 |
11 | it('should create the app', () => {
12 | const fixture = TestBed.createComponent(AppComponent);
13 | const app = fixture.componentInstance;
14 | expect(app).toBeTruthy();
15 | });
16 |
17 | it(`should have the 'dashboard' title`, () => {
18 | const fixture = TestBed.createComponent(AppComponent);
19 | const app = fixture.componentInstance;
20 | expect(app.title).toEqual('dashboard');
21 | });
22 |
23 | it('should render title', () => {
24 | const fixture = TestBed.createComponent(AppComponent);
25 | fixture.detectChanges();
26 | const compiled = fixture.nativeElement as HTMLElement;
27 | expect(compiled.querySelector('h1')?.textContent).toContain('Hello, dashboard');
28 | });
29 | });
30 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/app.config.ts:
--------------------------------------------------------------------------------
1 | import { ApplicationConfig } from '@angular/core';
2 | import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
3 |
4 | export const appConfig: ApplicationConfig = {
5 | providers: [provideAnimationsAsync()]
6 | };
7 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/battery-level/battery-level.component.css:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC orginazers
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 |
7 | 1. Redistributions of source code must retain the above copyright notice, this
8 | list of conditions and the following disclaimer.
9 |
10 | 2. Redistributions in binary form must reproduce the above copyright notice,
11 | this list of conditions and the following disclaimer in the documentation
12 | and/or other materials provided with the distribution.
13 |
14 | 3. Neither the name of the copyright holder nor the names of its
15 | contributors may be used to endorse or promote products derived from
16 | this software without specific prior written permission.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
28 |
29 | .battery-level {
30 | width: 100%;
31 | height: 100%;
32 | position: relative;
33 | }
34 |
35 | .battery-level-body {
36 | width: 100%;
37 | height: 100%;
38 | position: relative;
39 | }
40 |
41 | .battery-level-indicator-svg {
42 | display: flex;
43 | position: absolute;
44 | width: 100%;
45 | height: 100%;
46 | }
47 |
48 | #battery-level-needle-group {
49 | mask-image: linear-gradient(to top, rgba(0, 0, 0, 1) 70%, rgba(0, 0, 0, 0) 100%);
50 | -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 1) 70%, rgba(0, 0, 0, 0) 100%);
51 | mask-size: 100% 100%;
52 | mask-repeat: no-repeat;
53 | }
54 |
55 | .battery-level-text {
56 | font-size: 25px;
57 | text-anchor: middle;
58 | fill: white;
59 | }
60 |
61 | .battery-level-unit-text {
62 | font-size: 15px;
63 | opacity: 0.5;
64 | text-anchor: middle;
65 | fill: white;
66 | }
67 |
68 | .battery-level-big-lines {
69 | stroke: rgb(188, 188, 188);
70 | stroke-width: 2px;
71 | stroke-opacity: 0.8;
72 | mask-image: linear-gradient(200deg, rgba(0, 0, 0, 0) 10%, rgba(0, 0, 0, 1) 40%);
73 | -webkit-mask-image: linear-gradient(200deg, rgba(0, 0, 0, 0) 10%, rgba(0, 0, 0, 1) 40%);
74 | mask-size: 110% 110%;
75 | mask-repeat: no-repeat;
76 | }
77 |
78 | .battery-level-small-lines {
79 | stroke: rgb(191, 191, 191);
80 | stroke-width: 1px;
81 | stroke-opacity: 0.6;
82 | mask-image: linear-gradient(200deg, rgba(0, 0, 0, 0) 10%, rgba(0, 0, 0, 1) 40%);
83 | -webkit-mask-image: linear-gradient(200deg, rgba(0, 0, 0, 0) 10%, rgba(0, 0, 0, 1) 40%);
84 | mask-size: 110% 110%;
85 | mask-repeat: no-repeat;
86 | }
87 |
88 | #battery-level-path {
89 | stroke: rgb(188, 188, 188);
90 | stroke-width: 8px;
91 | fill: transparent;
92 | stroke-linecap: round;
93 | filter: drop-shadow(-3px 3px 3px rgb(0, 0, 0, 0.5));
94 | }
95 |
96 | #battery-level-needle {
97 | position: relative;
98 | stroke: red;
99 | stroke-width: 3px;
100 | stroke-linecap: round;
101 | filter: drop-shadow(0px 0px 2px rgb(255, 0, 0, 0.8));
102 | }
103 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/battery-level/battery-level.component.html:
--------------------------------------------------------------------------------
1 |
28 |
29 |
30 |
31 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/battery-level/battery-level.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { BatteryLevelComponent } from './battery-level.component';
4 |
5 | describe('BatteryLevelComponent', () => {
6 | let component: BatteryLevelComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async () => {
10 | await TestBed.configureTestingModule({
11 | imports: [BatteryLevelComponent]
12 | })
13 | .compileComponents();
14 |
15 | fixture = TestBed.createComponent(BatteryLevelComponent);
16 | component = fixture.componentInstance;
17 | fixture.detectChanges();
18 | });
19 |
20 | it('should create', () => {
21 | expect(component).toBeTruthy();
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/car/car.component.css:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC orginazers
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 |
7 | 1. Redistributions of source code must retain the above copyright notice, this
8 | list of conditions and the following disclaimer.
9 |
10 | 2. Redistributions in binary form must reproduce the above copyright notice,
11 | this list of conditions and the following disclaimer in the documentation
12 | and/or other materials provided with the distribution.
13 |
14 | 3. Neither the name of the copyright holder nor the names of its
15 | contributors may be used to endorse or promote products derived from
16 | this software without specific prior written permission.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
28 |
29 | .car {
30 | width: 100%;
31 | height: 100%;
32 | }
33 |
34 | .car-body {
35 | display: flex;
36 | position: relative;
37 | justify-content: center;
38 | width: 100%;
39 | height: 100%;
40 | }
41 |
42 | .car-road-svg {
43 | position: absolute;
44 | width: 100%;
45 | height: 100%;
46 | }
47 |
48 | .car-road-lines {
49 | stroke: rgb(191, 191, 191);
50 | stroke-width: 3%;
51 | mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 1) 20%, rgba(0, 0, 0, 1) 80%, rgba(0, 0, 0, 0) 100%);
52 | -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 1) 20% rgba(0, 0, 0, 1) 80%, rgba(0, 0, 0, 0) 100%);
53 | mask-size: 100% 100%;
54 | mask-repeat: repeat-x;
55 | filter: drop-shadow(0 0 0.5vw rgb(0, 0, 0, 0.8));
56 | }
57 |
58 | #car-image-svg {
59 | position: absolute;
60 | top: 15%;
61 | width: 35%;
62 | height: auto;
63 | filter: drop-shadow(0 0.6vw 0.2vw rgb(0, 0, 0, 0.2));
64 | }
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/car/car.component.html:
--------------------------------------------------------------------------------
1 |
28 |
29 |
30 |
31 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/car/car.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { CarComponent } from './car.component';
4 |
5 | describe('CarComponent', () => {
6 | let component: CarComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async () => {
10 | await TestBed.configureTestingModule({
11 | imports: [CarComponent]
12 | })
13 | .compileComponents();
14 |
15 | fixture = TestBed.createComponent(CarComponent);
16 | component = fixture.componentInstance;
17 | fixture.detectChanges();
18 | });
19 |
20 | it('should create', () => {
21 | expect(component).toBeTruthy();
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/car/car.component.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC orginazers
2 | // All rights reserved.
3 |
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are met:
6 |
7 | // 1. Redistributions of source code must retain the above copyright notice, this
8 | // list of conditions and the following disclaimer.
9 |
10 | // 2. Redistributions in binary form must reproduce the above copyright notice,
11 | // this list of conditions and the following disclaimer in the documentation
12 | // and/or other materials provided with the distribution.
13 |
14 | // 3. Neither the name of the copyright holder nor the names of its
15 | // contributors may be used to endorse or promote products derived from
16 | // this software without specific prior written permission.
17 |
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
29 | import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
30 |
31 | @Component({
32 | selector: 'app-car',
33 | standalone: true,
34 | imports: [],
35 | templateUrl: './car.component.html',
36 | styleUrl: './car.component.css'
37 | })
38 | export class CarComponent implements OnChanges {
39 | @Input() position: number = 0;
40 | @Input() leftLaneOn: boolean = false;
41 | @Input() rightLaneOn: boolean = false;
42 |
43 | ngOnChanges(changes: SimpleChanges): void {
44 | if (changes['position'] || changes['leftLaneOn'] || changes['rightLaneOn']) {
45 | this.updateCar();
46 | }
47 | }
48 |
49 | updateCar(): void {
50 | const car = document.getElementById("car-image-svg") as HTMLElement;
51 | if (car) {
52 | const xTranslation = this.position * 0.70;
53 | car.style.transform = `translateX(${xTranslation}%)`;
54 |
55 | const leftLine = document.getElementById("car-road-line-left") as HTMLElement;
56 | const rightLine = document.getElementById("car-road-line-right") as HTMLElement;
57 |
58 | if (this.rightLaneOn)
59 | if (xTranslation > 55)
60 | rightLine.style.stroke = "red";
61 | else if (xTranslation > 30)
62 | rightLine.style.stroke = "orange";
63 | else
64 | rightLine.style.stroke = "green";
65 | else
66 | rightLine.style.stroke = "white";
67 |
68 | if (this.leftLaneOn)
69 | if (xTranslation < -55)
70 | leftLine.style.stroke = "red";
71 | else if (xTranslation < -30)
72 | leftLine.style.stroke = "orange";
73 | else
74 | leftLine.style.stroke = "green";
75 | else
76 | leftLine.style.stroke = "white";
77 | }
78 | }
79 | }
80 |
81 |
82 |
83 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/cluster.component.html:
--------------------------------------------------------------------------------
1 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
{{battery}}
35 |
%
36 |
37 |
38 |
{{speed}}
39 |
cm/s
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/cluster.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { ClusterComponent } from './cluster.component';
4 |
5 | describe('ClusterComponent', () => {
6 | let component: ClusterComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async () => {
10 | await TestBed.configureTestingModule({
11 | imports: [ClusterComponent]
12 | })
13 | .compileComponents();
14 |
15 | fixture = TestBed.createComponent(ClusterComponent);
16 | component = fixture.componentInstance;
17 | fixture.detectChanges();
18 | });
19 |
20 | it('should create', () => {
21 | expect(component).toBeTruthy();
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/cluster.service.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed } from '@angular/core/testing';
2 |
3 | import { ClusterService } from './cluster.service';
4 |
5 | describe('ClusterService', () => {
6 | let service: ClusterService;
7 |
8 | beforeEach(() => {
9 | TestBed.configureTestingModule({});
10 | service = TestBed.inject(ClusterService);
11 | });
12 |
13 | it('should be created', () => {
14 | expect(service).toBeTruthy();
15 | });
16 | });
17 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/cluster.service.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 | import { BehaviorSubject, combineLatest } from 'rxjs';
3 | import { map } from 'rxjs/operators';
4 | import { Platform } from '@angular/cdk/platform';
5 |
6 | @Injectable({
7 | providedIn: 'root'
8 | })
9 | export class ClusterService {
10 |
11 | constructor(private platform: Platform) {}
12 |
13 | private klSubject = new BehaviorSubject('');
14 | kl$ = this.klSubject.asObservable();
15 |
16 | private drivingModeSubject = new BehaviorSubject('');
17 | drivingMode$ = this.drivingModeSubject.asObservable();
18 |
19 | private isMobileDevice(): boolean {
20 | const userAgent = navigator.userAgent || navigator.vendor || (window as any).opera;
21 | return /android|iPad|iPhone|iPod/i.test(userAgent) && !(window as any).MSStream;
22 | }
23 |
24 | isMobileDriving$ = combineLatest([this.kl$, this.drivingMode$]).pipe(
25 | map(([kl, drivingMode]) =>
26 | kl === '30' && drivingMode === 'manual' && this.isMobileDevice()
27 | )
28 | );
29 |
30 | updateKL(value: string) {
31 | this.klSubject.next(value);
32 | }
33 |
34 | updateDrivingMode(value: string) {
35 | this.drivingModeSubject.next(value);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/hardware-data/hardware-data.component.css:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC orginazers
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 |
7 | 1. Redistributions of source code must retain the above copyright notice, this
8 | list of conditions and the following disclaimer.
9 |
10 | 2. Redistributions in binary form must reproduce the above copyright notice,
11 | this list of conditions and the following disclaimer in the documentation
12 | and/or other materials provided with the distribution.
13 |
14 | 3. Neither the name of the copyright holder nor the names of its
15 | contributors may be used to endorse or promote products derived from
16 | this software without specific prior written permission.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
28 |
29 | .hardware-data {
30 | width: 100%;
31 | height: 100%;
32 | display: flex;
33 | gap: 4%;
34 | flex-direction: row;
35 | }
36 |
37 | .hardware-data-raspberry {
38 | display: flex;
39 | flex-direction: column;
40 | width: 70%;
41 | height: 100%;
42 | }
43 |
44 | .hardware-data-nucleo {
45 | display: flex;
46 | flex-direction: column;
47 | width: 23.3%;
48 | height: 100%;
49 | }
50 |
51 | .hardware-data-raspberry-title, .hardware-data-nucleo-title {
52 | width: 100%;
53 | height: 20%;
54 | }
55 |
56 | .hardware-data-raspberry-title-text, .hardware-data-nucleo-title-text {
57 | position: relative;
58 | bottom: 25%;
59 | color: white;
60 | font-size: 0.6vw;
61 | text-align: center;
62 | }
63 |
64 | .hardware-data-raspberry-title-text {
65 | left: 3.7%;
66 | }
67 |
68 | .hardware-data-nucleo-title-text {
69 | left: 12%;
70 | }
71 |
72 | .hardware-data-raspberry-indicators, .hardware-data-nucleo-indicators {
73 | width: 100%;
74 | height: 80%;
75 | }
76 |
77 | .hardware-data-raspberry-indicators, .hardware-data-nucleo-indicators {
78 | display: flex;
79 | flex-direction: row;
80 | gap: 1%;
81 | }
82 |
83 | .cpu-temp, .cpu-usage, .memory-usage {
84 | width: 16.66%;
85 | height: 100%;
86 | }
87 |
88 | .heap-usage, .stack-usage {
89 | width: 50%;
90 | height: 100%;
91 | }
92 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/hardware-data/hardware-data.component.html:
--------------------------------------------------------------------------------
1 |
28 |
29 |
30 |
31 |
32 |
Raspberry PI
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
Nucleo
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/hardware-data/hardware-data.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { HardwareDataComponent } from './hardware-data.component';
4 |
5 | describe('HardwareDataComponent', () => {
6 | let component: HardwareDataComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async () => {
10 | await TestBed.configureTestingModule({
11 | imports: [HardwareDataComponent]
12 | })
13 | .compileComponents();
14 |
15 | fixture = TestBed.createComponent(HardwareDataComponent);
16 | component = fixture.componentInstance;
17 | fixture.detectChanges();
18 | });
19 |
20 | it('should create', () => {
21 | expect(component).toBeTruthy();
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/hardware-data/indicator/indicator.component.css:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC orginazers
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 |
7 | 1. Redistributions of source code must retain the above copyright notice, this
8 | list of conditions and the following disclaimer.
9 |
10 | 2. Redistributions in binary form must reproduce the above copyright notice,
11 | this list of conditions and the following disclaimer in the documentation
12 | and/or other materials provided with the distribution.
13 |
14 | 3. Neither the name of the copyright holder nor the names of its
15 | contributors may be used to endorse or promote products derived from
16 | this software without specific prior written permission.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
28 |
29 | .indicator {
30 | display: flex;
31 | flex-direction: row;
32 | width: 100%;
33 | height: 100%;
34 | gap: 10%;
35 | }
36 |
37 | .indicator-slider {
38 | width: 30%;
39 | height: 85%;
40 | background-color: rgba(0, 0, 0, 0.363);
41 | }
42 |
43 | .indicator-slider-value {
44 | position: relative;
45 | top: 100%;
46 | transform: rotatex(180deg);
47 | transform-origin: top;
48 | background-color: rgb(81, 180, 81);
49 | }
50 |
51 | .indicator-text {
52 | display: flex;
53 | flex-direction: column;
54 | position: relative;
55 | width: 50%;
56 | height: 100%;
57 | }
58 |
59 | .indicator-text label {
60 | position: absolute;
61 | font-size: 0.6vw;
62 | right: 0%;
63 | transition: opacity 0.2s;
64 | }
65 |
66 | .indicator-text-max-value {
67 | top: 0%;
68 | }
69 |
70 | .indicator-text-min-value {
71 | bottom: 15%;
72 | }
73 |
74 | .indicator-text-indicator {
75 | bottom: 0%;
76 | }
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/hardware-data/indicator/indicator.component.html:
--------------------------------------------------------------------------------
1 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/hardware-data/indicator/indicator.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { IndicatorComponent } from './indicator.component';
4 |
5 | describe('IndicatorComponent', () => {
6 | let component: IndicatorComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async () => {
10 | await TestBed.configureTestingModule({
11 | imports: [IndicatorComponent]
12 | })
13 | .compileComponents();
14 |
15 | fixture = TestBed.createComponent(IndicatorComponent);
16 | component = fixture.componentInstance;
17 | fixture.detectChanges();
18 | });
19 |
20 | it('should create', () => {
21 | expect(component).toBeTruthy();
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/hardware-data/indicator/indicator.component.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC orginazers
2 | // All rights reserved.
3 |
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are met:
6 |
7 | // 1. Redistributions of source code must retain the above copyright notice, this
8 | // list of conditions and the following disclaimer.
9 |
10 | // 2. Redistributions in binary form must reproduce the above copyright notice,
11 | // this list of conditions and the following disclaimer in the documentation
12 | // and/or other materials provided with the distribution.
13 |
14 | // 3. Neither the name of the copyright holder nor the names of its
15 | // contributors may be used to endorse or promote products derived from
16 | // this software without specific prior written permission.
17 |
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
29 | import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
30 |
31 | @Component({
32 | selector: 'app-indicator',
33 | standalone: true,
34 | imports: [],
35 | templateUrl: './indicator.component.html',
36 | styleUrl: './indicator.component.css'
37 | })
38 | export class IndicatorComponent implements OnChanges {
39 | @Input() value: number | undefined;
40 | @Input() minValue: number = 0;
41 | @Input() maxValue: number = 100;
42 | @Input() title: string = "";
43 | @Input() titleOffset: number = 0;
44 | @Input() symbol: string = "";
45 | public valuePos: number = 0;
46 | public maxValueOpacity: number = 1;
47 | public minValueOpacity: number = 1;
48 |
49 | ngOnChanges(changes: SimpleChanges): void {
50 | if (changes['value']) {
51 | this.update();
52 | }
53 | }
54 |
55 | update(): void {
56 | if (this.value) {
57 | const currentValue = this.value * 100 / this.maxValue;
58 | this.valuePos = 80 - (currentValue * 0.85); // * 0.85 because we use only 85%
59 |
60 | if (this.valuePos >= 74) {
61 | this.valuePos = 74;
62 | }
63 |
64 | if (this.valuePos <= 0) {
65 | this.valuePos = 0;
66 | }
67 |
68 | if (this.valuePos <= 16) {
69 | this.maxValueOpacity = 0;
70 | }
71 | else {
72 | this.maxValueOpacity = 1;
73 | }
74 |
75 | if (this.valuePos >= 59) {
76 | this.minValueOpacity = 0;
77 | }
78 | else {
79 | this.minValueOpacity = 1;
80 | }
81 | }
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/instant-consumption/instant-consumption.component.html:
--------------------------------------------------------------------------------
1 |
28 |
29 |
30 |
31 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/instant-consumption/instant-consumption.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { InstantConsumptionComponent } from './instant-consumption.component';
4 |
5 | describe('InstantConsumptionComponent', () => {
6 | let component: InstantConsumptionComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async () => {
10 | await TestBed.configureTestingModule({
11 | imports: [InstantConsumptionComponent]
12 | })
13 | .compileComponents();
14 |
15 | fixture = TestBed.createComponent(InstantConsumptionComponent);
16 | component = fixture.componentInstance;
17 | fixture.detectChanges();
18 | });
19 |
20 | it('should create', () => {
21 | expect(component).toBeTruthy();
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/kl-switch/kl-switch.component.css:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC orginazers
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 |
7 | 1. Redistributions of source code must retain the above copyright notice, this
8 | list of conditions and the following disclaimer.
9 |
10 | 2. Redistributions in binary form must reproduce the above copyright notice,
11 | this list of conditions and the following disclaimer in the documentation
12 | and/or other materials provided with the distribution.
13 |
14 | 3. Neither the name of the copyright holder nor the names of its
15 | contributors may be used to endorse or promote products derived from
16 | this software without specific prior written permission.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
28 |
29 | .kl-switch {
30 | width: 100%;
31 | height: 100%;
32 | position: relative;
33 | display: flex;
34 | flex-direction: column;
35 | gap: 5%;
36 | }
37 |
38 | .kl-switch-text {
39 | color: white;
40 | opacity: 0.8;
41 | font-size: 0.6vw;
42 | }
43 |
44 | .kl-switch-body {
45 | width: 100%;
46 | height: 100%;
47 | display: flex;
48 | position: relative;
49 | font-family: Arial, sans-serif;
50 | overflow: hidden;
51 | background-color: rgba(21, 23, 24, 0.3);
52 | border-radius: 0.3vw;
53 | filter: drop-shadow(0 0 0.3vw rgb(0, 0, 0, 0.2));
54 | }
55 |
56 | .kl-switch-body input[type="radio"] {
57 | display: none;
58 | }
59 |
60 | .kl-switch-body label {
61 | width: 100%;
62 | height: 100%;
63 | display: flex;
64 | position: relative;
65 | user-select: none;
66 | z-index: 1;
67 | justify-content: center;
68 | align-items: center;
69 | font-size: 0.9vw;
70 | text-shadow: 0 0 0.3vw rgba(0, 0, 0, 1);
71 | }
72 |
73 | .kl-switch-body .slide {
74 | position: absolute;
75 | width: 100%;
76 | height: 100%;
77 | top: 0;
78 | left: 0;
79 | background-color: #2b8fd1;
80 | transition: left 0.3s ease-in-out;
81 | z-index: 0;
82 | border-radius: 0.3vw;
83 | filter: drop-shadow(0 0 0.3vw rgb(0, 0, 0, 0.4));
84 | }
85 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/kl-switch/kl-switch.component.html:
--------------------------------------------------------------------------------
1 |
28 |
29 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/kl-switch/kl-switch.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { KlSwitchComponent } from './kl-switch.component';
4 |
5 | describe('KlSwitchComponent', () => {
6 | let component: KlSwitchComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async () => {
10 | await TestBed.configureTestingModule({
11 | imports: [KlSwitchComponent]
12 | })
13 | .compileComponents();
14 |
15 | fixture = TestBed.createComponent(KlSwitchComponent);
16 | component = fixture.componentInstance;
17 | fixture.detectChanges();
18 | });
19 |
20 | it('should create', () => {
21 | expect(component).toBeTruthy();
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/live-camera/live-camera.component.css:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC orginazers
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 |
7 | 1. Redistributions of source code must retain the above copyright notice, this
8 | list of conditions and the following disclaimer.
9 |
10 | 2. Redistributions in binary form must reproduce the above copyright notice,
11 | this list of conditions and the following disclaimer in the documentation
12 | and/or other materials provided with the distribution.
13 |
14 | 3. Neither the name of the copyright holder nor the names of its
15 | contributors may be used to endorse or promote products derived from
16 | this software without specific prior written permission.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
28 |
29 | .image-container {
30 | width: 100%;
31 | height: auto;
32 | position: relative;
33 | }
34 |
35 | .scaled-image {
36 | width: 100%;
37 | height: auto;
38 | position: relative;
39 | object-fit: cover;
40 | border: 0.2vw solid rgb(188, 188, 188);
41 | filter: drop-shadow(0 0 0.3vw rgb(0, 0, 0, 0.5))
42 | }
43 |
44 | .loader {
45 | width: 10.93%;
46 | height: 20%;
47 | position: absolute;
48 | top: 40%;
49 | left: 45%;
50 |
51 | border: 0.2vw solid rgb(188, 188, 188);
52 | border-bottom-color: transparent;
53 | border-radius: 50%;
54 | box-sizing: border-box;
55 | animation: rotation 2s linear infinite;
56 | }
57 |
58 | @keyframes rotation {
59 | 0% {
60 | transform: rotate(0deg);
61 | }
62 | 100% {
63 | transform: rotate(360deg);
64 | }
65 | }
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/live-camera/live-camera.component.html:
--------------------------------------------------------------------------------
1 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/live-camera/live-camera.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { LiveCameraComponent } from './live-camera.component';
4 |
5 | describe('LiveCameraComponent', () => {
6 | let component: LiveCameraComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async () => {
10 | await TestBed.configureTestingModule({
11 | imports: [LiveCameraComponent]
12 | })
13 | .compileComponents();
14 |
15 | fixture = TestBed.createComponent(LiveCameraComponent);
16 | component = fixture.componentInstance;
17 | fixture.detectChanges();
18 | });
19 |
20 | it('should create', () => {
21 | expect(component).toBeTruthy();
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/live-camera/live-camera.component.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC orginazers
2 | // All rights reserved.
3 |
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are met:
6 |
7 | // 1. Redistributions of source code must retain the above copyright notice, this
8 | // list of conditions and the following disclaimer.
9 |
10 | // 2. Redistributions in binary form must reproduce the above copyright notice,
11 | // this list of conditions and the following disclaimer in the documentation
12 | // and/or other materials provided with the distribution.
13 |
14 | // 3. Neither the name of the copyright holder nor the names of its
15 | // contributors may be used to endorse or promote products derived from
16 | // this software without specific prior written permission.
17 |
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
29 | import { CommonModule } from '@angular/common';
30 | import { Component } from '@angular/core';
31 | import { Subscription } from 'rxjs';
32 | import { WebSocketService} from '../../webSocket/web-socket.service'
33 |
34 | @Component({
35 | selector: 'app-live-camera',
36 | standalone: true,
37 | imports: [CommonModule],
38 | templateUrl: './live-camera.component.html',
39 | styleUrl: './live-camera.component.css'
40 | })
41 | export class LiveCameraComponent {
42 | public image: string | undefined;
43 | public loading: boolean = true;
44 | private canvasSize: number[] = [512, 270];
45 | private cameraSubscription: Subscription | undefined;
46 |
47 | constructor( private webSocketService: WebSocketService) { }
48 |
49 | ngOnInit()
50 | {
51 | this.image = this.createBlackImage();
52 |
53 | this.cameraSubscription = this.webSocketService.receiveCamera().subscribe(
54 | (message) => {
55 | this.image = `data:image/png;base64,${message.value}`;
56 | this.loading = false;
57 | },
58 | (error) => {
59 | this.image = this.createBlackImage();
60 | this.loading = true;
61 | console.error('Error receiving disk usage:', error);
62 | }
63 | );
64 | }
65 |
66 | ngOnDestroy() {
67 | if (this.cameraSubscription) {
68 | this.cameraSubscription.unsubscribe();
69 | }
70 | this.webSocketService.disconnectSocket();
71 | }
72 |
73 | createBlackImage(): string {
74 | const canvas = document.createElement('canvas');
75 | canvas.width = this.canvasSize[0];
76 | canvas.height = this.canvasSize[1];
77 | const ctx = canvas.getContext('2d');
78 | if (ctx) {
79 | ctx.fillStyle = 'black';
80 | ctx.fillRect(0, 0, canvas.width, canvas.height);
81 | }
82 | return canvas.toDataURL('image/png');
83 | };
84 | }
85 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/map/map-cursor/map-cursor.component.css:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC orginazers
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 |
7 | 1. Redistributions of source code must retain the above copyright notice, this
8 | list of conditions and the following disclaimer.
9 |
10 | 2. Redistributions in binary form must reproduce the above copyright notice,
11 | this list of conditions and the following disclaimer in the documentation
12 | and/or other materials provided with the distribution.
13 |
14 | 3. Neither the name of the copyright holder nor the names of its
15 | contributors may be used to endorse or promote products derived from
16 | this software without specific prior written permission.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
28 |
29 | #map-cursor-arrow {
30 | width: 100%;
31 | height: 100%;
32 | }
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/map/map-cursor/map-cursor.component.html:
--------------------------------------------------------------------------------
1 |
28 |
29 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/map/map-cursor/map-cursor.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { MapCursorComponent } from './map-cursor.component';
4 |
5 | describe('MapCursorComponent', () => {
6 | let component: MapCursorComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async () => {
10 | await TestBed.configureTestingModule({
11 | imports: [MapCursorComponent]
12 | })
13 | .compileComponents();
14 |
15 | fixture = TestBed.createComponent(MapCursorComponent);
16 | component = fixture.componentInstance;
17 | fixture.detectChanges();
18 | });
19 |
20 | it('should create', () => {
21 | expect(component).toBeTruthy();
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/map/map-cursor/map-cursor.component.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC orginazers
2 | // All rights reserved.
3 |
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are met:
6 |
7 | // 1. Redistributions of source code must retain the above copyright notice, this
8 | // list of conditions and the following disclaimer.
9 |
10 | // 2. Redistributions in binary form must reproduce the above copyright notice,
11 | // this list of conditions and the following disclaimer in the documentation
12 | // and/or other materials provided with the distribution.
13 |
14 | // 3. Neither the name of the copyright holder nor the names of its
15 | // contributors may be used to endorse or promote products derived from
16 | // this software without specific prior written permission.
17 |
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
29 | import { Component, Input, OnChanges, SimpleChanges, Output, EventEmitter } from '@angular/core';
30 |
31 | @Component({
32 | selector: 'app-map-cursor',
33 | standalone: true,
34 | imports: [],
35 | templateUrl: './map-cursor.component.html',
36 | styleUrl: './map-cursor.component.css'
37 | })
38 | export class MapCursorComponent implements OnChanges {
39 | @Input() cursorRotation: number = 0;
40 | @Output() cursorLoaded = new EventEmitter();
41 |
42 | ngOnInit(): void {
43 | this.cursorLoaded.emit();
44 | }
45 |
46 | ngOnChanges(changes: SimpleChanges): void {
47 | if (changes['cursorRotation']) {
48 | this.updateRotation();
49 | }
50 | }
51 |
52 | updateRotation(): void {
53 | const cursor = document.getElementById("map-cursor-arrow") as HTMLElement;
54 | if (cursor) {
55 | cursor.style.transform = `rotate(${this.cursorRotation}deg)`;
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/map/map-semaphore/map-semaphore.component.css:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC orginazers
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 |
7 | 1. Redistributions of source code must retain the above copyright notice, this
8 | list of conditions and the following disclaimer.
9 |
10 | 2. Redistributions in binary form must reproduce the above copyright notice,
11 | this list of conditions and the following disclaimer in the documentation
12 | and/or other materials provided with the distribution.
13 |
14 | 3. Neither the name of the copyright holder nor the names of its
15 | contributors may be used to endorse or promote products derived from
16 | this software without specific prior written permission.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
28 |
29 | .semaphore {
30 | width: 100%;
31 | height: 100%;
32 | }
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/map/map-semaphore/map-semaphore.component.html:
--------------------------------------------------------------------------------
1 |
28 |
29 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/map/map-semaphore/map-semaphore.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { MapSemaphoreComponent } from './map-semaphore.component';
4 |
5 | describe('MapSemaphoreComponent', () => {
6 | let component: MapSemaphoreComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async () => {
10 | await TestBed.configureTestingModule({
11 | imports: [MapSemaphoreComponent]
12 | })
13 | .compileComponents();
14 |
15 | fixture = TestBed.createComponent(MapSemaphoreComponent);
16 | component = fixture.componentInstance;
17 | fixture.detectChanges();
18 | });
19 |
20 | it('should create', () => {
21 | expect(component).toBeTruthy();
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/map/map-semaphore/map-semaphore.component.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC orginazers
2 | // All rights reserved.
3 |
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are met:
6 |
7 | // 1. Redistributions of source code must retain the above copyright notice, this
8 | // list of conditions and the following disclaimer.
9 |
10 | // 2. Redistributions in binary form must reproduce the above copyright notice,
11 | // this list of conditions and the following disclaimer in the documentation
12 | // and/or other materials provided with the distribution.
13 |
14 | // 3. Neither the name of the copyright holder nor the names of its
15 | // contributors may be used to endorse or promote products derived from
16 | // this software without specific prior written permission.
17 |
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
29 | import { Component, Input, OnChanges, SimpleChanges, Output, EventEmitter } from '@angular/core';
30 |
31 | @Component({
32 | selector: 'app-map-semaphore',
33 | standalone: true,
34 | imports: [],
35 | templateUrl: './map-semaphore.component.html',
36 | styleUrl: './map-semaphore.component.css'
37 | })
38 | export class MapSemaphoreComponent implements OnChanges {
39 | @Input() state: string = '';
40 | @Output() semaphoreLoaded = new EventEmitter();
41 |
42 | public imagePath = "/assets/all-colors-light.svg"
43 |
44 | ngOnInit(): void {
45 | this.semaphoreLoaded.emit();
46 | }
47 |
48 | ngOnChanges(changes: SimpleChanges): void {
49 | if (changes['state']) {
50 | this.updateState();
51 | }
52 | }
53 |
54 | updateState(): void {
55 | if (this.state == "green") {
56 | this.imagePath = "/assets/green-light.svg";
57 | }
58 | else if (this.state == "yellow") {
59 | this.imagePath = "/assets/yellow-light.svg";
60 | }
61 | else if (this.state == "red") {
62 | this.imagePath = "/assets/red-light.svg";
63 | }
64 | else {
65 | this.imagePath = "/assets/all-colors-light.svg";
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/map/map.component.css:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC orginazers
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 |
7 | 1. Redistributions of source code must retain the above copyright notice, this
8 | list of conditions and the following disclaimer.
9 |
10 | 2. Redistributions in binary form must reproduce the above copyright notice,
11 | this list of conditions and the following disclaimer in the documentation
12 | and/or other materials provided with the distribution.
13 |
14 | 3. Neither the name of the copyright holder nor the names of its
15 | contributors may be used to endorse or promote products derived from
16 | this software without specific prior written permission.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
28 |
29 | .map-container {
30 | display: flex;
31 | position: relative;
32 | justify-content: center;
33 | align-items: center;
34 | width: 100%;
35 | height: 100%;
36 | }
37 |
38 | .map-track-container {
39 | display: flex;
40 | position: relative;
41 | justify-content: center;
42 | align-items: center;
43 | width: 100%;
44 | height: 100%;
45 | overflow: hidden;
46 | mask-image: radial-gradient(closest-side, rgba(0, 0, 0, 1) 60%, rgba(0, 0, 0, 0) 90%);
47 | -webkit-mask-image: radial-gradient(closest-side, rgba(0, 0, 0, 1) 60%, rgba(0, 0, 0, 0) 90%);
48 | mask-size: 100% 100%;
49 | mask-repeat: no-repeat;
50 | mask-position: center;
51 | -webkit-mask-size: 100% 100%;
52 | -webkit-mask-repeat: no-repeat;
53 | -webkit-mask-position: center;
54 | }
55 |
56 | #map-track-image-container {
57 | display: flex;
58 | position: relative;
59 | }
60 |
61 | #map-track-image {
62 | position: absolute;
63 | }
64 |
65 | #map-cursor {
66 | position: absolute;
67 | filter: drop-shadow(0 0 0.5vw rgba(0, 0, 0, 0.5));
68 | }
69 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/map/map.component.html:
--------------------------------------------------------------------------------
1 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/map/map.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { MapComponent } from './map.component';
4 |
5 | describe('MapComponent', () => {
6 | let component: MapComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async () => {
10 | await TestBed.configureTestingModule({
11 | imports: [MapComponent]
12 | })
13 | .compileComponents();
14 |
15 | fixture = TestBed.createComponent(MapComponent);
16 | component = fixture.componentInstance;
17 | fixture.detectChanges();
18 | });
19 |
20 | it('should create', () => {
21 | expect(component).toBeTruthy();
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/record/record.component.css:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC orginazers
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 |
7 | 1. Redistributions of source code must retain the above copyright notice, this
8 | list of conditions and the following disclaimer.
9 |
10 | 2. Redistributions in binary form must reproduce the above copyright notice,
11 | this list of conditions and the following disclaimer in the documentation
12 | and/or other materials provided with the distribution.
13 |
14 | 3. Neither the name of the copyright holder nor the names of its
15 | contributors may be used to endorse or promote products derived from
16 | this software without specific prior written permission.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
28 |
29 | .record-container {
30 | width: 100%;
31 | height: 100%;
32 | }
33 |
34 | .record-button {
35 | width: 100%;
36 | height: 100%;
37 | background-color: #d9534f;
38 | z-index: 10;
39 | border-radius: 0.3vw;
40 | color: white;
41 | font-size: 0.9vw;
42 | text-shadow: 0 0 0.3vw rgba(0, 0, 0, 1);
43 | filter: drop-shadow(0 0 0.3vw rgb(0, 0, 0, 0.3));
44 | user-select: none;
45 | text-align: center;
46 | text-decoration: none;
47 | -webkit-user-select: none;
48 | border: none;
49 | }
50 |
51 | .record-button:hover {
52 | opacity: 85%;
53 | }
54 |
55 | .record-button:active {
56 | opacity: 70%;
57 | }
58 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/record/record.component.html:
--------------------------------------------------------------------------------
1 |
28 |
29 |
30 |
33 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/record/record.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { RecordComponent } from './record.component';
4 |
5 | describe('RecordComponent', () => {
6 | let component: RecordComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async () => {
10 | await TestBed.configureTestingModule({
11 | imports: [RecordComponent]
12 | })
13 | .compileComponents();
14 |
15 | fixture = TestBed.createComponent(RecordComponent);
16 | component = fixture.componentInstance;
17 | fixture.detectChanges();
18 | });
19 |
20 | it('should create', () => {
21 | expect(component).toBeTruthy();
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/record/record.component.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC orginazers
2 | // All rights reserved.
3 |
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are met:
6 |
7 | // 1. Redistributions of source code must retain the above copyright notice, this
8 | // list of conditions and the following disclaimer.
9 |
10 | // 2. Redistributions in binary form must reproduce the above copyright notice,
11 | // this list of conditions and the following disclaimer in the documentation
12 | // and/or other materials provided with the distribution.
13 |
14 | // 3. Neither the name of the copyright holder nor the names of its
15 | // contributors may be used to endorse or promote products derived from
16 | // this software without specific prior written permission.
17 |
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
29 | import { WebSocketService } from './../../webSocket/web-socket.service';
30 | import { Component } from '@angular/core';
31 | import { CommonModule } from '@angular/common'
32 |
33 | @Component({
34 | selector: 'app-record',
35 | standalone: true,
36 | imports: [CommonModule],
37 | templateUrl: './record.component.html',
38 | styleUrl: './record.component.css'
39 | })
40 | export class RecordComponent {
41 | recording: boolean = false;
42 | text: string = "start record"
43 |
44 | constructor( private webSocketService: WebSocketService) { }
45 |
46 | changeState() {
47 | if (this.recording == false) {
48 | this.recording = true;
49 | this.text = "stop record"
50 | }
51 | else {
52 | this.recording = false;
53 | this.text = "start record"
54 | }
55 |
56 | this.webSocketService.sendMessageToFlask(`{"Name": "Record", "Value": "${this.recording}"}`);
57 | }
58 |
59 | getButtonColor() {
60 | if (this.recording === true) {
61 | return "#5cb85c";
62 | }
63 |
64 | return "#d9534f";
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/side-marker/side-marker.component.css:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC orginazers
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 |
7 | 1. Redistributions of source code must retain the above copyright notice, this
8 | list of conditions and the following disclaimer.
9 |
10 | 2. Redistributions in binary form must reproduce the above copyright notice,
11 | this list of conditions and the following disclaimer in the documentation
12 | and/or other materials provided with the distribution.
13 |
14 | 3. Neither the name of the copyright holder nor the names of its
15 | contributors may be used to endorse or promote products derived from
16 | this software without specific prior written permission.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
28 |
29 | .side-marker-body {
30 | width: 100%;
31 | height: 100%;
32 | position: absolute;
33 | }
34 |
35 | .side-marker-right, .side-marker-right-background, .side-marker-left, .side-marker-left-background {
36 | width: 10%;
37 | height: auto;
38 | }
39 |
40 | .side-marker-left, .side-marker-left-background {
41 | position: absolute;
42 | left: 0%;
43 | }
44 |
45 | .side-marker-right, .side-marker-right-background {
46 | position: absolute;
47 | left: 90%;
48 | }
49 |
50 | .side-marker-left, .side-marker-right {
51 | animation: pulse 1.5s infinite ease-in-out;
52 | }
53 |
54 | .side-marker-left-background, .side-marker-right-background {
55 | opacity: 0.3;
56 | }
57 |
58 | @keyframes pulse {
59 | 0% {
60 | opacity: 0;
61 | }
62 | 50% {
63 | opacity: 1;
64 | }
65 | 100% {
66 | opacity: 0;
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/side-marker/side-marker.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { SideMarkerComponent } from './side-marker.component';
4 |
5 | describe('SideMarkerComponent', () => {
6 | let component: SideMarkerComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async () => {
10 | await TestBed.configureTestingModule({
11 | imports: [SideMarkerComponent]
12 | })
13 | .compileComponents();
14 |
15 | fixture = TestBed.createComponent(SideMarkerComponent);
16 | component = fixture.componentInstance;
17 | fixture.detectChanges();
18 | });
19 |
20 | it('should create', () => {
21 | expect(component).toBeTruthy();
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/side-marker/side-marker.component.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC orginazers
2 | // All rights reserved.
3 |
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are met:
6 |
7 | // 1. Redistributions of source code must retain the above copyright notice, this
8 | // list of conditions and the following disclaimer.
9 |
10 | // 2. Redistributions in binary form must reproduce the above copyright notice,
11 | // this list of conditions and the following disclaimer in the documentation
12 | // and/or other materials provided with the distribution.
13 |
14 | // 3. Neither the name of the copyright holder nor the names of its
15 | // contributors may be used to endorse or promote products derived from
16 | // this software without specific prior written permission.
17 |
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
29 | import { Component } from '@angular/core';
30 | import { CommonModule } from '@angular/common';
31 | import { Subscription } from 'rxjs';
32 | import { WebSocketService} from '../../webSocket/web-socket.service'
33 |
34 |
35 | @Component({
36 | selector: 'app-side-marker',
37 | standalone: true,
38 | imports: [CommonModule],
39 | templateUrl: './side-marker.component.html',
40 | styleUrl: './side-marker.component.css'
41 | })
42 | export class SideMarkerComponent {
43 | public enableLeft: boolean = false;
44 | public enableRight: boolean = false;
45 | private steerSubscription: Subscription | undefined;
46 |
47 | constructor( private webSocketService: WebSocketService) { }
48 |
49 | ngOnInit()
50 | {
51 | // Listen for steer
52 | this.steerSubscription = this.webSocketService.receiveCurrentSteer().subscribe(
53 | (message) => {
54 | const angle = message.value / 10;
55 |
56 | if (angle > 15) {
57 | this.enableLeft = false;
58 | this.enableRight = true;
59 | }
60 | else if (angle < -15) {
61 | this.enableLeft = true;
62 | this.enableRight = false;
63 | }
64 | else {
65 | this.enableLeft = false;
66 | this.enableRight = false;
67 | }
68 | },
69 | (error) => {
70 | console.error('Error receiving disk usage:', error);
71 | }
72 | );
73 | }
74 |
75 | ngOnDestroy() {
76 | if (this.steerSubscription) {
77 | this.steerSubscription.unsubscribe();
78 | }
79 | this.webSocketService.disconnectSocket();
80 | }
81 | }
82 |
83 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/speedometer/speedometer.component.css:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC orginazers
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 |
7 | 1. Redistributions of source code must retain the above copyright notice, this
8 | list of conditions and the following disclaimer.
9 |
10 | 2. Redistributions in binary form must reproduce the above copyright notice,
11 | this list of conditions and the following disclaimer in the documentation
12 | and/or other materials provided with the distribution.
13 |
14 | 3. Neither the name of the copyright holder nor the names of its
15 | contributors may be used to endorse or promote products derived from
16 | this software without specific prior written permission.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
28 |
29 | .speedometer {
30 | width: 100%;
31 | height: 100%;
32 | position: relative;
33 | }
34 |
35 | .speedometer-body {
36 | width: 100%;
37 | height: 100%;
38 | position: relative;
39 | }
40 |
41 | .speedometer-indicator-svg {
42 | display: flex;
43 | position: absolute;
44 | width: 100%;
45 | height: 100%;
46 | }
47 |
48 | #speedometer-needle-group {
49 | mask-image: linear-gradient(to top, rgba(0, 0, 0, 1) 70%, rgba(0, 0, 0, 0) 100%);
50 | -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 1) 70%, rgba(0, 0, 0, 0) 100%);
51 | mask-size: 100% 100%;
52 | mask-repeat: no-repeat;
53 | }
54 |
55 | .speedometer-text {
56 | font-size: 25px;
57 | text-anchor: middle;
58 | fill: white;
59 | }
60 |
61 | .speedometer-unit-text {
62 | font-size: 15px;
63 | opacity: 0.5;
64 | text-anchor: middle;
65 | fill: white;
66 | }
67 |
68 | .speedometer-big-lines {
69 | stroke: rgb(188, 188, 188);
70 | stroke-width: 2px;
71 | stroke-opacity: 0.9;
72 | mask-image: linear-gradient(110deg, rgba(0, 0, 0, 0) 10%, rgba(0, 0, 0, 1) 40%);
73 | -webkit-mask-image: linear-gradient(110deg, rgba(0, 0, 0, 0) 10%, rgba(0, 0, 0, 1) 40%);
74 | mask-size: 110% 110%;
75 | mask-repeat: no-repeat;
76 | }
77 |
78 | .speedometer-small-lines {
79 | stroke: rgb(191, 191, 191);
80 | stroke-width: 1px;
81 | stroke-opacity: 0.6;
82 | mask-image: linear-gradient(110deg, rgba(0, 0, 0, 0) 10%, rgba(0, 0, 0, 1) 40%);
83 | -webkit-mask-image: linear-gradient(110deg, rgba(0, 0, 0, 0) 10%, rgba(0, 0, 0, 1) 40%);
84 | mask-size: 110% 110%;
85 | mask-repeat: no-repeat;
86 | }
87 |
88 | #speedometer-path {
89 | stroke: rgb(188, 188, 188);
90 | stroke-width: 8px;
91 | fill: transparent;
92 | stroke-linecap: round;
93 | filter: drop-shadow(3px 3px 3px rgb(0, 0, 0, 0.5));
94 | }
95 |
96 | #speedometer-needle {
97 | position: relative;
98 | stroke: red;
99 | stroke-width: 3px;
100 | stroke-linecap: round;
101 | filter: drop-shadow(0px 0px 2px rgb(255, 0, 0, 0.8));
102 | }
103 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/speedometer/speedometer.component.html:
--------------------------------------------------------------------------------
1 |
28 |
29 |
68 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/state-switch/state-switch.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { StateSwitchComponent } from './state-switch.component';
4 |
5 | describe('StateSwitchComponent', () => {
6 | let component: StateSwitchComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async () => {
10 | await TestBed.configureTestingModule({
11 | imports: [StateSwitchComponent]
12 | })
13 | .compileComponents();
14 |
15 | fixture = TestBed.createComponent(StateSwitchComponent);
16 | component = fixture.componentInstance;
17 | fixture.detectChanges();
18 | });
19 |
20 | it('should create', () => {
21 | expect(component).toBeTruthy();
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/steering/steering.component.css:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC orginazers
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 |
7 | 1. Redistributions of source code must retain the above copyright notice, this
8 | list of conditions and the following disclaimer.
9 |
10 | 2. Redistributions in binary form must reproduce the above copyright notice,
11 | this list of conditions and the following disclaimer in the documentation
12 | and/or other materials provided with the distribution.
13 |
14 | 3. Neither the name of the copyright holder nor the names of its
15 | contributors may be used to endorse or promote products derived from
16 | this software without specific prior written permission.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
28 |
29 | .steering-container {
30 | width: 100%;
31 | height: 100%;
32 | position: relative;
33 | }
34 |
35 | #steering-slider {
36 | position: absolute;
37 | width: 100%;
38 | height: 100%;
39 | -webkit-appearance: none;
40 | appearance: none;
41 | background: transparent;
42 | }
43 |
44 | #steering-slider::-webkit-slider-runnable-track {
45 | background: rgb(188, 188, 188);
46 | border-radius: 0.25vw;
47 | box-shadow: 0 0 1vw #00000057;
48 | height: 50%;
49 | }
50 |
51 | #steering-slider::-moz-range-track {
52 | background: rgb(188, 188, 188);
53 | height: 70%;
54 | }
55 |
56 | #steering-slider::-webkit-slider-thumb {
57 | -webkit-appearance: none;
58 | appearance: none;
59 | width: 10%;
60 | height: 100%;
61 | border-radius: 0.25vw;
62 | background-color: red;
63 | }
64 |
65 | #steering-slider::-moz-range-thumb {
66 | width: 10%;
67 | height: 100%;
68 | border-radius: 0.25vw;
69 | background-color: red;
70 | }
71 |
72 | .steering-container label {
73 | position: absolute;
74 | top: 100%;
75 | left: 0;
76 | width: 100%;
77 | height: 100%;
78 | display: flex;
79 | justify-content: center;
80 | align-items: center;
81 | font-size: 1vw;
82 | color: white;
83 | opacity: 0.7;
84 | filter: drop-shadow(0 0 1.7vw rgba(0, 0, 0, 0.7));
85 | }
86 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/steering/steering.component.html:
--------------------------------------------------------------------------------
1 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/steering/steering.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { SteeringComponent } from './steering.component';
4 |
5 | describe('SteeringComponent', () => {
6 | let component: SteeringComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async () => {
10 | await TestBed.configureTestingModule({
11 | imports: [SteeringComponent]
12 | })
13 | .compileComponents();
14 |
15 | fixture = TestBed.createComponent(SteeringComponent);
16 | component = fixture.componentInstance;
17 | fixture.detectChanges();
18 | });
19 |
20 | it('should create', () => {
21 | expect(component).toBeTruthy();
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/steering/steering.component.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC orginazers
2 | // All rights reserved.
3 |
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are met:
6 |
7 | // 1. Redistributions of source code must retain the above copyright notice, this
8 | // list of conditions and the following disclaimer.
9 |
10 | // 2. Redistributions in binary form must reproduce the above copyright notice,
11 | // this list of conditions and the following disclaimer in the documentation
12 | // and/or other materials provided with the distribution.
13 |
14 | // 3. Neither the name of the copyright holder nor the names of its
15 | // contributors may be used to endorse or promote products derived from
16 | // this software without specific prior written permission.
17 |
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
29 | import { Component } from '@angular/core';
30 | import { Subscription } from 'rxjs';
31 | import { WebSocketService} from '../../webSocket/web-socket.service'
32 |
33 |
34 | @Component({
35 | selector: 'app-steering',
36 | standalone: true,
37 | imports: [],
38 | templateUrl: './steering.component.html',
39 | styleUrl: './steering.component.css'
40 | })
41 | export class SteeringComponent {
42 | public angle: number = 0;
43 | private steerSubscription: Subscription | undefined;
44 |
45 | constructor( private webSocketService: WebSocketService) { }
46 |
47 | ngOnInit()
48 | {
49 | // Listen for camera
50 | this.steerSubscription = this.webSocketService.receiveCurrentSteer().subscribe(
51 | (message) => {
52 | this.angle = message.value/10;
53 | },
54 | (error) => {
55 | console.error('Error receiving disk usage:', error);
56 | }
57 | );
58 | }
59 |
60 | ngOnDestroy() {
61 | if (this.steerSubscription) {
62 | this.steerSubscription.unsubscribe();
63 | }
64 | this.webSocketService.disconnectSocket();
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/time-speed-steer/time-speed-steer.component.css:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC orginazers
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 |
7 | 1. Redistributions of source code must retain the above copyright notice, this
8 | list of conditions and the following disclaimer.
9 |
10 | 2. Redistributions in binary form must reproduce the above copyright notice,
11 | this list of conditions and the following disclaimer in the documentation
12 | and/or other materials provided with the distribution.
13 |
14 | 3. Neither the name of the copyright holder nor the names of its
15 | contributors may be used to endorse or promote products derived from
16 | this software without specific prior written permission.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
28 |
29 | .input-section {
30 | display: flex;
31 | width: 100%;
32 | height: 100%;
33 | flex-direction: column;
34 | align-items: flex-start;
35 | }
36 |
37 | .input-section label {
38 | font-size: 0.6vw;
39 | color: white;
40 | opacity: 0.8;
41 | padding-bottom: 1%;
42 | }
43 |
44 | .input-section input {
45 | width: 100%;
46 | height: 12%;
47 | margin-bottom: 4%;
48 | padding-left: 5%;
49 | border-radius: 0.3vw;
50 | font-size: 0.7vw;
51 | background-color: rgba(21, 23, 24, 0.3);
52 | color: white;
53 | text-shadow: 0 0 0.3vw rgba(0, 0, 0, 1);
54 | border: none;
55 | outline: none;
56 | }
57 |
58 | .input-section input[type="number"]::-webkit-outer-spin-button,
59 | .input-section input[type="number"]::-webkit-inner-spin-button {
60 | -webkit-appearance: none;
61 | margin: 0;
62 | }
63 |
64 | .input-section input[type="number"] {
65 | -moz-appearance: textfield;
66 | }
67 |
68 | .input-section button {
69 | width: 50%;
70 | height: 20%;
71 | font-size: 0.7vw;
72 | background-color: #2b8fd1;
73 | color: white;
74 | border-radius: 0.3vw;
75 | margin: auto;
76 | user-select: none;
77 | text-align: center;
78 | text-decoration: none;
79 | -webkit-user-select: none;
80 | border: none;
81 | filter: drop-shadow(0 0 0.3vw rgb(0, 0, 0, 0.3));
82 | }
83 |
84 | .input-section button:hover {
85 | opacity: 90%;
86 | }
87 |
88 | .input-section button:active {
89 | opacity: 70%;
90 | }
91 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/time-speed-steer/time-speed-steer.component.html:
--------------------------------------------------------------------------------
1 |
28 |
29 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/time-speed-steer/time-speed-steer.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { TimeSpeedSteerComponent } from './time-speed-steer.component';
4 |
5 | describe('TimeSpeedSteerComponent', () => {
6 | let component: TimeSpeedSteerComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async () => {
10 | await TestBed.configureTestingModule({
11 | imports: [TimeSpeedSteerComponent]
12 | })
13 | .compileComponents();
14 |
15 | fixture = TestBed.createComponent(TimeSpeedSteerComponent);
16 | component = fixture.componentInstance;
17 | fixture.detectChanges();
18 | });
19 |
20 | it('should create', () => {
21 | expect(component).toBeTruthy();
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/time-speed-steer/time-speed-steer.component.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC orginazers
2 | // All rights reserved.
3 |
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are met:
6 |
7 | // 1. Redistributions of source code must retain the above copyright notice, this
8 | // list of conditions and the following disclaimer.
9 |
10 | // 2. Redistributions in binary form must reproduce the above copyright notice,
11 | // this list of conditions and the following disclaimer in the documentation
12 | // and/or other materials provided with the distribution.
13 |
14 | // 3. Neither the name of the copyright holder nor the names of its
15 | // contributors may be used to endorse or promote products derived from
16 | // this software without specific prior written permission.
17 |
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
29 | import { Component } from '@angular/core';
30 | import { WebSocketService } from './../../webSocket/web-socket.service';
31 | import { FormsModule } from '@angular/forms';
32 |
33 | @Component({
34 | selector: 'app-time-speed-steer',
35 | standalone: true,
36 | imports: [FormsModule],
37 | templateUrl: './time-speed-steer.component.html',
38 | styleUrl: './time-speed-steer.component.css'
39 | })
40 | export class TimeSpeedSteerComponent {
41 | time: number = 0;
42 | speed: number = 0;
43 | steer: number = 0;
44 |
45 | constructor( private webSocketService: WebSocketService) { }
46 |
47 | activateFunction() {
48 | this.webSocketService.sendMessageToFlask(`{"Name": "Control", "Value": {"Time":"${this.time*10}","Speed":"${this.speed*10}","Steer":"${this.steer*10}"}}`)
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/warning-light/warning-light.component.css:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC orginazers
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 |
7 | 1. Redistributions of source code must retain the above copyright notice, this
8 | list of conditions and the following disclaimer.
9 |
10 | 2. Redistributions in binary form must reproduce the above copyright notice,
11 | this list of conditions and the following disclaimer in the documentation
12 | and/or other materials provided with the distribution.
13 |
14 | 3. Neither the name of the copyright holder nor the names of its
15 | contributors may be used to endorse or promote products derived from
16 | this software without specific prior written permission.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
28 |
29 | .warning-light-container {
30 | width: 100%;
31 | height: 100%;
32 | display: grid;
33 | grid-template-columns: repeat(6, 1fr);
34 | grid-gap: 5%;
35 | }
36 |
37 | .warning-light-items {
38 | width: 100%;
39 | height: 100%;
40 | display: flex;
41 | justify-content: center;
42 | align-items: center;
43 | }
44 |
45 | .warning-light-image {
46 | width: 100%;
47 | height: auto;
48 | filter: drop-shadow(0 0 0.05vw rgba(255, 255, 255));
49 | }
50 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/warning-light/warning-light.component.html:
--------------------------------------------------------------------------------
1 |
28 |
29 |
30 |
31 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/warning-light/warning-light.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { WarningLightComponent } from './warning-light.component';
4 |
5 | describe('WarningLightComponent', () => {
6 | let component: WarningLightComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async () => {
10 | await TestBed.configureTestingModule({
11 | imports: [WarningLightComponent]
12 | })
13 | .compileComponents();
14 |
15 | fixture = TestBed.createComponent(WarningLightComponent);
16 | component = fixture.componentInstance;
17 | fixture.detectChanges();
18 | });
19 |
20 | it('should create', () => {
21 | expect(component).toBeTruthy();
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/cluster/warning-light/warningLightDictionary.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC orginazers
2 | // All rights reserved.
3 |
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are met:
6 |
7 | // 1. Redistributions of source code must retain the above copyright notice, this
8 | // list of conditions and the following disclaimer.
9 |
10 | // 2. Redistributions in binary form must reproduce the above copyright notice,
11 | // this list of conditions and the following disclaimer in the documentation
12 | // and/or other materials provided with the distribution.
13 |
14 | // 3. Neither the name of the copyright holder nor the names of its
15 | // contributors may be used to endorse or promote products derived from
16 | // this software without specific prior written permission.
17 |
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
29 | type warningLightDictionaryModel = { [key: string]: string };
30 | export const warningLightDictionary: warningLightDictionaryModel = {
31 | "1": "bumpy_road",
32 | "2": "car_ahead",
33 | "3": "car_parking",
34 | "4": "crosswalk",
35 | "5": "forbidden",
36 | "6": "highway_entrance",
37 | "7": "highway_exit",
38 | "8": "intersection",
39 | "9": "oneway",
40 | "10": "parking",
41 | "11": "ped_on_crosswalk",
42 | "12": "ped_on_road",
43 | "13": "priority",
44 | "14": "road_block",
45 | "15": "roundabout",
46 | "16": "speed_limit_15_in",
47 | "17": "speed_limit_15_out",
48 | "18": "speed_limit_30_in",
49 | "19": "speed_limit_30_out",
50 | "20": "stop",
51 | "21": "traffic_light",
52 | };
53 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/table/table.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { TableComponent } from './table.component';
4 |
5 | describe('TableComponent', () => {
6 | let component: TableComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async () => {
10 | await TestBed.configureTestingModule({
11 | imports: [TableComponent]
12 | })
13 | .compileComponents();
14 |
15 | fixture = TestBed.createComponent(TableComponent);
16 | component = fixture.componentInstance;
17 | fixture.detectChanges();
18 | });
19 |
20 | it('should create', () => {
21 | expect(component).toBeTruthy();
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/app/webSocket/web-socket.service.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed } from '@angular/core/testing';
2 |
3 | import { WebSocketService } from './web-socket.service';
4 |
5 | describe('WebSocketService', () => {
6 | let service: WebSocketService;
7 |
8 | beforeEach(() => {
9 | TestBed.configureTestingModule({});
10 | service = TestBed.inject(WebSocketService);
11 | });
12 |
13 | it('should be created', () => {
14 | expect(service).toBeTruthy();
15 | });
16 | });
17 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/assets/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ECC-BFMC/Brain/535975d4e1aa4adc47ae28f7ce46787f63937b82/src/dashboard/frontend/src/assets/.gitkeep
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/assets/Car.svg:
--------------------------------------------------------------------------------
1 |
2 |
10 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/assets/bfmc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ECC-BFMC/Brain/535975d4e1aa4adc47ae28f7ce46787f63937b82/src/dashboard/frontend/src/assets/bfmc.png
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/assets/green-light.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
12 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/assets/warningLights/bumpy_road.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ECC-BFMC/Brain/535975d4e1aa4adc47ae28f7ce46787f63937b82/src/dashboard/frontend/src/assets/warningLights/bumpy_road.png
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/assets/warningLights/car_ahead.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ECC-BFMC/Brain/535975d4e1aa4adc47ae28f7ce46787f63937b82/src/dashboard/frontend/src/assets/warningLights/car_ahead.png
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/assets/warningLights/car_parking.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ECC-BFMC/Brain/535975d4e1aa4adc47ae28f7ce46787f63937b82/src/dashboard/frontend/src/assets/warningLights/car_parking.png
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/assets/warningLights/crosswalk.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ECC-BFMC/Brain/535975d4e1aa4adc47ae28f7ce46787f63937b82/src/dashboard/frontend/src/assets/warningLights/crosswalk.png
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/assets/warningLights/forbidden.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ECC-BFMC/Brain/535975d4e1aa4adc47ae28f7ce46787f63937b82/src/dashboard/frontend/src/assets/warningLights/forbidden.png
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/assets/warningLights/highway_entrance.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ECC-BFMC/Brain/535975d4e1aa4adc47ae28f7ce46787f63937b82/src/dashboard/frontend/src/assets/warningLights/highway_entrance.png
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/assets/warningLights/highway_exit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ECC-BFMC/Brain/535975d4e1aa4adc47ae28f7ce46787f63937b82/src/dashboard/frontend/src/assets/warningLights/highway_exit.png
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/assets/warningLights/intersection.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ECC-BFMC/Brain/535975d4e1aa4adc47ae28f7ce46787f63937b82/src/dashboard/frontend/src/assets/warningLights/intersection.png
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/assets/warningLights/oneway.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ECC-BFMC/Brain/535975d4e1aa4adc47ae28f7ce46787f63937b82/src/dashboard/frontend/src/assets/warningLights/oneway.png
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/assets/warningLights/parking.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ECC-BFMC/Brain/535975d4e1aa4adc47ae28f7ce46787f63937b82/src/dashboard/frontend/src/assets/warningLights/parking.png
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/assets/warningLights/ped_on_crosswalk.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ECC-BFMC/Brain/535975d4e1aa4adc47ae28f7ce46787f63937b82/src/dashboard/frontend/src/assets/warningLights/ped_on_crosswalk.png
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/assets/warningLights/ped_on_road.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ECC-BFMC/Brain/535975d4e1aa4adc47ae28f7ce46787f63937b82/src/dashboard/frontend/src/assets/warningLights/ped_on_road.png
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/assets/warningLights/priority.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ECC-BFMC/Brain/535975d4e1aa4adc47ae28f7ce46787f63937b82/src/dashboard/frontend/src/assets/warningLights/priority.png
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/assets/warningLights/road_block.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ECC-BFMC/Brain/535975d4e1aa4adc47ae28f7ce46787f63937b82/src/dashboard/frontend/src/assets/warningLights/road_block.png
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/assets/warningLights/roundabout.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ECC-BFMC/Brain/535975d4e1aa4adc47ae28f7ce46787f63937b82/src/dashboard/frontend/src/assets/warningLights/roundabout.png
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/assets/warningLights/speed_limit_15_in.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ECC-BFMC/Brain/535975d4e1aa4adc47ae28f7ce46787f63937b82/src/dashboard/frontend/src/assets/warningLights/speed_limit_15_in.png
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/assets/warningLights/speed_limit_15_out.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ECC-BFMC/Brain/535975d4e1aa4adc47ae28f7ce46787f63937b82/src/dashboard/frontend/src/assets/warningLights/speed_limit_15_out.png
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/assets/warningLights/speed_limit_30_in.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ECC-BFMC/Brain/535975d4e1aa4adc47ae28f7ce46787f63937b82/src/dashboard/frontend/src/assets/warningLights/speed_limit_30_in.png
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/assets/warningLights/speed_limit_30_out.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ECC-BFMC/Brain/535975d4e1aa4adc47ae28f7ce46787f63937b82/src/dashboard/frontend/src/assets/warningLights/speed_limit_30_out.png
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/assets/warningLights/stop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ECC-BFMC/Brain/535975d4e1aa4adc47ae28f7ce46787f63937b82/src/dashboard/frontend/src/assets/warningLights/stop.png
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/assets/warningLights/traffic_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ECC-BFMC/Brain/535975d4e1aa4adc47ae28f7ce46787f63937b82/src/dashboard/frontend/src/assets/warningLights/traffic_light.png
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ECC-BFMC/Brain/535975d4e1aa4adc47ae28f7ce46787f63937b82/src/dashboard/frontend/src/favicon.ico
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Dashboard
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/main.ts:
--------------------------------------------------------------------------------
1 | import { bootstrapApplication } from '@angular/platform-browser';
2 | import { appConfig } from './app/app.config';
3 | import { AppComponent } from './app/app.component';
4 |
5 | bootstrapApplication(AppComponent, appConfig)
6 | .catch((err) => console.error(err));
7 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/src/styles.css:
--------------------------------------------------------------------------------
1 | /* You can add global styles to this file, and also import other style files */
2 |
3 | :root {
4 | --aspect-ratio: 1.777777777777778;
5 | --cluster-width: 80vw;
6 | }
7 |
8 | * {
9 | box-sizing: border-box;
10 | }
11 |
12 | html, body {
13 | height: 100%;
14 | }
15 |
16 | body {
17 | font-family: "poppins", sans-serif;
18 | /* background: radial-gradient(circle at bottom, #151618, #222831); */
19 | background: #222831;
20 | color: #f0e5fe;
21 | margin: 0;
22 | padding: 0;
23 | display: flex;
24 | justify-content: center;
25 | align-items: center;
26 | }
27 |
28 | .app-root {
29 | width: auto;
30 | height: 100%;
31 | }
32 |
33 | /*
34 | html, body { height: 100%; }
35 | body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; } */
36 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */
2 | {
3 | "extends": "./tsconfig.json",
4 | "compilerOptions": {
5 | "outDir": "./out-tsc/app",
6 | "types": []
7 | },
8 | "files": [
9 | "src/main.ts"
10 | ],
11 | "include": [
12 | "src/**/*.d.ts"
13 | ]
14 | }
15 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": false,
3 | "compilerOptions": {
4 | "outDir": "./dist/out-tsc",
5 | "strict": true,
6 | "noImplicitOverride": true,
7 | "noPropertyAccessFromIndexSignature": true,
8 | "noImplicitReturns": true,
9 | "noFallthroughCasesInSwitch": true,
10 | "skipLibCheck": true,
11 | "esModuleInterop": true,
12 | "sourceMap": true,
13 | "declaration": false,
14 | "experimentalDecorators": true,
15 | "moduleResolution": "node",
16 | "importHelpers": true,
17 | "target": "ES2022",
18 | "module": "ES2022",
19 | "useDefineForClassFields": false,
20 | "lib": [
21 | "ES2022",
22 | "dom"
23 | ]
24 | },
25 | "angularCompilerOptions": {
26 | "enableI18nLegacyMessageIdFormat": false,
27 | "strictInjectionParameters": true,
28 | "strictInputAccessModifiers": true,
29 | "strictTemplates": true
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/dashboard/frontend/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */
2 | {
3 | "extends": "./tsconfig.json",
4 | "compilerOptions": {
5 | "outDir": "./out-tsc/spec",
6 | "types": [
7 | "jasmine"
8 | ]
9 | },
10 | "include": [
11 | "src/**/*.spec.ts",
12 | "src/**/*.d.ts"
13 | ]
14 | }
15 |
--------------------------------------------------------------------------------
/src/dashboard/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "dashboard",
3 | "lockfileVersion": 3,
4 | "requires": true,
5 | "packages": {}
6 | }
7 |
--------------------------------------------------------------------------------
/src/dashboard/threads/threadStartFrontend.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC orginazers
2 | # All rights reserved.
3 |
4 | # Redistribution and use in source and binary forms, with or without
5 | # modification, are permitted provided that the following conditions are met:
6 |
7 | # 1. Redistributions of source code must retain the above copyright notice, this
8 | # list of conditions and the following disclaimer.
9 |
10 | # 2. Redistributions in binary form must reproduce the above copyright notice,
11 | # this list of conditions and the following disclaimer in the documentation
12 | # and/or other materials provided with the distribution.
13 |
14 | # 3. Neither the name of the copyright holder nor the names of its
15 | # contributors may be used to endorse or promote products derived from
16 | # this software without specific prior written permission.
17 |
18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
29 | if __name__ == "__main__":
30 | import sys
31 | sys.path.insert(0, "../../..")
32 |
33 | import subprocess
34 | import os
35 | from src.templates.threadwithstop import ThreadWithStop
36 |
37 | class ThreadStartFrontend(ThreadWithStop):
38 |
39 | # ================================ INIT ===============================================
40 |
41 | def __init__(self, logger, project_path=os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "frontend")):
42 | """Thread for managing an Angular development server.
43 |
44 | Args:
45 | project_path (str): The file path to the Angular project directory.
46 | """
47 |
48 | self.project_path = project_path
49 | self.logger= logger
50 | super().__init__()
51 |
52 | # ================================= RUN ===============================================
53 |
54 | def run(self):
55 | """Overrides the Thread.run. Starts the Angular server and monitors the _running flag."""
56 |
57 | try:
58 | subprocess.run(f"cd {self.project_path} && npm start", shell=True, check=True)
59 | self.logger.info("Angular server started successfully.")
60 | except subprocess.CalledProcessError as e:
61 | self.logger.warning(f"Failed to start the Angular development server: {e}")
62 |
63 | # ================================ STOP ===============================================
64 |
65 | def stop(self):
66 | """Stops the Angular development server if running."""
67 |
68 | self.logger.warning("Angular server stopped.")
69 |
70 | # ================================= EXAMPLE ===============================================
71 |
72 | if __name__ == "__main__":
73 | # Replace '../frontend/' with the actual path to your Angular project
74 | angular_thread = ThreadStartFrontend("../frontend/")
75 | angular_thread.start()
76 | input("Press Enter to stop the server...")
77 | angular_thread.stop()
78 | angular_thread.join()
79 |
--------------------------------------------------------------------------------
/src/data/.github/workflows/triggerPullData.yml:
--------------------------------------------------------------------------------
1 | name: Propagate changes to data projects
2 |
3 | on:
4 | push:
5 |
6 | jobs:
7 | identify-and-print:
8 | runs-on: ubuntu-latest
9 | outputs:
10 | project_origin: ${{ steps.check-project-name.outputs.project_origin }}
11 |
12 |
13 | steps:
14 | - name: Check for project_name in push payload
15 | id: check-project-name
16 | run: |
17 | if [[ "${{ github.event.head_commit.message }}" == *"project_name="* ]]; then
18 | project_name=$(echo "${{ github.event.head_commit.message }}" | sed -n 's/.*project_name=\([^ ]*\).*/\1/p')
19 | echo "Project Name from commit message: $project_name"
20 | echo "project_origin=$project_name" >> $GITHUB_OUTPUT
21 | else
22 | echo "No project_name found in commit message."
23 | echo "project_origin=None" >> $GITHUB_OUTPUT
24 | fi
25 |
26 | dispatch:
27 | needs: identify-and-print
28 | runs-on: ubuntu-latest
29 | if: success()
30 | env:
31 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32 | steps:
33 | - name: Use project_origin output
34 | run: |
35 | project_origin="${{ needs.identify-and-print.outputs.project_origin }}"
36 |
37 |
38 | repositories=(Brain CompetitionPCing)
39 |
40 | # Remove the project_origin from the repositories array
41 | for i in "${!repositories[@]}"; do
42 | if [[ "${repositories[$i]}" == "$project_origin" ]]; then
43 | unset 'repositories[i]'
44 | fi
45 | done
46 |
47 | echo "Repos to update: ${repositories[@]}"
48 |
49 | # Uncomment the following block to perform the actual dispatch
50 | #test
51 | for repo in "${repositories[@]}"; do
52 | project_origin_name="ECC-BFMC/$repo"
53 | echo "Prepared to dispatch event to repository: $project_origin_name"
54 | dispatch_name="Pull-Data-Changes-$repo"
55 | echo "Event type: $dispatch_name"
56 |
57 | gh api repos/"$project_origin_name"/dispatches \
58 | -f event_type=$dispatch_name \
59 | -H "Authorization: token ${{ secrets.REPO_ACCESS_TOKEN }}"
60 | done
61 |
--------------------------------------------------------------------------------
/src/data/Semaphores/threads/threadSemaphores.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC organizers
2 | # All rights reserved.
3 |
4 | # Redistribution and use in source and binary forms, with or without
5 | # modification, are permitted provided that the following conditions are met:
6 |
7 | # 1. Redistributions of source code must retain the above copyright notice, this
8 | # list of conditions and the following disclaimer.
9 |
10 | # 2. Redistributions in binary form must reproduce the above copyright notice,
11 | # this list of conditions and the following disclaimer in the documentation
12 | # and/or other materials provided with the distribution.
13 |
14 | # 3. Neither the name of the copyright holder nor the names of its
15 | # contributors may be used to endorse or promote products derived from
16 | # this software without specific prior written permission.
17 |
18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
28 |
29 | from src.templates.threadwithstop import ThreadWithStop
30 | from twisted.internet import reactor
31 | from src.data.Semaphores.threads.udpListener import udpListener
32 |
33 |
34 | class threadSemaphores(ThreadWithStop):
35 | """Thread which will handle processCarsAndSemaphores functionalities
36 |
37 | Args:
38 | queueList (dictionary of multiprocessing.queues.Queue): Dictionary of queues where the ID is the type of messages.
39 | listenPort (int, optional): Listening port. Defaults to 5007.
40 | """
41 |
42 | # ====================================== INIT ==========================================
43 | def __init__(self, queueList, logger, debugging, listenPort=5007):
44 | super(threadSemaphores, self).__init__()
45 | self.listenPort = listenPort
46 | self.queueList = queueList
47 | self.logger = logger
48 | self.debugging = debugging
49 | self.udp_factory = udpListener(self.queueList, self.logger, self.debugging)
50 | self.reactor = reactor
51 | self.reactor.listenUDP(self.listenPort, self.udp_factory)
52 |
53 | # ======================================= RUN ==========================================
54 | def run(self):
55 | """
56 | Run the thread.
57 | """
58 | self.reactor.run(installSignalHandlers=False)
59 |
60 | # ====================================== STOP ==========================================
61 | def stop(self):
62 | """
63 | Stop the thread.
64 | """
65 | self.reactor.stop()
66 | super(threadSemaphores, self).stop()
67 |
--------------------------------------------------------------------------------
/src/data/Semaphores/threads/udpListener.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC organizers
2 | # All rights reserved.
3 |
4 | # Redistribution and use in source and binary forms, with or without
5 | # modification, are permitted provided that the following conditions are met:
6 |
7 | # 1. Redistributions of source code must retain the above copyright notice, this
8 | # list of conditions and the following disclaimer.
9 |
10 | # 2. Redistributions in binary form must reproduce the above copyright notice,
11 | # this list of conditions and the following disclaimer in the documentation
12 | # and/or other materials provided with the distribution.
13 |
14 | # 3. Neither the name of the copyright holder nor the names of its
15 | # contributors may be used to endorse or promote products derived Owner
16 | # this software without specific prior written permission.
17 |
18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
28 |
29 | import json
30 | from src.utils.messages.allMessages import Semaphores
31 | from twisted.internet import protocol
32 | from src.utils.messages.messageHandlerSender import messageHandlerSender
33 |
34 | class udpListener(protocol.DatagramProtocol):
35 | """This class is used to receive the information from the servers.
36 |
37 | Args:
38 | queue (multiprocessing.queues.Queue): the queue to send the info
39 | """
40 |
41 | def __init__(self, queuesList, logger, debugging):
42 | self.semaphoresSender = messageHandlerSender(queuesList, Semaphores)
43 | self.logger = logger
44 | self.debugging = debugging
45 |
46 | def datagramReceived(self, datagram, addr):
47 | """Specific function for receiving the information. It will select and create different dictionary for each type of data we receive(car or semaphore)
48 |
49 | Args:
50 | datagram (dictionary): In this we store the data we get from servers.
51 | """
52 | dat = datagram.decode("utf-8")
53 | dat = json.loads(dat)
54 |
55 | if dat["device"] == "semaphore":
56 | tmp = {"id": dat["id"], "state": dat["state"], "x": dat["x"], "y": dat["y"]}
57 |
58 | elif dat["device"] == "car":
59 | tmp = {"id": dat["id"], "x": dat["x"], "y": dat["y"]}
60 | if self.debugging:
61 | self.logger.info(tmp)
62 | self.semaphoresSender.send(tmp)
63 |
64 | def stopListening(self):
65 | super().stopListening()
66 |
--------------------------------------------------------------------------------
/src/data/TrafficCommunication/threads/udpListener.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC organizers
2 | # All rights reserved.
3 |
4 | # Redistribution and use in source and binary forms, with or without
5 | # modification, are permitted provided that the following conditions are met:
6 |
7 | # 1. Redistributions of source code must retain the above copyright notice, this
8 | # list of conditions and the following disclaimer.
9 |
10 | # 2. Redistributions in binary form must reproduce the above copyright notice,
11 | # this list of conditions and the following disclaimer in the documentation
12 | # and/or other materials provided with the distribution.
13 |
14 | # 3. Neither the name of the copyright holder nor the names of its
15 | # contributors may be used to endorse or promote products derived from
16 | # this software without specific prior written permission.
17 |
18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
28 |
29 | from twisted.internet import protocol
30 | import src.data.TrafficCommunication.useful.keyDealer as keyDealer
31 |
32 | class udpListener(protocol.DatagramProtocol):
33 | """This class will handle the connection.
34 |
35 | Args:
36 | decrypt_key (String): A path to the decripting key.
37 | serverfound (function): This function will be called if the server will be found.
38 | """
39 |
40 | def __init__(self, decrypt_key, serverfound):
41 | decrypt_key = decrypt_key
42 | self.pub_key = keyDealer.load_public_key(decrypt_key)
43 | self.serverfoundCllback = serverfound
44 |
45 | def startProtocol(self):
46 | print("Looking for Traffic Communicaiton Server")
47 |
48 | def datagramReceived(self, datagram, address):
49 | """In this function we split the receive data and we call the callbackfunction"""
50 |
51 | try:
52 | dat = datagram.split(b"(-.-)")
53 | if len(dat) != 2:
54 | raise Exception("Plaintext or signature not present")
55 | a = keyDealer.verify_data(self.pub_key, dat[1], dat[0])
56 | if not a:
57 | raise Exception("signature not valid")
58 | msg = dat[1].decode().split(":")
59 | port = int(msg[1])
60 | self.serverfoundCllback(address[0], port)
61 | except Exception as e:
62 | print("TrafficCommunication -> udpListener -> datagramReceived:")
63 | print(e)
64 |
65 | def stopListening(self):
66 | self.transport.stopListening()
67 |
--------------------------------------------------------------------------------
/src/data/TrafficCommunication/useful/periodicTask.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC organizers
2 | # All rights reserved.
3 |
4 | # Redistribution and use in source and binary forms, with or without
5 | # modification, are permitted provided that the following conditions are met:
6 |
7 | # 1. Redistributions of source code must retain the above copyright notice, this
8 | # list of conditions and the following disclaimer.
9 |
10 | # 2. Redistributions in binary form must reproduce the above copyright notice,
11 | # this list of conditions and the following disclaimer in the documentation
12 | # and/or other materials provided with the distribution.
13 |
14 | # 3. Neither the name of the copyright holder nor the names of its
15 | # contributors may be used to endorse or promote products derived from
16 | # this software without specific prior written permission.
17 |
18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
28 | from twisted.internet import task
29 |
30 |
31 | class periodicTask(task.LoopingCall):
32 | def __init__(self, interval, shrd_mem, tcp_factory):
33 | super().__init__(self.periodicCheck)
34 | self.interval = interval
35 | self.shrd_mem = shrd_mem
36 | self.tcp_factory = tcp_factory
37 |
38 | def start(self):
39 | """
40 | Start the periodic task with the specified interval.
41 | """
42 | super().start(self.interval)
43 |
44 | def periodicCheck(self):
45 | """
46 | Perform the periodic check and send data to the server.
47 | """
48 | tosend = self.shrd_mem.get()
49 | for mem in tosend:
50 | self.tcp_factory.send_data_to_server(mem)
51 |
--------------------------------------------------------------------------------
/src/data/TrafficCommunication/useful/publickey_server.pem:
--------------------------------------------------------------------------------
1 | -----BEGIN PUBLIC KEY-----
2 | MIIBITANBgkqhkiG9w0BAQEFAAOCAQ4AMIIBCQKCAQBrc289KPp+9N69JWyP7mk3
3 | nSMTQS/pMNDPy94AjffcSk6WTSXYtJJfZjXD0gmCwMWZtuU3Suaj0TnvUZ33GcN+
4 | HHbPuc6N3Rk9fximAyGJ4rbZH0zwlK6OzbwWlN5WWQh12tYrVJGe9UvwlBzcBMiG
5 | Lkd0iYCRAEkixkWAB9q8rzj/NXOy00wQIiaIe7tdKgtv26C/FyqyiVILwWnsOmRm
6 | /2J5odlTTCMtwbB7qsxpTYpqRYNZY6EE4gQL/beXZUC8FRFyvgTEA/9WdWuEiTKS
7 | VjWfxnFenEJ8VJeQ1yjBFOp137xh82Ia/OfCDU/XxJRvEZRvTtGM5mFEqG4P8yGp
8 | AgMBAAE=
9 | -----END PUBLIC KEY-----
--------------------------------------------------------------------------------
/src/data/TrafficCommunication/useful/publickey_server_test.pem:
--------------------------------------------------------------------------------
1 | -----BEGIN RSA PUBLIC KEY-----
2 | MIIBCgKCAQEApzKiiV4o2B+GXBajua5hA0sshk1EdoIaQO/59jwpY1BakoSsY1zu
3 | h/EKEKGWLYbXMZ6rxcdMg3hX6xEAqSHpYIx50Od4s3YqwcEcTIRsX5iFKIW/EBO7
4 | oyLXYWU7YGGFGvTNFCH0ge8e+8C9gteMxRJfg0FRZ+cuBAJWpQkjUi9o0LgOnCw2
5 | HJb8fJJtOct6pUbq1K1NQc7sOdDLYZ1jLiwcoit8J8mBkHZrFbnHX/Pq+siSn/Bx
6 | /P9iatzPE596ZmR9XStzJLVSy5kYabZ7jRhmC4M+5TWIsDwLv+Vw8aF41lKV5wGp
7 | klwzBUzae/uOdVinHTr1H7vmGNR7IrvDEQIDAQAB
8 | -----END RSA PUBLIC KEY-----
9 |
--------------------------------------------------------------------------------
/src/hardware/serialhandler/historyFile.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ECC-BFMC/Brain/535975d4e1aa4adc47ae28f7ce46787f63937b82/src/hardware/serialhandler/historyFile.txt
--------------------------------------------------------------------------------
/src/hardware/serialhandler/threads/filehandler.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC organizers
2 | # All rights reserved.
3 |
4 | # Redistribution and use in source and binary forms, with or without
5 | # modification, are permitted provided that the following conditions are met:
6 |
7 | # 1. Redistributions of source code must retain the above copyright notice, this
8 | # list of conditions and the following disclaimer.
9 |
10 | # 2. Redistributions in binary form must reproduce the above copyright notice,
11 | # this list of conditions and the following disclaimer in the documentation
12 | # and/or other materials provided with the distribution.
13 |
14 | # 3. Neither the name of the copyright holder nor the names of its
15 | # contributors may be used to endorse or promote products derived from
16 | # this software without specific prior written permission.
17 |
18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
28 | from threading import Lock
29 |
30 |
31 | class FileHandler:
32 | def __init__(self, f_fileName):
33 | self.outFile = open(f_fileName, "w")
34 | self.lock = Lock()
35 |
36 | def write(self, f_str):
37 | self.lock.acquire()
38 | self.outFile.write(f_str)
39 | self.lock.release()
40 |
41 | def close(self):
42 | self.outFile.close()
43 |
--------------------------------------------------------------------------------
/src/templates/threadwithstop.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC organizers
2 | # All rights reserved.
3 |
4 | # Redistribution and use in source and binary forms, with or without
5 | # modification, are permitted provided that the following conditions are met:
6 |
7 | # 1. Redistributions of source code must retain the above copyright notice, this
8 | # list of conditions and the following disclaimer.
9 |
10 | # 2. Redistributions in binary form must reproduce the above copyright notice,
11 | # this list of conditions and the following disclaimer in the documentation
12 | # and/or other materials provided with the distribution.
13 |
14 | # 3. Neither the name of the copyright holder nor the names of its
15 | # contributors may be used to endorse or promote products derived from
16 | # this software without specific prior written permission.
17 |
18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
28 |
29 | from threading import Thread
30 | from functools import partial
31 |
32 |
33 | class ThreadWithStop(Thread):
34 | def __init__(self, *args, **kwargs):
35 | """An extended version of the thread superclass, it contains a new attribute (_running) and a new method (stop).
36 | The '_running' flag can be used to control the state of the 'run' method and the 'stop' method can stop the running by changing its value.
37 |
38 | Raises
39 | ------
40 | ValueError
41 | the 'target' parameter of the constructor have to be a unbounded function
42 |
43 | Examples
44 | --------
45 | Creating a new subclass of 'ThreadWithStop' superclass:
46 |
47 | class AThread(ThreadWithStop):
48 | def run(self):
49 | while sel._running:
50 | ...
51 |
52 | th1 = AThread()
53 | th1.start()
54 | ...
55 | th1.stop()
56 | th1.join()
57 |
58 |
59 | An example with local function and witouth subclass definition:
60 |
61 | def examplesFunc(self,param):
62 | while self._running
63 | ...
64 |
65 | th1 = ThreadWithStop(target = examplesFunc, args = (param,))
66 | th1.start()
67 | ...
68 | th1.stop()
69 | th1.join()
70 |
71 | """
72 |
73 | # Check the target parameter definition. If it isn't a bounded method, then we have to give like the first parameter the new object. Thus the run method can access the object's field, (like self._running).
74 | if "target" in kwargs:
75 | if not hasattr(kwargs["target"], "__self__"):
76 | kwargs["target"] = partial(kwargs["target"], self)
77 | else:
78 | raise ValueError("target parameter must be a unbounded function")
79 | super(ThreadWithStop, self).__init__(*args, **kwargs)
80 | self._running = True
81 |
82 | def stop(self):
83 | """This method has role to stop the thread by setting the '_running' flag to false value."""
84 | self._running = False
85 |
--------------------------------------------------------------------------------
/src/utils/messages/messageHandlerSender.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC organizers
2 | # All rights reserved.
3 |
4 | # Redistribution and use in source and binary forms, with or without
5 | # modification, are permitted provided that the following conditions are met:
6 |
7 | # 1. Redistributions of source code must retain the above copyright notice, this
8 | # list of conditions and the following disclaimer.
9 |
10 | # 2. Redistributions in binary form must reproduce the above copyright notice,
11 | # this list of conditions and the following disclaimer in the documentation
12 | # and/or other materials provided with the distribution.
13 |
14 | # 3. Neither the name of the copyright holder nor the names of its
15 | # contributors may be used to endorse or promote products derived from
16 | # this software without specific prior written permission.
17 |
18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
28 |
29 | class messageHandlerSender:
30 | """Class which will handle sender functionalities.\n
31 | Args:
32 | queuesList (dictionary of multiprocessing.queues.Queue): Dictionary of queues where the ID is the type of messages.
33 | message (enum): A specific message
34 | """
35 |
36 | def __init__(self, queuesList, message):
37 | self.queuesList = queuesList
38 | self.message = message
39 |
40 | def send(self, value):
41 | """
42 | Puts a value into the queuesList
43 |
44 | Args:
45 | value (any type): The value to be put into the queue. This can be of any type
46 | """
47 | self.queuesList[self.message.Queue.value].put(
48 | {
49 | "Owner": self.message.Owner.value,
50 | "msgID": self.message.msgID.value,
51 | "msgType": self.message.msgType.value,
52 | "msgValue": value
53 | }
54 | )
--------------------------------------------------------------------------------
/src/utils/table_state.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "channel": "ToggleInstant",
4 | "value": "True",
5 | "initialValue": "True",
6 | "interval": 0,
7 | "type": "dropdown",
8 | "values": [
9 | "True",
10 | "False"
11 | ],
12 | "command": "instant",
13 | "checked": true,
14 | "hasChanged": false
15 | },
16 | {
17 | "channel": "ToggleBatteryLvl",
18 | "value": "True",
19 | "initialValue": "True",
20 | "interval": 0,
21 | "type": "dropdown",
22 | "values": [
23 | "True",
24 | "False"
25 | ],
26 | "command": "battery",
27 | "checked": true,
28 | "hasChanged": false
29 | },
30 | {
31 | "channel": "ToggleImuData",
32 | "value": "True",
33 | "initialValue": "True",
34 | "interval": 0,
35 | "type": "dropdown",
36 | "values": [
37 | "True",
38 | "False"
39 | ],
40 | "command": "imu",
41 | "checked": true,
42 | "hasChanged": false
43 | },
44 | {
45 | "channel": "ToggleResourceMonitor",
46 | "value": "True",
47 | "initialValue": "True",
48 | "interval": 0,
49 | "type": "dropdown",
50 | "values": [
51 | "True",
52 | "False"
53 | ],
54 | "command": "resourceMonitor",
55 | "checked": true,
56 | "hasChanged": false
57 | },
58 | {
59 | "channel": "Brightness",
60 | "value": 50,
61 | "initialValue": 50,
62 | "interval": 0,
63 | "type": "slider",
64 | "values": [
65 | 0,
66 | 100
67 | ],
68 | "checked": false,
69 | "hasChanged": false
70 | },
71 | {
72 | "channel": "Contrast",
73 | "value": 0,
74 | "initialValue": 0,
75 | "interval": 0,
76 | "type": "slider",
77 | "values": [
78 | 0,
79 | 3200
80 | ],
81 | "checked": false,
82 | "hasChanged": false
83 | },
84 | {
85 | "channel": "init",
86 | "type": "Config",
87 | "batteryCapacity": {
88 | "capacity": 9000
89 | },
90 | "hasChanged": false
91 | }
92 | ]
--------------------------------------------------------------------------------