homebridge-xbox-tv 2.9.10-beta.21 → 2.9.10-beta.22
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "Xbox TV",
|
|
3
3
|
"name": "homebridge-xbox-tv",
|
|
4
|
-
"version": "2.9.10-beta.
|
|
4
|
+
"version": "2.9.10-beta.22",
|
|
5
5
|
"description": "Homebridge plugin (https://github.com/homebridge/homebridge) to control Xbox game consoles.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "grzegorz914",
|
package/src/localApi/message.js
CHANGED
|
@@ -58,10 +58,8 @@ class MESSAGE {
|
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
pack(crypto, sequenceNumber,
|
|
61
|
+
pack(crypto, sequenceNumber, targetParticipantId) {
|
|
62
62
|
const packetStructure = new PacketStructure();
|
|
63
|
-
const type = Buffer.from('d00d', 'hex');
|
|
64
|
-
const flag = this.setFlag(this.type);
|
|
65
63
|
let packet;
|
|
66
64
|
|
|
67
65
|
for (const name in this.structure) {
|
|
@@ -69,12 +67,12 @@ class MESSAGE {
|
|
|
69
67
|
}
|
|
70
68
|
|
|
71
69
|
const header = new PacketStructure();
|
|
72
|
-
header.writeBytes(
|
|
70
|
+
header.writeBytes(Buffer.from('d00d', 'hex'));
|
|
73
71
|
header.writeUInt16(packetStructure.toBuffer().length);
|
|
74
72
|
header.writeUInt32(sequenceNumber);
|
|
75
|
-
header.writeUInt32(
|
|
76
|
-
header.writeUInt32(
|
|
77
|
-
header.writeBytes(
|
|
73
|
+
header.writeUInt32(targetParticipantId);
|
|
74
|
+
header.writeUInt32(targetParticipantId);
|
|
75
|
+
header.writeBytes(this.setFlag(this.type));
|
|
78
76
|
header.writeBytes(CHANNELID);
|
|
79
77
|
|
|
80
78
|
if (packetStructure.toBuffer().length % 16 > 0) {
|
|
@@ -102,7 +100,6 @@ class MESSAGE {
|
|
|
102
100
|
|
|
103
101
|
unpack(crypto = undefined) {
|
|
104
102
|
const packetStructure = new PacketStructure(this.data);
|
|
105
|
-
const flag = this.getFlag(packetStructure.readBytes(2));
|
|
106
103
|
|
|
107
104
|
let packet = {
|
|
108
105
|
type: packetStructure.readBytes(2).toString('hex'),
|
|
@@ -110,7 +107,7 @@ class MESSAGE {
|
|
|
110
107
|
sequenceNumber: packetStructure.readUInt32(),
|
|
111
108
|
targetParticipantId: packetStructure.readUInt32(),
|
|
112
109
|
sourceParticipantId: packetStructure.readUInt32(),
|
|
113
|
-
flags:
|
|
110
|
+
flags: this.getFlag(packetStructure.readBytes(2)),
|
|
114
111
|
channelId: packetStructure.readBytes(8),
|
|
115
112
|
protectedPayload: packetStructure.readBytes()
|
|
116
113
|
};
|
|
@@ -28,7 +28,6 @@ class XBOXLOCALAPI extends EventEmitter {
|
|
|
28
28
|
|
|
29
29
|
this.sequenceNumber = 0;
|
|
30
30
|
this.targetParticipantId = 0;
|
|
31
|
-
this.sourceParticipantId = 0;
|
|
32
31
|
this.mediaRequestId = 0;
|
|
33
32
|
this.emitDevInfo = true;
|
|
34
33
|
|
|
@@ -189,7 +188,7 @@ class XBOXLOCALAPI extends EventEmitter {
|
|
|
189
188
|
this.isConnected = true;
|
|
190
189
|
try {
|
|
191
190
|
const localJoin = new MessagePacket('message.localJoin');
|
|
192
|
-
const localJointMessage = localJoin.pack(this.crypto, this.getSequenceNumber(), this.
|
|
191
|
+
const localJointMessage = localJoin.pack(this.crypto, this.getSequenceNumber(), this.targetParticipantId);
|
|
193
192
|
await this.sendSocketMessage(localJointMessage);
|
|
194
193
|
} catch (error) {
|
|
195
194
|
this.emit('error', `Send local join error: ${error}`)
|
|
@@ -203,7 +202,7 @@ class XBOXLOCALAPI extends EventEmitter {
|
|
|
203
202
|
acknowledge.structure.processedList.value.push({
|
|
204
203
|
id: this.sequenceNumber
|
|
205
204
|
});
|
|
206
|
-
const message = acknowledge.pack(this.crypto, this.getSequenceNumber(), this.
|
|
205
|
+
const message = acknowledge.pack(this.crypto, this.getSequenceNumber(), this.targetParticipantId);
|
|
207
206
|
await this.sendSocketMessage(message);
|
|
208
207
|
} catch (error) {
|
|
209
208
|
this.emit('error', `Send acknowledge error: ${error}`)
|
|
@@ -250,7 +249,7 @@ class XBOXLOCALAPI extends EventEmitter {
|
|
|
250
249
|
try {
|
|
251
250
|
const acknowledge = new MessagePacket('message.acknowledge');
|
|
252
251
|
acknowledge.set('lowWatermark', this.sequenceNumber);
|
|
253
|
-
const message = acknowledge.pack(this.crypto, this.getSequenceNumber(), this.
|
|
252
|
+
const message = acknowledge.pack(this.crypto, this.getSequenceNumber(), this.targetParticipantId);
|
|
254
253
|
await this.sendSocketMessage(message);
|
|
255
254
|
} catch (error) {
|
|
256
255
|
this.emit('error', `Send acknowledge error: ${error}`)
|
|
@@ -332,7 +331,7 @@ class XBOXLOCALAPI extends EventEmitter {
|
|
|
332
331
|
try {
|
|
333
332
|
const powerOff = new MessagePacket('message.powerOff');
|
|
334
333
|
powerOff.set('liveId', this.xboxLiveId);
|
|
335
|
-
const message = powerOff.pack(this.crypto, this.getSequenceNumber(), this.
|
|
334
|
+
const message = powerOff.pack(this.crypto, this.getSequenceNumber(), this.targetParticipantId);
|
|
336
335
|
await this.sendSocketMessage(message);
|
|
337
336
|
|
|
338
337
|
await new Promise(resolve => setTimeout(resolve, 3500));
|
|
@@ -356,7 +355,7 @@ class XBOXLOCALAPI extends EventEmitter {
|
|
|
356
355
|
const recordGameDvr = new MessagePacket('message.recordGameDvr');
|
|
357
356
|
recordGameDvr.set('startTimeDelta', -60);
|
|
358
357
|
recordGameDvr.set('endTimeDelta', 0);
|
|
359
|
-
const message = recordGameDvr.pack(this.crypto, this.getSequenceNumber(), this.
|
|
358
|
+
const message = recordGameDvr.pack(this.crypto, this.getSequenceNumber(), this.targetParticipantId);
|
|
360
359
|
await this.sendSocketMessage(message);
|
|
361
360
|
resolve();
|
|
362
361
|
} catch (error) {
|
|
@@ -375,7 +374,7 @@ class XBOXLOCALAPI extends EventEmitter {
|
|
|
375
374
|
const disconnect = new MessagePacket('message.disconnect');
|
|
376
375
|
disconnect.set('reason', 4);
|
|
377
376
|
disconnect.set('errorCode', 0);
|
|
378
|
-
const message = disconnect.pack(this.crypto, this.getSequenceNumber(), this.
|
|
377
|
+
const message = disconnect.pack(this.crypto, this.getSequenceNumber(), this.targetParticipantId);
|
|
379
378
|
await this.sendSocketMessage(message);
|
|
380
379
|
this.emit('disconnected', 'Disconnected.');
|
|
381
380
|
resolve();
|