Code inspections

This commit is contained in:
2019-09-29 22:16:03 +01:00
parent 7905da9651
commit 07bf72a8c3
2 changed files with 50 additions and 99 deletions
+43 -43
View File
@@ -1638,63 +1638,63 @@ namespace ASCOM.Meade.net
}
}
private double TargetAltitude
{
set
{
if (value > 90)
throw new InvalidValueException("Altitude cannot be greater than 90.");
//private double TargetAltitude
//{
// set
// {
// if (value > 90)
// throw new InvalidValueException("Altitude cannot be greater than 90.");
if (value < 0)
throw new InvalidValueException("Altitide cannot be less than 0.");
// if (value < 0)
// throw new InvalidValueException("Altitide cannot be less than 0.");
CheckConnected("TargetAltitude Set");
// CheckConnected("TargetAltitude Set");
//todo this serial string does not work. Calculate the EQ version instead.
// //todo this serial string does not work. Calculate the EQ version instead.
var dms = _utilities.DegreesToDMS(value, "*", "'", "",0);
var s = value < 0 ? string.Empty : "+";
// var dms = _utilities.DegreesToDMS(value, "*", "'", "",0);
// var s = value < 0 ? string.Empty : "+";
var result = _sharedResourcesWrapper.SendChar($":Sa{s}{dms}#");
//:SasDD*MM#
//Set target object altitude to sDD*MM# or sDD*MMSS# [LX 16”, Autostar, Autostar II]
//Returns:
//1 Object within slew range
//0 Object out of slew range
// var result = _sharedResourcesWrapper.SendChar($":Sa{s}{dms}#");
// //:SasDD*MM#
// //Set target object altitude to sDD*MM# or sDD*MMSS# [LX 16”, Autostar, Autostar II]
// //Returns:
// //1 Object within slew range
// //0 Object out of slew range
if (result == "0")
throw new InvalidOperationException("Target altitude out of slew range");
}
}
// if (result == "0")
// throw new InvalidOperationException("Target altitude out of slew range");
// }
//}
private double TargetAzimuth
{
set
{
if (value >= 360)
throw new InvalidValueException("Azimuth cannot be 360 or higher.");
//private double TargetAzimuth
//{
// set
// {
// if (value >= 360)
// throw new InvalidValueException("Azimuth cannot be 360 or higher.");
if (value < 0)
throw new InvalidValueException("Azimuth cannot be less than 0.");
// if (value < 0)
// throw new InvalidValueException("Azimuth cannot be less than 0.");
CheckConnected("TargetAzimuth Set");
// CheckConnected("TargetAzimuth Set");
//todo this serial string does not work. Calculate the EQ version instead.
// //todo this serial string does not work. Calculate the EQ version instead.
var dms = _utilitiesExtra.DegreesToDM(value, "*" );
// var dms = _utilitiesExtra.DegreesToDM(value, "*" );
var result = _sharedResourcesWrapper.SendChar($":Sz{dms}#");
//:SzDDD*MM#
//Sets the target Object Azimuth[LX 16” and Autostar II only]
//Returns:
//0 Invalid
//1 - Valid
// var result = _sharedResourcesWrapper.SendChar($":Sz{dms}#");
// //:SzDDD*MM#
// //Sets the target Object Azimuth[LX 16” and Autostar II only]
// //Returns:
// //0 Invalid
// //1 - Valid
if (result == "0")
throw new InvalidOperationException("Target Azimuth out of slew range");
// if (result == "0")
// throw new InvalidOperationException("Target Azimuth out of slew range");
}
}
// }
//}
public void SlewToAltAzAsync(double azimuth, double altitude)
{
+7 -56
View File
@@ -35,64 +35,15 @@ namespace ASCOM.Meade.net
private const string DriverName = "Meade Generic";
#region Access to kernel32.dll, user32.dll, and ole32.dll functions
[Flags]
enum Clsctx : uint
{
ClsctxInprocServer = 0x1,
ClsctxInprocHandler = 0x2,
ClsctxLocalServer = 0x4,
ClsctxInprocServer16 = 0x8,
ClsctxRemoteServer = 0x10,
ClsctxInprocHandler16 = 0x20,
ClsctxReserved1 = 0x40,
ClsctxReserved2 = 0x80,
ClsctxReserved3 = 0x100,
ClsctxReserved4 = 0x200,
ClsctxNoCodeDownload = 0x400,
ClsctxReserved5 = 0x800,
ClsctxNoCustomMarshal = 0x1000,
ClsctxEnableCodeDownload = 0x2000,
ClsctxNoFailureLog = 0x4000,
ClsctxDisableAaa = 0x8000,
ClsctxEnableAaa = 0x10000,
ClsctxFromDefaultContext = 0x20000,
ClsctxInproc = ClsctxInprocServer | ClsctxInprocHandler,
ClsctxServer = ClsctxInprocServer | ClsctxLocalServer | ClsctxRemoteServer,
ClsctxAll = ClsctxServer | ClsctxInprocHandler
}
[Flags]
enum Coinit : uint
{
/// Initializes the thread for multi-threaded object concurrency.
CoinitMultithreaded = 0x0,
/// Initializes the thread for apartment-threaded object concurrency.
CoinitApartmentthreaded = 0x2,
/// Disables DDE for Ole1 support.
CoinitDisableOle1Dde = 0x4,
/// Trades memory for speed.
CoinitSpeedOverMemory = 0x8
}
//// CoInitializeEx() can be used to set the apartment model
//// of individual threads.
//[DllImport("ole32.dll")]
//static extern int CoInitializeEx(IntPtr pvReserved, uint dwCoInit);
[Flags]
enum Regcls : uint
{
RegclsSingleuse = 0,
RegclsMultipleuse = 1,
RegclsMultiSeparate = 2,
RegclsSuspended = 4,
RegclsSurrogate = 8
}
// CoInitializeEx() can be used to set the apartment model
// of individual threads.
[DllImport("ole32.dll")]
static extern int CoInitializeEx(IntPtr pvReserved, uint dwCoInit);
// CoUninitialize() is used to uninitialize a COM thread.
[DllImport("ole32.dll")]
static extern void CoUninitialize();
//// CoUninitialize() is used to uninitialize a COM thread.
//[DllImport("ole32.dll")]
//static extern void CoUninitialize();
// PostThreadMessage() allows us to post a Windows Message to
// a specific thread (identified by its thread id).