Code inspection cleanup

This commit is contained in:
2019-10-22 21:51:59 +01:00
parent ba0ae056ea
commit 2cbb1fb68c
6 changed files with 54 additions and 87 deletions
-30
View File
@@ -1417,7 +1417,6 @@ namespace ASCOM.Meade.net
} }
else else
{ {
string d = string.Empty;
switch (direction) switch (direction)
{ {
case GuideDirections.guideEast: case GuideDirections.guideEast:
@@ -1441,35 +1440,6 @@ namespace ASCOM.Meade.net
MoveAxis(TelescopeAxes.axisPrimary, 0); MoveAxis(TelescopeAxes.axisPrimary, 0);
break; break;
} }
//LogMessage("PulseGuide", "Using old pulse guiding technique");
//_sharedResourcesWrapper.Lock(() =>
//{
// _sharedResourcesWrapper.SendBlind("#:RG#"); //Make sure we are at guide rate
// //:RG# Set Slew rate to Guiding Rate (slowest)
// //Returns: Nothing
// _sharedResourcesWrapper.SendBlind($"#:M{d}#");
// //:Me# Move Telescope East at current slew rate
// //Returns: Nothing
// //:Mn# Move Telescope North at current slew rate
// //Returns: Nothing
// //:Ms# Move Telescope South at current slew rate
// //Returns: Nothing
// //:Mw# Move Telescope West at current slew rate
// //Returns: Nothing
// _utilities.WaitForMilliseconds(duration);
// _sharedResourcesWrapper.SendBlind($"#:Q{d}#");
// //:Qe# Halt eastward Slews
// //Returns: Nothing
// //:Qn# Halt northward Slews
// //Returns: Nothing
// //:Qs# Halt southward Slews
// //Returns: Nothing
// //:Qw# Halt westward Slews
// //Returns: Nothing
//});
} }
var coordinatesAfterMove = GetTelescopeRaAndDec(); var coordinatesAfterMove = GetTelescopeRaAndDec();
@@ -1,5 +1,4 @@
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
@@ -110,10 +110,11 @@ namespace Meade.net.UnitTests
SharedResources.ProfileFactory = profileFactoryMock.Object; SharedResources.ProfileFactory = profileFactoryMock.Object;
var profileProperties = new ProfileProperties(); var profileProperties = new ProfileProperties
profileProperties.TraceLogger = false; {
profileProperties.ComPort = "TestComPort"; TraceLogger = false,
ComPort = "TestComPort"
};
SharedResources.WriteProfile(profileProperties); SharedResources.WriteProfile(profileProperties);
@@ -246,10 +247,8 @@ namespace Meade.net.UnitTests
SharedResources.ProfileFactory = profileFactoryMock.Object; SharedResources.ProfileFactory = profileFactoryMock.Object;
string serialPortReturn = string.Empty; _serialMock.Setup(x => x.Transmit(":GVP#")).Callback(() => { });
_serialMock.Setup(x => x.ReceiveTerminated("#")).Returns(() => throw new Exception("Testerror"));
_serialMock.Setup(x => x.Transmit(":GVP#")).Callback(() => { serialPortReturn = ":GVP#"; });
_serialMock.Setup(x => x.ReceiveTerminated("#")).Returns(() => { throw new Exception("Testerror"); });
var connectionResult = SharedResources.Connect(deviceId, string.Empty); var connectionResult = SharedResources.Connect(deviceId, string.Empty);
-1
View File
@@ -1,5 +1,4 @@
using ASCOM.Meade.net.Wrapper; using ASCOM.Meade.net.Wrapper;
using ASCOM.Utilities;
namespace ASCOM.Meade.net namespace ASCOM.Meade.net
{ {
+40 -40
View File
@@ -14,59 +14,59 @@ namespace ASCOM.Meade.net.Wrapper
{ {
private readonly Profile _profile = new Profile(); private readonly Profile _profile = new Profile();
public ArrayList RegisteredDevices(string DeviceType) public ArrayList RegisteredDevices(string deviceType)
{ {
return _profile.RegisteredDevices(DeviceType); return _profile.RegisteredDevices(deviceType);
} }
public bool IsRegistered(string DriverID) public bool IsRegistered(string driverId)
{ {
return _profile.IsRegistered(DriverID); return _profile.IsRegistered(driverId);
} }
public void Register(string DriverID, string DescriptiveName) public void Register(string driverId, string descriptiveName)
{ {
_profile.Register(DriverID, DescriptiveName); _profile.Register(driverId, descriptiveName);
} }
public void Unregister(string DriverID) public void Unregister(string driverId)
{ {
_profile.Unregister(DriverID); _profile.Unregister(driverId);
} }
public string GetValue(string DriverID, string Name, string SubKey, string DefaultValue) public string GetValue(string driverId, string name, string subKey, string defaultValue)
{ {
return _profile.GetValue(DriverID, Name, SubKey, DefaultValue); return _profile.GetValue(driverId, name, subKey, defaultValue);
} }
public void WriteValue(string DriverID, string Name, string Value, string SubKey) public void WriteValue(string driverId, string name, string value, string subKey)
{ {
_profile.WriteValue(DriverID, Name, Value); _profile.WriteValue(driverId, name, value);
} }
public ArrayList Values(string DriverID, string SubKey) public ArrayList Values(string driverId, string subKey)
{ {
return _profile.Values(DriverID, SubKey); return _profile.Values(driverId, subKey);
} }
public void DeleteValue(string DriverID, string Name, string SubKey) public void DeleteValue(string driverId, string name, string subKey)
{ {
_profile.DeleteValue(DriverID, Name, SubKey); _profile.DeleteValue(driverId, name, subKey);
} }
public void CreateSubKey(string DriverID, string SubKey) public void CreateSubKey(string driverId, string subKey)
{ {
_profile.CreateSubKey(DriverID, SubKey); _profile.CreateSubKey(driverId, subKey);
} }
public ArrayList SubKeys(string DriverID, string SubKey) public ArrayList SubKeys(string driverId, string subKey)
{ {
return _profile.SubKeys(DriverID, SubKey); return _profile.SubKeys(driverId, subKey);
} }
public void DeleteSubKey(string DriverID, string SubKey) public void DeleteSubKey(string driverId, string subKey)
{ {
_profile.DeleteSubKey(DriverID, SubKey); _profile.DeleteSubKey(driverId, subKey);
} }
public string GetProfileXML(string deviceId) public string GetProfileXML(string deviceId)
@@ -86,49 +86,49 @@ namespace ASCOM.Meade.net.Wrapper
} }
public ArrayList RegisteredDeviceTypes => _profile.RegisteredDeviceTypes; public ArrayList RegisteredDeviceTypes => _profile.RegisteredDeviceTypes;
public void MigrateProfile(string CurrentPlatformVersion) public void MigrateProfile(string currentPlatformVersion)
{ {
_profile.MigrateProfile(CurrentPlatformVersion); _profile.MigrateProfile(currentPlatformVersion);
} }
public void DeleteValue(string DriverID, string Name) public void DeleteValue(string driverId, string name)
{ {
_profile.DeleteValue(DriverID, Name); _profile.DeleteValue(driverId, name);
} }
public string GetValue(string DriverID, string Name) public string GetValue(string driverId, string name)
{ {
return _profile.GetValue(DriverID, Name); return _profile.GetValue(driverId, name);
} }
public string GetValue(string DriverID, string Name, string SubKey) public string GetValue(string driverId, string name, string subKey)
{ {
return _profile.GetValue(DriverID, Name, SubKey); return _profile.GetValue(driverId, name, subKey);
} }
public ArrayList SubKeys(string DriverID) public ArrayList SubKeys(string driverId)
{ {
return _profile.SubKeys(DriverID); return _profile.SubKeys(driverId);
} }
public ArrayList Values(string DriverID) public ArrayList Values(string driverId)
{ {
return _profile.Values(DriverID); return _profile.Values(driverId);
} }
public void WriteValue(string DriverID, string Name, string Value) public void WriteValue(string driverId, string name, string value)
{ {
_profile.WriteValue(DriverID, Name, Value); _profile.WriteValue(driverId, name, value);
} }
public ASCOMProfile GetProfile(string DriverId) public ASCOMProfile GetProfile(string driverId)
{ {
return _profile.GetProfile(DriverId); return _profile.GetProfile(driverId);
} }
public void SetProfile(string DriverId, ASCOMProfile XmlProfileKey) public void SetProfile(string driverId, ASCOMProfile xmlProfileKey)
{ {
_profile.SetProfile(DriverId, XmlProfileKey); _profile.SetProfile(driverId, xmlProfileKey);
} }
public void Dispose() public void Dispose()
+7 -7
View File
@@ -58,26 +58,26 @@ namespace ASCOM.Meade.net
var seconds = 10; var seconds = 10;
Console.WriteLine($"Slewing tests 10 second in each direction"); Console.WriteLine("Slewing tests 10 second in each direction");
Console.WriteLine($"test 1"); Console.WriteLine("test 1");
device.MoveAxis(TelescopeAxes.axisPrimary, 4); device.MoveAxis(TelescopeAxes.axisPrimary, 4);
Thread.Sleep(seconds * 1000); Thread.Sleep(seconds * 1000);
device.MoveAxis(TelescopeAxes.axisPrimary, 0); device.MoveAxis(TelescopeAxes.axisPrimary, 0);
Console.WriteLine($"test 2"); Console.WriteLine("test 2");
device.MoveAxis(TelescopeAxes.axisPrimary, -4); device.MoveAxis(TelescopeAxes.axisPrimary, -4);
Thread.Sleep(seconds * 1000); Thread.Sleep(seconds * 1000);
device.MoveAxis(TelescopeAxes.axisPrimary, 0); device.MoveAxis(TelescopeAxes.axisPrimary, 0);
Console.WriteLine($"test 3"); Console.WriteLine("test 3");
device.MoveAxis(TelescopeAxes.axisSecondary, 4); device.MoveAxis(TelescopeAxes.axisSecondary, 4);
Thread.Sleep(seconds * 1000); Thread.Sleep(seconds * 1000);
device.MoveAxis(TelescopeAxes.axisSecondary, 0); device.MoveAxis(TelescopeAxes.axisSecondary, 0);
Console.WriteLine($"test 4"); Console.WriteLine("test 4");
device.MoveAxis(TelescopeAxes.axisSecondary, -4); device.MoveAxis(TelescopeAxes.axisSecondary, -4);
Thread.Sleep(seconds * 1000); Thread.Sleep(seconds * 1000);
device.MoveAxis(TelescopeAxes.axisSecondary, 0); device.MoveAxis(TelescopeAxes.axisSecondary, 0);
Console.WriteLine($"Slewing tests complete"); Console.WriteLine("Slewing tests complete");
seconds = 120; seconds = 120;
@@ -89,7 +89,7 @@ namespace ASCOM.Meade.net
Console.WriteLine($"{direction.ToString()}"); Console.WriteLine($"{direction.ToString()}");
device.PulseGuide(direction, seconds* 1000); device.PulseGuide(direction, seconds* 1000);
} }
Console.WriteLine($"Guiding Finished"); Console.WriteLine("Guiding Finished");