esp-idf/tools/esp_prov/transport/transport_console.py

19 lines
571 B
Python
Raw Normal View History

# SPDX-FileCopyrightText: 2018-2024 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
#
from utils import str_to_bytes
2018-12-04 07:46:48 -05:00
from .transport import Transport
class Transport_Console(Transport):
async def send_data(self, path, data, session_id=0):
print('Client->Device msg :', path, session_id, str_to_bytes(data).hex())
try:
resp = input('Enter device->client msg : ')
except Exception as err:
print('error:', err)
return None
return bytearray.fromhex(resp).decode('latin-1')