homebridge-xbox-tv 3.3.0-beta.0 → 3.3.0-beta.2
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/index.js +2 -1
- package/package.json +1 -1
- package/src/localApi/xboxlocalapi.js +15 -0
package/index.js
CHANGED
|
@@ -123,8 +123,9 @@ class XboxPlatform {
|
|
|
123
123
|
//start impulse generator
|
|
124
124
|
impulseGenerator.start([{ name: 'start', sampling: 45000 }]);
|
|
125
125
|
} catch (error) {
|
|
126
|
-
|
|
126
|
+
throw new Error(`Device: ${host} ${deviceName}, Did finish launching error: ${error}.`);
|
|
127
127
|
}
|
|
128
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
128
129
|
}
|
|
129
130
|
});
|
|
130
131
|
}
|
package/package.json
CHANGED
|
@@ -618,8 +618,23 @@ class XboxLocalApi extends EventEmitter {
|
|
|
618
618
|
const debug = this.enableDebugMode ? this.emit('debug', `Server start listening: ${address.address}:${address.port}.`) : false;
|
|
619
619
|
this.socket = socket;
|
|
620
620
|
this.emitDevInfo = true;
|
|
621
|
+
|
|
622
|
+
if (!this.isConnected) {
|
|
623
|
+
const debug = this.enableDebugMode ? this.emit('debug', `Plugin send heartbeat to console`) : false;
|
|
624
|
+
const state = await Ping.promise.probe(this.host, { timeout: 3 });
|
|
625
|
+
|
|
626
|
+
if (!state.alive || this.isConnected) {
|
|
627
|
+
return;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
const debug1 = this.enableDebugMode ? this.emit('debug', `Plugin received heartbeat from console`) : false
|
|
631
|
+
const discoveryRequest = new SimplePacket('discoveryRequest');
|
|
632
|
+
const message = discoveryRequest.pack(this.crypto);
|
|
633
|
+
await this.sendSocketMessage(message, 'discoveryRequest');
|
|
634
|
+
}
|
|
621
635
|
}).bind();
|
|
622
636
|
|
|
637
|
+
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
623
638
|
return true;
|
|
624
639
|
} catch (error) {
|
|
625
640
|
throw new Error(`Connect error: ${error.message || error}`);
|