LttPClient: warn when connection is not made to SNI
This commit is contained in:
parent
fe7f109127
commit
5c25a08dc1
|
@ -15,6 +15,7 @@ import asyncio
|
|||
from json import loads, dumps
|
||||
|
||||
import ModuleUpdate
|
||||
|
||||
ModuleUpdate.update()
|
||||
|
||||
from Utils import get_item_name_from_id
|
||||
|
@ -527,11 +528,22 @@ async def get_snes_devices(ctx: Context):
|
|||
await socket.send(dumps(DeviceList_Request))
|
||||
reply = loads(await socket.recv())
|
||||
devices = reply['Results'] if 'Results' in reply and len(reply['Results']) > 0 else None
|
||||
|
||||
await verify_snes_app(socket)
|
||||
await socket.close()
|
||||
return devices
|
||||
|
||||
|
||||
async def verify_snes_app(socket):
|
||||
AppVersion_Request = {
|
||||
"Opcode": "AppVersion",
|
||||
}
|
||||
await socket.send(dumps(AppVersion_Request))
|
||||
|
||||
app: str = loads(await socket.recv())["Results"][0]
|
||||
if not "SNI" in app:
|
||||
snes_logger.warning(f"Warning: Did not find SNI as the endpoint, instead {app} was found.")
|
||||
|
||||
|
||||
async def snes_connect(ctx: Context, address, deviceIndex=-1):
|
||||
global SNES_RECONNECT_DELAY
|
||||
if ctx.snes_socket is not None and ctx.snes_state == SNESState.SNES_CONNECTED:
|
||||
|
|
Loading…
Reference in New Issue