mirror of
https://bitbucket.org/cjdskunkworks/lynxastrodewcontroller.git
synced 2026-05-03 09:18:51 +00:00
Redone the log messages
This commit is contained in:
@@ -74,7 +74,7 @@ namespace ASCOM.LynxAstro.DewController
|
||||
{
|
||||
get
|
||||
{
|
||||
Tl.LogMessage("SupportedActions Get", "Returning empty arraylist");
|
||||
LogMessage("SupportedActions Get", "Returning empty arraylist");
|
||||
return new ArrayList();
|
||||
}
|
||||
}
|
||||
@@ -183,7 +183,7 @@ namespace ASCOM.LynxAstro.DewController
|
||||
get
|
||||
{
|
||||
string name = "LynxAstro.DewController";
|
||||
Tl.LogMessage("Name Get", name);
|
||||
LogMessage("Name Get", name);
|
||||
return name;
|
||||
}
|
||||
}
|
||||
@@ -213,7 +213,7 @@ namespace ASCOM.LynxAstro.DewController
|
||||
//Purpose: Get the device type, i.e.the number of channels the dew controller has.
|
||||
//Response: :GDX# where X is either 1 or 4 depending on the number of channels this device has
|
||||
|
||||
Tl.LogMessage("MaxSwitch Get", numSwitch.ToString());
|
||||
LogMessage("MaxSwitch Get", numSwitch.ToString());
|
||||
return this.numSwitch;
|
||||
}
|
||||
}
|
||||
@@ -230,7 +230,10 @@ namespace ASCOM.LynxAstro.DewController
|
||||
Validate("GetSwitchName", id);
|
||||
ReadProfile();
|
||||
|
||||
return switchNames.Count > id ? switchNames[id] : string.Empty;
|
||||
var switchName = switchNames.Count > id ? switchNames[id] : string.Empty;
|
||||
|
||||
LogMessage("GetSwitchName", $"{id}: {switchName}");
|
||||
return switchName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -246,6 +249,8 @@ namespace ASCOM.LynxAstro.DewController
|
||||
while (id > switchNames.Count)
|
||||
switchNames.Add(string.Empty);
|
||||
|
||||
|
||||
LogMessage("SetSwitchName", $"{id}: \"{switchNames[id]}\" to \"{name}\"");
|
||||
switchNames[id] = name;
|
||||
|
||||
WriteSwitchNames();
|
||||
@@ -259,7 +264,11 @@ namespace ASCOM.LynxAstro.DewController
|
||||
public string GetSwitchDescription(short id)
|
||||
{
|
||||
Validate("GetSwitchDescription", id);
|
||||
return $"Channel {ChannelToLetter(id)}";
|
||||
|
||||
var channel= $"Channel {ChannelToLetter(id)}";
|
||||
|
||||
LogMessage("GetSwitchDescription", channel);
|
||||
return channel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -276,7 +285,8 @@ namespace ASCOM.LynxAstro.DewController
|
||||
{
|
||||
Validate("CanWrite", id);
|
||||
// default behavour is to report true
|
||||
Tl.LogMessage("CanWrite", string.Format("CanWrite({0}) - default true", id));
|
||||
|
||||
LogMessage("CanWrite", $"CanWrite({id}) - default true");
|
||||
return true;
|
||||
// implementation should report the correct behaviour
|
||||
//tl.LogMessage("CanWrite", string.Format("CanWrite({0}) - not implemented", id));
|
||||
@@ -296,7 +306,11 @@ namespace ASCOM.LynxAstro.DewController
|
||||
public bool GetSwitch(short id)
|
||||
{
|
||||
var value = GetSwitchValue(id);
|
||||
return value > 0;
|
||||
|
||||
var switchIsOn = value > 0;
|
||||
|
||||
LogMessage("GetSwitch", $"{id}: {switchIsOn} ({value})");
|
||||
return switchIsOn;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -316,7 +330,11 @@ namespace ASCOM.LynxAstro.DewController
|
||||
Tl.LogMessage("SetSwitch", str);
|
||||
throw new MethodNotImplementedException(str);
|
||||
}
|
||||
SetSwitchValue(id, state ? 1023 : 0);
|
||||
|
||||
var switchIsOn = state ? 1023 : 0;
|
||||
|
||||
LogMessage("SetSwitch", $"{id}: {state} ({switchIsOn})");
|
||||
SetSwitchValue(id, switchIsOn);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -389,6 +407,8 @@ namespace ASCOM.LynxAstro.DewController
|
||||
var encoded = SharedResourcesWrapper.SendString($":GC{channel}#");
|
||||
var decoded = DecodeResult(":GC", encoded);
|
||||
|
||||
LogMessage("GetSwitchValue", $"{id}: {channel} - {decoded}");
|
||||
|
||||
return double.Parse(decoded.TrimStart(channel));
|
||||
//Command: :GCX# where X is the channel A, B, C or D to retrieve.
|
||||
//Purpose: Get the current power setting for a specific channel.
|
||||
@@ -431,8 +451,10 @@ namespace ASCOM.LynxAstro.DewController
|
||||
//Possible Errors
|
||||
//:ER4# = Not enough data received - make sure you zero pad the power level.
|
||||
//:ER5# = Channel or power level out of range, e.g. channel B on a 1 channel device or power above 1023.
|
||||
|
||||
var channel = ChannelToLetter(id);
|
||||
|
||||
var channel = ChannelToLetter(id);
|
||||
|
||||
LogMessage("SetSwitchValue", $"{id}: {channel} - {value}");
|
||||
|
||||
var encoded = SharedResourcesWrapper.SendString($":SC{channel}{value:0000}#");
|
||||
var decoded = DecodeResult(":SC", encoded);
|
||||
@@ -441,6 +463,7 @@ namespace ASCOM.LynxAstro.DewController
|
||||
{
|
||||
throw new InvalidValueException($"Unable to set switch {{id}} to value {value}");
|
||||
}
|
||||
|
||||
//return double.Parse(decoded.TrimStart(channel));
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace ASCOM.LynxAstro.DewController
|
||||
/// <summary>
|
||||
/// Driver description that displays in the ASCOM Chooser.
|
||||
/// </summary>
|
||||
protected static readonly string DriverDescription = "Meade Generic";
|
||||
protected static readonly string DriverDescription = "LynxAstro.DewController";
|
||||
|
||||
protected static string ComPort; // Variables to hold the currrent device configuration
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace ASCOM.LynxAstro.DewController
|
||||
|
||||
protected void Initialise(string className)
|
||||
{
|
||||
Tl = new TraceLogger("", $"Meade.Generic.{className}");
|
||||
Tl = new TraceLogger("", $"LynxAstro.DewController.{className}");
|
||||
|
||||
ReadProfile(); // Read device configuration from the ASCOM Profile store
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace ASCOM.LynxAstro.DewController
|
||||
{
|
||||
get
|
||||
{
|
||||
Tl.LogMessage("Description Get", DriverDescription);
|
||||
LogMessage("Description Get", DriverDescription);
|
||||
return DriverDescription;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,6 +147,8 @@ namespace ASCOM.LynxAstro.DewController
|
||||
driverProfile.DeviceType = "Switch";
|
||||
driverProfile.WriteValue(DriverId, TraceStateProfileName, profileProperties.TraceLogger.ToString());
|
||||
driverProfile.WriteValue(DriverId, ComPortProfileName, profileProperties.ComPort);
|
||||
|
||||
//todo write the switch names
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user