ESTool SDK
Project description
ESTOOL-SDK 工具使用说明文档
概述
用于与设备进行通信并执行各种操作。演示了如何使用SDK连接到服务器,并调用各类API接口控制硬件设备。
初始化和连接
pip install estool-sdk
from estool.EsApiSdk import EsApiSdk
# 创建SDK实例
sdk = EsApiSdk(ip="127.0.0.1")
# 连接到服务器
is_connect = sdk.connect()
主要功能模块
串口管理
- get_serialport() - 获取可用串口列表
- connect_serialport(serialport, dwBaudRate) - 连接指定串口
- disconnect_serialport() - 断开当前串口连接
系统控制
- emergency() - 发送紧急中断指令
- do_start() - 启动系统运行
- do_stop() - 停止系统运行
通道管理
- get_channels() - 获取通道列表信息
- enable_channel(channel_no) - 开启指定编号的通道
- disable_channel(channel_no) - 关闭指定编号的通道
分组管理
- save_group(group_no, group_name, channels) - 创建新的通道分组
- delete_group(group_no) - 删除指定分组
- get_group_list() - 获取所有分组信息
参数设置
- set_all_channel_param(frequency, pulseWidth, currentAmplitude, pulsesPerGroup, gap) - 设置所有通道参数
- set_group_channel_param(group_no, frequency, pulseWidth, currentAmplitude, pulsesPerGroup, gap) - 设置指定分组的通道参数
- set_channel_param(channel_no, frequency, pulseWidth, currentAmplitude, pulsesPerGroup, gap) - 设置单个通道参数
电流设置
- set_all_channel_current(currentAmplitude) - 设置所有通道电流
- set_group_channel_current(group_no, currentAmplitude) - 设置指定分组的通道电流
- set_channel_current(channel_no, currentAmplitude) - 设置单个通道电流
数据获取
- get_system_staus() - 获取系统状态信息
- get_real_current() - 获取实时电流数据
- get_alert_info() - 获取报警信息
- get_real_channel_param() - 获取实时通道参数
- send_command(command) - 发送自定义命令(透传)
事件监听机制
通过添加通知处理器来接收来自设备的实时消息:
def notification_handler(message_type: str, data: Dict):
print(f"Received notification - Type: {message_type}, Data: {data}")
# 注册不同类型的通知监听器
sdk.add_notification_handler(EsMsgType.SYSTEM_STATUS, notification_handler)
支持的消息类型包括:
- EsMsgType.SYSTEM_STATUS - 系统状态更新
- EsMsgType.ALERT_LISTENER - 报警信息
- EsMsgType.REAL_CURRENT - 实时电流数据
- EsMsgType.CHANNEL_PARAMS - 通道参数变化
注意事项
- 在执行任何操作前必须先成功建立连接
- 所有操作返回结果应检查是否成功执行
- 可以根据实际需求取消注释相应的测试代码段进行调试
- 测试完成后会自动断开连接
- 日志级别已配置为INFO,可根据需要调整详细程度
提示:可以通过修改IP地址和其他参数适配不同的硬件环境。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
estool_sdk-0.0.1.tar.gz
(12.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file estool_sdk-0.0.1.tar.gz.
File metadata
- Download URL: estool_sdk-0.0.1.tar.gz
- Upload date:
- Size: 12.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea65e7ffd43b652794f1c32baa454042fb4b369a5ffa91e2d16583515696b71d
|
|
| MD5 |
6a7d5aacc00e0728016bd48acfcf2179
|
|
| BLAKE2b-256 |
7013acdf5405c46d2f3fc5aff0501278d0a62d42e62d102ab90cd660044eba83
|
File details
Details for the file estool_sdk-0.0.1-py3-none-any.whl.
File metadata
- Download URL: estool_sdk-0.0.1-py3-none-any.whl
- Upload date:
- Size: 11.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76d4befc044cc27f7093901e82ef0a15b4555c0b046c66e2a183a9fbdf9ea1a0
|
|
| MD5 |
d7ebcbcdc59211de0ed5807597ee4c1a
|
|
| BLAKE2b-256 |
2207a1389668f32726406c9bbc154a0b5bbb56bf21f7587213238ead363046f8
|