Merge branch 'master' into feature/neeo_control
This commit is contained in:
		| @@ -85,7 +85,10 @@ export class ControlUnit implements IAccessory { | |||||||
|  |  | ||||||
|         //Configure services |         //Configure services | ||||||
|         this.configureTvService(); |         this.configureTvService(); | ||||||
|  |  | ||||||
|         this.configureTvSpeakerService(); |         this.configureTvSpeakerService(); | ||||||
|  |  | ||||||
|  |  | ||||||
|         // this.configureAccessoryInformation(); |         // this.configureAccessoryInformation(); | ||||||
|         this.configureInputSourceService(); |         this.configureInputSourceService(); | ||||||
|  |  | ||||||
| @@ -130,9 +133,12 @@ export class ControlUnit implements IAccessory { | |||||||
|             //@ts-ignore |             //@ts-ignore | ||||||
|             .on("get", callbackify(this.onGetAccessoryActive)); |             .on("get", callbackify(this.onGetAccessoryActive)); | ||||||
|  |  | ||||||
|  |         //Set remote characteristics if is external | ||||||
|  |         if (this.isExternal) { | ||||||
|             this.televisionService.getCharacteristic(Characteristic.RemoteKey) |             this.televisionService.getCharacteristic(Characteristic.RemoteKey) | ||||||
|                 //@ts-ignore |                 //@ts-ignore | ||||||
|                 .on("set", callbackify(this.onSetRemoteKey)); |                 .on("set", callbackify(this.onSetRemoteKey)); | ||||||
|  |         } | ||||||
|  |  | ||||||
|         this.televisionService.getCharacteristic(Characteristic.ActiveIdentifier) |         this.televisionService.getCharacteristic(Characteristic.ActiveIdentifier) | ||||||
|             //@ts-ignore |             //@ts-ignore | ||||||
| @@ -166,16 +172,18 @@ export class ControlUnit implements IAccessory { | |||||||
|      * Event handler for SET remote key |      * Event handler for SET remote key | ||||||
|      */ |      */ | ||||||
|     private onSetRemoteKey = async (key: any) => { |     private onSetRemoteKey = async (key: any) => { | ||||||
|  |         if (this.isExternal) { | ||||||
|             //Set the active identifier with every key press |             //Set the active identifier with every key press | ||||||
|         let currentActivity: Activity = this.dataProvider.getIsActive(this.name)!; |             // let currentActivity: Activity = this.dataProvider.getIsActive(this.name)!; | ||||||
|         let identifier: number = 0; |             // let identifier: number = 0; | ||||||
|         if (currentActivity) { |             // if (currentActivity) { | ||||||
|             identifier = this.activities.findIndex(e => e.displayName === currentActivity.displayName); |             //     identifier = this.activities.findIndex(e => e.displayName === currentActivity.displayName); | ||||||
|         } |             // } | ||||||
|         this.televisionService!.setCharacteristic(Characteristic.ActiveIdentifier, identifier); |             // this.televisionService!.setCharacteristic(Characteristic.ActiveIdentifier, identifier); | ||||||
|  |  | ||||||
|             this.dataProvider.sendKeyPress(this.name, key); |             this.dataProvider.sendKeyPress(this.name, key); | ||||||
|         } |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Event handler for SET active identifier characteristic |      * Event handler for SET active identifier characteristic | ||||||
| @@ -233,11 +241,13 @@ export class ControlUnit implements IAccessory { | |||||||
|      * Event handler for SET volume characteristic |      * Event handler for SET volume characteristic | ||||||
|      */ |      */ | ||||||
|     private onSetVolumeSelector = async (value: any) => { |     private onSetVolumeSelector = async (value: any) => { | ||||||
|  |         if (this.isExternal) { | ||||||
|             switch (value) { |             switch (value) { | ||||||
|                 case 0: this.dataProvider.volumeUp(this.name); break; |                 case 0: this.dataProvider.volumeUp(this.name); break; | ||||||
|                 case 1: this.dataProvider.volumeDown(this.name); break; |                 case 1: this.dataProvider.volumeDown(this.name); break; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|     /********************* |     /********************* | ||||||
|      *  |      *  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user