我一直在尝试构建一个 python 客户端,它从 Empatica E4 收集实时数据流并能够操作数据。
from e4client import E4StreamingClient, E4DataStreamID
import threading
with E4StreamingClient('127.0.0.1', 28000) as client:
dev_list = client.list_connected_devices()
with client.connect_to_device(dev_list[0]) as conn:
# connected to the first device here
event = threading.Event()
def _callback(stream: E4DataStreamID, timestamp: float, *data):
print(stream, timestamp, *data)
event.set()
conn.subscribe_to_stream(E4DataStreamID.TAG, _callback)
# block and wait for a tag press:
event.wait()
# device disconnected here, no need to disconnect or unsubscribe,
# all is handled by the context manager.
我正在尝试这个示例 python 客户端,但它一直在我这边返回错误,说连接太多。我正在使用流媒体服务器上写的端口和 ip 地址。
如果有效,应该有多个数据流入 python 客户端。