Merged in feature/AllowAltAzPulseGuiding (pull request #45)
Feature/AllowAltAzPulseGuiding
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>ASCOM.MeadeGeneric</RootNamespace>
|
<RootNamespace>ASCOM.MeadeGeneric</RootNamespace>
|
||||||
<AssemblyName>ASCOM.MeadeGeneric.Test</AssemblyName>
|
<AssemblyName>ASCOM.MeadeGeneric.Test</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||||
<TargetFrameworkProfile>
|
<TargetFrameworkProfile>
|
||||||
</TargetFrameworkProfile>
|
</TargetFrameworkProfile>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
|
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ namespace Meade.net.Focuser.UnitTests
|
|||||||
{
|
{
|
||||||
private Mock<IUtil> _utilMock;
|
private Mock<IUtil> _utilMock;
|
||||||
private Mock<ISharedResourcesWrapper> _sharedResourcesWrapperMock;
|
private Mock<ISharedResourcesWrapper> _sharedResourcesWrapperMock;
|
||||||
|
private Mock<ITraceLogger> _traceLoggerMock;
|
||||||
|
|
||||||
private ProfileProperties _profileProperties;
|
private ProfileProperties _profileProperties;
|
||||||
|
|
||||||
@@ -40,11 +41,13 @@ namespace Meade.net.Focuser.UnitTests
|
|||||||
|
|
||||||
_utilMock = new Mock<IUtil>();
|
_utilMock = new Mock<IUtil>();
|
||||||
|
|
||||||
|
_traceLoggerMock = new Mock<ITraceLogger>();
|
||||||
|
|
||||||
_sharedResourcesWrapperMock = new Mock<ISharedResourcesWrapper>();
|
_sharedResourcesWrapperMock = new Mock<ISharedResourcesWrapper>();
|
||||||
|
|
||||||
_sharedResourcesWrapperMock.Setup(x => x.ReadProfile()).Returns(() => _profileProperties);
|
_sharedResourcesWrapperMock.Setup(x => x.ReadProfile()).Returns(() => _profileProperties);
|
||||||
|
|
||||||
_focuser = new ASCOM.Meade.net.Focuser(_utilMock.Object, _sharedResourcesWrapperMock.Object);
|
_focuser = new ASCOM.Meade.net.Focuser(_utilMock.Object, _sharedResourcesWrapperMock.Object, _traceLoggerMock.Object);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ConnectFocuser()
|
private void ConnectFocuser()
|
||||||
@@ -117,7 +120,7 @@ namespace Meade.net.Focuser.UnitTests
|
|||||||
|
|
||||||
_focuser.CommandBlind(expectedMessage, raw);
|
_focuser.CommandBlind(expectedMessage, raw);
|
||||||
|
|
||||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(expectedMessage, raw), Times.Once);
|
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(_traceLoggerMock.Object, expectedMessage, raw), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -134,13 +137,13 @@ namespace Meade.net.Focuser.UnitTests
|
|||||||
public void CommandBool_WhenConnected_ThenSendsExpectedMessage(bool raw)
|
public void CommandBool_WhenConnected_ThenSendsExpectedMessage(bool raw)
|
||||||
{
|
{
|
||||||
string expectedMessage = "test blind Message";
|
string expectedMessage = "test blind Message";
|
||||||
_sharedResourcesWrapperMock.Setup(x => x.SendBool(expectedMessage, raw)).Returns(true);
|
_sharedResourcesWrapperMock.Setup(x => x.SendBool(_traceLoggerMock.Object, expectedMessage, raw)).Returns(true);
|
||||||
|
|
||||||
ConnectFocuser();
|
ConnectFocuser();
|
||||||
|
|
||||||
var result = _focuser.CommandBool(expectedMessage, raw);
|
var result = _focuser.CommandBool(expectedMessage, raw);
|
||||||
|
|
||||||
_sharedResourcesWrapperMock.Verify(x => x.SendBool(expectedMessage, raw), Times.Once);
|
_sharedResourcesWrapperMock.Verify(x => x.SendBool(_traceLoggerMock.Object, expectedMessage, raw), Times.Once);
|
||||||
Assert.That(result, Is.True);
|
Assert.That(result, Is.True);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,11 +164,11 @@ namespace Meade.net.Focuser.UnitTests
|
|||||||
|
|
||||||
ConnectFocuser();
|
ConnectFocuser();
|
||||||
|
|
||||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(sendMessage, true)).Returns(() => expectedMessage);
|
_sharedResourcesWrapperMock.Setup(x => x.SendString(_traceLoggerMock.Object, sendMessage, true)).Returns(() => expectedMessage);
|
||||||
|
|
||||||
var actualMessage = _focuser.CommandString(sendMessage, true);
|
var actualMessage = _focuser.CommandString(sendMessage, true);
|
||||||
|
|
||||||
_sharedResourcesWrapperMock.Verify(x => x.SendString(sendMessage, true), Times.Once);
|
_sharedResourcesWrapperMock.Verify(x => x.SendString(_traceLoggerMock.Object, sendMessage, true), Times.Once);
|
||||||
Assert.That(actualMessage, Is.EqualTo(expectedMessage));
|
Assert.That(actualMessage, Is.EqualTo(expectedMessage));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -321,7 +324,7 @@ namespace Meade.net.Focuser.UnitTests
|
|||||||
|
|
||||||
_focuser.Halt();
|
_focuser.Halt();
|
||||||
|
|
||||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("FQ", false), Times.AtLeastOnce);
|
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(_traceLoggerMock.Object, "FQ", false), Times.AtLeastOnce);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -411,13 +414,13 @@ namespace Meade.net.Focuser.UnitTests
|
|||||||
|
|
||||||
if (position < 0)
|
if (position < 0)
|
||||||
{
|
{
|
||||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("F-", false), Times.Once);
|
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(_traceLoggerMock.Object, "F-", false), Times.Once);
|
||||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("F+", false), Times.Never);
|
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(_traceLoggerMock.Object, "F+", false), Times.Never);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("F-", false), Times.Never);
|
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(_traceLoggerMock.Object, "F-", false), Times.Never);
|
||||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("F+", false), Times.Once);
|
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(_traceLoggerMock.Object, "F+", false), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
_utilMock.Verify(x => x.WaitForMilliseconds(Math.Abs(position)), Times.Once);
|
_utilMock.Verify(x => x.WaitForMilliseconds(Math.Abs(position)), Times.Once);
|
||||||
@@ -437,16 +440,16 @@ namespace Meade.net.Focuser.UnitTests
|
|||||||
|
|
||||||
if (position < 0)
|
if (position < 0)
|
||||||
{
|
{
|
||||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("F-", false), Times.Once);
|
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(_traceLoggerMock.Object, "F-", false), Times.Once);
|
||||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("F+", false), Times.Never);
|
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(_traceLoggerMock.Object, "F+", false), Times.Never);
|
||||||
_utilMock.Verify(x => x.WaitForMilliseconds(Math.Abs(position)), Times.Once);
|
_utilMock.Verify(x => x.WaitForMilliseconds(Math.Abs(position)), Times.Once);
|
||||||
_utilMock.Verify(x => x.WaitForMilliseconds(Math.Abs(_profileProperties.BacklashCompensation)), Times.Never);
|
_utilMock.Verify(x => x.WaitForMilliseconds(Math.Abs(_profileProperties.BacklashCompensation)), Times.Never);
|
||||||
_utilMock.Verify(x => x.WaitForMilliseconds(100), Times.Exactly(1));
|
_utilMock.Verify(x => x.WaitForMilliseconds(100), Times.Exactly(1));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("F-", false), Times.Once);
|
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(_traceLoggerMock.Object, "F-", false), Times.Once);
|
||||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("F+", false), Times.Once);
|
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(_traceLoggerMock.Object, "F+", false), Times.Once);
|
||||||
_utilMock.Verify(x => x.WaitForMilliseconds(Math.Abs(position) + _profileProperties.BacklashCompensation), Times.Once);
|
_utilMock.Verify(x => x.WaitForMilliseconds(Math.Abs(position) + _profileProperties.BacklashCompensation), Times.Once);
|
||||||
_utilMock.Verify(x => x.WaitForMilliseconds(_profileProperties.BacklashCompensation), Times.Once);
|
_utilMock.Verify(x => x.WaitForMilliseconds(_profileProperties.BacklashCompensation), Times.Once);
|
||||||
_utilMock.Verify(x => x.WaitForMilliseconds(100), Times.Exactly(2));
|
_utilMock.Verify(x => x.WaitForMilliseconds(100), Times.Exactly(2));
|
||||||
|
|||||||
@@ -21,13 +21,13 @@
|
|||||||
Type="raw" />
|
Type="raw" />
|
||||||
</Property>
|
</Property>
|
||||||
|
|
||||||
<Condition Message="This application requires Ascom Platform 6.4 SP1 or higher. Please install this before installing the driver.">
|
<Condition Message="This application requires Ascom Platform 6.6.0 or higher. Please install this before installing the driver.">
|
||||||
<![CDATA[Installed OR ASCOMPLATFORMVERSION >= "6.4.1"]]>
|
<![CDATA[Installed OR ASCOMPLATFORMVERSION >= "6.6.0"]]>
|
||||||
</Condition>
|
</Condition>
|
||||||
|
|
||||||
<PropertyRef Id="NETFRAMEWORK45"/>
|
<PropertyRef Id='WIXNETFX4RELEASEINSTALLED'/>
|
||||||
<Condition Message="This application requires .NET Framework 4.5 or higher. Please install the .NET Framework then run this installer again.">
|
<Condition Message="This application requires .NET Framework 4.8 or higher. Please install the .NET Framework then run this installer again.">
|
||||||
<![CDATA[Installed OR NETFRAMEWORK45]]>
|
<![CDATA[Installed OR (WIXNETFX4RELEASEINSTALLED >= "#528040")]]>
|
||||||
</Condition>
|
</Condition>
|
||||||
|
|
||||||
<!-- <Condition Message="Please use the correct installer for your operating system - x86 for 32-bit, x64 for 64-bit.">
|
<!-- <Condition Message="Please use the correct installer for your operating system - x86 for 32-bit, x64 for 64-bit.">
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,8 @@
|
|||||||
<ProjectConfiguration>
|
<ProjectConfiguration>
|
||||||
<Settings>
|
<Settings>
|
||||||
|
<HiddenComponentWarnings>
|
||||||
|
<Value>CopyReferencedAssembliesToWorkspaceIsOn</Value>
|
||||||
|
</HiddenComponentWarnings>
|
||||||
<UseCPUArchitecture>x86</UseCPUArchitecture>
|
<UseCPUArchitecture>x86</UseCPUArchitecture>
|
||||||
</Settings>
|
</Settings>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
+276
-271
File diff suppressed because it is too large
Load Diff
@@ -38,7 +38,7 @@ namespace Meade.net.UnitTests
|
|||||||
public void SendBlind_WhenCalled_Then_ClearsBuffersAndSendsMessage(bool raw, string expectedMessage)
|
public void SendBlind_WhenCalled_Then_ClearsBuffersAndSendsMessage(bool raw, string expectedMessage)
|
||||||
{
|
{
|
||||||
var sendMessage = "Test";
|
var sendMessage = "Test";
|
||||||
SharedResources.SendBlind(sendMessage, raw);
|
SharedResources.SendBlind(_traceLoggerMock.Object, sendMessage, raw);
|
||||||
|
|
||||||
_serialMock.Verify(x=> x.ClearBuffers(), Times.Once);
|
_serialMock.Verify(x=> x.ClearBuffers(), Times.Once);
|
||||||
_serialMock.Verify(x=>x.Transmit(expectedMessage), Times.Once);
|
_serialMock.Verify(x=>x.Transmit(expectedMessage), Times.Once);
|
||||||
@@ -53,7 +53,7 @@ namespace Meade.net.UnitTests
|
|||||||
|
|
||||||
_serialMock.Setup(x => x.ReceiveCounted(1)).Returns(expectedResult);
|
_serialMock.Setup(x => x.ReceiveCounted(1)).Returns(expectedResult);
|
||||||
|
|
||||||
var result = SharedResources.SendChar(command, raw);
|
var result = SharedResources.SendChar(_traceLoggerMock.Object, command, raw);
|
||||||
|
|
||||||
_serialMock.Verify(x => x.ClearBuffers(), Times.Once);
|
_serialMock.Verify(x => x.ClearBuffers(), Times.Once);
|
||||||
_serialMock.Verify(x => x.Transmit(expectedCommand), Times.Once);
|
_serialMock.Verify(x => x.Transmit(expectedCommand), Times.Once);
|
||||||
@@ -70,7 +70,7 @@ namespace Meade.net.UnitTests
|
|||||||
|
|
||||||
_serialMock.Setup(x => x.ReceiveTerminated("#")).Returns(expectedResult);
|
_serialMock.Setup(x => x.ReceiveTerminated("#")).Returns(expectedResult);
|
||||||
|
|
||||||
var result = SharedResources.SendString(transmitMessage, includePrefix);
|
var result = SharedResources.SendString(_traceLoggerMock.Object, transmitMessage, includePrefix);
|
||||||
|
|
||||||
_serialMock.Verify(x => x.ClearBuffers(), Times.Once);
|
_serialMock.Verify(x => x.ClearBuffers(), Times.Once);
|
||||||
_serialMock.Verify(x => x.Transmit(expectedMessage), Times.Once);
|
_serialMock.Verify(x => x.Transmit(expectedMessage), Times.Once);
|
||||||
|
|||||||
@@ -57,11 +57,11 @@ namespace ASCOM.Meade.net
|
|||||||
Initialise(nameof(Focuser));
|
Initialise(nameof(Focuser));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Focuser(IUtil util, ISharedResourcesWrapper sharedResourcesWrapper) : base(sharedResourcesWrapper)
|
public Focuser(IUtil util, ISharedResourcesWrapper sharedResourcesWrapper, ITraceLogger traceLogger) : base(sharedResourcesWrapper)
|
||||||
{
|
{
|
||||||
_utilities = util;
|
_utilities = util;
|
||||||
|
|
||||||
Initialise(nameof(Focuser));
|
Initialise(nameof(Focuser), traceLogger);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -78,17 +78,17 @@ namespace ASCOM.Meade.net
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void SetupDialog()
|
public void SetupDialog()
|
||||||
{
|
{
|
||||||
Tl.LogMessage("SetupDialog", "Opening setup dialog");
|
Tl.LogMessage("SetupDialog", "Opening setup dialog", false);
|
||||||
SharedResourcesWrapper.SetupDialog();
|
SharedResourcesWrapper.SetupDialog();
|
||||||
ReadProfile();
|
ReadProfile();
|
||||||
Tl.LogMessage("SetupDialog", "complete");
|
Tl.LogMessage("SetupDialog", "complete", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList SupportedActions
|
public ArrayList SupportedActions
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
Tl.LogMessage("SupportedActions Get", "Returning empty arraylist");
|
Tl.LogMessage("SupportedActions Get", "Returning empty arraylist", false);
|
||||||
return new ArrayList();
|
return new ArrayList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -105,7 +105,7 @@ namespace ASCOM.Meade.net
|
|||||||
CheckConnected("CommandBlind");
|
CheckConnected("CommandBlind");
|
||||||
// Call CommandString and return as soon as it finishes
|
// Call CommandString and return as soon as it finishes
|
||||||
//this.CommandString(command, raw);
|
//this.CommandString(command, raw);
|
||||||
SharedResourcesWrapper.SendBlind(command, raw);
|
SharedResourcesWrapper.SendBlind(Tl, command, raw);
|
||||||
// or
|
// or
|
||||||
//throw new ASCOM.MethodNotImplementedException("CommandBlind");
|
//throw new ASCOM.MethodNotImplementedException("CommandBlind");
|
||||||
// DO NOT have both these sections! One or the other
|
// DO NOT have both these sections! One or the other
|
||||||
@@ -116,7 +116,7 @@ namespace ASCOM.Meade.net
|
|||||||
{
|
{
|
||||||
LogMessage("CommandBool", "raw: {0} command {0}", raw, command);
|
LogMessage("CommandBool", "raw: {0} command {0}", raw, command);
|
||||||
CheckConnected("CommandBool");
|
CheckConnected("CommandBool");
|
||||||
var result = SharedResourcesWrapper.SendBool(command, raw);
|
var result = SharedResourcesWrapper.SendBool(Tl, command, raw);
|
||||||
LogMessage("CommandBool", "Completed: {0}", result);
|
LogMessage("CommandBool", "Completed: {0}", result);
|
||||||
return result;
|
return result;
|
||||||
// or
|
// or
|
||||||
@@ -131,7 +131,7 @@ namespace ASCOM.Meade.net
|
|||||||
// it's a good idea to put all the low level communication with the device here,
|
// it's a good idea to put all the low level communication with the device here,
|
||||||
// then all communication calls this function
|
// then all communication calls this function
|
||||||
// you need something to ensure that only one command is in progress at a time
|
// you need something to ensure that only one command is in progress at a time
|
||||||
var result = SharedResourcesWrapper.SendString(command, raw);
|
var result = SharedResourcesWrapper.SendString(Tl, command, raw);
|
||||||
LogMessage("CommandBool", "Completed: {0}", result);
|
LogMessage("CommandBool", "Completed: {0}", result);
|
||||||
return result;
|
return result;
|
||||||
//throw new ASCOM.MethodNotImplementedException("CommandString");
|
//throw new ASCOM.MethodNotImplementedException("CommandString");
|
||||||
@@ -141,8 +141,8 @@ namespace ASCOM.Meade.net
|
|||||||
{
|
{
|
||||||
// Clean up the tracelogger and util objects
|
// Clean up the tracelogger and util objects
|
||||||
Tl.Enabled = false;
|
Tl.Enabled = false;
|
||||||
Tl.Dispose();
|
//Tl.Dispose();
|
||||||
Tl = null;
|
//Tl = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Connected
|
public bool Connected
|
||||||
@@ -204,7 +204,7 @@ namespace ASCOM.Meade.net
|
|||||||
{
|
{
|
||||||
//string name = "Short driver name - please customise";
|
//string name = "Short driver name - please customise";
|
||||||
string name = DriverDescription;
|
string name = DriverDescription;
|
||||||
Tl.LogMessage("Name Get", name);
|
Tl.LogMessage("Name Get", name, false);
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -219,20 +219,20 @@ namespace ASCOM.Meade.net
|
|||||||
{
|
{
|
||||||
CheckConnected("Absolute Get");
|
CheckConnected("Absolute Get");
|
||||||
|
|
||||||
Tl.LogMessage("Absolute Get", false.ToString());
|
Tl.LogMessage("Absolute Get", false.ToString(), false);
|
||||||
return false; // This is a relative focuser
|
return false; // This is a relative focuser
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Halt()
|
public void Halt()
|
||||||
{
|
{
|
||||||
Tl.LogMessage("Halt", "Halting");
|
Tl.LogMessage("Halt", "Halting", false);
|
||||||
|
|
||||||
CheckConnected("Halt");
|
CheckConnected("Halt");
|
||||||
|
|
||||||
//todo fix this issue: A single halt command is sometimes missed by the #909 apm, so let's do it a few times to be safe.
|
//todo fix this issue: A single halt command is sometimes missed by the #909 apm, so let's do it a few times to be safe.
|
||||||
|
|
||||||
SharedResourcesWrapper.SendBlind("FQ");
|
SharedResourcesWrapper.SendBlind(Tl, "FQ");
|
||||||
//:FQ# Halt Focuser Motion
|
//:FQ# Halt Focuser Motion
|
||||||
//Returns: Nothing
|
//Returns: Nothing
|
||||||
}
|
}
|
||||||
@@ -241,7 +241,7 @@ namespace ASCOM.Meade.net
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
Tl.LogMessage("IsMoving Get", false.ToString());
|
Tl.LogMessage("IsMoving Get", false.ToString(), false);
|
||||||
return false; // This focuser always moves instantaneously so no need for IsMoving ever to be True
|
return false; // This focuser always moves instantaneously so no need for IsMoving ever to be True
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -250,12 +250,12 @@ namespace ASCOM.Meade.net
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
Tl.LogMessage("Link Get", Connected.ToString());
|
Tl.LogMessage("Link Get", Connected.ToString(), false);
|
||||||
return Connected; // Direct function to the connected method, the Link method is just here for backwards compatibility
|
return Connected; // Direct function to the connected method, the Link method is just here for backwards compatibility
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
Tl.LogMessage("Link Set", value.ToString());
|
Tl.LogMessage("Link Set", value.ToString(), false);
|
||||||
Connected = value; // Direct function to the connected method, the Link method is just here for backwards compatibility
|
Connected = value; // Direct function to the connected method, the Link method is just here for backwards compatibility
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -265,7 +265,7 @@ namespace ASCOM.Meade.net
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
Tl.LogMessage("MaxIncrement Get", _maxIncrement.ToString());
|
Tl.LogMessage("MaxIncrement Get", _maxIncrement.ToString(), false);
|
||||||
return _maxIncrement; // Maximum change in one move
|
return _maxIncrement; // Maximum change in one move
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -276,14 +276,14 @@ namespace ASCOM.Meade.net
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
Tl.LogMessage("MaxStep Get", _maxStep.ToString());
|
Tl.LogMessage("MaxStep Get", _maxStep.ToString(), false);
|
||||||
return _maxStep;
|
return _maxStep;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Move(int position)
|
public void Move(int position)
|
||||||
{
|
{
|
||||||
Tl.LogMessage("Move", position.ToString());
|
Tl.LogMessage("Move", position.ToString(), false);
|
||||||
CheckConnected("Move");
|
CheckConnected("Move");
|
||||||
|
|
||||||
if (position < -MaxIncrement || position > MaxIncrement)
|
if (position < -MaxIncrement || position > MaxIncrement)
|
||||||
@@ -311,7 +311,7 @@ namespace ASCOM.Meade.net
|
|||||||
//ApplyBacklashCompensation(direction);
|
//ApplyBacklashCompensation(direction);
|
||||||
if (direction & backlashCompensationSteps != 0)
|
if (direction & backlashCompensationSteps != 0)
|
||||||
{
|
{
|
||||||
Tl.LogMessage("Move", "Applying backlash compensation");
|
Tl.LogMessage("Move", "Applying backlash compensation", false);
|
||||||
MoveFocuser(!direction, backlashCompensationSteps);
|
MoveFocuser(!direction, backlashCompensationSteps);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -325,7 +325,7 @@ namespace ASCOM.Meade.net
|
|||||||
if (!_profileProperties.DynamicBreaking)
|
if (!_profileProperties.DynamicBreaking)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Tl.LogMessage("Move", "Applying dynamic breaking");
|
Tl.LogMessage("Move", "Applying dynamic breaking", false);
|
||||||
|
|
||||||
PerformFocuserMove(directionOut);
|
PerformFocuserMove(directionOut);
|
||||||
Halt();
|
Halt();
|
||||||
@@ -354,7 +354,7 @@ namespace ASCOM.Meade.net
|
|||||||
|
|
||||||
private void PerformFocuserMove(bool directionOut)
|
private void PerformFocuserMove(bool directionOut)
|
||||||
{
|
{
|
||||||
SharedResourcesWrapper.SendBlind(directionOut ? "F+" : "F-");
|
SharedResourcesWrapper.SendBlind(Tl, directionOut ? "F+" : "F-");
|
||||||
//:F+# Start Focuser moving inward (toward objective)
|
//:F+# Start Focuser moving inward (toward objective)
|
||||||
//Returns: None
|
//Returns: None
|
||||||
|
|
||||||
@@ -368,7 +368,7 @@ namespace ASCOM.Meade.net
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
Tl.LogMessage("StepSize Get", "Not implemented");
|
Tl.LogMessage("StepSize Get", "Not implemented", false);
|
||||||
throw new PropertyNotImplementedException("StepSize", false);
|
throw new PropertyNotImplementedException("StepSize", false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -377,13 +377,13 @@ namespace ASCOM.Meade.net
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
Tl.LogMessage("TempComp Get", false.ToString());
|
Tl.LogMessage("TempComp Get", false.ToString(), false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// ReSharper disable once ValueParameterNotUsed
|
// ReSharper disable once ValueParameterNotUsed
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
Tl.LogMessage("TempComp Set", "Not implemented");
|
Tl.LogMessage("TempComp Set", "Not implemented", false);
|
||||||
throw new PropertyNotImplementedException("TempComp", false);
|
throw new PropertyNotImplementedException("TempComp", false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -392,7 +392,7 @@ namespace ASCOM.Meade.net
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
Tl.LogMessage("TempCompAvailable Get", false.ToString());
|
Tl.LogMessage("TempCompAvailable Get", false.ToString(), false);
|
||||||
return false; // Temperature compensation is not available in this driver
|
return false; // Temperature compensation is not available in this driver
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -401,7 +401,7 @@ namespace ASCOM.Meade.net
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
Tl.LogMessage("Temperature Get", "Not implemented");
|
Tl.LogMessage("Temperature Get", "Not implemented", false);
|
||||||
throw new PropertyNotImplementedException("Temperature", false);
|
throw new PropertyNotImplementedException("Temperature", false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
<ProjectConfiguration>
|
<ProjectConfiguration>
|
||||||
<Settings>
|
<Settings>
|
||||||
|
<HiddenComponentWarnings>
|
||||||
|
<Value>CopyReferencedAssembliesToWorkspaceIsOn</Value>
|
||||||
|
</HiddenComponentWarnings>
|
||||||
<UseCPUArchitecture>x86</UseCPUArchitecture>
|
<UseCPUArchitecture>x86</UseCPUArchitecture>
|
||||||
</Settings>
|
</Settings>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
@@ -3,6 +3,7 @@ using System.Reflection;
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using ASCOM.Meade.net.Wrapper;
|
using ASCOM.Meade.net.Wrapper;
|
||||||
using ASCOM.Utilities;
|
using ASCOM.Utilities;
|
||||||
|
using ASCOM.Utilities.Interfaces;
|
||||||
|
|
||||||
namespace ASCOM.Meade.net
|
namespace ASCOM.Meade.net
|
||||||
{
|
{
|
||||||
@@ -12,7 +13,7 @@ namespace ASCOM.Meade.net
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Variable to hold the trace logger object (creates a diagnostic log file with information that you specify)
|
/// Variable to hold the trace logger object (creates a diagnostic log file with information that you specify)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected static TraceLogger Tl;
|
protected static ITraceLogger Tl;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Driver description that displays in the ASCOM Chooser.
|
/// Driver description that displays in the ASCOM Chooser.
|
||||||
@@ -32,9 +33,9 @@ namespace ASCOM.Meade.net
|
|||||||
SharedResourcesWrapper = sharedResourcesWrapper;
|
SharedResourcesWrapper = sharedResourcesWrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void Initialise(string className)
|
protected void Initialise(string className, ITraceLogger traceLogger = null)
|
||||||
{
|
{
|
||||||
Tl = new TraceLogger("", $"Meade.Generic.{className}");
|
Tl = traceLogger ?? new TraceLogger("", $"Meade.Generic.{className}");
|
||||||
|
|
||||||
ReadProfile(); // Read device configuration from the ASCOM Profile store
|
ReadProfile(); // Read device configuration from the ASCOM Profile store
|
||||||
|
|
||||||
@@ -79,7 +80,7 @@ namespace ASCOM.Meade.net
|
|||||||
public static void LogMessage(string identifier, string message, params object[] args)
|
public static void LogMessage(string identifier, string message, params object[] args)
|
||||||
{
|
{
|
||||||
var msg = string.Format(message, args);
|
var msg = string.Format(message, args);
|
||||||
Tl.LogMessage(identifier, msg);
|
Tl.LogMessage(identifier, msg, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -91,7 +92,7 @@ namespace ASCOM.Meade.net
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
Tl.LogMessage("Description Get", DriverDescription);
|
Tl.LogMessage("Description Get", DriverDescription, false);
|
||||||
return DriverDescription;
|
return DriverDescription;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using ASCOM.DeviceInterface;
|
using ASCOM.DeviceInterface;
|
||||||
@@ -80,12 +79,13 @@ namespace ASCOM.Meade.net
|
|||||||
}
|
}
|
||||||
|
|
||||||
//todo add code to ensure that there is a minimum gap between commands. 5ms as default.
|
//todo add code to ensure that there is a minimum gap between commands. 5ms as default.
|
||||||
public static void SendBlind(string message, bool raw = false)
|
public static void SendBlind(ITraceLogger traceLogger, string message, bool raw = false)
|
||||||
{
|
{
|
||||||
lock (LockObject)
|
lock (LockObject)
|
||||||
{
|
{
|
||||||
SharedSerial.ClearBuffers();
|
SharedSerial.ClearBuffers();
|
||||||
var encodedMessage = raw ? message : $"#:{message}#";
|
var encodedMessage = raw ? message : $"#:{message}#";
|
||||||
|
traceLogger.LogMessage("SendBlind", $"Transmitting {encodedMessage}", false);
|
||||||
SharedSerial.Transmit(encodedMessage);
|
SharedSerial.Transmit(encodedMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -99,21 +99,25 @@ namespace ASCOM.Meade.net
|
|||||||
/// <param name="message"></param>
|
/// <param name="message"></param>
|
||||||
/// <param name="raw"></param>
|
/// <param name="raw"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string SendString(string message, bool raw = false)
|
public static string SendString(ITraceLogger traceLogger, string message, bool raw = false)
|
||||||
{
|
{
|
||||||
lock (LockObject)
|
lock (LockObject)
|
||||||
{
|
{
|
||||||
SharedSerial.ClearBuffers();
|
SharedSerial.ClearBuffers();
|
||||||
|
|
||||||
var encodedMessage = raw ? message : $"#:{message}#";
|
var encodedMessage = raw ? message : $"#:{message}#";
|
||||||
|
traceLogger.LogMessage("SendString", $"Transmitting {encodedMessage}", false);
|
||||||
SharedSerial.Transmit(encodedMessage);
|
SharedSerial.Transmit(encodedMessage);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return SharedSerial.ReceiveTerminated("#").TrimEnd('#');
|
var result = SharedSerial.ReceiveTerminated("#").TrimEnd('#');
|
||||||
|
traceLogger.LogMessage("SendString", $"Received {result}", false);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
catch (COMException ex)
|
catch (COMException ex)
|
||||||
{
|
{
|
||||||
|
traceLogger.LogIssue("SendString", ex.Message);
|
||||||
if (ex.Message.Contains("Timed out waiting for received data"))
|
if (ex.Message.Contains("Timed out waiting for received data"))
|
||||||
throw new TimeoutException(ex.Message, ex);
|
throw new TimeoutException(ex.Message, ex);
|
||||||
|
|
||||||
@@ -122,34 +126,41 @@ namespace ASCOM.Meade.net
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool SendBool(string command, bool raw = false)
|
public static bool SendBool(ITraceLogger traceLogger, string command, bool raw = false)
|
||||||
{
|
{
|
||||||
var result = SendChar(command, raw);
|
var result = SendChar(traceLogger, command, raw);
|
||||||
|
|
||||||
return result == "1";
|
return result == "1";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string SendChar(string command, bool raw = false)
|
public static string SendChar(ITraceLogger traceLogger, string command, bool raw = false)
|
||||||
{
|
{
|
||||||
return SendChars(command, raw, count: 1);
|
return SendChars(traceLogger, command, raw, count: 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string SendChars(string command, bool raw = false, int count = 1)
|
public static string SendChars(ITraceLogger traceLogger, string command, bool raw = false, int count = 1)
|
||||||
{
|
{
|
||||||
lock (LockObject)
|
lock (LockObject)
|
||||||
{
|
{
|
||||||
SharedSerial.ClearBuffers();
|
SharedSerial.ClearBuffers();
|
||||||
|
|
||||||
var encodedMessage = raw ? command : $"#:{command}#";
|
var encodedMessage = raw ? command : $"#:{command}#";
|
||||||
|
traceLogger.LogMessage("SendChars", $"Transmitting {encodedMessage}", false);
|
||||||
SharedSerial.Transmit(encodedMessage);
|
SharedSerial.Transmit(encodedMessage);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return SharedSerial.ReceiveCounted(count);
|
var result = SharedSerial.ReceiveCounted(count);
|
||||||
|
traceLogger.LogMessage("SendChars", $"Received {result}", false);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
catch (COMException ex) when (ex.Message.Contains("Timed out waiting for received data"))
|
catch (COMException ex)
|
||||||
{
|
{
|
||||||
throw new TimeoutException(ex.Message, ex);
|
traceLogger.LogIssue("SendString", ex.Message);
|
||||||
|
if (ex.Message.Contains("Timed out waiting for received data"))
|
||||||
|
throw new TimeoutException(ex.Message, ex);
|
||||||
|
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -404,7 +415,7 @@ namespace ASCOM.Meade.net
|
|||||||
//Test if communication is working.
|
//Test if communication is working.
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string utcOffSet = SendString("GG");
|
string utcOffSet = SendString( traceLogger, "GG");
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
@@ -433,7 +444,7 @@ namespace ASCOM.Meade.net
|
|||||||
//SendBlind($"SB{newSpeedIndex}");
|
//SendBlind($"SB{newSpeedIndex}");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var speedChanged = SendChar($"SB{newSpeedIndex}");
|
var speedChanged = SendChar(traceLogger, $"SB{newSpeedIndex}");
|
||||||
if (speedChanged == "1")
|
if (speedChanged == "1")
|
||||||
{
|
{
|
||||||
SharedSerial.Connected = false;
|
SharedSerial.Connected = false;
|
||||||
@@ -458,8 +469,8 @@ namespace ASCOM.Meade.net
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ProductName = SendString("GVP");
|
ProductName = SendString(traceLogger, "GVP");
|
||||||
FirmwareVersion = SendString("GVN");
|
FirmwareVersion = SendString(traceLogger, "GVN");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -479,7 +490,7 @@ namespace ASCOM.Meade.net
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string utcOffSet = SendString("GG");
|
string utcOffSet = SendString(traceLogger, "GG");
|
||||||
//:GG# Get UTC offset time
|
//:GG# Get UTC offset time
|
||||||
//Returns: sHH# or sHH.H#
|
//Returns: sHH# or sHH.H#
|
||||||
//The number of decimal hours to add to local time to convert it to UTC. If the number is a whole number the
|
//The number of decimal hours to add to local time to convert it to UTC. If the number is a whole number the
|
||||||
|
|||||||
@@ -23,14 +23,22 @@
|
|||||||
// ReSharper disable once InconsistentNaming
|
// ReSharper disable once InconsistentNaming
|
||||||
public const string LX200GPS = "LX2001";
|
public const string LX200GPS = "LX2001";
|
||||||
|
|
||||||
public const string LX200GPS_42F = "4.2F";
|
public const string LX200GPS_42F = "4.2f";
|
||||||
// ReSharper disable once InconsistentNaming
|
// ReSharper disable once InconsistentNaming
|
||||||
public const string LX200GPS_42G = "4.2G";
|
public const string LX200GPS_42G = "4.2g";
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region LX200EMC
|
#region LX200EMC
|
||||||
// ReSharper disable once InconsistentNaming
|
// ReSharper disable once InconsistentNaming
|
||||||
public const string LX200CLASSIC = "LX200 Classic"; //GVP command is not supported!
|
public const string LX200CLASSIC = "LX200 Classic"; //GVP command is not supported!
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region RCX400
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
|
public const string RCX400 = "RCX400";
|
||||||
|
|
||||||
|
public const string RCX400_22I = "2.2i";
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ namespace ASCOM.Meade.net.Wrapper
|
|||||||
|
|
||||||
string FirmwareVersion { get; }
|
string FirmwareVersion { get; }
|
||||||
|
|
||||||
string SendString(string message, bool raw = false);
|
string SendString(ITraceLogger traceLogger, string message, bool raw = false);
|
||||||
void SendBlind(string message, bool raw = false);
|
void SendBlind(ITraceLogger traceLogger, string message, bool raw = false);
|
||||||
bool SendBool(string command, bool raw = false);
|
bool SendBool(ITraceLogger traceLogger, string command, bool raw = false);
|
||||||
string SendChar(string message, bool raw = false);
|
string SendChar(ITraceLogger traceLogger, string message, bool raw = false);
|
||||||
string SendChars(string message, bool raw = false, int count = 1);
|
string SendChars(ITraceLogger traceLogger, string message, bool raw = false, int count = 1);
|
||||||
|
|
||||||
string ReadTerminated();
|
string ReadTerminated();
|
||||||
|
|
||||||
@@ -66,29 +66,29 @@ namespace ASCOM.Meade.net.Wrapper
|
|||||||
|
|
||||||
public string FirmwareVersion => SharedResources.FirmwareVersion;
|
public string FirmwareVersion => SharedResources.FirmwareVersion;
|
||||||
|
|
||||||
public string SendString(string message, bool raw = false)
|
public string SendString(ITraceLogger traceLogger, string message, bool raw = false)
|
||||||
{
|
{
|
||||||
return SharedResources.SendString(message, raw);
|
return SharedResources.SendString(traceLogger, message, raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendBlind(string message, bool raw = false)
|
public void SendBlind(ITraceLogger traceLogger, string message, bool raw = false)
|
||||||
{
|
{
|
||||||
SharedResources.SendBlind(message, raw);
|
SharedResources.SendBlind(traceLogger, message, raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SendBool(string command, bool raw = false)
|
public bool SendBool(ITraceLogger traceLogger, string command, bool raw = false)
|
||||||
{
|
{
|
||||||
return SharedResources.SendBool(command, raw);
|
return SharedResources.SendBool(traceLogger, command, raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string SendChar(string message, bool raw = false)
|
public string SendChar(ITraceLogger traceLogger, string message, bool raw = false)
|
||||||
{
|
{
|
||||||
return SharedResources.SendChar(message, raw);
|
return SharedResources.SendChar(traceLogger, message, raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string SendChars(string message, bool raw = false, int count = 1)
|
public string SendChars(ITraceLogger traceLogger, string message, bool raw = false, int count = 1)
|
||||||
{
|
{
|
||||||
return SharedResources.SendChars(message, raw, count);
|
return SharedResources.SendChars(traceLogger, message, raw, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ReadTerminated()
|
public string ReadTerminated()
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>ASCOM.Meade.net</RootNamespace>
|
<RootNamespace>ASCOM.Meade.net</RootNamespace>
|
||||||
<AssemblyName>ASCOM.Meade.net.Test</AssemblyName>
|
<AssemblyName>ASCOM.Meade.net.Test</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||||
<TargetFrameworkProfile>
|
<TargetFrameworkProfile>
|
||||||
</TargetFrameworkProfile>
|
</TargetFrameworkProfile>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
|
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
|
||||||
|
|||||||
Reference in New Issue
Block a user