2022-06-07 12:16:23 -04:00
|
|
|
# SPDX-FileCopyrightText: 2018-2022 Espressif Systems (Shanghai) CO LTD
|
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
2018-07-30 12:10:10 -04:00
|
|
|
#
|
|
|
|
|
2022-06-22 05:44:19 -04:00
|
|
|
from utils import hex_str_to_bytes, str_to_bytes
|
2018-07-30 12:10:10 -04:00
|
|
|
|
2018-12-04 07:46:48 -05:00
|
|
|
from .transport import Transport
|
|
|
|
|
2018-07-30 12:10:10 -04:00
|
|
|
|
|
|
|
class Transport_Console(Transport):
|
|
|
|
|
2022-06-07 12:16:23 -04:00
|
|
|
async def send_data(self, path, data, session_id=0):
|
2022-06-22 05:44:19 -04:00
|
|
|
print('Client->Device msg :', path, session_id, str_to_bytes(data).hex())
|
2018-07-30 12:10:10 -04:00
|
|
|
try:
|
2021-01-25 21:49:01 -05:00
|
|
|
resp = input('Enter device->client msg : ')
|
2018-07-30 12:10:10 -04:00
|
|
|
except Exception as err:
|
2021-01-25 21:49:01 -05:00
|
|
|
print('error:', err)
|
2018-07-30 12:10:10 -04:00
|
|
|
return None
|
2022-06-22 05:44:19 -04:00
|
|
|
return hex_str_to_bytes(resp)
|