DM-Tech.Library.MDM
1.1.2
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package DM-Tech.Library.MDM --version 1.1.2
NuGet\Install-Package DM-Tech.Library.MDM -Version 1.1.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DM-Tech.Library.MDM" Version="1.1.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DM-Tech.Library.MDM --version 1.1.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: DM-Tech.Library.MDM, 1.1.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DM-Tech.Library.MDM as a Cake Addin #addin nuget:?package=DM-Tech.Library.MDM&version=1.1.2 // Install DM-Tech.Library.MDM as a Cake Tool #tool nuget:?package=DM-Tech.Library.MDM&version=1.1.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Library MDM
Descrição
Pacote para integração com o sistema MDM através do protocolo MQTT.
Dependências
- MQTTnet
Deploy
Requisitos
- Variável de ambiente
API_KEY_GITHUB_NUGET
com a chave de acesso do Github
Publicar pacote no Nuget
# Substituir x.x.x pela versão desejada
bash publish.sh x.x.x
Se a versão for diferente do LibraryMDM.csproj, ele irá atualizar o arquivo e commitar automaticamente.
Como usar?
Instalação
dotnet add package DM-Tech.Library.MDM --version x.x.x
Configuração
using LibraryMDM.Client;
MdmConfiguration.Server = "localhost";
MdmConfiguration.Port = 1883;
MdmConfiguration.Username = "lucas";
MdmConfiguration.Password = "secret";
MdmConfiguration.ClientId = "lucas";
Exemplo de uso
// Publisher
Console.WriteLine("Starting console sender...");
Console.WriteLine("Press ESC to exit.");
while (true)
{
var client = new Mdm();
await client.OnConnectedAsync();
await client.PublishAsync("samples/guid", "Guid: " + Guid.NewGuid());
Console.WriteLine("MQTT application message is published.");
Console.WriteLine("Press any key to publish again");
var key = Console.ReadKey();
if (key.Key == ConsoleKey.Escape){
await client.OnDisconnectedAsync();
break;
}
}
// Publisher + Events
Console.WriteLine("Starting console sender...");
Console.WriteLine("Press ESC to exit.");
while (true)
{
var client = new Mdm(new Events());
await client.OnConnectedAsync();
await client.PublishAsync("samples/guid", "Guid: " + Guid.NewGuid());
Console.WriteLine("MQTT application message is published.");
Console.WriteLine("Press any key to publish again");
var key = Console.ReadKey();
if (key.Key == ConsoleKey.Escape){
await client.OnDisconnectedAsync();
break;
}
}
internal class Events : IMdmEvents
{
public Task OnDisconnectedCallbackAsync(bool disconnectionRequested)
{
Console.WriteLine("Disconnected: {0}", disconnectionRequested ? "Requested" : "Unexpected");
return Task.CompletedTask;
}
public Task OnConnectedCallbackAsync()
{
Console.WriteLine("Connected");
return Task.CompletedTask;
}
}
// Subscriber
using LibraryMDM.Client;
Console.WriteLine("Starting console receiver...");
var client = new Mdm();
await client.OnConnectedAsync();
await client.SubscribeAsync("samples/guid", (string payload) =>
{
Console.WriteLine($"samples/guid: {payload}");
return Task.CompletedTask;
});
Console.WriteLine("Press any key to exit.");
Console.ReadKey();
await client.OnDisconnectedAsync();
// Subscriber + Events
using LibraryMDM.Client;
Console.WriteLine("Starting console receiver...");
var client = new Mdm(new Events());
await client.OnConnectedAsync();
await client.SubscribeAsync("samples/guid", (string payload) =>
{
Console.WriteLine($"samples/guid: {payload}");
return Task.CompletedTask;
});
Console.WriteLine("Press any key to exit.");
Console.ReadKey();
await client.OnDisconnectedAsync();
internal class Events : IMdmEvents
{
public Task OnDisconnectedCallbackAsync(bool disconnectionRequested)
{
Console.WriteLine("Disconnected: {0}", disconnectionRequested ? "Requested" : "Unexpected");
return Task.CompletedTask;
}
public Task OnConnectedCallbackAsync()
{
Console.WriteLine("Connected");
return Task.CompletedTask;
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- MQTTnet (>= 4.3.3.952)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.