文档目录: <>

* 说明 <https://www.cnblogs.com/whuanle/p/10994645.html>
* 1. 连接阿里云物联网 <https://www.cnblogs.com/whuanle/p/10994663.html>
* 2. IoT 客户端 <https://www.cnblogs.com/whuanle/p/10994673.html>
* 3. 订阅Topic与响应Topic <https://www.cnblogs.com/whuanle/p/10994686.html>
* 4. 设备上报属性 <https://www.cnblogs.com/whuanle/p/10994694.html>
* 4.1 上报位置信息 <https://www.cnblogs.com/whuanle/p/10994696.html>
* 5. 设置设备属性 <https://www.cnblogs.com/whuanle/p/10994701.html>
* 6. 设备事件上报 <https://www.cnblogs.com/whuanle/p/10994707.html>
* 7. 服务调用 <https://www.cnblogs.com/whuanle/p/10994708.html>
* 8. 委托事件 <https://www.cnblogs.com/whuanle/p/10994713.html>
* 9. 自定义委托事件方法
<https://www.cnblogs.com/whuanle/p/10994720.html>
 

CZGL.AliIoTClient 里设置了 7 个委托事件,在程序的不不同生命周期触发。


<https://gitee.com/whuanle/CZGL.AliIoTClient/wikis/8.%20%E5%A7%94%E6%89%98%E4%BA%8B%E4%BB%B6?sort_id=1479198#17%E4%B8%AA%E5%A7%94%E6%89%98%E4%BA%8B%E4%BB%B6>
1)7个委托事件
/// <summary> /// 服务器属性设置 /// </summary> public PublishPropertyEventHandler
PubPropertyEventHandler;/// <summary> /// 服务调用 /// </summary> public
PublishServiceEventHandler PubServiceEventHandler;/// <summary> /// 收到其它Topic时触发
///</summary> public PublishCommonEventHandler PubCommonEventHandler; ///
<summary>/// 当 QOS=1或2时,收到订阅触发 /// </summary> public
uPLibrary.Networking.M2Mqtt.MqttClient.MqttMsgPublishedEventHandler
PubedEventHandler;/// <summary> /// 向服务器发布 Topic 时 /// </summary> public
uPLibrary.Networking.M2Mqtt.MqttClient.MqttMsgSubscribedEventHandler
SubedEventHandler;/// <summary> /// 向服务器发布 Topic 失败时 /// </summary> public
uPLibrary.Networking.M2Mqtt.MqttClient.MqttMsgUnsubscribedEventHandler
UnSubedEventHandler;/// <summary> /// 断开连接时 /// </summary> public
uPLibrary.Networking.M2Mqtt.MqttClient.ConnectionClosedEventHandler
ConnectionClosedEventHandler;
使用方法
public static void TestEvent(object sender, MqttMsgPublishEventArgs e) { { //
handle message receivedstring topic = e.Topic; string message =
Encoding.ASCII.GetString(e.Message);Console.WriteLine("- - - - - - - - - - ");
Console.WriteLine("get topic message,Date: " + DateTime.Now.ToLongTimeString());
Console.WriteLine("topic: " + topic); Console.WriteLine("get messgae :\n" +
message); } client.PubPropertyEventHandler += TestEvent;
这里是旧版本的文档,可以参考一下。
https://www.cnblogs.com/whuanle/p/10786991.html
<https://www.cnblogs.com/whuanle/p/10786991.html>

友情链接
KaDraw流程图
API参考文档
OK工具箱
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:ixiaoyang8@qq.com
QQ群:637538335
关注微信