MqttSyncClientPoolReadString 方法 |
从MQTT服务器同步读取数据,将指定编码的字符串payload发送到服务器,然后从服务器返回相关的数据,并转换为指定编码的字符串,支持数据发送进度报告,服务器执行进度报告,接收数据进度报告操作
Synchronously read data from the MQTT server, send the specified encoded string payload to the server,
and then return the data from the server, and convert it to the specified encoded string,
support data transmission progress report, the server executes the progress report, and receives the data progress report
命名空间:
HslCommunication.MQTT
程序集:
HslCommunication (在 HslCommunication.dll 中) 版本:12.1.2.0 (12.1.2.0)
语法 public OperateResult<string, string> ReadString(
string topic,
string payload,
Action<long, long> sendProgress = null,
Action<string, string> handleProgress = null,
Action<long, long> receiveProgress = null
)
Public Function ReadString (
topic As String,
payload As String,
Optional sendProgress As Action(Of Long, Long) = Nothing,
Optional handleProgress As Action(Of String, String) = Nothing,
Optional receiveProgress As Action(Of Long, Long) = Nothing
) As OperateResult(Of String, String)
public:
OperateResult<String^, String^>^ ReadString(
String^ topic,
String^ payload,
Action<long long, long long>^ sendProgress = nullptr,
Action<String^, String^>^ handleProgress = nullptr,
Action<long long, long long>^ receiveProgress = nullptr
)
member ReadString :
topic : string *
payload : string *
?sendProgress : Action<int64, int64> *
?handleProgress : Action<string, string> *
?receiveProgress : Action<int64, int64>
(* Defaults:
let _sendProgress = defaultArg sendProgress null
let _handleProgress = defaultArg handleProgress null
let _receiveProgress = defaultArg receiveProgress null
*)
-> OperateResult<string, string>
参数
- topic
- 类型:SystemString
主题信息 - payload
- 类型:SystemString
负载数据 - sendProgress (Optional)
- 类型:SystemActionInt64, Int64
发送数据给服务器时的进度报告,第一个参数为已发送数据,第二个参数为总发送数据 - handleProgress (Optional)
- 类型:SystemActionString, String
服务器处理数据的进度报告,第一个参数Topic自定义,通常用来传送操作百分比,第二个参数自定义,通常用来表示服务器消息 - receiveProgress (Optional)
- 类型:SystemActionInt64, Int64
从服务器接收数据的进度报告,第一个参数为已接收数据,第二个参数为总接收数据
返回值
类型:
OperateResultString,
String服务器返回的数据信息
参见