Protokolll inhalt erweitert
This commit is contained in:
@@ -14,6 +14,7 @@ namespace TempCAN
|
||||
private static int PORT = 4223;
|
||||
private static string UID = "dW3";
|
||||
double temperatur;
|
||||
bool erfolg = true;
|
||||
|
||||
public TinkerForgeTemperatur()
|
||||
{
|
||||
@@ -21,15 +22,27 @@ namespace TempCAN
|
||||
BrickletTemperature t = new BrickletTemperature(UID, ipcon);
|
||||
|
||||
ipcon.Connect(HOST, PORT);
|
||||
short temp = t.GetTemperature();
|
||||
short temp;
|
||||
try
|
||||
{
|
||||
temp = t.GetTemperature();
|
||||
|
||||
}
|
||||
catch(Tinkerforge.TimeoutException)
|
||||
{
|
||||
temp = 100;
|
||||
erfolg = false;
|
||||
}
|
||||
temperatur = (temp / 100.0);
|
||||
ipcon.Disconnect();
|
||||
t = null;
|
||||
ipcon = null;
|
||||
}
|
||||
|
||||
public double GetTemperatur()
|
||||
public double GetTemperatur(out string message)
|
||||
{
|
||||
message = "";
|
||||
if (!erfolg) message = "Es konnte keine Verbindung mit der TemperaturSystem aufgebaut werden";
|
||||
return temperatur;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user