Geschrieben April 23, 2017 at 16:1223. Apr 2017 Hallo zusammen, ich bin ein großer Fan des Tinkerforge Baukastensystems. Außerdem programmiere ich fast ausschließlich in C#. Leider finde ich die C# API nicht besonders komfortabel, was wie ich denke auf die vielen Methoden mit „out“-Parametren zurückzuführen ist. Microsoft bzw. das C# Team haben das erkannt und mit .net 4.7 und C# Version 7 (Windows 10 Creators Update) das Problem behoben. Daher möchte ich nun hier meine C# Plugin für .net 4.7 vorstellen. Diese Erweiterung fügt für alle Methoden aus der Tinkerfoge API für .net eine Methoden-Überschreibung hinzu. Es handelt sich um keine neue API sondern um eine API-Erweiterung. Es wird weiterhin die Basis-DLL benötigt. Beispiel für C#: var ipcon = new IPConnection(); // Create IP connection var io = new BrickletIO4("h2R", ipcon); // Create device object ipcon.Connect("localhost", 4223); // Connect to brickd //Old Style io.GetMonoflop(0, out byte value, out long time, out long timeRemaining); Console.WriteLine("Remaining time: " + timeRemaining); //New Style Console.WriteLine("Remaining time: " + io.GetMonoflop(0).TimeRemaining); ipcon.Disconnect(); Console.WriteLine("Press enter to exit..."); Console.ReadKey(); Beispiel VB.net: Dim ipcon = New IPConnection Dim io = New BrickletIO4("h2R", ipcon) ' Create device object ipcon.Connect("localhost", 4223) ' Connect to brickd 'Old Style Dim value As Byte Dim time As Long Dim timeRemaining As Long io.GetMonoflop(0, value:=value, time:=time, timeRemaining:=timeRemaining) Console.WriteLine("Remaining time: " + timeRemaining.ToString()) 'New Style Console.WriteLine("Remaining time: " + io.GetMonoflop(0).TimeRemaining.ToString()) ipcon.Disconnect() Console.WriteLine("Press enter to exit...") Console.ReadKey() Ich kenne mich leider mit Mono nicht aus, daher kann ich nicht sagen, ob das kompatibel ist. Fragen und Kommentare sind willkommen! TinkerforgeNetPlus47.zipTinkerforgeNetPlus47.dll
Geschrieben April 26, 2017 at 09:1826. Apr 2017 Sieht sehr gut aus! Wir brechen nur sehr ungern die API, deswegen ist es für uns immer schwer solche Sprachverbesserungen im Nachhinein umzusetzen.
Geschrieben April 30, 2017 at 15:3330. Apr 2017 Autor Ist nun auch auf NuGet verfügbar: https://www.nuget.org/packages/Tinkerforge.Tuple/ Regelmäßige Updates, wenn es API Erweiterungen gibt, sind geplant.
Geschrieben May 14, 2017 at 17:4414. Mai 2017 Autor Version 1.1 veröffentlicht für GPS Bricklet 2.0. https://www.nuget.org/packages/Tinkerforge.Tuple/
Geschrieben May 23, 2017 at 13:1123. Mai 2017 Gehe ich richtig in der Annahme, dass man dafür jetzt zwingend Visual Studio 2017 benötigt? Ich habe die 2015er Community-Version, habe auch das .net-Framework 4.7 installiert (Betriebssystem ist Windows 7) aber ich kann das Zielframework nicht auf die Version 4.7 ändern. Es wird in der Dropdownliste nicht angezeigt.
Geschrieben May 23, 2017 at 16:4323. Mai 2017 Autor Also bei mir funktioniert das auch mit VS2015 allerdings unter Windows 10. Ansonsten ist .NET 4.7 zum Download hier erhältlich: https://blogs.msdn.microsoft.com/dotnet/2017/05/02/announcing-the-net-framework-4-7-general-availability/
Geschrieben May 24, 2017 at 06:1924. Mai 2017 Hallo Fabio, danke für Deine Antwort. Ich habe das .Net-Framework 4.7 ja bereits installiert, aber es steht mir für eine Auswahl dennoch nicht zur Verfügung. Danke Dir dennoch!
Geschrieben May 24, 2017 at 07:4424. Mai 2017 Habs auch endlich hinbekommen. Gibt für den Download nochmal eine Auswahl für welche VisualStudio Version man es herunterladen will. Da hatte ich offensichtlich nicht das richtige.
Geschrieben August 8, 2017 at 17:488. Aug 2017 Autor Version 1.2 veröffentlicht: Unterstützung für RS485 Bricklet NuGet: https://www.nuget.org/packages/Tinkerforge.Tuple/
Geschrieben March 7, 2018 at 01:077. Mär 2018 Vielleicht kann TF einen hinweis in der Doku zu dieser Erweiterung hinterlegen
Geschrieben March 23, 2018 at 17:1023. Mär 2018 Autor Update 1.3 Unterstützung für folgende Bricklet´s wurde ergänzt: -Remote Switch Bricklet 2.0 -Motion Detector Bricklet 2.0 -Analog In Bricklet 3.0 -NFC Bricklet -Temperature IR Bricklet 2.0 -Rotary Encoder Bricklet 2.0 -Solid State Relay Bricklet 2.0 -Outdoor Weather Bricklet -DMX Bricklet, Humidity Bricklet 2.0 -Motorized Linear Poti Bricklet -RGB LED Button Bricklet -RGB LED Matrix Bricklet -Thermal Imaging Bricklet
Geschrieben January 29, 2019 at 17:0429. Jan 2019 Hi, Not sure if this package is being maintained. Please see https://www.tinkerunity.org/forum/index.php/topic,4748.0.html for another option with Async/Await support and other additional features
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.