[NF] Mqtt library changed

This commit is contained in:
2018-04-01 17:31:18 +00:00
parent f6f3a47803
commit 9bb84237bb
55 changed files with 3349 additions and 1767 deletions
+11 -13
View File
@@ -1,25 +1,23 @@
/*
M2Mqtt - MQTT Client Library for .Net
Copyright (c) 2014, Paolo Patierno, All rights reserved.
Copyright (c) 2013, 2014 Paolo Patierno
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 of the License, or (at your option) any later version.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
and Eclipse Distribution License v1.0 which accompany this distribution.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
The Eclipse Public License is available at
http://www.eclipse.org/legal/epl-v10.html
and the Eclipse Distribution License is available at
http://www.eclipse.org/org/documents/edl-v10.php.
You should have received a copy of the GNU Lesser General Public
License along with this library.
Contributors:
Paolo Patierno - initial API and implementation and/or initial documentation
*/
using System;
using System.Collections;
namespace uPLibrary.Networking.M2Mqtt
namespace uPLibrary.Networking.M2Mqtt.Utility
{
/// <summary>
/// Extension class for a Queue
+86
View File
@@ -0,0 +1,86 @@
/*
Copyright (c) 2013, 2014 Paolo Patierno
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
and Eclipse Distribution License v1.0 which accompany this distribution.
The Eclipse Public License is available at
http://www.eclipse.org/legal/epl-v10.html
and the Eclipse Distribution License is available at
http://www.eclipse.org/org/documents/edl-v10.php.
Contributors:
Paolo Patierno - initial API and implementation and/or initial documentation
*/
using System.Diagnostics;
namespace uPLibrary.Networking.M2Mqtt.Utility
{
/// <summary>
/// Tracing levels
/// </summary>
public enum TraceLevel
{
Error = 0x01,
Warning = 0x02,
Information = 0x04,
Verbose = 0x0F,
Frame = 0x10,
Queuing = 0x20
}
// delegate for writing trace
public delegate void WriteTrace(string format, params object[] args);
/// <summary>
/// Tracing class
/// </summary>
public static class Trace
{
public static TraceLevel TraceLevel;
public static WriteTrace TraceListener;
[Conditional("DEBUG")]
public static void Debug(string format, params object[] args)
{
if (TraceListener != null)
{
TraceListener(format, args);
}
}
public static void WriteLine(TraceLevel level, string format)
{
if (TraceListener != null && (level & TraceLevel) > 0)
{
TraceListener(format);
}
}
public static void WriteLine(TraceLevel level, string format, object arg1)
{
if (TraceListener != null && (level & TraceLevel) > 0)
{
TraceListener(format, arg1);
}
}
public static void WriteLine(TraceLevel level, string format, object arg1, object arg2)
{
if (TraceListener != null && (level & TraceLevel) > 0)
{
TraceListener(format, arg1, arg2);
}
}
public static void WriteLine(TraceLevel level, string format, object arg1, object arg2, object arg3)
{
if (TraceListener != null && (level & TraceLevel) > 0)
{
TraceListener(format, arg1, arg2, arg3);
}
}
}
}