Я пытался реализовать простое приложение для чата с использованием chirp.io sdk, но всякий раз, когда я запускаю свой код, я получаю:
chirpsdk.exceptions.ConnectError: Неизвестный код ошибки
import time
from chirpsdk import ChirpConnect, CallbackSet
chirp = ChirpConnect()
chirp.start(send = True,receive = True)
class Callbacks(CallbackSet):
def on_received(self, payload, channel):
if payload is not None:
msg = payload.decode('utf-8')
print('Received : '+msg)
else:
print('Decode failed')
chirp.set_callbacks(Callbacks())
print(f'Protocol used : {chirp.protocol_name}')
msg = input()
while msg!='quit':
payload = bytearray([ord(ch) for ch in msg])
if chirp.is_valid(payload):
chirp.send(payload)
else:
print('[Warning] : Message size must be (0,32] bytes.')
msg = input()
chirp.stop()
From cffi callback <function _StreamBase.__init__.<locals>.callback_ptr at 0x7f9333f89b70>:
Traceback (most recent call last):
File "/home/lawliet/.local/lib/python3.6/site-packages/sounddevice.py", line 732, in callback_ptr
Protocol used : ultrasonic
return _wrap_callback(callback, data, frames, time, status)
File "/home/lawliet/.local/lib/python3.6/site-packages/sounddevice.py", line 2517, in _wrap_callback
callback(*args)
File "/home/lawliet/.local/lib/python3.6/site-packages/chirpsdk/audio.py", line 102, in process_output
self.process_output_fn(outdata)
File "/home/lawliet/.local/lib/python3.6/site-packages/chirpsdk/connect.py", line 836, in process_output
self._call(libconnect.chirp_connect_process_output, self._sdk, floats, length)
File "/home/lawliet/.local/lib/python3.6/site-packages/chirpsdk/connect.py", line 489, in _call
raise ConnectError(err.decode(), code=rc)
chirpsdk.exceptions.ConnectError: Unknown error code.