25 lines
810 B
C#
25 lines
810 B
C#
using FfiChannels;
|
|
|
|
Bindings.register_callback((bytes) => {
|
|
var data = bytes.ToByteArray();
|
|
Console.WriteLine($"Callback called, bytes: {string.Join(',',data)}");
|
|
});
|
|
Bindings.start_listening();
|
|
|
|
Console.WriteLine("Press key to send");
|
|
Console.ReadKey(true);
|
|
|
|
Bindings.send(new byte[]{ 1,2,3,4,5,6,7,8,9,10 }, 10);
|
|
|
|
Console.WriteLine("Press key to exit");
|
|
Console.ReadKey(true);
|
|
|
|
// var receiving = Bindings.ReceiveAsync();
|
|
// Console.WriteLine("Press key to send");
|
|
// Console.ReadKey(true);
|
|
// Console.WriteLine("Hello world, sending data to Rust:");
|
|
// Bindings.send(new byte[]{ 1,2,3,4,5,6,7,8,9,10 }, 10);
|
|
// Console.WriteLine("Press a key to receive");
|
|
// Console.ReadKey(true);
|
|
// var data = await receiving;
|
|
// Console.WriteLine($"Received: {string.Join(',',data)}"); |