Пример #1
0
 /// <summary>
 /// 执行失败
 /// </summary>
 /// <param name="context">上下文</param>
 /// <param name="successData">数据</param>
 protected override void MQTTAsync_onFailure(IntPtr context, MQTTAsync_failureData *failureData)
 {
     if (failureData == NULL)
     {
         var ex = new MqttException(MqttError.Failure);
         base.RaiseOnException(context, ex);
     }
     else if (failureData->code < 0)
     {
         var ex = new MqttException(failureData->code);
         base.RaiseOnException(context, ex);
     }
     else
     {
         var code = (ConnectError)failureData->code;
         base.RaiseOnCompleted(context, code);
     }
 }
Пример #2
0
 /// <summary>
 /// mqtt客户端异常
 /// </summary>
 /// <param name="error">异常码</param>
 /// <exception cref="ArgumentOutOfRangeException"></exception>
 public MqttException(MqttError error) :
     base(MqttException.GetEerrorMessage(error))
 {
     this.Error = error;
 }