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.


  1. Sofata Repository: github/djaus2/Soft-ata
  2. Earlier Blog post: Wilderness Labs: About Project Lab V3
  3. The Issue: Socket.Send throw exception with ‘The descriptor is not a socket’ #590
  1. The target board: The Wilderness Labs project V3
  2. Meadow ProjectLab_Demo
  3. WildernessLabs/Meadow.ProjectLab
  4. Meadow ProjectLab Samples
  5. Meadow.Core.Samples
  6. Meadow.Foundation.Grove
  7. WildernessLabs
  8. WildernessLabs Repositories

Djz Project Labs V3 GitHub Repositories

  1. Meadow.ProjectLab.Extensions
  2. MQTTnet for Azure IoT Hub Apps

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 ….


 TopicSubtopic
<  Prev:   Aged Care Independent Living
   
 This Category Links 
Category:Softata Index:Softata
  Next: > Softata
<  Prev:   Softata