Skip to content

Commit

Permalink
FreeDV demodulator channel component
Browse files Browse the repository at this point in the history
  • Loading branch information
f4exb committed Apr 17, 2019
1 parent d254d94 commit 7870af8
Show file tree
Hide file tree
Showing 10 changed files with 636 additions and 6 deletions.
5 changes: 5 additions & 0 deletions src/app/channel-details/channel-details-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { UdpSourceComponent } from './udp-source/udp-source.component';
import { RemoteSourceComponent } from './remote-source/remote-source.component';
import { RemoteSinkComponent } from './remote-sink/remote-sink.component';
import { FreeDVModComponent } from './freedv-mod/freedv-mod.component';
import { FreeDVDemodComponent } from './freedv-demod/freedv-demod.component';

export const routes: Routes = [
{
Expand All @@ -31,6 +32,10 @@ export const routes: Routes = [
path: 'bfmdemod',
component: BfmDemodComponent
},
{
path: 'freedvdemod',
component: FreeDVDemodComponent
},
{
path: 'remotesink',
component: RemoteSinkComponent
Expand Down
2 changes: 2 additions & 0 deletions src/app/channel-details/channel-details.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ export class ChannelDetailsComponent implements OnInit {
this.router.navigate(['amdemod'], { relativeTo: this.route});
} else if (channelSettings.channelType === 'BFMDemod') {
this.router.navigate(['bfmdemod'], { relativeTo: this.route});
} else if (channelSettings.channelType === 'FreeDVDemod') {
this.router.navigate(['freedvdemod'], { relativeTo: this.route});
} else if (channelSettings.channelType === 'RemoteSink') {
this.router.navigate(['remotesink'], { relativeTo: this.route});
} else if (channelSettings.channelType === 'RemoteSource') {
Expand Down
4 changes: 3 additions & 1 deletion src/app/channel-details/channel-details.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { UdpSourceComponent } from './udp-source/udp-source.component';
import { RemoteSourceComponent } from './remote-source/remote-source.component';
import { RemoteSinkComponent } from './remote-sink/remote-sink.component';
import { FreeDVModComponent } from './freedv-mod/freedv-mod.component';
import { FreeDVDemodComponent } from './freedv-demod/freedv-demod.component';

@NgModule({
imports: [
Expand Down Expand Up @@ -60,7 +61,8 @@ import { FreeDVModComponent } from './freedv-mod/freedv-mod.component';
UdpSourceComponent,
RemoteSourceComponent,
RemoteSinkComponent,
FreeDVModComponent
FreeDVModComponent,
FreeDVDemodComponent
]
})
export class ChannelDetailsModule { }
3 changes: 3 additions & 0 deletions src/app/channel-details/channel-details.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ import { UDPSourceSettings, UDPSourceReport } from './udp-source/udp-source';
import { RemoteSourceSettings, RemoteSourceReport } from './remote-source/remote-source';
import { RemoteSinkSettings } from './remote-sink/remote-sink';
import { FreeDVModSettings, FreeDVModReport } from './freedv-mod/freedv-mod';
import { FreeDVDemodSettings, FreeDVDemodReport } from './freedv-demod/freedv-demod';

export interface ChannelSettings {
channelType: string;
tx: number;
AMDemodSettings?: AMDemodSettings;
BFMDemodSettings?: BFMDemodSettings;
FreeDVDemodSettings?: FreeDVDemodSettings;
FreeDVModSettings?: FreeDVModSettings;
NFMDemodSettings?: NFMDemodSettings;
SSBDemodSettings?: SSBDemodSettings;
Expand All @@ -37,6 +39,7 @@ export interface ChannelSettings {
export interface ChannelReport {
AMDemodReport?: AMDemodReport;
BFMDemodReport?: BFMDemodReport;
FreeDVDemodReport?: FreeDVDemodReport;
FreeDVModReport?: FreeDVModReport;
NFMDemodReport?: NFMDemodReport;
SSBDemodReport?: SSBDemodReport;
Expand Down
91 changes: 91 additions & 0 deletions src/app/channel-details/freedv-demod/freedv-demod.component.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
.channel-card-header {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
border: solid;
border-color: gray;
border-width: 1px;
margin-bottom: 5px;
padding: 0.2em 0.2em 0.2em 0.2em;
}

.channel-header-rx {
background-color: rgb(170,255,200);
}

.channel-header-comp {
margin-top: 1px;
}

.button-card {
padding-top: 0px;
padding-right: 0px;
padding-bottom: 0px;
padding-left: 0px;
width: 22px;
height: 22px;
}

.button-on {
border: solid;
border-width: 1px;
border-color: gray;
background-color: rgb(0, 255, 0, 1.0);
}

.button-off {
border: solid;
border-width: 1px;
border-color: gray;
background-color: rgb(0, 0, 0, 0);
}

.volume-input {
width: 6ch;
}

.squelch-input {
width: 6ch;
}

.rfbw-input {
width: 6ch;
}

.source-input {
width: 10ch;
background-color: white;
}

td {
background-color: rgb(230, 230, 210);
}

.status-ok-card {
border: outset;
border-color: rgb(134, 255, 110);
border-width: 2px;
margin-bottom: 5px;
padding: 0.2em 0.2em 0.2em 0.2em;
}

.status-ko-card {
border: solid;
border-color: rgb(255, 134, 110);
border-width: 2px;
padding: 0.2em 0.2em 0.2em 0.2em;
}

::ng-deep .mat-card {
/* CSS styles go here */
padding: 0px; /* for example to remove the margin */
}

::ng-deep .mat-checkbox-inner-container {
height: 14px!important;
width: 14px!important;
background-color: white;
}

::ng-deep .mat-checkbox-label {
line-height: 16px!important;
}
132 changes: 132 additions & 0 deletions src/app/channel-details/freedv-demod/freedv-demod.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
<mat-card>
<mat-card-header class="channel-card-header channel-header-rx">
<button mat-button class="button-card" matTooltip="Refresh" (click)="getChannelSettings()">
<img src="./assets/icons/if_refresh.svg" style="height:16px; width:16px"/>
</button>&nbsp;
<button mat-button mat-raised-button
[ngClass]="{'button-card': true, 'button-on': monitor, 'button-off': !monitor}"
matTooltip="Monitor on/off"
(click)="toggleMonitor()">
<img src="./assets/icons/eye-icon.svg" style="height:16px; width:16px; margin-top: 2px;"/>
</button>&nbsp;
<app-channel-header class="channel-header-comp" channelType="FreeDVDemod"
[basebandRate]="deviceBasebandRate"
[title]="settings.title"
[color]="rgbTitleStr"
(titleChanged)="onTitleChanged($event)"
(colorChanged)="onTitleColorChanged($event)" >
</app-channel-header>
</mat-card-header>
<mat-card-content>
<table>
<!-- Row 1: channel monitor (optional) -->
<tr *ngIf="monitor">
<td colspan="3">
<app-channel-monitor [value]=this.report.channelPowerDB
[min]="-120"
[max]="0"
[squelch]="this.report.squelch !== 0">
</app-channel-monitor>
</td>
</tr>
<!-- Row 2: Frequency dial -->
<tr>
<td colspan="2">
<app-frequency-dial
[frequency]="channelCenterFrequencyKhz"
[min]="channelMinFrequencyKhz"
[max]="channelMaxFrequencyKhz"
(frequencyChanged)="onFrequencyUpdate($event)">
</app-frequency-dial>
</td>
<td style="width:15ch">
&#x394;f {{getDeltaFrequency()}} kHz
</td>
</tr>
<!-- Row 3: Span, Mode, AGC -->
<tr>
<td>
&#xf7;
<mat-select style="width:6ch; background-color: white; margin: 1px;"
[(value)]="settings.spanLog2"
(selectionChange)="setSpan()"
matTooltip="Channel decimation">
<mat-option *ngFor="let spanLog2 of spanLog2s" [value]="spanLog2.value">
{{spanLog2.viewValue}}
</mat-option>
</mat-select>
<span matTooltip="Channel bandwidth">
{{getChannelBaseband()}} kHz
</span>
</td>
<td>
Mode
<mat-select class="source-input"
[(value)]="settings.freeDVMode"
(selectionChange)="setFreeDVMode()"
matTooltip="FreeDV protocol and modulation mode">
<mat-option *ngFor="let freeDVMode of freeDVModes" [value]="freeDVMode.value">
{{freeDVMode.viewValue}}
</mat-option>
</mat-select>
</td>
<td>
<mat-checkbox color="primary" [(ngModel)]="agc" (change)="setAGC()" matTooltip="Automatic Gain Control">
AGC
</mat-checkbox>
</td>
</tr>
<!-- row 4:volumeIn, volume, audio mute-->
<tr>
<td>
Vol In
<input type="number" class="volume-input"
[(ngModel)]="settings.volumeIn"
(change)="setVolumeIn()"
matTooltip="Modem input volume"
min=0 max=9.9
step="0.1">
</td>
<td>
Vol Out
<input type="number" class="volume-input"
[(ngModel)]="settings.volume"
(change)="setVolume()"
matTooltip="Audio output volume"
min=0 max=9.9
step="0.1">
</td>
<td>
<mat-checkbox color="primary" [(ngModel)]="audioMute" (change)="setAudioMute()" matTooltip="Audio mute">
Mute
</mat-checkbox>
</td>
</tr>
<!-- Audio options -->
<tr>
<td colspan="3">
Audio:
<mat-select style="width:48ch; background-color: white; margin: 1px;"
[(value)]="settings.audioDeviceName"
(selectionChange)="setAudioDevice()"
matTooltip="Audio input device">
<mat-option *ngFor="let audioDevice of audioDevices" [value]="audioDevice.value">
{{audioDevice.value}}
</mat-option>
</mat-select>
</td>
</tr>
<!-- Row 6: empty footer -->
<tr style="height: 3px;">
</tr>
</table>
<!-- empty footer -->
<table>
<tr style="height: 3px;">
</tr>
</table>
</mat-card-content>
</mat-card>
<mat-card [ngClass]="{'status-ko-card': statusError, 'status-ok-card': !statusError}">
{{ statusMessage }}
</mat-card>
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { FreeDVDemodComponent } from './freedv-demod.component';
import { ChannelHeaderComponent } from '../channel-header/channel-header.component';
import { ChannelMonitorComponent } from '../channel-monitor/channel-monitor.component';
import { RouterModule, ActivatedRoute } from '@angular/router';
import { FormsModule } from '@angular/forms';
import { MatCardModule, MatSelectModule, MatOptionModule, MatCheckboxModule, MatTooltipModule, MatProgressBarModule } from '@angular/material';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { CommonComponentsModule } from 'src/app/common-components/common-components.module';
import { ColorPickerModule } from 'ngx-color-picker';

describe('FreedvDemodComponent', () => {
let component: FreeDVDemodComponent;
let fixture: ComponentFixture<FreeDVDemodComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
FreeDVDemodComponent,
ChannelHeaderComponent,
ChannelMonitorComponent
],
imports: [
RouterModule,
FormsModule,
MatCardModule,
MatSelectModule,
MatOptionModule,
MatCheckboxModule,
MatTooltipModule,
MatProgressBarModule,
HttpClientTestingModule,
CommonComponentsModule,
ColorPickerModule
],
providers: [
{provide: ActivatedRoute, useValue: { snapshot: {parent: {params: {dix: 0, cix: 0}}}}}
]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(FreeDVDemodComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Loading

0 comments on commit 7870af8

Please sign in to comment.