API 参考
打印服务客户端。
接口形状与 C API tijet_core.h 保持一致:
| C API | Python |
|---|---|
tijet_client_create | TinCore() |
tijet_client_destroy | client.close() / with |
tijet_client_connect | client.connect(address) |
tijet_client_set_* | client.set_*(...) |
tijet_client_get_* | client.get_*(...) |
| —— | —— |
释放资源(对应 tijet_client_destroy())。
断开连接(对应 tijet_client_disconnect())。
查询连接状态(对应 tijet_client_is_connected())。
启动事件订阅(对应 tijet_client_start_event_subscription())。
在后台线程中以 server-side streaming 读取事件。
停止事件订阅(对应 tijet_client_stop_event_subscription())。
启动日志订阅(对应 tijet_client_start_log_subscription())。
注意: 当前 proto 尚无
WatchLogsRPC 定义,本方法为存根。
停止日志订阅(对应 tijet_client_stop_log_subscription())。
最近一次错误信息(对应 tijet_client_last_error())。
SDK 版本号(对应 tijet_client_version())。
将单条消息包装为单元素迭代器(client-side streaming 用)。
TiJet C SDK — TinCore 客户端
本模块提供与 C API (tijet_core.h) 完全一致的接口形状。 每个方法对应一个 C API 函数,参数和返回值经 Python 惯用法调整。
from tijet_grpc import TinCore
client = TinCore()
client.connect()
client.set_parameter("print_speed", "100")
speed = client.get_parameter("print_speed")
client.disconnect()