homebridge-xbox-tv 2.10.0-beta.21 → 2.10.0-beta.211

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -8,13 +8,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8
8
  ## After update to 2.x.x the plugin settings (xboxLiveId) need to be updated.
9
9
 
10
10
  ## [2.10.0] - (xx.09.2023)
11
+ ## After update to this version the plugin properties are changed and console must be authorized and settings need to be corrected.
11
12
  ## Changes
12
13
  - full code refactor
13
- - added possibility to enable/disable power, rc and volume control over web api
14
- - fixed RC control over local api (only if disabled over web api)
15
- - fixed Volume control over local api (only if disabled over web api)
14
+ - added possibility toggle Power control between local/web api
15
+ - added possibility toggle RC control between local/web api
16
+ - added possibility toggle Volume control between local/web api
17
+ - fixed laggy remote control [#140](https://github.com/grzegorz914/homebridge-xbox-tv/issues/140)
16
18
  - fixed disconnect problem on first run
19
+ - performance and stability improvements
17
20
  - config.schema updated
21
+ - readme updated
18
22
  - cleanup
19
23
 
20
24
  ## [2.9.0] - (29.07.2023)
package/README.md CHANGED
@@ -25,14 +25,14 @@ Homebridge plugin for Microsoft game Consoles. Tested with Xbox One X/S and Xbox
25
25
 
26
26
  ## About The Plugin
27
27
  * Power ON/OFF short press tile in HomeKit app.
28
- * Reboot Console with additional button, rquired `webApiControl` enabled.
29
- * RC/Media control is possible after you go to the RC app on iPhone/iPad.
30
- * Speaker control is possible after you go to RC app on iPhone/iPad `Speaker Service`.
31
- * Legacy Volume and Mute control is possible throught extra `lightbulb`/`fan` (slider).
28
+ * Reboot Console with button, rquired `webApiControl` enabled.
29
+ * Record Game DVR with button, rquired `webApiControl` enabled.
30
+ * RC/Media/Volume control from RC app on iPhone/iPad and possible over web/local api.
31
+ * Speaker control from RC app on iPhone/iPad `Speaker Service`.
32
+ * Legacy Volume/Mute control is possible throught extra `lightbulb`/`fan` (slider).
32
33
  * Apps, Inputs, Games can be switched if `webApiControl` is enabled and console is authorized.
33
- * Siri can be used for all functions, some times need create legacy buttons/switches/sensors.
34
- * Automations can be used for all functions, some times need create legacy buttons/switches/sensors.
35
- * Record Game DVR with additional button.
34
+ * Siri can be used for all functions, some times need to be created legacy buttons/switches/sensors.
35
+ * Automations can be used for all functions, some times need to be created legacy buttons/switches/sensors.
36
36
  * RESTful server:
37
37
  * Request: `http//homebridge_ip_address:port/path`.
38
38
  * Path: `info`, `state`, `consoleslist`, `profile`, `apps`, `storages`, `status`.
@@ -41,7 +41,7 @@ Homebridge plugin for Microsoft game Consoles. Tested with Xbox One X/S and Xbox
41
41
  * Topic: `Info`, `State`, `Consoles List`, `Profile`, `Apps`, `Storages`, `Status`.
42
42
  * Publish as JSON data.
43
43
 
44
- <p align="left">
44
+ <p align="center">
45
45
  <a href="https://github.com/grzegorz914/homebridge-xbox-tv"><img alt="Accessory tile in the HomeKit app" src="https://raw.githubusercontent.com/grzegorz914/homebridge-xbox-tv/master/graphics/homekit.png" width="382" /></a>
46
46
  <a href="https://github.com/grzegorz914/homebridge-xbox-tv"><img alt="Changing the accessory input" src="https://raw.githubusercontent.com/grzegorz914/homebridge-xbox-tv/master/graphics/inputs.png" width="135" /></a>
47
47
  <a href="https://github.com/grzegorz914/homebridge-xbox-tv"><img alt="Arrow pointing to the remote control icon in the control center" src="https://raw.githubusercontent.com/grzegorz914/homebridge-xbox-tv/master/graphics/rc1.png" width="135" /></a>
@@ -53,7 +53,7 @@ Homebridge plugin for Microsoft game Consoles. Tested with Xbox One X/S and Xbox
53
53
  * Start new authorization need remove old token first, to clear token use Authorization Manager GUI.
54
54
  * Make sure Your web browser do not block pop-up window, if Yes allow pop-up window for this app.
55
55
 
56
- <p align="left">
56
+ <p align="center">
57
57
  <a href="https://github.com/grzegorz914/homebridge-xbox-tv"><img alt="Authentication Manager" src="https://raw.githubusercontent.com/grzegorz914/homebridge-xbox-tv/master/graphics/config manager.png" width="540"></a>
58
58
  </p>
59
59
 
@@ -64,11 +64,10 @@ Homebridge plugin for Microsoft game Consoles. Tested with Xbox One X/S and Xbox
64
64
  * Profile & System > Settings > Devices & Connections > Remote features > Xbox app preferences.
65
65
  * Run this plugin as a [Child Bridge](https://github.com/homebridge/homebridge/wiki/Child-Bridges) (Highly Recommended), this prevent crash Homebridge if plugin crashes.
66
66
  * Install and use [Homebridge Config UI X](https://github.com/oznu/homebridge-config-ui-x/wiki) to configure this plugin.
67
- * The `sample-config.json` can be edited and used as an alternative.
68
- * Be sure to always make a backup copy of your config.json file before making any changes to it.
67
+ * The `sample-config.json` can be edited and used as an alternative (advanced users).
69
68
 
70
- <p align="left">
71
- <a href="https://github.com/grzegorz914/homebridge-xbox-tv"><img src="https://raw.githubusercontent.com/grzegorz914/homebridge-xbox-tv/master/graphics/plugin settings.png" width="840"></a>
69
+ <p align="center">
70
+ <a href="https://github.com/grzegorz914/homebridge-xbox-tv"><img src="https://raw.githubusercontent.com/grzegorz914/homebridge-xbox-tv/master/graphics/settings.png" width="840"></a>
72
71
  </p>
73
72
 
74
73
  | Key | Description |
@@ -96,12 +95,12 @@ Homebridge plugin for Microsoft game Consoles. Tested with Xbox One X/S and Xbox
96
95
  | `sensorInputs.reference` | Here set *Reference* like `Xbox.Dashboard_8wekyb3d8bbwe!Xbox.Dashboard.Application` to be exposed as sensor (active on switch to this Input). |
97
96
  | `sensorInputs.displayType` | Here select sensor type to be exposed in HomeKit app, possible `None/Disabled`, `Motion Sensor`, `Occupancy Sensor`, `Contact Sensor`. |
98
97
  | `webApiControl` | This enable console control over Web Api. Additional functions are available in `Advanced Settings` section. |
99
- | `webApiPowerOnOff` | This enable power control over Web Api. |
100
- | `webApiRcControl` | This enable remote control over Web Api. |
101
- | `webApiVolumeControl` | This enable volume/mute control over Web Api. |
102
- | `xboxWebApiToken` | Required if `webApiControl` enabled. |
103
- | `clientId` | If You create app on Azure AD then You can use your own Client Id. |
104
- | `clientSecret` | If You create app on Azure AD then You can use own Client Secret. |
98
+ | `webApiPowerOnOff` | This enable `Power` control over Web Api. |
99
+ | `webApiRcControl` | This enable `Remote` control over Web Api. |
100
+ | `webApiVolumeControl` | This enable `Volume/Mute` control over Web Api. |
101
+ | `webApiToken` | Required if `webApiControl` enabled, use Authorization Manager to get it. |
102
+ | `webApiClientId` | If You are created App on Azure AD then You can use your own Client Id. |
103
+ | `webApiClientSecret` | If You are created App on Azure AD then You can use own Client Secret. |
105
104
  | `enableDebugMode` | If enabled, deep log will be present in homebridge console. |
106
105
  | `disableLogInfo` | If enabled, disable log info, all values and state will not be displayed in Homebridge log console. |
107
106
  | `disableLogDeviceInfo` | If enabled, add ability to disable log device info by every connections device to the network. |
@@ -111,26 +110,27 @@ Homebridge plugin for Microsoft game Consoles. Tested with Xbox One X/S and Xbox
111
110
  | `restFulPort` | Here set the listening `Port` for RESTful server. |
112
111
  | `restFulDebug` | If enabled, deep log will be present in homebridge console for RESTFul server. |
113
112
  | `enableMqtt` | If enabled, MQTT Broker will start automatically and publish all awailable PV installation data. |
114
- | `mqttHost` | Here set the *IP Address* or *Hostname* for MQTT Broker. |
115
- | `mqttPort` | Here set the *Port* for MQTT Broker, default 1883. |
116
- | `mqttPrefix` | Here set the *Prefix* for *Topic* or leave empty. |
113
+ | `mqttHost` | Here set the `IP Address` or `Hostname` for MQTT Broker. |
114
+ | `mqttPort` | Here set the `Port` for MQTT Broker, default 1883. |
115
+ | `mqttClientId` | Here optional set the `Client Id` of MQTT Broker. |
116
+ | `mqttPrefix` | Here set the`Prefix` for `Topic` or leave empty. |
117
117
  | `mqttAuth` | If enabled, MQTT Broker will use authorization credentials. |
118
- | `mqttUser` | Here set the MQTT Broker user. |
119
- | `mqttPasswd` | Here set the MQTT Broker password. |
118
+ | `mqttUser` | Here set the `User` for MQTT Broker. |
119
+ | `mqttPasswd` | Here set the `Password` for MQTT Broker. |
120
120
  | `mqttDebug` | If enabled, deep log will be present in homebridge console for MQTT. |
121
121
  | `reference`, `oneStoreProductId` | If web Api enabled then all available in `./homebridge/xboxTv/inputs_xxxxxx` file. |
122
122
  | `Volume Control` | -1 - `None/Disabled`, 0 - `Slider`, 1 - `Fan`. |
123
123
  | `Display Type Inputs/Buttons` | -1 - `None/Disabled`, 0 - `Outlet`, 1 - `Switch`. |
124
124
  | `Display Type Sensors` | -1 - `None/Disabled`, 0 - `Motion Sensor`, 1 - `Occupancy Sensor`, 2 - `Contact Sensor`. |
125
125
 
126
- ## Create app on Azure AD
126
+ ## Create App on Azure AD
127
127
  * Go to [Azure Portal](https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationsListBlade)
128
- * Register new app *+ New registration*
128
+ * Register new *App* + *New registration*
129
129
  * Enter a name for your app
130
130
  * Set *Supported account types* to *Personal Microsoft accounts only*
131
131
  * Click register
132
132
  * Choose *Redirect URIs* -> *Add a Redirect URI*
133
- * Click "Add a platform" -> "Mobile and desktop applications"
133
+ * Click *Add a platform* -> *Mobile and desktop applications*
134
134
  * Enter custom redirect URI *http://localhost:8888/auth/callback*
135
- * From the overview of your app page, copy *Application (client) ID* to `clientId`
135
+ * From the overview of your app page, copy *Application (client) ID* to `webApiClientId`
136
136
  * Save restart plugin and authorize console again and have fun.
@@ -511,27 +511,27 @@
511
511
  "functionBody": "return model.devices[arrayIndices].webApiControl === true;"
512
512
  }
513
513
  },
514
- "xboxWebApiToken": {
514
+ "webApiToken": {
515
515
  "title": "Web Api Token",
516
516
  "type": "string",
517
517
  "placeholder": "Web Api Token",
518
518
  "description": "Here put the reponse Token (value after ?code=) from the authorization URL.",
519
- "required": false,
519
+ "required": true,
520
520
  "condition": {
521
521
  "functionBody": "return model.devices[arrayIndices].webApiControl === true;"
522
522
  }
523
523
  },
524
- "clientId": {
525
- "title": "Client ID",
524
+ "webApiClientId": {
525
+ "title": "Client Id",
526
526
  "type": "string",
527
527
  "placeholder": "a34ac209-edab-4b08-91e7-a4558d8da1bd",
528
- "description": "Here set your own Client ID from Azure AD or leave empty if you do not have own account.",
528
+ "description": "Here set your own Client Id from Azure AD or leave empty if you do not have own account.",
529
529
  "required": false,
530
530
  "condition": {
531
531
  "functionBody": "return model.devices[arrayIndices].webApiControl === true;"
532
532
  }
533
533
  },
534
- "clientSecret": {
534
+ "webApiClientSecret": {
535
535
  "title": "Client Secret",
536
536
  "type": "string",
537
537
  "placeholder": "Client Secret",
@@ -713,6 +713,16 @@
713
713
  "functionBody": "return model.devices[arrayIndices].enableMqtt === true;"
714
714
  }
715
715
  },
716
+ "mqttClientId": {
717
+ "title": "Client ID",
718
+ "type": "string",
719
+ "placeholder": "client id",
720
+ "required": false,
721
+ "description": "Here optional set the Client ID of MQTT Broker.",
722
+ "condition": {
723
+ "functionBody": "return model.devices[arrayIndices].enableMqtt === true"
724
+ }
725
+ },
716
726
  "mqttAuth": {
717
727
  "title": "Authorization",
718
728
  "type": "boolean",
@@ -853,9 +863,9 @@
853
863
  "devices[].webApiPowerOnOff",
854
864
  "devices[].webApiRcControl",
855
865
  "devices[].webApiVolumeControl",
856
- "devices[].xboxWebApiToken",
857
- "devices[].clientId",
858
- "devices[].clientSecret"
866
+ "devices[].webApiToken",
867
+ "devices[].webApiClientId",
868
+ "devices[].webApiClientSecret"
859
869
  ]
860
870
  },
861
871
  {
@@ -895,6 +905,7 @@
895
905
  "devices[].mqttDebug",
896
906
  "devices[].mqttHost",
897
907
  "devices[].mqttPort",
908
+ "devices[].mqttClientId",
898
909
  "devices[].mqttPrefix",
899
910
  "devices[].mqttAuth",
900
911
  "devices[].mqttUser",
@@ -60,10 +60,10 @@
60
60
  document.getElementById('deviceName').innerHTML = pluginConfig[0].devices[i].name || '';
61
61
  document.getElementById('deviceHost').value = pluginConfig[0].devices[i].host || '';
62
62
  document.getElementById('deviceLiveId').value = pluginConfig[0].devices[i].xboxLiveId || '';
63
- document.getElementById('deviceToken').value = pluginConfig[0].devices[i].xboxWebApiToken || '';
63
+ document.getElementById('deviceToken').value = pluginConfig[0].devices[i].webApiToken || '';
64
64
  document.getElementById('deviceWebApiControl').checked = pluginConfig[0].devices[i].webApiControl || false;
65
65
 
66
- const tokenLength = (pluginConfig[0].devices[i].xboxWebApiToken).length || 0;
66
+ const tokenLength = (pluginConfig[0].devices[i].webApiToken).length || 0;
67
67
  const setButtonName = tokenLength <= 10 ? document.getElementById('startAuthorizationButton').innerText = "Start authorization" : document.getElementById('startAuthorizationButton').innerText = "Check state";
68
68
  const setCheckboxState = tokenLength <= 10 ? document.getElementById('deviceWebApiControl').checked = false : false;
69
69
  const setCheckboxMode = tokenLength <= 10 ? document.getElementById('deviceWebApiControl').disabled = true : document.getElementById('deviceWebApiControl').disabled = false;
@@ -88,7 +88,7 @@
88
88
  document.getElementById('configForm').addEventListener('input', async () => {
89
89
  pluginConfig[0].devices[this.deviceIndex].host = document.querySelector('#deviceHost').value;
90
90
  pluginConfig[0].devices[this.deviceIndex].xboxLiveId = document.querySelector('#deviceLiveId').value;
91
- pluginConfig[0].devices[this.deviceIndex].xboxWebApiToken = document.querySelector('#deviceToken').value;
91
+ pluginConfig[0].devices[this.deviceIndex].webApiToken = document.querySelector('#deviceToken').value;
92
92
  pluginConfig[0].devices[this.deviceIndex].webApiControl = document.querySelector('#deviceWebApiControl').checked;
93
93
 
94
94
  const tokenLength1 = (document.querySelector('#deviceToken').value).length || 0;
@@ -118,7 +118,7 @@
118
118
  document.getElementById('deviceWebApiControl').checked = false;
119
119
  document.getElementById('deviceWebApiControl').disabled = true;
120
120
  document.getElementById('info').innerHTML = info;
121
- pluginConfig[0].devices[this.deviceIndex].xboxWebApiToken = '';
121
+ pluginConfig[0].devices[this.deviceIndex].webApiToken = '';
122
122
  pluginConfig[0].devices[this.deviceIndex].webApiControl = false;
123
123
 
124
124
  await homebridge.updatePluginConfig(pluginConfig);
@@ -145,16 +145,16 @@
145
145
  document.getElementById('info').innerHTML = '';
146
146
 
147
147
  const host = pluginConfig[0].devices[this.deviceIndex].host;
148
- const clientId = pluginConfig[0].devices[this.deviceIndex].clientId;
149
- const clientSecret = pluginConfig[0].devices[this.deviceIndex].clientSecret;
150
- const xboxWebApiToken = pluginConfig[0].devices[this.deviceIndex].xboxWebApiToken;
148
+ const webApiClientId = pluginConfig[0].devices[this.deviceIndex].webApiClientId;
149
+ const webApiClientSecret = pluginConfig[0].devices[this.deviceIndex].webApiClientSecret;
150
+ const webApiToken = pluginConfig[0].devices[this.deviceIndex].webApiToken;
151
151
 
152
152
  const payload = {
153
153
  mode: 'authorization',
154
154
  host: host,
155
- clientId: clientId,
156
- clientSecret: clientSecret,
157
- webApiToken: xboxWebApiToken
155
+ webApiClientId: webApiClientId,
156
+ webApiClientSecret: webApiClientSecret,
157
+ webApiToken: webApiToken
158
158
  };
159
159
  const response = await homebridge.request('/startAuthorization', payload);
160
160
  const info = response.info;
@@ -25,8 +25,8 @@ class PluginUiServer extends HomebridgePluginUiServer {
25
25
  const tokensFile = `${this.homebridgeStoragePath}/xboxTv/authToken_${host.split('.').join('')}`;
26
26
 
27
27
  const authConfig = {
28
- clientId: payload.clientId,
29
- clientSecret: payload.clientSecret,
28
+ webApiClientId: payload.webApiClientId,
29
+ webApiClientSecret: payload.webApiClientSecret,
30
30
  tokensFile: tokensFile
31
31
  }
32
32
  const authentication = new Authentication(authConfig);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "Xbox TV",
3
3
  "name": "homebridge-xbox-tv",
4
- "version": "2.10.0-beta.21",
4
+ "version": "2.10.0-beta.211",
5
5
  "description": "Homebridge plugin (https://github.com/homebridge/homebridge) to control Xbox game consoles.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
@@ -25,8 +25,8 @@
25
25
  "LICENSE"
26
26
  ],
27
27
  "engines": {
28
- "node": ">=16.0.0",
29
- "homebridge": ">=1.5.0"
28
+ "node": ">=18.0.0",
29
+ "homebridge": ">=1.6.0"
30
30
  },
31
31
  "dependencies": {
32
32
  "@homebridge/plugin-ui-utils": "^0.1.0",
@@ -34,9 +34,10 @@
34
34
  "elliptic": "^6.5.4",
35
35
  "hex-to-binary": "^1.0.1",
36
36
  "jsrsasign": "^10.8.6",
37
- "uuid": "^9.0.0",
37
+ "uuid": "^9.0.1",
38
38
  "ping": "^0.4.4",
39
- "express": "^4.18.2"
39
+ "express": "^4.18.2",
40
+ "axios": "^1.5.1"
40
41
  },
41
42
  "keywords": [
42
43
  "homebridge",
package/src/constans.json CHANGED
@@ -3,66 +3,75 @@
3
3
  "PluginName": "homebridge-xbox-tv",
4
4
  "DefaultInputs": [
5
5
  {
6
- "name": "Screensaver",
6
+ "oneStoreProductId": "Screensaver",
7
7
  "titleId": "851275400",
8
8
  "reference": "Xbox.IdleScreen_8wekyb3d8bbwe!Xbox.IdleScreen.Application",
9
- "oneStoreProductId": "Screensaver",
9
+ "isGame": false,
10
+ "name": "Screensaver",
10
11
  "contentType": "Dashboard"
11
12
  },
12
13
  {
13
- "name": "Dashboard",
14
+ "oneStoreProductId": "Dashboard",
14
15
  "titleId": "750323071",
15
16
  "reference": "Xbox.Dashboard_8wekyb3d8bbwe!Xbox.Dashboard.Application",
16
- "oneStoreProductId": "Dashboard",
17
+ "isGame": false,
18
+ "name": "Dashboard",
17
19
  "contentType": "Dashboard"
18
20
  },
19
21
  {
20
- "name": "Settings",
22
+ "oneStoreProductId": "Settings",
21
23
  "titleId": "1837352387",
22
24
  "reference": "Microsoft.Xbox.Settings_8wekyb3d8bbwe!Xbox.Settings.Application",
23
- "oneStoreProductId": "Settings",
25
+ "isGame": false,
26
+ "name": "Settings",
24
27
  "contentType": "Dashboard"
25
28
  },
26
29
  {
27
- "name": "Television",
30
+ "oneStoreProductId": "Television",
28
31
  "titleId": "371594669",
29
32
  "reference": "Microsoft.Xbox.LiveTV_8wekyb3d8bbwe!Microsoft.Xbox.LiveTV.Application",
30
- "oneStoreProductId": "Television",
33
+ "isGame": false,
34
+ "name": "Television",
31
35
  "contentType": "systemApp"
32
36
  },
33
37
  {
34
- "name": "Settings TV",
38
+ "oneStoreProductId": "SettingsTv",
35
39
  "titleId": "2019308066",
36
40
  "reference": "Microsoft.Xbox.TvSettings_8wekyb3d8bbwe!Microsoft.Xbox.TvSettings.Application",
37
- "oneStoreProductId": "SettingsTv",
41
+ "isGame": false,
42
+ "name": "Settings TV",
38
43
  "contentType": "Dashboard"
39
44
  },
40
45
  {
41
- "name": "Accessory",
46
+ "oneStoreProductId": "Accessory",
42
47
  "titleId": "758407307",
43
48
  "reference": "Microsoft.XboxDevices_8wekyb3d8bbwe!App",
44
- "oneStoreProductId": "Accessory",
49
+ "isGame": false,
50
+ "name": "Accessory",
45
51
  "contentType": "systemApp"
46
52
  },
47
53
  {
48
- "name": "Network Troubleshooter",
54
+ "oneStoreProductId": "NetworkTroubleshooter",
49
55
  "titleId": "1614319806",
50
56
  "reference": "Xbox.NetworkTroubleshooter_8wekyb3d8bbwe!Xbox.NetworkTroubleshooter.Application",
51
- "oneStoreProductId": "NetworkTroubleshooter",
57
+ "isGame": false,
58
+ "name": "Network Troubleshooter",
52
59
  "contentType": "systemApp"
53
60
  },
54
61
  {
55
- "name": "Microsoft Store",
62
+ "oneStoreProductId": "MicrosoftStore",
56
63
  "titleId": "1864271209",
57
64
  "reference": "Microsoft.storify_8wekyb3d8bbwe!App",
58
- "oneStoreProductId": "MicrosoftStore",
65
+ "isGame": false,
66
+ "name": "Microsoft Store",
59
67
  "contentType": "Dashboard"
60
68
  },
61
69
  {
62
- "name": "Xbox Guide",
70
+ "oneStoreProductId": "XboxGuide",
63
71
  "titleId": "1052052983",
64
72
  "reference": "Xbox.Guide_8wekyb3d8bbwe!Xbox.Guide.Application",
65
- "oneStoreProductId": "XboxGuide",
73
+ "isGame": false,
74
+ "name": "Xbox Guide",
66
75
  "contentType": "systemApp"
67
76
  }
68
77
  ],
@@ -118,75 +127,102 @@
118
127
  "ParticipantId": {
119
128
  "Target": 0
120
129
  },
121
- "Channels": {
122
- "SystemMedia": {
123
- "ChannelId": 0,
124
- "ChannelName": "SystemMedia",
125
- "ChannelUuid": "48a9ca24eb6d4e128c43d57469edd3cd"
126
- },
127
- "SystemInput": {
128
- "ChannelId": 1,
129
- "ChannelName": "SystemInput",
130
- "ChannelUuid": "fa20b8ca66fb46e0adb60b978a59d35f"
131
- },
132
- "TvRemote": {
133
- "ChannelId": 2,
134
- "ChannelName": "TvRemote",
135
- "ChannelUuid": "d451e3b360bb4c71b3dbf994b1aca3a7"
136
- },
137
- "SystemConfig": {
138
- "ChannelId": 3,
139
- "ChannelName": "SystemConfig",
140
- "ChannelUuid": "d451e3b360bb4c71b3dbf994b1aca3a7",
141
- "ChannelsConfigNames": [
142
- "GetConfiguration",
143
- "GetHeadendInfo",
144
- "GetLiveTVInfo",
145
- "GetTunerLineups",
146
- "GetAppChannelLineups"
147
- ]
130
+ "Console": {
131
+ "Name": {
132
+ "1": "Xbox One",
133
+ "2": "Xbox 360",
134
+ "3": "Windows Desktop",
135
+ "4": "Windows Store",
136
+ "5": "Windows Phone",
137
+ "6": "iPhone",
138
+ "7": "iPad",
139
+ "8": "Android"
148
140
  },
149
- "Commands": {
150
- "SystemMedia": {
151
- "play": 2,
152
- "pause": 4,
153
- "playPause": 8,
154
- "stop": 16,
155
- "record": 32,
156
- "nextTrack": 64,
157
- "prevTrack": 128,
158
- "fastForward": 256,
159
- "rewind": 512,
160
- "channelUp": 1024,
161
- "channelDown": 2048,
162
- "back": 4096,
163
- "view": 8192,
164
- "menu": 16384,
165
- "seek": 32786
166
- },
167
- "SystemInput": {
168
- "unpress": 0,
169
- "enroll": 1,
170
- "nexus": 2,
171
- "view": 4,
172
- "menu": 8,
173
- "a": 16,
174
- "b": 32,
175
- "x": 64,
176
- "y": 128,
177
- "up": 256,
178
- "down": 512,
179
- "left": 1024,
180
- "right": 2048,
181
- "leftShoulder": 4096,
182
- "rightShoulder": 8192,
183
- "leftThumbstick": 16384,
184
- "rightThumbstick": 32768
141
+ "PairingState": {
142
+ "0": "Not Paired",
143
+ "1": "Paired"
144
+ }
145
+ },
146
+ "Channels": {
147
+ "System": {
148
+ "Input": {
149
+ "Id": 0,
150
+ "Uuid": "fa20b8ca66fb46e0adb60b978a59d35f",
151
+ "Commands": {
152
+ "unpress": 0,
153
+ "enroll": 1,
154
+ "nexus": 2,
155
+ "view": 4,
156
+ "menu": 8,
157
+ "a": 16,
158
+ "b": 32,
159
+ "x": 64,
160
+ "y": 128,
161
+ "up": 256,
162
+ "down": 512,
163
+ "left": 1024,
164
+ "right": 2048,
165
+ "leftShoulder": 4096,
166
+ "rightShoulder": 8192,
167
+ "leftThumbstick": 16384,
168
+ "rightThumbstick": 32768
169
+ }
185
170
  },
186
171
  "TvRemote": {
187
- "volUp": "btn.vol_up",
188
- "volDown": "btn.vol_down",
189
- "volMute": "btn.vol_mute"
172
+ "Id": 1,
173
+ "Uuid": "d451e3b360bb4c71b3dbf994b1aca3a7",
174
+ "Commands": {
175
+ "volUp": "btn.vol_up",
176
+ "volDown": "btn.vol_down",
177
+ "volMute": "btn.vol_mute"
178
+ },
179
+ "MessageType": {
180
+ "Error": "Error",
181
+ "GetConfiguration": "GetConfiguration",
182
+ "GetHeadendInfo": "GetHeadendInfo",
183
+ "GetLiveTVInfo": "GetLiveTVInfo",
184
+ "GetProgramInfo": "GetProgramInfo",
185
+ "GetRecentChannels": "GetRecentChannels",
186
+ "GetTunerLineups": "GetTunerLineups",
187
+ "GetAppChannelData": "GetAppChannelData",
188
+ "GetAppChannelLineups": "GetAppChannelLineups",
189
+ "GetAppChannelProgramData": "GetAppChannelProgramData",
190
+ "SendKey": "SendKey",
191
+ "SetChannel": "SetChannel"
192
+ }
193
+ },
194
+ "Media": {
195
+ "Id": 2,
196
+ "Uuid": "48a9ca24eb6d4e128c43d57469edd3cd",
197
+ "Commands": {
198
+ "play": 2,
199
+ "pause": 4,
200
+ "playPause": 8,
201
+ "stop": 16,
202
+ "record": 32,
203
+ "nextTrack": 64,
204
+ "previousTrack": 128,
205
+ "fastForward": 256,
206
+ "rewind": 512,
207
+ "channelUp": 1024,
208
+ "channelDown": 2048,
209
+ "back": 4096,
210
+ "view": 8192,
211
+ "menu": 16384,
212
+ "seek": 32786
213
+ }
214
+ },
215
+ "Text": {
216
+ "Id": 3,
217
+ "Uuid": "7af3e6a2488b40cba93179c04b7da3a0"
218
+ },
219
+ "Broadcast": {
220
+ "Id": 4,
221
+ "Uuid": "b6a117d8f5e245d7862e8fd8e3156476"
222
+ },
223
+ "Title": {
224
+ "Id": 5,
225
+ "Uuid": "00000000000000000000000000000000"
190
226
  }
191
227
  }
192
228
  },
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  const HexToBin = require('hex-to-binary');
3
- const Structure = require('./structure');
4
3
  const Packets = require('./packets.js');
4
+ const Structure = require('./structure');
5
5
  const CONSTANTS = require('../constans.json');
6
6
 
7
7
  class MESSAGE {
@@ -98,7 +98,7 @@ class MESSAGE {
98
98
  0x23: "titleLaunch",
99
99
  channelStartRequest: Buffer.from('a026', 'hex'),
100
100
  channelStartResponse: Buffer.from('a027', 'hex'),
101
- channelStop: Buffer.from('a028', 'hex'),
101
+ 0x28: "channelStop",
102
102
  0x29: "system",
103
103
  disconnect: Buffer.from('802a', 'hex'),
104
104
  0x2E: "titleTouch",
@@ -127,12 +127,12 @@ class MESSAGE {
127
127
 
128
128
  set(key, value, subkey = false) {
129
129
  switch (subkey) {
130
- case true:
131
- this.packet[subkey][key].value = value;
132
- break;
133
130
  case false:
134
131
  this.packet[key].value = value;
135
132
  break;
133
+ default:
134
+ this.packet[subkey][key].value = value;
135
+ break;
136
136
  };
137
137
  };
138
138
 
@@ -179,9 +179,10 @@ class MESSAGE {
179
179
 
180
180
  unpack(crypto = undefined, data = false) {
181
181
  const structure = new Structure(data);
182
+ const type = structure.readBytes(2).toString('hex');
182
183
 
183
184
  let packet = {
184
- type: structure.readBytes(2).toString('hex'),
185
+ type: type,
185
186
  payloadLength: structure.readUInt16(),
186
187
  sequenceNumber: structure.readUInt32(),
187
188
  targetParticipantId: structure.readUInt32(),
@@ -196,15 +197,16 @@ class MESSAGE {
196
197
  this.channelId = packet.channelId;
197
198
 
198
199
  // Lets decrypt the data when the payload is encrypted
199
- if (packet.payloadProtected) {
200
- const payloadDecrypted = crypto.decrypt(packet.payloadProtected, crypto.encrypt(data.slice(0, 16), crypto.getIv()));
200
+ const payloadProtectedExist = packet.payloadProtected !== undefined;
201
+ if (payloadProtectedExist) {
202
+ let payloadDecrypted = crypto.decrypt(packet.payloadProtected, crypto.encrypt(data.slice(0, 16), crypto.getIv()));
201
203
  packet.payloadDecrypted = new Structure(payloadDecrypted).toBuffer();
202
- packet.payloadProtected = {};
204
+ packet['payloadProtected'] = {};
203
205
 
204
206
  const packetProtected = this.packets[packet.type];
205
- const structureDecrypted = new Structure(payloadDecrypted);
207
+ const structurePayloadDecrypted = new Structure(payloadDecrypted);
206
208
  for (const name in packetProtected) {
207
- packet.payloadProtected[name] = packetProtected[name].unpack(structureDecrypted);
209
+ packet.payloadProtected[name] = packetProtected[name].unpack(structurePayloadDecrypted);
208
210
  };
209
211
  };
210
212