LLDev.TI.CC2531
8.0.2
dotnet add package LLDev.TI.CC2531 --version 8.0.2
NuGet\Install-Package LLDev.TI.CC2531 -Version 8.0.2
<PackageReference Include="LLDev.TI.CC2531" Version="8.0.2" />
paket add LLDev.TI.CC2531 --version 8.0.2
#r "nuget: LLDev.TI.CC2531, 8.0.2"
// Install LLDev.TI.CC2531 as a Cake Addin #addin nuget:?package=LLDev.TI.CC2531&version=8.0.2 // Install LLDev.TI.CC2531 as a Cake Tool #tool nuget:?package=LLDev.TI.CC2531&version=8.0.2
LLDev.TI.CC2531
This package allow to communicate with ZigBee devices using Texas Instruments CC2531 as a ZigBee network controller in .NET projects.
CC2531 Setup
CC2531 should have ZStack firmware. Internet have many instructions how to flash firmware to the device. Here are some of them:
- https://www.zigbee2mqtt.io/guide/adapters/flashing/flashing_the_cc2531.html
- https://www.zigbee2mqtt.io/guide/adapters/flashing/alternative_flashing_methods.html
ZStack firmware could be found here.
Using the package
To use the package, first of all it should be added to .NET dependency injection system. To to it, you need to define port that package should use. It can be done by adding port to appsettings.json file:
"MyJsonSection": {
"PortName": "COM0" // in windows,
//"PortName": "/dev/ttyACM0" // in linux
},
If you are catching "Cannot receive response within specified duration X ms" exception, you could also increase wait duration from appsettings:
"MyJsonSection": {
"PortName": "..."
"WaitResponseTimeoutMs": 9999
},
Default wait duration is 2 seconds.
Then you need to call AddZigBeeServices method:
using LLDev.TI.CC2531.Extensions;
...
IConfiguration configuration;
IServiceCollection services;
services.AddZigBeeServices(configuration.GetSection("MyJsonSection"));
It will add LLDev.TI.CC2531.Handlers.INetworkHandler object to dependency injection system as a singleton.
When it is done, you need to start the network and allow devices to join it. It could be done so:
using LLDev.TI.CC2531.Handlers;
LLDev.TI.CC2531.Handlers.INetworkHandler networkHandler;
networkHandler.StartZigBeeNetwork();
networkHandler.PermitNetworkJoin(true);
LLDev.TI.CC2531.Handlers.INetworkHandler have 2 events:
event DeviceAnnouncedHandler? DeviceAnnouncedAsync;
event EndDeviceMessageReceivedHandler? DeviceMessageReceivedAsync;
DeviceAnnouncedAsync event will be called when device is connecting to the network.
DeviceMessageReceivedAsync event will be called when device message received.
NB! Currently this package is allowing to receive device messages, and do not allow to send messages to ZigBee device.
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. |
-
net8.0
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Options (>= 8.0.2)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- System.IO.Ports (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.