This repository has been archived by the owner on Mar 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implemented Mos-connection (it works now)
- Loading branch information
Showing
5 changed files
with
127 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,42 @@ | ||
|
||
import {MosHandler} from './mosHandler' | ||
import {CoreHandler} from './coreHandler' | ||
import {MosHandler, MosConfig} from './mosHandler' | ||
import {CoreHandler, CoreConfig} from './coreHandler' | ||
|
||
export interface Config { | ||
core: CoreConfig | ||
mos: MosConfig | ||
} | ||
export class Connector { | ||
|
||
private mosHandler: MosHandler | ||
private coreHandler: CoreHandler | ||
private _config: Config | ||
|
||
init (): Promise<number> { | ||
init (config: Config): Promise<number> { | ||
this._config = config | ||
|
||
return Promise.resolve() | ||
.then(() => { | ||
console.log('Initializing Core...') | ||
return this.initCore() | ||
}) | ||
.then(() => { | ||
console.log('Initializing Mos...') | ||
return this.initMos() | ||
}) | ||
.then(() => { | ||
console.log('Initialization done') | ||
return 0 | ||
}) | ||
} | ||
initCore () { | ||
this.coreHandler = new CoreHandler() | ||
return this.coreHandler.init() | ||
return this.coreHandler.init(this._config.core) | ||
} | ||
initMos (): Promise<void> { | ||
// TODO: maybe get some config data from core here? | ||
this.mosHandler = new MosHandler() | ||
return this.mosHandler.init(this.coreHandler) | ||
return this.mosHandler.init(this._config.mos, this.coreHandler) | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,41 @@ | ||
|
||
import {Connector} from './connector' | ||
import {Connector, Config} from './connector' | ||
|
||
console.log('Running MOS-integration...') | ||
let c = new Connector() | ||
|
||
c.init() | ||
let config: Config = { | ||
core: { | ||
host: '127.0.0.1', | ||
port: 3010 | ||
}, | ||
mos: { | ||
self: { | ||
|
||
mosID: 'seff.tv.automation', | ||
acceptsConnections: true, // default:true | ||
// accepsConnectionsFrom: ['127.0.0.1'], | ||
profiles: { | ||
'0': true, | ||
'1': true, | ||
'2': true, | ||
'3': false, | ||
'4': false, | ||
'5': false, | ||
'6': false, | ||
'7': false | ||
} | ||
}, | ||
devices: [{ | ||
primary: { | ||
id: 'WINSERVERSOMETHINGENPS', | ||
host: '10.0.1.248' | ||
} | ||
/*secondary?: { | ||
ncsID: string; | ||
host: string; | ||
},*/ | ||
}] | ||
} | ||
} | ||
c.init(config) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters