remove libraries as they will also move to separate repositories
Some checks failed
Rust / build (push) Failing after 2m20s
Some checks failed
Rust / build (push) Failing after 2m20s
This commit is contained in:
parent
21931f847f
commit
c6d2ee6fe1
10
.github/workflows/rust.yml
vendored
10
.github/workflows/rust.yml
vendored
|
@ -29,17 +29,7 @@ jobs:
|
|||
|
||||
- name: Run Clippy
|
||||
run: cargo clippy --all-targets --all-features
|
||||
|
||||
- name: build default features
|
||||
run: cargo build --all --verbose
|
||||
- name: build default features -- examples
|
||||
run: cargo build --examples --verbose
|
||||
- name: test default features
|
||||
run: cargo test --all --verbose
|
||||
|
||||
- name: build all features
|
||||
run: cargo build --all-features --verbose
|
||||
- name: build all features -- examples
|
||||
run: cargo build --all-features --examples --verbose
|
||||
- name: test all features
|
||||
run: cargo test --all --all-features --verbose
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
# About the display
|
||||
|
||||
- Resolution: 352x160=56,320 pixels
|
||||
- Pixels are grouped into 44x20=880 tiles (8x8=64 pixels each)
|
||||
- Smallest addressable unit: row of pixels inside of a tile (8 pixels = 1 byte)
|
||||
- The brightness can only be set per tile
|
||||
- Screen content can be changed using a simple UDP protocol
|
||||
- Between each row of tiles, there is a gap of around 4 pixels size. This gap changes the aspect ratio of the display.
|
||||
|
||||
### Binary format
|
||||
|
||||
A UDP package sent to the display has a header size of 10 bytes.
|
||||
Each header value has a size of two bytes (unsigned 16 bit integer).
|
||||
Depending on the command, there can be a payload following the header.
|
||||
|
||||
To change screen contents, these commands are the most relevant:
|
||||
|
||||
1. Clear screen
|
||||
- command: `0x0002`
|
||||
- (rest does not matter)
|
||||
2. Send CP437 data: render specified text into rectangular region
|
||||
- command: `0x0003`
|
||||
- top left tile x
|
||||
- top left tile y
|
||||
- width in tiles
|
||||
- height in tiles
|
||||
- payload: (width in tiles * height in tiles) bytes
|
||||
- 1 byte = 1 character
|
||||
- each character is rendered into one tile (mono-spaced)
|
||||
- characters are encoded using code page 437
|
||||
3. Send bitmap window: set pixel states for a rectangular region
|
||||
- command: `0x0013`
|
||||
- top left tile x
|
||||
- top left _pixel_ y
|
||||
- width in tiles
|
||||
- height in _pixels_
|
||||
- payload: (width in tiles * height in pixels) bytes
|
||||
- network byte order
|
||||
- 1 bit = 1 pixel
|
||||
|
||||
There are other commands implemented as well, e.g. for changing the brightness.
|
21
flake.lock
21
flake.lock
|
@ -1,25 +1,5 @@
|
|||
{
|
||||
"nodes": {
|
||||
"naersk": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1736429655,
|
||||
"narHash": "sha256-BwMekRuVlSB9C0QgwKMICiJ5EVbLGjfe4qyueyNQyGI=",
|
||||
"owner": "nix-community",
|
||||
"repo": "naersk",
|
||||
"rev": "0621e47bd95542b8e1ce2ee2d65d6a1f887a13ce",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "naersk",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1739357830,
|
||||
|
@ -38,7 +18,6 @@
|
|||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"naersk": "naersk",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,17 +3,12 @@
|
|||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
|
||||
naersk = {
|
||||
url = "github:nix-community/naersk";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs =
|
||||
inputs@{
|
||||
self,
|
||||
nixpkgs,
|
||||
naersk,
|
||||
}:
|
||||
let
|
||||
lib = nixpkgs.lib;
|
||||
|
@ -51,10 +46,6 @@
|
|||
cargo-tarpaulin
|
||||
];
|
||||
})
|
||||
ruby
|
||||
dotnet-sdk_8
|
||||
gcc
|
||||
gnumake
|
||||
xe
|
||||
xz
|
||||
pkg-config
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
cargo build --release
|
||||
|
||||
SCRIPT_PATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
||||
TARGET_PATH="$(realpath "$SCRIPT_PATH"/../../target/release)"
|
||||
SERVICEPOINT_SO="$TARGET_PATH/libservicepoint_binding_uniffi.so"
|
||||
LIBRARIES_PATH="$SCRIPT_PATH/libraries"
|
||||
|
||||
echo "Source: $SERVICEPOINT_SO"
|
||||
echo "Output: $LIBRARIES_PATH"
|
||||
|
||||
BINDGEN="cargo run --features=uniffi/cli --bin uniffi-bindgen -- "
|
||||
BINDGEN_CS="cargo run --features=cs --bin uniffi-bindgen-cs -- "
|
||||
BINDGEN_GO="cargo run --features=go --bin uniffi-bindgen-go -- "
|
||||
COMMON_ARGS="--library $SERVICEPOINT_SO"
|
||||
|
||||
${BINDGEN} generate $COMMON_ARGS --language python --out-dir "$LIBRARIES_PATH/python"
|
||||
${BINDGEN} generate $COMMON_ARGS --language kotlin --out-dir "$LIBRARIES_PATH/kotlin"
|
||||
${BINDGEN} generate $COMMON_ARGS --language swift --out-dir "$LIBRARIES_PATH/swift"
|
||||
${BINDGEN} generate $COMMON_ARGS --language ruby --out-dir "$LIBRARIES_PATH/ruby/lib"
|
||||
${BINDGEN_CS} $COMMON_ARGS --out-dir "$LIBRARIES_PATH/csharp/ServicePoint"
|
||||
${BINDGEN_GO} $COMMON_ARGS --out-dir "$LIBRARIES_PATH/go/"
|
4
libraries/.gitignore
vendored
4
libraries/.gitignore
vendored
|
@ -1,4 +0,0 @@
|
|||
go
|
||||
kotlin
|
||||
python
|
||||
swift
|
2
libraries/csharp/.gitignore
vendored
2
libraries/csharp/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
|||
bin
|
||||
obj
|
|
@ -1,2 +0,0 @@
|
|||
bin
|
||||
obj
|
|
@ -1,19 +0,0 @@
|
|||
using System.Threading;
|
||||
using ServicePoint;
|
||||
|
||||
var connection = new Connection("127.0.0.1:2342");
|
||||
connection.Send(Command.Clear());
|
||||
|
||||
connection.Send(Command.Brightness(5));
|
||||
|
||||
var pixels = Bitmap.NewMaxSized();
|
||||
for (ulong offset = 0; offset < ulong.MaxValue; offset++)
|
||||
{
|
||||
pixels.Fill(false);
|
||||
|
||||
for (ulong y = 0; y < pixels.Height(); y++)
|
||||
pixels.Set((y + offset) % pixels.Width(), y, true);
|
||||
|
||||
connection.Send(Command.BitmapLinearWin(0, 0, pixels));
|
||||
Thread.Sleep(14);
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<RootNamespace>ServicePoint.Example</RootNamespace>
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../ServicePoint/ServicePoint.csproj"/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -1,16 +0,0 @@
|
|||
namespace ServicePoint.Tests;
|
||||
|
||||
public class BitmapTests
|
||||
{
|
||||
[Fact]
|
||||
public void BasicFunctions()
|
||||
{
|
||||
var bitmap = new Bitmap(8, 2);
|
||||
Assert.False(bitmap.Get(0, 0));
|
||||
Assert.False(bitmap.Get(bitmap.Width() - 1, bitmap.Height() - 1));
|
||||
bitmap.Fill(true);
|
||||
Assert.True(bitmap.Get(1, 1));
|
||||
bitmap.Set(1, 1, false);
|
||||
Assert.False(bitmap.Get(1, 1));
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
namespace ServicePoint.Tests;
|
||||
|
||||
public class CharGridTests
|
||||
{
|
||||
[Fact]
|
||||
public void BasicFunctions()
|
||||
{
|
||||
var grid = new CharGrid(8, 2);
|
||||
Assert.Equal("\0", grid.Get(0, 0));
|
||||
Assert.Equal("\0", grid.Get(grid.Width() - 1, grid.Height() - 1));
|
||||
grid.Fill(" ");
|
||||
Assert.Equal(" ", grid.Get(1, 1));
|
||||
grid.Set(1, 1, "-");
|
||||
Assert.Equal("-", grid.Get(1, 1));
|
||||
Assert.Throws<PanicException>(() => grid.Get(8, 2));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RowAndCol()
|
||||
{
|
||||
var grid = new CharGrid(3, 2);
|
||||
Assert.Equal("\0\0\0", grid.GetRow(0));
|
||||
grid.Fill(" ");
|
||||
Assert.Equal(" ", grid.GetCol(1));
|
||||
Assert.Throws<CharGridException.OutOfBounds>(() => grid.GetCol(3));
|
||||
Assert.Throws<CharGridException.InvalidSeriesLength>(() => grid.SetRow(1, "Text"));
|
||||
grid.SetRow(1, "Foo");
|
||||
Assert.Equal("Foo", grid.GetRow(1));
|
||||
Assert.Equal(" o", grid.GetCol(2));
|
||||
}
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
namespace ServicePoint.Tests;
|
||||
|
||||
public class CommandTests
|
||||
{
|
||||
private Connection _connection = Connection.NewFake();
|
||||
|
||||
[Fact]
|
||||
public void ClearSendable()
|
||||
{
|
||||
_connection.Send(Command.Clear());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BrightnessSendable()
|
||||
{
|
||||
_connection.Send(Command.Brightness(5));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InvalidBrightnessThrows()
|
||||
{
|
||||
Assert.Throws<ServicePointException.InvalidBrightness>(() => Command.Brightness(42));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void FadeOutSendable()
|
||||
{
|
||||
_connection.Send(Command.FadeOut());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void HardResetSendable()
|
||||
{
|
||||
_connection.Send(Command.HardReset());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BitmapLinearWinSendable()
|
||||
{
|
||||
_connection.Send(Command.BitmapLinearWin(0, 0, Bitmap.NewMaxSized(), CompressionCode.Uncompressed));
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
namespace ServicePoint.Tests;
|
||||
|
||||
public class ConnectionTests
|
||||
{
|
||||
[Fact]
|
||||
public void InvalidHostnameThrows()
|
||||
{
|
||||
Assert.Throws<ServicePointException.IoException>(() => new Connection(""));
|
||||
Assert.Throws<ServicePointException.IoException>(() => new Connection("-%6$§"));
|
||||
}
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
global using Xunit;
|
||||
global using ServicePoint;
|
|
@ -1,27 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
<IsTestProject>true</IsTestProject>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../ServicePoint/ServicePoint.csproj"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="coverlet.collector" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
|
||||
<PackageReference Include="xunit" Version="2.5.3" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Using Include="Xunit" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -1,14 +0,0 @@
|
|||
|
||||
using ServicePoint;
|
||||
|
||||
public static class ServicePointConstants
|
||||
{
|
||||
private static readonly Constants _instance = ServicepointBindingUniffiMethods.GetConstants();
|
||||
|
||||
public static readonly ulong PixelWidth = _instance.pixelWidth;
|
||||
public static readonly ulong PixelHeight = _instance.pixelHeight;
|
||||
public static readonly ulong PixelCount = _instance.pixelCount;
|
||||
public static readonly ulong TileWidth = _instance.tileWidth;
|
||||
public static readonly ulong TileHeight = _instance.tileHeight;
|
||||
public static readonly ulong TileSize = _instance.tileSize;
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<PackageId>ServicePoint</PackageId>
|
||||
<Version>0.13.1</Version>
|
||||
<Authors>Repository Authors</Authors>
|
||||
<Company>None</Company>
|
||||
<Product>ServicePoint</Product>
|
||||
<PackageTags>CCCB</PackageTags>
|
||||
<Description>
|
||||
C# bindings for the rust crate servicepoint. You will need a suitable native shared library to use this.
|
||||
For documentation, see the rust documentation: https://docs.rs/servicepoint/latest/servicepoint/.
|
||||
Note that this library is still in early development. Breaking changes are expected before 1.0 is released.
|
||||
</Description>
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
<PublishRepositoryUrl>true</PublishRepositoryUrl>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- generate C# bindings -->
|
||||
<Target Name="BuildBindings" Condition="'$(Configuration)'=='Release'" BeforeTargets="PrepareForBuild">
|
||||
<Exec Command="cargo build -p servicepoint_binding_uniffi --release"/>
|
||||
</Target>
|
||||
<Target Name="BuildBindings" Condition="'$(Configuration)'=='Debug'" BeforeTargets="PrepareForBuild">
|
||||
<Exec Command="cargo build -p servicepoint_binding_uniffi"/>
|
||||
</Target>
|
||||
|
||||
<!-- include native binary in output -->
|
||||
<ItemGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<Content Include="../../../../../target/debug/libservicepoint_binding_uniffi.so" CopyToOutputDirectory="Always">
|
||||
<Link>libservicepoint_binding_uniffi.so</Link>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(Configuration)'=='Release'">
|
||||
<Content Include="../../../../../target/release/libservicepoint_binding_uniffi.so" CopyToOutputDirectory="Always">
|
||||
<Link>libservicepoint_binding_uniffi.so</Link>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!-- add README.md to package -->
|
||||
<None Include="../README.md" Pack="true" PackagePath="\"/>
|
||||
<!-- include link to source code at revision -->
|
||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
File diff suppressed because it is too large
Load diff
|
@ -1,34 +0,0 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.0.31903.59
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServicePoint", "ServicePoint\ServicePoint.csproj", "{53576D3C-E32E-49BF-BF10-2DB504E50CE1}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServicePoint.Example", "ServicePoint.Example\ServicePoint.Example.csproj", "{FEF24227-090E-46C2-B8F6-ACB5AA1A4309}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServicePoint.Tests", "ServicePoint.Tests\ServicePoint.Tests.csproj", "{9DC15508-A980-4135-9FC6-659FF54B4E5C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{53576D3C-E32E-49BF-BF10-2DB504E50CE1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{53576D3C-E32E-49BF-BF10-2DB504E50CE1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{53576D3C-E32E-49BF-BF10-2DB504E50CE1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{53576D3C-E32E-49BF-BF10-2DB504E50CE1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{FEF24227-090E-46C2-B8F6-ACB5AA1A4309}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FEF24227-090E-46C2-B8F6-ACB5AA1A4309}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FEF24227-090E-46C2-B8F6-ACB5AA1A4309}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FEF24227-090E-46C2-B8F6-ACB5AA1A4309}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9DC15508-A980-4135-9FC6-659FF54B4E5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9DC15508-A980-4135-9FC6-659FF54B4E5C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9DC15508-A980-4135-9FC6-659FF54B4E5C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9DC15508-A980-4135-9FC6-659FF54B4E5C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -1,3 +0,0 @@
|
|||
source 'https://rubygems.org'
|
||||
|
||||
gem 'servicepoint', path: '..'
|
|
@ -1,19 +0,0 @@
|
|||
PATH
|
||||
remote: ..
|
||||
specs:
|
||||
servicepoint (0.0.0)
|
||||
ffi
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
ffi (1.17.0-x86_64-linux-gnu)
|
||||
|
||||
PLATFORMS
|
||||
x86_64-linux
|
||||
|
||||
DEPENDENCIES
|
||||
servicepoint!
|
||||
|
||||
BUNDLED WITH
|
||||
2.3.27
|
|
@ -1,25 +0,0 @@
|
|||
require_relative "../lib/servicepoint_binding_uniffi"
|
||||
|
||||
include ServicepointBindingUniffi
|
||||
|
||||
connection = Connection.new("172.23.42.29:2342")
|
||||
|
||||
pixels = Bitmap.new_max_sized
|
||||
x_offset = 0
|
||||
loop do
|
||||
|
||||
pixels.fill(false)
|
||||
|
||||
(0..((pixels.height) -1)).each do |y|
|
||||
pixels.set((y + x_offset) % pixels.width, y, true);
|
||||
end
|
||||
|
||||
command = Command.bitmap_linear_win(0, 0, pixels, CompressionCode::UNCOMPRESSED)
|
||||
|
||||
connection.send(command)
|
||||
sleep 0.0005
|
||||
|
||||
x_offset += 1
|
||||
end
|
||||
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
LD_LIBRARY_PATH="../../../../../target/release:$LD_LIBRARY_PATH" ruby example.rb
|
File diff suppressed because it is too large
Load diff
|
@ -1,13 +0,0 @@
|
|||
Gem::Specification.new do |s|
|
||||
s.name = "servicepoint"
|
||||
s.version = "0.13.1"
|
||||
s.summary = ""
|
||||
s.description = ""
|
||||
s.authors = ["kaesaecracker"]
|
||||
s.email = ""
|
||||
s.files = ["lib/servicepoint_binding_uniffi.rb"]
|
||||
s.homepage =
|
||||
"https://rubygems.org/gems/hola"
|
||||
s.license = "MIT"
|
||||
s.add_dependency 'ffi'
|
||||
end
|
Loading…
Reference in a new issue