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