8.get_chl_param
函数声明
| C |
|---|
| BOOL py_get_chl_param(const char *chl_name,int type,void *p_param_info);
|
提示
串口通道传入串口参数结构体,TCP通道传入TCP参数结构体。
| Python |
|---|
| c4py.py_load_so()
c4py.global_init()
chl_name = "python采集通道"
uart_info = c4py.UartInfo()
c4py.get_chl_param(chl_name.encode(),1,ctypes.pointer(uart_info))
print("通道名称:" + chl_name + ";串口名称:" + com_name + ";波特率:" + str(uart_info.baud) +
";数据位:" + str(uart_info.data_bit) + ";停止位:" + str(uart_info.stop_bit) + ";校验位:" + str(uart_info.check) + ".")
c4py.global_release()
|
| Python |
|---|
| c4py.py_load_so()
c4py.global_init()
chl_name2 = "python采集通道2"
tcp_info = c4py.TCPInfo()
c4py.get_chl_param(chl_name2.encode(),1,ctypes.pointer(tcp_info))
print("通道名称:" + chl_name2 + ";IP/域名:" + tcp_info.ip_addr.decode() + ";端口号:" + str(tcp_info.port) + ";超时:" + str(tcp_info.timeout) + ".")
c4py.global_release()
|