Add project files.

This commit is contained in:
Martijn Dijkstra
2025-05-08 09:10:15 +02:00
parent 7be30a6f28
commit 6a44bd4fd2
211 changed files with 729572 additions and 0 deletions

BIN
Server/M.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

25
Server/OpenTK.dll.config Normal file
View File

@@ -0,0 +1,25 @@
<configuration>
<dllmap os="linux" dll="opengl32.dll" target="libGL.so.1"/>
<dllmap os="linux" dll="glu32.dll" target="libGLU.so.1"/>
<dllmap os="linux" dll="openal32.dll" target="libopenal.so.1"/>
<dllmap os="linux" dll="alut.dll" target="libalut.so.0"/>
<dllmap os="linux" dll="opencl.dll" target="libOpenCL.so"/>
<dllmap os="linux" dll="libX11" target="libX11.so.6"/>
<dllmap os="linux" dll="libXi" target="libXi.so.6"/>
<dllmap os="linux" dll="SDL2.dll" target="libSDL2-2.0.so.0"/>
<dllmap os="osx" dll="opengl32.dll" target="/System/Library/Frameworks/OpenGL.framework/OpenGL"/>
<dllmap os="osx" dll="openal32.dll" target="/System/Library/Frameworks/OpenAL.framework/OpenAL" />
<dllmap os="osx" dll="alut.dll" target="/System/Library/Frameworks/OpenAL.framework/OpenAL" />
<dllmap os="osx" dll="libGLES.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
<dllmap os="osx" dll="libGLESv1_CM.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
<dllmap os="osx" dll="libGLESv2.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
<dllmap os="osx" dll="opencl.dll" target="/System/Library/Frameworks/OpenCL.framework/OpenCL"/>
<dllmap os="osx" dll="SDL2.dll" target="libSDL2.dylib"/>
<!-- XQuartz compatibility (X11 on Mac) -->
<dllmap os="osx" dll="libGL.so.1" target="/usr/X11/lib/libGL.dylib"/>
<dllmap os="osx" dll="libX11" target="/usr/X11/lib/libX11.dylib"/>
<dllmap os="osx" dll="libXcursor.so.1" target="/usr/X11/lib/libXcursor.dylib"/>
<dllmap os="osx" dll="libXi" target="/usr/X11/lib/libXi.dylib"/>
<dllmap os="osx" dll="libXinerama" target="/usr/X11/lib/libXinerama.dylib"/>
<dllmap os="osx" dll="libXrandr.so.2" target="/usr/X11/lib/libXrandr.dylib"/>
</configuration>

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Server")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Server")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ce8fb8af-6b3a-42d2-9808-e94790707e91")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

199
Server/RaspberryDELTA.cs Normal file
View File

@@ -0,0 +1,199 @@
//commentaar
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Maser.Feanor.Model;
using System.Net;
using Maser.Feanor.Biz;
using System.Globalization;
namespace Maser.Feanor.Server
{
public class RaspberryDELTA : Server
{
public const ServerType SERVERTYPE = ServerType.RaspberryPI;
public RaspberryDELTA(Chamber Chamber) : base(Chamber)
{
_chamber = Chamber;
}
// Return a list of standard defined sensors for RaspberryPI
public override List<Sensor> StandardSensors()
{
// Format: int PK, int ID, int chamberPK, String Description, SensorType, Enabled: true/false, ApplyCalibration: true/false
List<Sensor> sensors = new List<Sensor>();
sensors.Add(new Sensor(-1, 0, _chamber.PK, "Air temperature", SensorType.Pt100, true, false)); // dry bulb
sensors.Add(new Sensor(-1, 1, _chamber.PK, "Water temperature", SensorType.Pt100, true, false)); // wet bulb
sensors.Add(new Sensor(-1, 2, _chamber.PK, String.Format("Voltage Ch01"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 3, _chamber.PK, String.Format("Voltage Ch02"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 4, _chamber.PK, String.Format("Voltage Ch03"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 5, _chamber.PK, String.Format("Voltage Ch04"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 6, _chamber.PK, String.Format("Voltage Ch05"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 7, _chamber.PK, String.Format("Voltage Ch06"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 8, _chamber.PK, String.Format("Voltage Ch07"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 9, _chamber.PK, String.Format("Voltage Ch08"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 10, _chamber.PK, String.Format("Voltage Ch09"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 11, _chamber.PK, String.Format("Voltage Ch10"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 12, _chamber.PK, String.Format("Voltage Ch11"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 13, _chamber.PK, String.Format("Voltage Ch12"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 14, _chamber.PK, String.Format("Voltage Ch13"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 15, _chamber.PK, String.Format("Voltage Ch14"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 16, _chamber.PK, String.Format("Voltage Ch15"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 17, _chamber.PK, String.Format("Voltage Ch16"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 18, _chamber.PK, "RH psychrometer", SensorType.PsychrometerRH, true, false));
sensors.Add(new Sensor(-1, 19, _chamber.PK, "RH pressurecooker", SensorType.PressurecookerRH, true, false));
sensors.Add(new Sensor(-1, 20, _chamber.PK, String.Format("Delta Voltage"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 21, _chamber.PK, String.Format("Delta Current"), SensorType.Current, true, false));
return sensors;
}
public override bool Read()
{
_Results = new List<Result>();
string url = URL + "ContentToClient";
string data;
try
{
using (WebClient client = new WebClient())
{
data = client.DownloadString(url);
String[] objects = data.Split(';');
foreach (String obj in objects)
{
try
{
// Create Results from data-string
if (obj.Trim().StartsWith("<D>") && obj.Trim().EndsWith("</D>"))
{
string s = obj.Replace("<D>", "").Replace("</D>", "").Trim();
string[] vars = s.Split(',');
int ID = int.Parse(vars[0]);
DateTime dt = Time.UnixToDatetime(int.Parse(vars[1]));
float fValue = float.Parse(vars[2], CultureInfo.InvariantCulture);
int calibrationPK = int.Parse(vars[3]);
Int32 sensorPK = _Sensors.Find(delegate (Sensor sensor) { return (sensor.ID == ID); }).PK;
_Results.Add(new Result(-1, sensorPK, fValue, dt, calibrationPK));
}
}
catch
{
// Continue with next object , ignoring exception
}
}
}
}
catch
{
return false;
}
return true;
}
public bool ReadStartup()
{
DateTime zero = Time.UnixToDatetime(0);
// return zero;
return false;
}
public override bool WriteDatetime(DateTime dt)
{
// Format: <time>,[unix timestamp],</time>
string http = "<time>,";
http += string.Format("{0},", Time.DatetimeToUnix(dt));
http += "</time>";
return HTTP_POST(http);
}
public override Boolean WriteInterval(Int32 Interval)
{
// Format: <interval>,[interval],</interval>
string http = "<interval>,";
http += string.Format("{0},", Interval);
http += "</interval>";
return HTTP_POST(http);
}
public override bool WriteSensors()
{
bool result = true;
foreach (Sensor sensor in _Sensors)
{
Calibration cal = _Calibrations.Find(delegate (Calibration c) { return (c.SensorPK == sensor.PK); });
if (cal == null)
cal = new Calibration(-1, sensor.PK, DateTime.Now, DateTime.Now, DateTime.Now, new double[2] { 0, 1 }, 0, new double[4] {0, 0, 1, 1 } );
if (!ModifySensor(sensor, cal))
result = false;
}
return result;
}
public override bool ModifySensor(Sensor sensor, Calibration calibration)
{
// Format: <sensor>,ID,[Enabled:1/0],[ApplyCalibration:1/0],Description,CalibrationPK,c0,c1,...cn
string sensorHTTP = "";
sensorHTTP += "<sensor>,";
sensorHTTP += sensor.ID.ToString() + ",";
sensorHTTP += (sensor.Enabled) ? "1," : "0,";
sensorHTTP += (sensor.ApplyCalibration) ? "1," : "0,";
sensorHTTP += sensor.Description + ",";
sensorHTTP += calibration.PK.ToString() + ",";
sensorHTTP += String.Join(",", calibration.Coefficients);
sensorHTTP += ",</sensor>"; // <-- de komma is later toegevoegd. zonder komma wordt c[3] niet herkend door het Python script van de RPI
return HTTP_POST(sensorHTTP);
}
private bool HTTP_POST(string http)
{
/*
var reqparm = new System.Collections.Specialized.NameValueCollection();
reqparm.Add("param1", "<any> kinds & of = ? strings");
reqparm.Add("param2", "escaping is already handled");
byte[] responsebytes = client.UploadValues("http://localhost", "POST", reqparm);
string responsebody = Encoding.UTF8.GetString(responsebytes);
*/
try
{
using (WebClient wc = new WebClient())
{
wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
string HtmlResult = wc.UploadString(URL, http);
if (HtmlResult != "OK")
return false;
}
}
catch (Exception ex)
{
throw ex;
}
return true;
}
}
}

205
Server/RaspberryHAMEG.cs Normal file
View File

@@ -0,0 +1,205 @@
//commentaar
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Maser.Feanor.Model;
using System.Net;
using Maser.Feanor.Biz;
using System.Globalization;
namespace Maser.Feanor.Server
{
public class RaspberryHAMEG : Server
{
public const ServerType SERVERTYPE = ServerType.RaspberryPI;
public RaspberryHAMEG(Chamber Chamber) : base(Chamber)
{
_chamber = Chamber;
}
// Return a list of standard defined sensors for RaspberryPI
public override List<Sensor> StandardSensors()
{
// Format: int PK, int ID, int chamberPK, String Description, SensorType, Enabled: true/false, ApplyCalibration: true/false
List<Sensor> sensors = new List<Sensor>();
sensors.Add(new Sensor(-1, 0, _chamber.PK, "Air temperature", SensorType.Pt100, true, false)); // dry bulb
sensors.Add(new Sensor(-1, 1, _chamber.PK, "Water temperature", SensorType.Pt100, true, false)); // wet bulb
sensors.Add(new Sensor(-1, 2, _chamber.PK, String.Format("Voltage Ch01"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 3, _chamber.PK, String.Format("Voltage Ch02"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 4, _chamber.PK, String.Format("Voltage Ch03"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 5, _chamber.PK, String.Format("Voltage Ch04"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 6, _chamber.PK, String.Format("Voltage Ch05"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 7, _chamber.PK, String.Format("Voltage Ch06"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 8, _chamber.PK, String.Format("Voltage Ch07"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 9, _chamber.PK, String.Format("Voltage Ch08"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 10, _chamber.PK, String.Format("Voltage Ch09"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 11, _chamber.PK, String.Format("Voltage Ch10"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 12, _chamber.PK, String.Format("Voltage Ch11"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 13, _chamber.PK, String.Format("Voltage Ch12"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 14, _chamber.PK, String.Format("Voltage Ch13"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 15, _chamber.PK, String.Format("Voltage Ch14"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 16, _chamber.PK, String.Format("Voltage Ch15"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 17, _chamber.PK, String.Format("Voltage Ch16"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 18, _chamber.PK, "RH psychrometer", SensorType.PsychrometerRH, true, false));
sensors.Add(new Sensor(-1, 19, _chamber.PK, "RH pressurecooker", SensorType.PressurecookerRH, true, false));
sensors.Add(new Sensor(-1, 20, _chamber.PK, String.Format("Delta Voltage"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 21, _chamber.PK, String.Format("Delta Current"), SensorType.Current, true, false));
sensors.Add(new Sensor(-1, 22, _chamber.PK, String.Format("Hameg voltage Ch1"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 23, _chamber.PK, String.Format("Hameg current Ch1"), SensorType.Current, true, false));
sensors.Add(new Sensor(-1, 24, _chamber.PK, String.Format("Hameg voltage Ch2"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 25, _chamber.PK, String.Format("Hameg current Ch2"), SensorType.Current, true, false));
sensors.Add(new Sensor(-1, 26, _chamber.PK, String.Format("Hameg voltage Ch3"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 27, _chamber.PK, String.Format("Hameg current Ch3"), SensorType.Current, true, false));
sensors.Add(new Sensor(-1, 28, _chamber.PK, String.Format("Hameg voltage Ch4"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 29, _chamber.PK, String.Format("Hameg current Ch4"), SensorType.Current, true, false));
return sensors;
}
public override bool Read()
{
_Results = new List<Result>();
string url = URL + "ContentToClient";
string data;
try
{
using (WebClient client = new WebClient())
{
data = client.DownloadString(url);
String[] objects = data.Split(';');
foreach (String obj in objects)
{
try
{
// Create Results from data-string
if (obj.Trim().StartsWith("<D>") && obj.Trim().EndsWith("</D>"))
{
string s = obj.Replace("<D>", "").Replace("</D>", "").Trim();
string[] vars = s.Split(',');
int ID = int.Parse(vars[0]);
DateTime dt = Time.UnixToDatetime(int.Parse(vars[1]));
float fValue = float.Parse(vars[2], CultureInfo.InvariantCulture);
int calibrationPK = int.Parse(vars[3]);
Int32 sensorPK = _Sensors.Find(delegate (Sensor sensor) { return (sensor.ID == ID); }).PK;
_Results.Add(new Result(-1, sensorPK, fValue, dt, calibrationPK));
}
}
catch
{
// Continue with next object, ignoring exception
}
}
}
}
catch
{
return false;
}
return true;
}
public bool ReadStartup()
{
DateTime zero = Time.UnixToDatetime(0);
// return zero;
return false;
}
public override bool WriteDatetime(DateTime dt)
{
// Format: <time>,[unix timestamp],</time>
string http = "<time>,";
http += string.Format("{0},", Time.DatetimeToUnix(dt));
http += "</time>";
return HTTP_POST(http);
}
public override Boolean WriteInterval(Int32 Interval)
{
// Format: <interval>,[interval],</interval>
string http = "<interval>,";
http += string.Format("{0},", Interval);
http += "</interval>";
return HTTP_POST(http);
}
public override bool WriteSensors()
{
bool result = true;
foreach (Sensor sensor in _Sensors)
{
Calibration cal = _Calibrations.Find(delegate (Calibration c) { return (c.SensorPK == sensor.PK); });
if (cal == null)
cal = new Calibration(-1, sensor.PK, DateTime.Now, DateTime.Now, DateTime.Now, new double[2] { 0, 1 }, 0, new double[4] { 0, 0, 1, 1 });
if (!ModifySensor(sensor, cal))
result = false;
}
return result;
}
public override bool ModifySensor(Sensor sensor, Calibration calibration)
{
// Format: <sensor>,ID,[Enabled:1/0],[ApplyCalibration:1/0],Description,CalibrationPK,c0,c1,...cn
string sensorHTTP = "";
sensorHTTP += "<sensor>,";
sensorHTTP += sensor.ID.ToString() + ",";
sensorHTTP += (sensor.Enabled) ? "1," : "0,";
sensorHTTP += (sensor.ApplyCalibration) ? "1," : "0,";
sensorHTTP += sensor.Description + ",";
sensorHTTP += calibration.PK.ToString() + ",";
sensorHTTP += String.Join(",", calibration.Coefficients);
sensorHTTP += ",</sensor>"; // <-- de komma is later toegevoegd. zonder komma wordt c[3] niet herkend door het Python script van de RPI
return HTTP_POST(sensorHTTP);
}
private bool HTTP_POST(string http)
{
/*
var reqparm = new System.Collections.Specialized.NameValueCollection();
reqparm.Add("param1", "<any> kinds & of = ? strings");
reqparm.Add("param2", "escaping is already handled");
byte[] responsebytes = client.UploadValues("http://localhost", "POST", reqparm);
string responsebody = Encoding.UTF8.GetString(responsebytes);
*/
try
{
using (WebClient wc = new WebClient())
{
wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
string HtmlResult = wc.UploadString(URL, http);
if (HtmlResult != "OK")
return false;
}
}
catch (Exception ex)
{
throw ex;
}
return true;
}
}
}

79
Server/Server.Base.cs Normal file
View File

@@ -0,0 +1,79 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Maser.Feanor.Model;
using Maser.Feanor.Biz;
namespace Maser.Feanor.Server
{
public abstract class Server
{
public List<Result> Results { get { return _Results; } set { _Results = value; } }
protected List<Result> _Results;
public Chamber Chamber { get { return _chamber; } set { _chamber = value; } }
protected Chamber _chamber;
protected List<Sensor> _Sensors = new List<Sensor>(); // Sensors are retrieved from DB in constructor
protected List<Calibration> _Calibrations = new List<Calibration>(); // Calibrations are retrieved from DB in constructor
public abstract Boolean Read();
public abstract Boolean WriteDatetime(DateTime dt);
public abstract Boolean WriteInterval(Int32 Interval);
public abstract Boolean ModifySensor(Sensor sensor, Calibration calibration);
public abstract Boolean WriteSensors();
public Server(Chamber Chamber)
{
_chamber = Chamber;
// Get list of sensors from database and current calibration
try
{
SetSensorsAndCalibrations();
}
catch(Exception ex)
{
throw ex;
#warning What to do if the sensors or calibrations are not found while creating server?
}
}
public void SetSensorsAndCalibrations()
{
// Get list of sensors from database and current calibration
_Sensors = new Sensors().GetByChamber(_chamber.PK);
_Calibrations = new List<Calibration>();
foreach (Sensor sensor in _Sensors)
{
Calibration c = new Calibrations().GetLastCreatedBySensorPK(sensor.PK);
if (c != null)
_Calibrations.Add(c);
}
}
public String URL { get { return @"http://" + _chamber.Network + ":8080/"; } }
public abstract List<Sensor> StandardSensors(); // The sensor with lowest ID is exported as primary sensor
}
}

View File

@@ -0,0 +1,246 @@
//commentaar
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Maser.Feanor.Model;
using System.Net;
using Maser.Feanor.Biz;
using System.Globalization;
using System.Net.NetworkInformation;
namespace Maser.Feanor.Server
{
public class RaspberryPI : Server
{
public const ServerType SERVERTYPE = ServerType.RaspberryPI;
public RaspberryPI(Chamber Chamber) : base(Chamber)
{
_chamber = Chamber;
}
// Return a list of standard defined sensors for RaspberryPI
public override List<Sensor> StandardSensors()
{
// Format: int PK, int ID, int chamberPK, String Description, SensorType, Enabled: true/false, ApplyCalibration: true/false
List<Sensor> sensors = new List<Sensor>();
sensors.Add(new Sensor(-1, 0, _chamber.PK, "Air temperature", SensorType.Pt100, true, false)); // dry bulb
sensors.Add(new Sensor(-1, 1, _chamber.PK, "Water temperature", SensorType.Pt100, true, false)); // wet bulb
sensors.Add(new Sensor(-1, 2, _chamber.PK, String.Format("Voltage Ch01"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 3, _chamber.PK, String.Format("Voltage Ch02"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 4, _chamber.PK, String.Format("Voltage Ch03"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 5, _chamber.PK, String.Format("Voltage Ch04"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 6, _chamber.PK, String.Format("Voltage Ch05"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 7, _chamber.PK, String.Format("Voltage Ch06"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 8, _chamber.PK, String.Format("Voltage Ch07"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 9, _chamber.PK, String.Format("Voltage Ch08"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 10, _chamber.PK, String.Format("Voltage Ch09"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 11, _chamber.PK, String.Format("Voltage Ch10"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 12, _chamber.PK, String.Format("Voltage Ch11"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 13, _chamber.PK, String.Format("Voltage Ch12"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 14, _chamber.PK, String.Format("Voltage Ch13"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 15, _chamber.PK, String.Format("Voltage Ch14"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 16, _chamber.PK, String.Format("Voltage Ch15"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 17, _chamber.PK, String.Format("Voltage Ch16"), SensorType.Voltage, true, false));
sensors.Add(new Sensor(-1, 18, _chamber.PK, "RH psychrometer", SensorType.PsychrometerRH, true, false));
sensors.Add(new Sensor(-1, 19, _chamber.PK, "RH pressurecooker", SensorType.PressurecookerRH, true, false));
return sensors;
}
public override bool Read()
{
_Results = new List<Result>();
string url = URL + "ContentToClient";
string data;
//Console.WriteLine(url);
try
{
using (WebClient client = new WebClient())
{
data = client.DownloadString(url);
String[] objects = data.Split(';');
foreach (String obj in objects)
{
try
{
// Create Results from data-string
if (obj.Trim().StartsWith("<D>") && obj.Trim().EndsWith("</D>"))
{
string s = obj.Replace("<D>", "").Replace("</D>", "").Trim();
string[] vars = s.Split(',');
int ID = int.Parse(vars[0]);
DateTime dt = Time.UnixToDatetime(int.Parse(vars[1]));
float fValue = float.Parse(vars[2], CultureInfo.InvariantCulture);
int calibrationPK = int.Parse(vars[3]);
Int32 sensorPK = _Sensors.Find(delegate (Sensor sensor) { return (sensor.ID == ID); }).PK;
/*
if(ID == 0 || ID == 1) // temp
{
Console.Write(ID.ToString());
Console.Write(" ");
Console.Write(fValue.ToString());
Console.Write(" ");
if(fValue < -500.0)
{
Console.WriteLine("Temperature not store in DB");
// hier temp niet in DB opslaan
}
else
{
Console.WriteLine("Temperature store in DB");
// hier temp wel in DB opslaan
}
}
if(ID > 1 && ID < 18) // volt
{
float VoltThreshold = 0.1f;
Console.Write(ID.ToString());
Console.Write(" ");
Console.Write(fValue.ToString());
Console.Write(" ");
if(fValue > VoltThreshold || fValue < (-1.0*VoltThreshold ))
{
Console.WriteLine("VOLT store in DB");
// hier voltage opslaan in DB
}
else
{
Console.WriteLine("VOLT not store in DB");
// hier niets doen
}
}
*/
_Results.Add(new Result(-1, sensorPK, fValue, dt, calibrationPK));
}
}
catch
{
// Continue with next object, ignoring exception
}
}
}
}
catch
{
//Console.WriteLine("ERROR during data extraction");
return false;
}
//Console.WriteLine("Succesfull data extraction");
return true;
}
public bool ReadStartup()
{
DateTime zero = Time.UnixToDatetime(0);
// return zero;
return false;
}
public override bool WriteDatetime(DateTime dt)
{
// Format: <time>,[unix timestamp],</time>
string http = "<time>,";
http += string.Format("{0},", Time.DatetimeToUnix(dt));
http += "</time>";
return HTTP_POST(http);
}
public override Boolean WriteInterval(Int32 Interval)
{
// Format: <interval>,[interval],</interval>
string http = "<interval>,";
http += string.Format("{0},", Interval);
http += "</interval>";
return HTTP_POST(http);
}
public override bool WriteSensors()
{
bool result = true;
foreach (Sensor sensor in _Sensors)
{
Calibration cal = _Calibrations.Find(delegate (Calibration c) { return (c.SensorPK == sensor.PK); });
if (cal == null)
cal = new Calibration(-1, sensor.PK, DateTime.Now, DateTime.Now, DateTime.Now, new double[2] { 0, 1 }, 0, new double[4] { 0, 0, 1, 1 });
if (!ModifySensor(sensor, cal))
result = false;
}
return result;
}
public override bool ModifySensor(Sensor sensor, Calibration calibration)
{
// Format: <sensor>,ID,[Enabled:1/0],[ApplyCalibration:1/0],Description,CalibrationPK,c0,c1,...cn
string sensorHTTP = "";
sensorHTTP += "<sensor>,";
sensorHTTP += sensor.ID.ToString() + ",";
sensorHTTP += (sensor.Enabled) ? "1," : "0,";
sensorHTTP += (sensor.ApplyCalibration) ? "1," : "0,";
sensorHTTP += sensor.Description + ",";
sensorHTTP += calibration.PK.ToString() + ",";
sensorHTTP += String.Join(",", calibration.Coefficients);
sensorHTTP += ",</sensor>"; // <-- de komma is later toegevoegd. zonder komma wordt c[3] niet herkend door het Python script van de RPI
return HTTP_POST(sensorHTTP);
}
private bool HTTP_POST(string http)
{
/*
var reqparm = new System.Collections.Specialized.NameValueCollection();
reqparm.Add("param1", "<any> kinds & of = ? strings");
reqparm.Add("param2", "escaping is already handled");
byte[] responsebytes = client.UploadValues("http://localhost", "POST", reqparm);
string responsebody = Encoding.UTF8.GetString(responsebytes);
*/
try
{
using (WebClient wc = new WebClient())
{
wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
string HtmlResult = wc.UploadString(URL, http);
if (HtmlResult != "OK")
return false;
}
}
catch (Exception ex)
{
throw ex;
}
return true;
}
}
}

176
Server/Server.Yun020208.cs Normal file
View File

@@ -0,0 +1,176 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Maser.Feanor.Model;
using System.Net;
using Maser.Feanor.Biz;
namespace Maser.Feanor.Server
{
public class Yun020208 : Server
{
public const ServerType SERVERTYPE = ServerType.Yun020208;
public Yun020208(Chamber Chamber) : base(Chamber)
{
_chamber = Chamber;
}
// Return a list of standard defined sensors for Yun020208
public override List<Sensor> StandardSensors()
{
List<Sensor> sensors = new List<Sensor>();
sensors.Add(new Sensor(-1, 0, _chamber.PK, "Pt100", SensorType.Pt100, true, false));
sensors.Add(new Sensor(-1, 1, _chamber.PK, "Pt100", SensorType.Pt100, false, false));
sensors.Add(new Sensor(-1, 2, _chamber.PK, "Thermocouple K", SensorType.ThermocoupleK, false, false));
sensors.Add(new Sensor(-1, 3, _chamber.PK, "Thermocouple K", SensorType.ThermocoupleK, false, false));
for (int i = 4; i < 12; i++)
sensors.Add(new Sensor(-1, i, _chamber.PK, String.Format("Voltage #{0:00}", i), SensorType.Voltage,false , false));
sensors.Add(new Sensor(-1, 12, _chamber.PK, "RH psychrometer", SensorType.PsychrometerRH, false, false));
sensors.Add(new Sensor(-1, 13, _chamber.PK, "RH pressurecooker", SensorType.PressurecookerRH, false, false));
return sensors;
}
public override bool Read()
{
_Results = new List<Result>();
string url = URL + "ContentToClient";
string data;
try
{
using (WebClient client = new WebClient())
{
data = client.DownloadString(url);
String[] objects = data.Split(';');
foreach (String obj in objects)
{
try
{
// Create Results from data-string
if (obj.Trim().StartsWith("<D>") && obj.Trim().EndsWith("</D>"))
{
string s = obj.Replace("<D>", "").Replace("</D>", "").Trim();
string[] vars = s.Split(',');
int ID = int.Parse(vars[0]);
DateTime dt = Time.UnixToDatetime(int.Parse(vars[1]));
float fValue = float.Parse(vars[2]);
int calibrationPK = int.Parse(vars[3]);
Int32 sensorPK = _Sensors.Find(delegate (Sensor sensor) { return (sensor.ID == ID); }).PK;
_Results.Add(new Result(-1, sensorPK, fValue, dt, calibrationPK));
}
}
catch
{
// Continue with next object, ignoring exception
}
}
}
}
catch
{
return false;
}
return true;
}
public override bool WriteDatetime(DateTime dt)
{
// Format: <time>,[unix timestamp],</time>
string http = "<time>,";
http += string.Format("{0},", Time.DatetimeToUnix(dt));
http += "</time>";
return HTTP_POST(http);
}
public override Boolean WriteInterval(Int32 Interval)
{
// Format: <interval>,[interval],</interval>
string http = "<interval>,";
http += string.Format("{0},", Interval);
http += "</interval>";
return HTTP_POST(http);
}
public override bool WriteSensors()
{
bool result = true;
foreach (Sensor sensor in _Sensors)
{
Calibration cal = _Calibrations.Find(delegate (Calibration c) { return (c.SensorPK == sensor.PK); });
if (cal == null)
cal = new Calibration(-1, sensor.PK, DateTime.Now, DateTime.Now, DateTime.Now, new double[2] { 0, 1 }, 0, new double[4] { 0, 0, 1, 1 });
if (!ModifySensor(sensor, cal))
result = false;
}
return result;
}
public override bool ModifySensor(Sensor sensor, Calibration calibration)
{
// Format: <sensor>,ID,[Enabled:1/0],[ApplyCalibration:1/0],Description,CalibrationPK,c0,c1,...cn
string sensorHTTP = "";
sensorHTTP += "<sensor>,";
sensorHTTP += sensor.ID.ToString() + ",";
sensorHTTP += (sensor.Enabled) ? "1," : "0,";
sensorHTTP += (sensor.ApplyCalibration) ? "1," : "0,";
sensorHTTP += sensor.Description + ",";
sensorHTTP += calibration.PK.ToString() + ",";
sensorHTTP += String.Join(",", calibration.Coefficients);
sensorHTTP += "</sensor>";
return HTTP_POST(sensorHTTP);
}
private bool HTTP_POST(string http)
{
/*
var reqparm = new System.Collections.Specialized.NameValueCollection();
reqparm.Add("param1", "<any> kinds & of = ? strings");
reqparm.Add("param2", "escaping is already handled");
byte[] responsebytes = client.UploadValues("http://localhost", "POST", reqparm);
string responsebody = Encoding.UTF8.GetString(responsebytes);
*/
try
{
using (WebClient wc = new WebClient())
{
wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
string HtmlResult = wc.UploadString(URL, http);
if (HtmlResult != "OK")
return false;
}
}
catch (Exception ex)
{
throw ex;
}
return true;
}
}
}

160
Server/Server.csproj Normal file
View File

@@ -0,0 +1,160 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{CE8FB8AF-6B3A-42D2-9808-E94790707E91}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Server</RootNamespace>
<AssemblyName>Server</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>M.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="HarfBuzzSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>..\packages\HarfBuzzSharp.7.3.0.3\lib\net462\HarfBuzzSharp.dll</HintPath>
</Reference>
<Reference Include="LiveCharts, Version=0.9.7.0, Culture=neutral, PublicKeyToken=0bc1f845d1ebb8df, processorArchitecture=MSIL">
<HintPath>..\packages\LiveCharts.0.9.7\lib\net45\LiveCharts.dll</HintPath>
</Reference>
<Reference Include="LiveCharts.WinForms, Version=0.9.7.1, Culture=neutral, PublicKeyToken=0bc1f845d1ebb8df, processorArchitecture=MSIL">
<HintPath>..\packages\LiveCharts.WinForms.0.9.7.1\lib\net45\LiveCharts.WinForms.dll</HintPath>
</Reference>
<Reference Include="LiveCharts.Wpf, Version=0.9.7.0, Culture=neutral, PublicKeyToken=0bc1f845d1ebb8df, processorArchitecture=MSIL">
<HintPath>..\packages\LiveCharts.Wpf.0.9.7\lib\net45\LiveCharts.Wpf.dll</HintPath>
</Reference>
<Reference Include="OpenTK, Version=3.1.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
<HintPath>..\packages\OpenTK.3.1.0\lib\net20\OpenTK.dll</HintPath>
</Reference>
<Reference Include="OpenTK.GLControl, Version=3.1.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
<HintPath>..\packages\OpenTK.GLControl.3.1.0\lib\net20\OpenTK.GLControl.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="ScottPlot, Version=5.0.53.0, Culture=neutral, PublicKeyToken=86698dc10387c39e, processorArchitecture=MSIL">
<HintPath>..\packages\ScottPlot.5.0.53\lib\net462\ScottPlot.dll</HintPath>
</Reference>
<Reference Include="ScottPlot.WinForms, Version=5.0.53.0, Culture=neutral, PublicKeyToken=86698dc10387c39e, processorArchitecture=MSIL">
<HintPath>..\packages\ScottPlot.WinForms.5.0.53\lib\net462\ScottPlot.WinForms.dll</HintPath>
</Reference>
<Reference Include="SkiaSharp, Version=2.88.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>..\packages\SkiaSharp.2.88.9\lib\net462\SkiaSharp.dll</HintPath>
</Reference>
<Reference Include="SkiaSharp.HarfBuzz, Version=2.88.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>..\packages\SkiaSharp.HarfBuzz.2.88.9\lib\net462\SkiaSharp.HarfBuzz.dll</HintPath>
</Reference>
<Reference Include="SkiaSharp.Views.Desktop.Common, Version=2.88.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>..\packages\SkiaSharp.Views.Desktop.Common.2.88.9\lib\net462\SkiaSharp.Views.Desktop.Common.dll</HintPath>
</Reference>
<Reference Include="SkiaSharp.Views.WindowsForms, Version=2.88.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>..\packages\SkiaSharp.Views.WindowsForms.2.88.9\lib\net462\SkiaSharp.Views.WindowsForms.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Drawing.Common, Version=4.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Drawing.Common.4.7.3\lib\net461\System.Drawing.Common.dll</HintPath>
</Reference>
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
<Reference Include="WindowsFormsIntegration" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RaspberryDELTA.cs" />
<Compile Include="RaspberryHAMEG.cs" />
<Compile Include="Server.Base.cs" />
<Compile Include="Server.RaspberryPi.cs" />
<Compile Include="Server.Yun020208.cs" />
<Compile Include="Servers.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Maser.Feanor.Biz\Maser.Feanor.Biz.csproj">
<Project>{316710e0-2143-44cd-8779-a833a2987174}</Project>
<Name>Maser.Feanor.Biz</Name>
</ProjectReference>
<ProjectReference Include="..\Maser.Feanor\Maser.Feanor.Model.csproj">
<Project>{f96ec5eb-647c-405e-934f-08df688f55f8}</Project>
<Name>Maser.Feanor.Model</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="M.ico" />
</ItemGroup>
<ItemGroup>
<None Include="OpenTK.dll.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\HarfBuzzSharp.NativeAssets.macOS.7.3.0.3\build\net462\HarfBuzzSharp.NativeAssets.macOS.targets" Condition="Exists('..\packages\HarfBuzzSharp.NativeAssets.macOS.7.3.0.3\build\net462\HarfBuzzSharp.NativeAssets.macOS.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\HarfBuzzSharp.NativeAssets.macOS.7.3.0.3\build\net462\HarfBuzzSharp.NativeAssets.macOS.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\HarfBuzzSharp.NativeAssets.macOS.7.3.0.3\build\net462\HarfBuzzSharp.NativeAssets.macOS.targets'))" />
<Error Condition="!Exists('..\packages\HarfBuzzSharp.NativeAssets.Win32.7.3.0.3\build\net462\HarfBuzzSharp.NativeAssets.Win32.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\HarfBuzzSharp.NativeAssets.Win32.7.3.0.3\build\net462\HarfBuzzSharp.NativeAssets.Win32.targets'))" />
<Error Condition="!Exists('..\packages\SkiaSharp.NativeAssets.macOS.2.88.9\build\net462\SkiaSharp.NativeAssets.macOS.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SkiaSharp.NativeAssets.macOS.2.88.9\build\net462\SkiaSharp.NativeAssets.macOS.targets'))" />
<Error Condition="!Exists('..\packages\SkiaSharp.NativeAssets.Win32.2.88.9\build\net462\SkiaSharp.NativeAssets.Win32.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SkiaSharp.NativeAssets.Win32.2.88.9\build\net462\SkiaSharp.NativeAssets.Win32.targets'))" />
<Error Condition="!Exists('..\packages\HarfBuzzSharp.NativeAssets.Linux.7.3.0.3\build\net462\HarfBuzzSharp.NativeAssets.Linux.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\HarfBuzzSharp.NativeAssets.Linux.7.3.0.3\build\net462\HarfBuzzSharp.NativeAssets.Linux.targets'))" />
<Error Condition="!Exists('..\packages\SkiaSharp.NativeAssets.Linux.NoDependencies.2.88.9\build\net462\SkiaSharp.NativeAssets.Linux.NoDependencies.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SkiaSharp.NativeAssets.Linux.NoDependencies.2.88.9\build\net462\SkiaSharp.NativeAssets.Linux.NoDependencies.targets'))" />
</Target>
<Import Project="..\packages\HarfBuzzSharp.NativeAssets.Win32.7.3.0.3\build\net462\HarfBuzzSharp.NativeAssets.Win32.targets" Condition="Exists('..\packages\HarfBuzzSharp.NativeAssets.Win32.7.3.0.3\build\net462\HarfBuzzSharp.NativeAssets.Win32.targets')" />
<Import Project="..\packages\SkiaSharp.NativeAssets.macOS.2.88.9\build\net462\SkiaSharp.NativeAssets.macOS.targets" Condition="Exists('..\packages\SkiaSharp.NativeAssets.macOS.2.88.9\build\net462\SkiaSharp.NativeAssets.macOS.targets')" />
<Import Project="..\packages\SkiaSharp.NativeAssets.Win32.2.88.9\build\net462\SkiaSharp.NativeAssets.Win32.targets" Condition="Exists('..\packages\SkiaSharp.NativeAssets.Win32.2.88.9\build\net462\SkiaSharp.NativeAssets.Win32.targets')" />
<Import Project="..\packages\HarfBuzzSharp.NativeAssets.Linux.7.3.0.3\build\net462\HarfBuzzSharp.NativeAssets.Linux.targets" Condition="Exists('..\packages\HarfBuzzSharp.NativeAssets.Linux.7.3.0.3\build\net462\HarfBuzzSharp.NativeAssets.Linux.targets')" />
<Import Project="..\packages\SkiaSharp.NativeAssets.Linux.NoDependencies.2.88.9\build\net462\SkiaSharp.NativeAssets.Linux.NoDependencies.targets" Condition="Exists('..\packages\SkiaSharp.NativeAssets.Linux.NoDependencies.2.88.9\build\net462\SkiaSharp.NativeAssets.Linux.NoDependencies.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

39
Server/Servers.cs Normal file
View File

@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Maser.Feanor.Model;
using System.Net;
using Maser.Feanor.Biz;
namespace Maser.Feanor.Server
{
public static class Servers
{
public static Server GetInstanceByChamber(Chamber Chamber)
{
Server server;
// Determine the server
switch (Chamber.ServerType)
{
case ServerType.Yun020208:
server = new Yun020208(Chamber);
break;
case ServerType.RaspberryPI:
server = new RaspberryPI(Chamber);
break;
case ServerType.RaspberryDELTA:
server = new RaspberryDELTA(Chamber);
break;
case ServerType.RaspberryHAMEG:
server = new RaspberryHAMEG(Chamber);
break;
default:
throw new Exception("ServerType unknown!");
}
return server;
}
}
}

27
Server/packages.config Normal file
View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="HarfBuzzSharp" version="7.3.0.3" targetFramework="net472" />
<package id="HarfBuzzSharp.NativeAssets.Linux" version="7.3.0.3" targetFramework="net472" />
<package id="HarfBuzzSharp.NativeAssets.macOS" version="7.3.0.3" targetFramework="net472" />
<package id="HarfBuzzSharp.NativeAssets.Win32" version="7.3.0.3" targetFramework="net472" />
<package id="LiveCharts" version="0.9.7" targetFramework="net472" />
<package id="LiveCharts.WinForms" version="0.9.7.1" targetFramework="net472" />
<package id="LiveCharts.Wpf" version="0.9.7" targetFramework="net472" />
<package id="OpenTK" version="3.1.0" targetFramework="net472" />
<package id="OpenTK.GLControl" version="3.1.0" targetFramework="net472" />
<package id="ScottPlot" version="5.0.53" targetFramework="net472" />
<package id="ScottPlot.WinForms" version="5.0.53" targetFramework="net472" />
<package id="SkiaSharp" version="2.88.9" targetFramework="net472" />
<package id="SkiaSharp.HarfBuzz" version="2.88.9" targetFramework="net472" />
<package id="SkiaSharp.NativeAssets.Linux.NoDependencies" version="2.88.9" targetFramework="net472" />
<package id="SkiaSharp.NativeAssets.macOS" version="2.88.9" targetFramework="net472" />
<package id="SkiaSharp.NativeAssets.Win32" version="2.88.9" targetFramework="net472" />
<package id="SkiaSharp.Views.Desktop.Common" version="2.88.9" targetFramework="net472" />
<package id="SkiaSharp.Views.WindowsForms" version="2.88.9" targetFramework="net472" />
<package id="System.Buffers" version="4.5.1" targetFramework="net472" />
<package id="System.Drawing.Common" version="4.7.3" targetFramework="net472" />
<package id="System.Memory" version="4.5.5" targetFramework="net472" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" targetFramework="net472" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
</packages>