SBC4 C#

General PhidgetSBC Discussion.
Post Reply
coso2
Phidgetsian
Posts: 7
Joined: Wed Sep 01, 2021 5:45 am
Contact:

SBC4 C#

Post by coso2 »

Hi, I am testing an application involving an RFID reader and an SBC4. I tried to follow the guide on the website, installed mono and downloaded an example

Code: Select all

using System;
using Phidget22;

namespace ConsoleApplication
{
	class Program
	{

		private static void Rfid0_Tag(object sender, Phidget22.Events.RFIDTagEventArgs e)
		{
			Console.WriteLine("Tag: " + e.Tag);
			Console.WriteLine("Protocol: " + e.Protocol);
			Console.WriteLine("----------");
		}

		private static void Rfid0_TagLost(object sender, Phidget22.Events.RFIDTagLostEventArgs e)
		{
			Console.WriteLine("Tag: " + e.Tag);
			Console.WriteLine("Protocol: " + e.Protocol);
			Console.WriteLine("----------");
		}

		static void Main(string[] args)
		{
			RFID rfid0 = new RFID();

			rfid0.Tag += Rfid0_Tag;
			rfid0.TagLost += Rfid0_TagLost;

			rfid0.Open(5000);

			//Wait until Enter has been pressed before exiting
			Console.ReadLine();

			rfid0.Close();
		}
	}
}

I have to censor the NET on the dll name because it won't let me write it down.

I created the project folder, and uploaded the main.cs and a copy of Phidget22.***.dll from net46

then I compiled the program with the command

Code: Select all

mcs main.cs -r:Phidget22.***.dll
But, when I try to run the program I get an error


Unhandled Exception:
System.DllNotFoundException: phidget22 assembly:<unknown assembly> type:<unknown type> member:(null)
at (wrapper managed-to-native) Phidget22.Phidget22Imports.PhidgetRFID_create(intptr&)
at Phidget22.RFID..ctor () [0x00006] in <2a14baf30be24c0890d1479431891150>:0
at ConsoleApplication.Program.Main (System.String[] args) [0x00000] in <8a885098fb564fbf92c56e046a36c2d5>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.DllNotFoundException: phidget22 assembly:<unknown assembly> type:<unknown type> member:(null)
at (wrapper managed-to-native) Phidget22.Phidget22Imports.PhidgetRFID_create(intptr&)
at Phidget22.RFID..ctor () [0x00006] in <2a14baf30be24c0890d1479431891150>:0
at ConsoleApplication.Program.Main (System.String[] args) [0x00000] in <8a885098fb564fbf92c56e046a36c2d5>:0


Am I missing something or doing something wrong? I am a C# windows user, linux and mono are outside my comfort zone :)
coso2
Phidgetsian
Posts: 7
Joined: Wed Sep 01, 2021 5:45 am
Contact:

Re: SBC4 C#

Post by coso2 »

Ok, so, maybe I found the problem. The main dll.
There are 2 dll needed for this to run, the Phidget22.***.dll and the phidget22.dll. Uploaded the second one inside the same folder and now it works. Now my problem is to find a way to start the program on boot.

Would be useful on the web interface the ability to install mono and compile/run projects without using putty
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest