Skip to content
This repository has been archived by the owner on Mar 3, 2022. It is now read-only.

Commit

Permalink
Feat: updated deviceType of sub-devices
Browse files Browse the repository at this point in the history
  • Loading branch information
nytamin committed May 18, 2018
1 parent 87e1b15 commit 3953b42
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/coreHandler.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { CoreConnection,
CoreOptions,
DeviceType,
PeripheralDeviceAPI as P
} from 'core-integration'
import * as Winston from 'winston'
Expand Down Expand Up @@ -64,7 +63,7 @@ export class CoreMosDeviceHandler {
this._mosDevice = this._mosDevice // ts-ignore fix

this._coreParentHandler.logger.info('new CoreMosDeviceHandler ' + mosDevice.idPrimary)
this.core = new CoreConnection(parent.getCoreConnectionOptions('MOS: ' + mosDevice.idPrimary, mosDevice.idPrimary))
this.core = new CoreConnection(parent.getCoreConnectionOptions('MOS: ' + mosDevice.idPrimary, mosDevice.idPrimary, false))


}
Expand Down Expand Up @@ -107,10 +106,10 @@ export class CoreMosDeviceHandler {
this._coreParentHandler.logger.info(type, id, cmd)
this.executeFunction(cmd)
}
observer.added = (id) => {
observer.added = (id: string) => {
addedChanged('added', id)
}
observer.changed = (id) => {
observer.changed = (id: string) => {
addedChanged('changed', id)
}
let cmds = this.core.getCollection('peripheralDeviceCommands')
Expand Down Expand Up @@ -344,7 +343,7 @@ export class CoreHandler {

init (config: CoreConfig): Promise<void> {
this.logger.info('========')
this.core = new CoreConnection(this.getCoreConnectionOptions('MOS: Parent process', 'MosCoreParent'))
this.core = new CoreConnection(this.getCoreConnectionOptions('MOS: Parent process', 'MosCoreParent', true))

this.core.onConnected(() => {
this.logger.info('Core Connected!')
Expand Down Expand Up @@ -384,10 +383,10 @@ export class CoreHandler {
// nothing
})
}
getCoreConnectionOptions (name: string, deviceId: string): CoreOptions {
getCoreConnectionOptions (name: string, deviceId: string, parentProcess: boolean): CoreOptions {
let credentials = CoreConnection.getCredentials(deviceId)
return _.extend(credentials, {
deviceType: DeviceType.MOSDEVICE,
deviceType: (parentProcess ? P.DeviceType.MOSDEVICE : P.DeviceType.OTHER),
deviceName: name
})
}
Expand Down

0 comments on commit 3953b42

Please sign in to comment.