Softata: Meadow ... A work in progress
As previously discussed here, including 2 GitHub Repositories, Wilderness Labs Project Lab 3 is an embedded board based upon the Meadow F7 Core Compute module. It comes with .NET Standard installed and numerous onboard sensors etc. A .NET Standard version of SoftataLib has been implemented but there is documented bug with respect to TCP Client to a remote Service.
Links
- Sofata Repository: github/djaus2/Soft-ata
- Earlier Blog post: Wilderness Labs: About Project Lab V3
- The Issue: Socket.Send throw exception with ‘The descriptor is not a socket’ #590
Links as previous
- The target board: The Wilderness Labs project V3
- Meadow ProjectLab_Demo
- WildernessLabs/Meadow.ProjectLab
- Meadow ProjectLab Samples
- Meadow.Core.Samples
- Meadow.Foundation.Grove
- WildernessLabs
- WildernessLabs Repositories
Djz Project Labs V3 GitHub Repositories
Softata
SoftataLib is a .NET C# library that marshalls commands from a .NET app and forwards them to a RPi Pico W running the Softata Arduino sketch. Connectivity is from a TCP Client at the .NET end to a TCP Service at the reception end. The service interprets the command and returns “OK” with data if it ius, for example, a sensor read. The initial commands are:
- Connect using the service IPAddress and port
- Begin
- Get Version
- Get Devices Types
There is also and Reset or End command that forces a reboot of the Pico W. For these “simple” commands, it is only the first letter that is sent.
Commands can then instantiate various Displays, Sensors and Actuators that have been implemented. Note that the code for these is based upon existing Arduino libraries whether included in the Arduino collection, or available from a third party as a Zip file. The code for each implemented device is extended from the base implementation for its device type with the device specific Arduino code called at specific points.
Commands can then send data to displays and actuators and read sensors. Commands can also start/pause/stop periodic streams of data from sensors over Bluetooth or to an Azure IoT Hub.
Commands are implemented in SoftataLib at 2 levels. At the top is a class of each device type with a subclass for each implemented device. This standardizes the commands that can be sent to a device type. For example, all displays would implement the command Clear() but that makes little sense for a sensor which implement Read(). At the low level are two methods that marshall to the commands and submit them the service and get the response. The first method takes a simple one word as per the initial commands Begin, Version and Devices as well as the final command End. The second method takes the required data to submit and forms an array of bytes before submission.
‘The descriptor is not a socket’ issue
The Meadow Project Lab apps are .NET Standard. The SoftataLib was ported to this with little difficulty. When run with the desktop version of the Meadow, Meadow.Windows, the app run OK. See the MeadowLab.WindowsDesktop app in the repository. Of interest is that it works with both the .NET Standard and the .NET versions of SoftataLib!
When run with a Project Labs device connection occurs OK But in the vicinity of a read by the service when a command is sent, you get the following error back in the client app:
Task ID 1 faulted: One or more errors occurred. (The descriptor is not a socket)
When you view the properties of the TCP Client in the Meadow app with .Available property shows that error which means having sent a command you can’t wait for the response.
// Waiting for a response:
while (Client.Available == 0) ;
TCP Client properties with Project Labs app
TCP Client properties with Windows app
Status
This has been logged as an issue on GitHub as per the third link at the top: Socket.Send throw exception ….
Topic | Subtopic | |
< Prev: | Aged Care Independent Living | Monitoring Devices |
This Category Links | ||
Category: | Softata Index: | Softata |
Next: > | Softata | Blockly ... The Holy Grail |
< Prev: | Softata | Many ways to skin a cat |