FriendsRobotics.TreeAPI
1.1.1
dotnet add package FriendsRobotics.TreeAPI --version 1.1.1
NuGet\Install-Package FriendsRobotics.TreeAPI -Version 1.1.1
<PackageReference Include="FriendsRobotics.TreeAPI" Version="1.1.1" />
paket add FriendsRobotics.TreeAPI --version 1.1.1
#r "nuget: FriendsRobotics.TreeAPI, 1.1.1"
// Install FriendsRobotics.TreeAPI as a Cake Addin #addin nuget:?package=FriendsRobotics.TreeAPI&version=1.1.1 // Install FriendsRobotics.TreeAPI as a Cake Tool #tool nuget:?package=FriendsRobotics.TreeAPI&version=1.1.1
<div align="center"> <h1>Tree Light API </h1>
A Simple API to commicate with a christmas tree running a TreeServer
</div>
Install
NuGet
You can import the API into your project through the command line:
> dotnet add package FriendsRobotics.TreeAPI --version 1.0.0
Or you can use the NuGet GUI and search for:
FriendsRobotics.TreeAPI
Usage
Configuration
Drop a using
at the start to import the API
using TreeAPI;
To get started, configure your settings
// This should be the tree's Ip Address
ConfigManager.IP = "127.0.0.1";
// This should be the path you are connecting to.
// Refer to tree-lights/docs if unsure
ConfigMangager.Path = "Text";
// You can usually leave the port out as it will default to 1234
ConfigManager.Port = 1234;
Alternatively, you can use ClientConfig
if you wish to use a config file.
Connecting to the tree
It is easiest to wrap the tree in a using
statement as it will automatically close the sockets when you are finished.
using (Tree tree = new Tree()) {
// Code goes in here
}
Now we can connect:
tree.Connect();
N.B. If you wish to connect to mutliple different paths without having to usee the ConfigManager, there is an IpAddr
class for you to mess around with
Sending some data to the tree
Sending data is pretty rudimentary:
tree.Send("Hello, World!");
If you want to capture the response from the tree, there is a ReceivedMessage
property of the tree.
Console.WriteLine( tree.ReceivedMessage );
Sending Frames and Animations
To send some useful data, you need an ISendable
object, effectively either a Frame
or a Animation
.
Frame frame = new Frame() {
// Create your pixels here
}
Animation animation = new Animation() {
// Create your frames here
}
tree.Send(frame);
tree.Send(animation);
Sending either of those will serialize them and send them to the tree to be stored / displayed.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
-
net7.0
- Newtonsoft.Json (>= 13.0.3)
- WebSocketSharp-netstandard (>= 1.0.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on FriendsRobotics.TreeAPI:
Package | Downloads |
---|---|
FslGift.Serialization
A Serialization API to seraialize and deserialize .fslgift files |
GitHub repositories
This package is not used by any popular GitHub repositories.
Update Project Files