mirror of
https://github.com/Eugeny/tabby.git
synced 2025-07-19 18:07:58 +00:00
strongly typed partial profiles wip
This commit is contained in:
@@ -9,7 +9,7 @@ import { SerialService } from '../services/serial.service'
|
||||
@Component({
|
||||
template: require('./serialProfileSettings.component.pug'),
|
||||
})
|
||||
export class SerialProfileSettingsComponent implements ProfileSettingsComponent {
|
||||
export class SerialProfileSettingsComponent implements ProfileSettingsComponent<SerialProfile> {
|
||||
profile: SerialProfile
|
||||
foundPorts: SerialPortInfo[]
|
||||
Platform = Platform
|
||||
|
@@ -10,7 +10,7 @@ import { SerialService } from './services/serial.service'
|
||||
import { BAUD_RATES, SerialProfile } from './api'
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class SerialProfilesService extends ProfileProvider {
|
||||
export class SerialProfilesService extends ProfileProvider<SerialProfile> {
|
||||
id = 'serial'
|
||||
name = 'Serial'
|
||||
settingsComponent = SerialProfileSettingsComponent
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import SerialPort from 'serialport'
|
||||
import { ProfilesService } from 'tabby-core'
|
||||
import { PartialProfile, ProfilesService } from 'tabby-core'
|
||||
import { SerialPortInfo, SerialProfile } from '../api'
|
||||
import { SerialTabComponent } from '../components/serialTab.component'
|
||||
|
||||
@@ -24,19 +24,12 @@ export class SerialService {
|
||||
baudrate = parseInt(path.split('@')[1])
|
||||
path = path.split('@')[0]
|
||||
}
|
||||
const profile: SerialProfile = {
|
||||
const profile: PartialProfile<SerialProfile> = {
|
||||
name: query,
|
||||
type: 'serial',
|
||||
options: {
|
||||
port: path,
|
||||
baudrate: baudrate,
|
||||
databits: 8,
|
||||
parity: 'none',
|
||||
rtscts: false,
|
||||
stopbits: 1,
|
||||
xany: false,
|
||||
xoff: false,
|
||||
xon: false,
|
||||
},
|
||||
}
|
||||
window.localStorage.lastSerialConnection = JSON.stringify(profile)
|
||||
|
Reference in New Issue
Block a user