Compare commits

...

309 Commits

Author SHA1 Message Date
ColinD cd776cbc98 Added code to override the bypassing of intro prompts 2023-10-12 17:30:00 +01:00
ColinD 4c7a40a8e4 Added extra values to GW translation.
Also added extra log message that includes the hour angle when calculating the destination side of pier.
2023-02-22 22:14:38 +00:00
ColinD 003dbe059a . doing the trim of the trailing # after writing the log message.
. for LX800 scopes, trying to use a send string instead of send chars for GW command.
2023-02-18 22:50:57 +00:00
ColinD c673e0c7d6 . doing the trim of the trailing # after writing the log message.
. for LX800 scopes, trying to use a send string instead of send chars for GW command.
2023-02-18 22:37:47 +00:00
ColinD 5678285e0e Added unit test to make sure that the LX200GPS with german firmware works as expected. 2023-01-02 09:31:05 +00:00
ColinD b263d5f3e2 Removed wrong test. 2023-01-01 22:37:22 +00:00
ColinD 4be35eb5d7 Added unit test for LX200GPS with german firmware 2023-01-01 22:31:23 +00:00
ColinD 4b78d8fb4f Added code to check for LX200GPS firmware version 4G0m which does not support the GW command. 2022-12-31 22:03:39 +00:00
ColinD 466d995873 Upgraded max steps to 30000 to allow for much much longer moves. 2022-11-26 17:10:46 +00:00
ColinD 1ce2afe9ce Trying the Ack command instead to see if this can workaround the CM bug. 2022-11-24 15:21:32 +00:00
ColinD d5108cf4db Adding a possible workaround to the Autostart not syncing problem 2022-11-23 16:06:38 +00:00
ColinD 888ab1aa46 Added LX800 series to scope as an autostar II based telescope. 2022-11-12 20:50:48 +00:00
ColinD 21d1d93235 Another attempt at the Dec value 2022-11-12 19:16:41 +00:00
ColinD 005643a7c7 Corrected all unit test setups. 2022-11-12 17:35:33 +00:00
ColinD 8539308cf3 oops 2022-11-12 17:34:24 +00:00
ColinD cd304f5955 Let's see what this does 2022-11-12 17:28:25 +00:00
ColinD da1d1baa30 Another tweak for the low preceion code. 2022-11-12 16:54:12 +00:00
ColinD a2b15f291d Needed to change one more thing 2022-11-12 15:47:35 +00:00
ColinD c380016b71 Changes the low precision target so that it's using seconds, instead of a fraction of a minute for the seconds portion of the coordinates. 2022-11-12 15:33:49 +00:00
ColinD febf52738e Set the path to open the logs folder properly 2022-11-10 20:31:30 +00:00
ColinD 7afa7458c7 Added comments for unit testing 2022-11-10 18:05:39 +00:00
ColinD 3ffa9fbe8b Nuget package updates 2022-11-10 17:57:45 +00:00
ColinD 6db59eaef1 Corrected Typo in name 2022-11-10 17:57:21 +00:00
ColinD cfa7e1d1cf Adding a catch so that when setting the precision, if one mode fails, try the other. 2022-11-10 16:53:27 +00:00
ColinD 129fc23d83 Added an attempt to use the short format to set the TargetRightAscension if the long format fails. 2022-11-10 15:30:16 +00:00
ColinD 5c3bb7d4ad Modified unit tests for force a pass. 2022-11-10 14:58:12 +00:00
ColinD e93da73431 Tried trimming a traingin : if it exists, that should not be part of the command sent to the scope. 2022-11-10 14:43:41 +00:00
ColinD 1e5bb04817 Added attempt to set the TargetRightAscension using the other format if one fails. 2022-11-10 14:34:10 +00:00
ColinD e851fd0e01 Adding support for Audiostar to be returned as a Synonym of Autostar for GW detection. 2022-09-25 17:04:24 +01:00
ColinD fa7106a1b4 Adding extra tests to ensure that GetTracking is working correctly for the AudoStar 2022-09-20 12:47:24 +01:00
ColinD ef2ec06b0a Merged in develop (pull request #46)
Develop
2022-07-25 21:06:09 +00:00
ColinD 89f5b6d546 Merged in feature/AllowAltAzPulseGuiding (pull request #45)
Feature/AllowAltAzPulseGuiding
2022-07-25 21:01:18 +00:00
ColinD 349397b70f Fixed logging message 2022-07-25 21:57:52 +01:00
ColinD 9666811eff Added messages to include information about what is being sent via the serial port. 2022-07-25 16:08:50 +01:00
ColinD 7287990240 Added messages to include information about what is being sent via the serial port. 2022-07-25 16:07:55 +01:00
ColinD 6428e6d31b Added the tracelogger to the calls that send the actual serial commands. 2022-07-25 15:53:29 +01:00
ColinD 0fbb2331cf Added unit tests to show that StarPatch firmware can attempt pulse guide 2022-07-19 18:42:34 +01:00
ColinD faf2692fae Added code to allow pulseguide commands to be sent to telescopes with StarPatch installed. 2022-07-19 18:30:26 +01:00
ColinD d996d6f8d6 Revert "Added Wix installer as a nuget package. Hopefully this will fix the new build agent."
This reverts commit 57a76383bc.
2022-07-17 13:12:07 +01:00
ColinD 2a40807dc3 Revert "Attempting to override project restore"
This reverts commit adeab53bd3.
2022-07-17 13:12:07 +01:00
ColinD adeab53bd3 Attempting to override project restore 2022-07-17 12:46:41 +01:00
ColinD 57a76383bc Added Wix installer as a nuget package. Hopefully this will fix the new build agent. 2022-07-17 12:39:11 +01:00
ColinD 5f3157a58d Refactored code
Added support for setting the guide rate on the RCX400
2022-07-17 12:03:32 +01:00
ColinD 5f75916116 Added support for RCX400 using newer pulse guiding commands.
Refactored the connect set to be a little less cluttered.
2022-07-16 14:17:39 +01:00
ColinD aff44494bc Added long enter and goto commands. 2022-07-15 21:08:54 +01:00
ColinD 78e686b3cb Attempt to fix .net 4.8 install detection 2022-07-13 17:55:56 +01:00
ColinD 519005d892 Fixed the property name for .net framework 4.8 detection.
Fixed Typo in the Ascom Platform required line.
2022-07-13 17:41:22 +01:00
ColinD e0d51eae81 Removed redundant code. 2022-06-29 18:41:51 +01:00
ColinD 42f2f45866 Added test for StarParch firmware. PulseGuiding is always enabled. 2022-06-28 18:47:33 +01:00
ColinD 0066a6ebed Fixed broken unit test 2022-06-28 17:45:55 +01:00
ColinD 9b2818ddba Added pseudocode for detecting StarPatch firmware 2022-06-27 21:55:09 +01:00
ColinD 0806696d30 Added support for allowing pulse guiding for AltAz telescope using older guiding method. 2022-06-27 21:25:58 +01:00
ColinD fd4c524264 Upgraded requirements to need Ascom 6.6.0 and .net framework 4.8 or higher. 2022-06-24 20:05:40 +01:00
ColinD 4e0e105255 Merged in develop (pull request #44)
Develop
2022-05-17 19:57:34 +00:00
ColinD 3fa8079a41 Merged in feature/SideOfPier (pull request #43)
Feature/SideOfPier
2022-05-17 19:47:38 +00:00
ColinD 7dc96c650d tidied up old unneeded unit test code 2022-05-17 19:11:01 +01:00
ColinD 650fc04bca Changing how side of pier is calculated. 2022-05-16 18:59:55 +01:00
ColinD 5c2bd21f1e Merged in develop (pull request #42)
1.3.4
2022-05-14 12:12:54 +00:00
ColinD 39a6bfca80 Merged in feature/LX200ClassicPark (pull request #41)
Feature/LX200ClassicPark
2022-05-14 12:08:17 +00:00
ColinD f551081454 LX200 Park unit test added. 2022-05-14 12:57:00 +01:00
ColinD 5c362a5a9a Changed how the part position is calculated. 2022-05-10 11:39:40 +01:00
ColinD abb985559e Upgraded error trapping for all the public methods in the driver. 2022-05-09 20:06:01 +01:00
ColinD ddd6178416 Removed side of pier set that isn't needed. 2022-05-09 14:57:40 +01:00
ColinD 356377ce36 Removed the requirement for GW Support when trying to set the alignment mode. 2022-05-09 12:09:59 +01:00
ColinD 1b220334d6 Added a general try catch to the UnPark method. 2022-05-08 15:31:56 +01:00
ColinD bb54356b58 Added more loggins to the unparking process 2022-05-08 15:22:04 +01:00
ColinD ebca231d9a Made sure that the alignment mode is preserved when parked, across sessions. 2022-05-08 15:15:30 +01:00
ColinD 2b5205d9c5 I think this will allow the LX200Classic to unpark 2022-05-08 14:46:53 +01:00
ColinD 81d2b98bfe Added ability to unpark the LX200 Classic 2022-05-08 14:30:39 +01:00
ColinD 9ee6adf063 Merge remote-tracking branch 'origin/feature/LX200ClassicPark' into feature/LX200ClassicPark
# Conflicts:
#	Meade.net/SharedResources.cs
2022-05-08 13:01:49 +01:00
ColinD 554b1af082 Maybe this is what's missing to get the telescope to park 2022-05-08 13:00:05 +01:00
ColinD 70f72e3df7 Upgraded the align mode command to have a retry and added support for land mode. 2022-05-08 13:00:05 +01:00
ColinD 3af02920c4 Added more logging to DoSlewAsync, Added a retry to the AltAz Slew. 2022-05-08 13:00:05 +01:00
ColinD ede7c33302 Added Alt Az coordinates to the connected message. 2022-05-08 13:00:05 +01:00
ColinD 9866578cab Added more error checks for connected, and found a couple of logic holds in the code that sets the IsConnected property. 2022-05-08 12:58:28 +01:00
ColinD d9093635de Added a log message for when connected check fails. 2022-05-08 12:58:27 +01:00
ColinD 885edba1c5 Removed the AL command as I think it's failing 2022-05-08 12:58:27 +01:00
ColinD 1949c50764 Modified the deubgging information. 2022-05-08 12:58:27 +01:00
ColinD 2b7d12fac9 Added some debugging messages 2022-05-08 12:58:26 +01:00
ColinD f168acc90b Added work around for LX200 classed to be able to turn tracking off when parking. 2022-05-08 12:58:26 +01:00
ColinD 8f6ea33139 Changes LX200 Park to use Alt 0 Az 0. i.e. Pointing level and North 2022-05-08 12:58:26 +01:00
ColinD c6f938bd5c Merge remote-tracking branch 'origin/feature/LX200ClassicPark' into feature/LX200ClassicPark 2022-05-08 12:58:25 +01:00
ColinD c271f0c4d3 New Park routine for the LX-200 Classic, uses the same technique as the 5.0.4 driver. 2022-05-08 12:58:25 +01:00
ColinD 35a76fe52c Merged in feature/PortSpeed (pull request #40)
Feature/PortSpeed

* Added support for changing the speed of the autostar

* Added support for changing the speed of the autostar

* Merge remote-tracking branch 'origin/feature/PortSpeed' into feature/PortSpeed

* Upgraded unit testing to make sure that speed changes are properly tested
2022-05-08 11:52:45 +00:00
ColinD 64e42f961c Maybe this is what's missing to get the telescope to park 2022-05-07 19:37:16 +01:00
ColinD 8eb093c13a Upgraded the align mode command to have a retry and added support for land mode. 2022-05-07 18:09:37 +01:00
ColinD a204f9c57f Added more logging to DoSlewAsync, Added a retry to the AltAz Slew. 2022-05-07 16:54:22 +01:00
ColinD 700802033b Added Alt Az coordinates to the connected message. 2022-05-07 14:00:29 +01:00
ColinD 350dd23ed1 Added more error checks for connected, and found a couple of logic holds in the code that sets the IsConnected property. 2022-05-07 12:22:46 +01:00
ColinD 5e65ea7946 Added a log message for when connected check fails. 2022-05-07 12:15:45 +01:00
ColinD 0c70688b60 Removed the AL command as I think it's failing 2022-05-07 10:00:57 +01:00
ColinD af3cca7611 Modified the deubgging information. 2022-05-06 21:31:12 +01:00
ColinD ef498fc5a0 Added some debugging messages 2022-05-06 20:09:40 +01:00
ColinD ceca3a15dc Added work around for LX200 classed to be able to turn tracking off when parking. 2022-05-06 13:39:34 +01:00
ColinD a9b8a60e43 Changes LX200 Park to use Alt 0 Az 0. i.e. Pointing level and North 2022-05-06 12:14:24 +01:00
ColinD 7a85f7ca9e Merge remote-tracking branch 'origin/feature/LX200ClassicPark' into feature/LX200ClassicPark 2022-05-05 21:50:28 +01:00
ColinD 57c5a34fe2 New Park routine for the LX-200 Classic, uses the same technique as the 5.0.4 driver. 2022-05-05 21:50:13 +01:00
ColinD a68e86d8cd Added unit tests for long duration pulse guides. 2022-05-05 20:56:18 +01:00
ColinD 503eec38a3 Added check to ensure that telescope is in Polar Mode when attempting to PulseGuide. CanPulseGuide also fails when scope is in AltAz mode. 2022-05-05 20:40:51 +01:00
ColinD ed54487a88 New Park routine for the LX-200 Classic, uses the same technique as the 5.0.4 driver. 2022-05-05 18:55:38 +01:00
ColinD f788320927 Refactor to use ProfileProperties instead of assigning individual variables.
Added support for ApertureArea and ApertureDiameter
2022-05-03 21:57:25 +01:00
ColinD dc68bb0b4c Added Focal Length property to telescope setup screen 2022-04-28 23:55:35 +01:00
ColinD 1a66f41d78 Add support for the IsGuiding function 2022-04-28 23:20:56 +01:00
ColinD 826f887bdf Added mossing file 2021-12-17 13:16:20 +00:00
ColinD 7ac3c95c8e modified the get tracking code to make it less better. amd more tolerant of lunar speeds, taken from Nasa and other sources (Info from David Richards) 2021-12-17 13:11:32 +00:00
ColinD acb1533f21 Upgraded the tracking rate detection, now detects solar, lunar and sidereal better than before. 2021-12-15 20:23:46 +00:00
ColinD eda3a53d6f Added logging to MoxingAxis call to see if a telescope axis is moving 2021-12-13 14:09:16 +00:00
ColinD 6786db65fe Overridden the alignment status ToString to help with logging 2021-12-13 12:58:40 +00:00
ColinD df7dfb7c04 Modified the implementation of side of pier support detection. Hopefully will now,
Added extra checking to ensure that a slew cannot be started whilst a slew is in progress.
2021-12-11 19:10:18 +00:00
ColinD 771e325067 Merged in develop (pull request #39)
Removed unneeded lock and will cause a lock recursion and break things.
2021-10-18 17:56:27 +00:00
ColinD a5a3bd5bd4 Removed unneeded lock and will cause a lock recursion and break things. 2021-10-14 13:50:24 +01:00
ColinD a605a3ed9d Merged in develop (pull request #38)
Develop
2021-09-26 16:18:18 +00:00
ColinD ad9169a48d Modified so that the driver supports either +60.1 or 60.1 for tracking rate 2021-09-26 16:50:46 +01:00
ColinD 3b056ef7f8 Fixed bug in tracking rate get where it always returns lunar when it should be sidereal 2021-09-17 09:38:35 +01:00
ColinD 710ae0420a Added left, right as sysonyms of back and forward for the handbox commands.
Added scrollup and scrolldown handbox commands as well.
2021-09-09 12:14:15 +01:00
ColinD 2a6b74c6fd Merged in develop (pull request #37)
version 1.3.1
2021-08-04 18:48:01 +00:00
ColinD 49c43358de Added check to ensure that the Lunar Tracking rate cannot be selected on the LX200 Classic. 2021-08-04 18:48:24 +01:00
ColinD 27a0f54b07 Added check to make sure that the tracking rate cannot be set for an LX200. 2021-08-04 17:01:06 +01:00
ColinD a562b848c0 Corrected the expected result of the GT command. 2021-08-04 09:22:31 +01:00
ColinD f4c26d777b Added more logging around the tracking rates.
Corrected the Command logged messages to use the correct info.
Added a try catch to the setup dialog to see if an error occurs to give a better message.
2021-08-03 21:55:06 +01:00
ColinD 8d8b50957c Merged in develop (pull request #36)
Develop
2021-07-03 12:35:42 +00:00
Sebastian Godelet faa6ad757e Merged in feature/GWSupport-update (pull request #35)
Feature/GWSupport update
2021-07-03 11:23:32 +00:00
Sebastian Godelet 64df8282a0 Support Set Tracking when GW is supported 2021-06-29 15:31:57 +10:00
Sebastian Godelet 8478af26bf Implemented TrackingRate via GT 2021-06-28 16:06:15 +10:00
Sebastian Godelet 77c87a51fa Moved IsGuiding to SharedResourcesWrapper 2021-06-28 13:03:07 +10:00
Sebastian Godelet 631aa91d94 Moved IsTargetCoordinateInitRequired to SharedResourcesWrapper 2021-06-28 12:53:05 +10:00
Sebastian Godelet 90713de34b Moved parked SiteLat/Long to ParkedPosition data 2021-06-28 12:45:26 +10:00
Sebastian Godelet a3408a86c3 Update unit tests to support GW command
SideOfPier also supports German EQ
2021-06-27 19:16:39 +10:00
Sebastian Godelet 74440b6b3b Merge branch 'develop' into feature/GWSupport 2021-06-25 15:34:58 +10:00
ColinD f1d100892b Removed nunit3 Test adapter 2021-06-23 13:18:30 +01:00
ColinD c6baab2b12 Added tolerance in unit test to allow for rounding error. 2021-06-23 13:11:33 +01:00
Sebastian Godelet f47b205025 Merged in feature/preserve-sop-target-radec-across-connections (pull request #34)
Preserve SideOfPier, Target{RA,DEC}, SlewSettleTime, Move axis across connections

Approved-by: Colin Dawson
2021-06-23 08:53:31 +00:00
Sebastian Godelet 6c27499769 Create generic ThreadSafeValue 2021-06-23 16:21:08 +10:00
Sebastian Godelet 6dff32505e Clarify thread-safe value test intention 2021-06-23 11:09:22 +10:00
Sebastian Godelet 7afd364efa Add tests for SharedResources properties
Ensure that default values are correct and no error appears
2021-06-22 17:43:25 +10:00
Sebastian Godelet 6fc476b031 Make further properties multi-client and thread-safe
Move MovingPrimary, MovingSecondary, EarliestNonSlewingTime to
SharedResources, make all new properties thread-safe (atomic)
operations.
2021-06-22 17:21:21 +10:00
Sebastian Godelet af750549fe Test that low-precision digit values are preserved across connections 2021-06-13 17:36:42 +10:00
Sebastian Godelet 2e3572375f Test that SideralTime is preserved across connections 2021-06-13 17:24:09 +10:00
Sebastian Godelet b23da15022 Make Focuser.cs ASCII compatible 2021-06-13 16:30:55 +10:00
Sebastian Godelet 0b75b8d2cd Remove now unneeded Setup for DestinationSideOfPier
DestinationSideOfPier will not call Slewing anymore,
since it reads the property from SharedResourcesWrapper directly.
2021-06-13 09:59:17 +10:00
Sebastian Godelet 036a9d7116 Add multi-connection test for TargetRightAscension 2021-06-13 09:45:07 +10:00
Sebastian Godelet 6c769f3649 Add SlewSettleTime and IsLongFormat to SharedResources interface
Also ensure that digit precision is set during initialisation
2021-06-12 20:09:51 +10:00
Sebastian Godelet bdbd206a54 Avoid possible data race condition when calculating DSOP 2021-06-12 16:22:38 +10:00
Sebastian Godelet 1684bd60bd Move SideOfPier, TargetRA/DEC properties to SharedResourcesWrapper
This change allows several instances of the driver to be in sync
w.r.t. TargetRightAscension, TargetDeclination and SideOfPier
2021-06-12 15:47:34 +10:00
Sebastian Godelet 8c4b08d0c6 Merged in feature/side-of-pier-unit-tests (pull request #33)
Add unit test around meridian flip detection

Approved-by: Colin Dawson
2021-06-07 10:30:52 +00:00
Sebastian Godelet fe3c106954 Add unit test around meridian flip detection 2021-06-07 17:58:20 +10:00
ColinD 3d0464f379 Merged in develop (pull request #32)
Develop
2021-06-06 13:44:33 +00:00
Sebastian Godelet d1b5652228 Merged in feature/add-side-of-pier (pull request #31)
Implemented SideOfPier and DestinationSideOfPier

Approved-by: Colin Dawson
2021-06-06 13:23:49 +00:00
Sebastian Godelet 65e06f2d6c Implemented SideOfPier and DestinationSideOfPier
For telescopes that automatically perform a meridian flip we can
implement the SideOfPier property by updating the current side of pier
after a telescope slew (via DestinationSideOfPier)
2021-06-06 19:44:40 +10:00
ColinD b27e50275d Added extra logging for CommandBlind, CommandBool, and CommandString. 2021-05-09 15:20:45 +01:00
ColinD a101d3a2d7 Merged in develop (pull request #30)
Develop
2021-04-29 15:18:42 +00:00
ColinD d7637928b7 Made sure that the telescope doesn't think it's parked for the first Telescope to connect. 2021-04-27 22:14:22 +01:00
ColinD 486a9205ee Fixed the defect when one instance of the driver gets parked, the info is shared to the other instances. 2021-04-27 22:08:25 +01:00
ColinD 2c2c59290e Reinstated the Real Alt Az methods for the LX200GPS. Changes how the parked behaviour is implemented, so that it doesn't need to make as many calls. 2021-04-27 20:14:57 +01:00
ColinD 70e615bb4e Made sure that CommandString, CommandBool and CommandBlind work as expected, complete with Raw and non raw support. (Implementation is the same as one of the LX200 drivers.) 2021-04-26 20:51:41 +01:00
ColinD 43ec63b0f5 Merged in develop (pull request #29)
Develop
2021-04-25 19:54:35 +00:00
ColinD 8c94fd6b71 Merge branch 'develop' into feature/GWSupport 2021-04-25 20:28:48 +01:00
ColinD f354bcdee1 Merged in feature/AddDateTimeByPass (pull request #28)
Feature/AddDateTimeByPass
2021-04-25 19:27:23 +00:00
ColinD e32c2aa50a Sorted out some code inspection issues 2021-04-25 20:16:07 +01:00
ColinD 795dc0c741 Added parked behaviour modes to the unit testing. 2021-04-25 19:58:09 +01:00
ColinD 22a8a794ba Added unit tests for check Parked, when parked mode is set to no coordinates 2021-04-25 19:17:56 +01:00
ColinD c6b54e273d Added unit testing for bypass feature, and setting the date on first connection 2021-04-25 18:27:44 +01:00
ColinD 7eec6c0008 Fixed some issued with the telescope parking and unparking. Now reports reported correctly for the LX200GPS, and Autostars 2021-04-24 22:29:11 +01:00
ColinD f9bb2aa879 Fixed the date format for the bypass date time setting for the LX-200GPS 2021-04-24 21:23:12 +01:00
ColinD 18ea52c972 Impemented the code changes to return co-ordinated when the telescope is parked.
Also added loads of checks for if the telescope is parked.
2021-04-24 20:52:21 +01:00
ColinD f4eafa668d Added a log for the display output 2021-04-24 19:30:46 +01:00
ColinD 53abdba374 Added extra logging. 2021-04-24 19:20:05 +01:00
ColinD fdd008fcfb Adding support for sending co-ordinates when scope is parked. 2021-04-24 19:16:36 +01:00
ColinD eaeae4d66b Combined the skip prompts and set date time code, to just one check box. 2021-04-24 13:16:08 +01:00
ColinD 6ac80c408c Fixed problem with changing the modifying the profile on the fly! 2021-04-24 13:07:42 +01:00
ColinD 9c5620edee Going to try the proper command for bypassing the date entry for AutostarII 2021-04-23 21:13:46 +01:00
ColinD ad40eb8b9a Fixed problem with Autostar not returning the correct value for IsSlewing 2021-04-23 20:45:48 +01:00
ColinD aca01de4ee Added a # prefix before the commands. 2021-04-23 19:45:10 +01:00
ColinD 384deecc3f More attempts to detect the slewing character 2021-04-23 19:11:45 +01:00
ColinD b27adf2649 Added check that returns [7F] when slewing 2021-04-23 18:58:14 +01:00
ColinD 2776b469c8 Fixed broken logic, and fixed broken unit tests. 2021-04-23 18:26:49 +01:00
ColinD fc3c91b975 Added extra logging to get slewing 2021-04-23 17:14:33 +01:00
ColinD e7c81aba24 Added code to force the date time to happen after the display bypass for autostar 497's 2021-04-23 16:51:05 +01:00
ColinD a15bf22785 Switched the order of the setting of the date and time, then skipping the prompts. 2021-04-23 15:00:03 +01:00
ColinD ed84313c2e Added initial display values bypass for the Autostar 497 2021-04-22 21:40:07 +01:00
ColinD e4af93dd07 Added ability to skip the prompts initial connect, and added ability to send the date and time on initial connect 2021-04-21 20:17:00 +01:00
ColinD 5538f51cf0 Merged in feature/SerialPort (pull request #27)
Feature/SerialPort
2021-04-21 16:35:02 +00:00
ColinD a2abbbb3d0 Working on a possible side of pier implementation 2021-04-21 17:24:40 +01:00
ColinD d0f12a604a Made the new serial options dropdownLists to help avoid ID10T errors. 2021-04-09 21:35:19 +01:00
ColinD 178ef8b11d Fixed the dataBits profile name, and upgraded the sharedresources unit tests for the new comport settings. 2021-04-09 20:43:12 +01:00
ColinD 0835431e76 Added new profile settings to the unit tests 2021-04-09 20:07:52 +01:00
ColinD bf6203d901 Added support for setting all serial properties. 2021-04-09 19:57:43 +01:00
ColinD 51bf99cb8c Started adding full serial port settings, so that people can do crazy things at their own risk. 2021-04-09 12:54:25 +01:00
ColinD 21e7bcd530 Added support for the GW Command.
Removed the implementation of Tracking Set as this does not do anything in the code.
Set Can Set Tracking to false.
Get tracking always returns true is the GW command is not supported.
2021-03-10 19:25:27 +00:00
ColinD 8713154e84 Merged in develop (pull request #26)
Version 1.0.0
2021-03-02 20:31:32 +00:00
ColinD 75b6f0b4b4 Added unit testing for the settle time delay on MoveAxis. 2021-03-02 20:24:43 +00:00
ColinD 032fb2e8a8 Code inspection 2021-03-02 20:24:13 +00:00
ColinD a5773aaaa9 Trying to change the inspections again 2021-03-02 14:23:42 +00:00
ColinD f88ad13f0d Testing to ignore unit tests from code inspections. 2021-03-02 14:02:12 +00:00
ColinD 9dde0d9e81 Another code inspection. 2021-03-02 13:49:02 +00:00
ColinD acc935248b Couple more code inspections, and changes the MoveAxis so that it will apply the settle time delay when not guiding. 2021-03-02 13:07:21 +00:00
ColinD cdf1066e4e Fixed a few more code inspections 2021-03-02 12:54:47 +00:00
ColinD f57a73843a Fixed a few code inspections 2021-03-01 11:19:27 +00:00
ColinD b0ef75ae66 Added code to include the settle time in the Moving Axis commands (except when moving at Guide Rate) 2021-03-01 09:55:07 +00:00
ColinD 136ccc8fa9 Added more places to initialise the slewing settle delay 2021-02-28 20:03:19 +00:00
ColinD e9491da707 Seperated the SlewSettleTime property from the ProfileSettle time, and implemented a delay on IsSlewing to use the combined SettleTimes 2021-02-27 21:20:06 +00:00
ColinD db06002ebf Added support for SlewSettleTime 2021-02-26 00:11:44 +00:00
ColinD ca1b7f8883 Merged in develop (pull request #24)
Made alteration to IsSlewing response when the LX200 returns a buffer of rubbish.
2021-02-10 10:24:54 +00:00
ColinD 14b5651795 Made alteration to IsSlewing response when the LX200 returns a buffer of rubbish. 2021-02-09 21:57:42 +00:00
ColinD 1186924761 Merged in develop (pull request #23)
7.13 Release
2021-02-01 23:34:07 +00:00
Frank S 1616ddbc21 Merged in feature/lowPrecisionEnhancement (pull request #22)
Classic LX 200 low precision and lock on slewing enhancement (issue #8)

Approved-by: Colin Dawson
2021-02-01 23:26:17 +00:00
ColinD 79a404e78a Fixed the last unit test, seems that the special code for the chr(255)'s isn't needed as it's a non empty string, which should indicate that slewing is happening. 2021-02-01 23:23:00 +00:00
ColinD 9cd547c204 Merge branch 'develop' into feature/lowPrecisionEnhancement 2021-01-31 16:25:33 +00:00
ColinD f140e8aee1 Added support for saving the site elevation into the driver profile 2021-01-31 15:52:16 +00:00
ColinD a9f57b7ad2 The is Slewing is now actively detecting a | response, or an empty string to return the correct value. There is still an edge case of a string of FF characters which is unresolved 2021-01-31 11:33:43 +00:00
ColinD c7fa7ab095 Fixed SlewToCoordinatesAsync_WhenCalled_ThenSetsTargetAndSlews 2021-01-30 21:55:44 +00:00
ColinD 778b36b7f5 Fixed SyncToCoordinates_WhenConnected_ThenReturnsExpectedResult 2021-01-30 21:45:47 +00:00
ColinD 447ff3ace9 Fixed SlewToAltAzAsync_WhenAltAndAzValid_ThenConvertsToRADec 2021-01-30 16:00:18 +00:00
ColinD c848ebd9be Fixed TargetRightAscension_Get_WhenValueOK_ThenSetsNewTargetDeclination 2021-01-30 15:55:36 +00:00
ColinD d9acad1caa removed unneeded ncrunch file 2021-01-30 15:50:04 +00:00
ColinD f827a1ea3a Added ncrunchsolution.user files to .gitIgnore 2021-01-30 15:46:39 +00:00
ColinD 26b94de48c Fixed unit test TargetDeclination_Get_WhenValueOK_ThenSetsNewTargetDeclination 2021-01-30 15:42:31 +00:00
ColinD 779d314748 Fixed another unit test 2021-01-30 15:33:23 +00:00
ColinD 199b068e94 Fixed another broken unit test 2021-01-17 20:18:07 +00:00
ColinD e8f3b00912 Fixed test case to send the correct encoded string rather than a english readable non encoded string. 2021-01-17 18:48:53 +00:00
ColinD 579ea164f8 Fixed another unit test 2021-01-17 18:24:15 +00:00
ColinD 902d6bbc6e Added a check to the telescope to ensure that this is only triggered for the LX200CLASSIC other scopes do not need to the extra work. 2021-01-17 18:23:20 +00:00
ColinD 927d6bce47 Fixed the log message to be returned from IsSlewing with the final state every time without exception. 2021-01-17 18:19:16 +00:00
ColinD 65afa07125 Another unit test fail bites the dust 2021-01-17 18:13:32 +00:00
ColinD 58992c2947 More unit tests fixed 2021-01-17 18:04:24 +00:00
ColinD 1297b5eb78 Fixed 9 of the broken unit tests by populating the mock information properly. 2021-01-17 17:49:45 +00:00
ColinD cd8330196e Made a few minor tweaks whilst reviewing. 2021-01-17 17:30:29 +00:00
Frank S 9042c76d48 Classic LX 200 low precision and lock on slewing enhancement (issue #8) 2021-01-17 17:01:07 +01:00
ColinD 4126b2ee44 Added JetBrains.Annotations 2021-01-07 20:07:00 +00:00
ColinD ca0028f08d Upgraded to .net 4.7.2, and fixed issue with the site location being set wrongly 2021-01-07 19:28:46 +00:00
ColinD a59ecaf21d Added support for being able to enable the Rts/Dtr signals which is needed to Meade LS series scopes 2020-10-13 10:30:43 +01:00
ColinD 1b73bb62b6 Fixed logic for LX200 Classic is slewing test 2020-09-24 22:01:52 +01:00
ColinD c34ed41ddf Added check to ensure that the LX-200 classic return value is sanitised when it's not slewing. 2020-09-22 17:34:57 +01:00
ColinD d0406b32dd Added ability to unpark telescope
Added extra logging information to the "isslewing test"
2020-09-21 23:04:58 +01:00
ColinD b33d1741c4 Removed the Classname static as it doesn't work as desired. Replace with a parameter on the initialise method instead. 2020-09-04 15:23:46 +01:00
ColinD d728dbe272 Trying to reduce code duplication 2020-09-03 23:34:04 +01:00
ColinD 47d0a047a5 Code inspection 2020-09-03 23:07:54 +01:00
ColinD 83dd7d87f0 Code Inspections 2020-09-03 22:52:02 +01:00
ColinD 03f2022f2f Refactored the error message 2020-09-03 21:04:28 +01:00
ColinD 89600c463b Removed unneeded variable 2020-09-03 20:53:11 +01:00
ColinD 92ab807eae Code inspections 2020-09-03 20:35:37 +01:00
ColinD a2fcaac2a9 Code inspections 2020-09-03 20:28:32 +01:00
ColinD da4e4fd81a Refactored code to reduce duplication. 2020-09-03 19:05:01 +01:00
ColinD 4266139429 Removed all # symbols from before the commands, as they're not really needed. 2020-09-03 18:35:40 +01:00
ColinD 1dc7d7142a Refactored the backlash compensation so that less move commands are issued. 2020-09-03 17:06:16 +01:00
ColinD b9f1dd9d61 Another try 2020-09-03 14:07:41 +01:00
ColinD 6c25373d7f Trying older version of nuget api 2020-09-03 13:39:36 +01:00
ColinD c19115f252 Added nuget.config file 2020-09-03 13:32:08 +01:00
ColinD 9c4329deed Nuget packages updated to latest versions 2020-09-03 13:20:44 +01:00
ColinD a563a77554 Implemenated a few todo notes 2020-09-03 13:12:06 +01:00
ColinD f9792b22bc Implemenated a few todo notes 2020-09-03 13:11:47 +01:00
ColinD 8d097fefe1 Added reverse direction feature 2020-06-04 23:31:41 +01:00
ColinD 71ed5cc58b removed redundant using 2020-06-03 12:44:23 +01:00
ColinD d6cec4d63e Checked and removed completed todo tasks 2020-06-03 00:10:27 +01:00
ColinD 139191a1ce Unneeded code 2020-06-02 23:54:19 +01:00
ColinD 946fb4b141 Implementation of backlash compensation feature 2020-06-02 23:52:25 +01:00
ColinD 3d47e03240 Added a post connect check to see if the serial port is functioning correctly. 2020-05-24 22:02:21 +01:00
ColinD 855a21122a Added a trim, so that whitespace is ignored when seeing the result of is slewing to target. 2020-05-24 18:30:46 +01:00
ColinD 2c7de157e8 Added unit test for telescope hitting tripod. 2020-05-24 16:40:47 +01:00
ColinD 1e59d5610e Fixed spelling mistake 2020-05-24 16:39:09 +01:00
ColinD bd8476e11a Added support for a warning when the telescope could hit the mount. (older command used by the Meade CSD prior to the LX200 command set.) 2020-05-24 16:38:30 +01:00
ColinD 3e00398af0 Modified the puleguide method to make sure that the _isGuiding property is set correctly regardless of the old or new guiding method.
Added log message for when PulseGuide fails with an error for any reason
2020-05-24 15:56:24 +01:00
ColinD 2ab9cfb9c8 Merged in develop (pull request #21)
Develop
2020-05-23 18:35:43 +00:00
ColinD 894b78d9f1 code inspections 2020-05-23 19:23:48 +01:00
ColinD b9522ae2a2 Added and error message to the trace log when the com port is failing and looping back data 2020-05-23 18:40:04 +01:00
ColinD 07665b7617 removed unused local variable 2020-02-27 23:42:23 +00:00
ColinD 6130cb6d64 Added new feature to allow the guiding style to be forced, Auto = driver decides. Pulse guiding will use the newer pulse guiding technique, Guide rate slew, will use the older technique. 2020-02-27 22:57:19 +00:00
ColinD d925312403 Merge branch 'master' into develop 2020-02-24 21:05:10 +00:00
ColinD 5a18577552 Merged in develop (pull request #20)
Develop
2020-02-24 21:01:21 +00:00
ColinD c7f1a4272f Slewing now reports false when performing a guide command using the old guiding method. 2020-02-20 21:31:09 +00:00
ColinD 6601fa6205 Added a check to ensure that pulse guide commands fail when the scope is slewing or already being moved on the same axes. 2019-12-11 23:53:37 +00:00
ColinD e2abda2d14 Merged in develop (pull request #19)
Develop
2019-12-03 21:10:42 +00:00
ColinD 97810b5575 Attempt ad fixing the double.parse error. 2019-12-02 12:39:03 +00:00
ColinD 1185770a94 Added try catch to the default constructor to show the details of an error if something goes wrong. 2019-12-01 00:11:13 +00:00
ColinD 25d88b0609 Set global com visible to false and only exposed the classes that need to be. 2019-11-30 19:15:06 +00:00
ColinD 85c77787ce Added unit test for getting site count 2019-11-12 10:35:03 +00:00
ColinD 2181ff5602 Added extra # in front of every command as recommended by Meade.
Code inspections
Duplicate reconcile
Code upgraded to use .net 4.5
Added log message for when a pulse guide move is completed that will show the difference.
.net 4.5 is not being recognised as installed, so trying a different variable.
Modified how the old guiding method is implmented - it's now much simplified and uses the same move axis commands as normal slewing, which is what it does under the hood anyway.
Modified how the RA detection is done, and changed the message logs
RA position report on connect to trigger for ALL connects.
Modified the LX200 Classic connections, so that if a :GVP is returned when :GVP# is sent, it assumes an error. A timeout will be assumed to be an LX200 Classic.
Started working on unit testing for the sharedresources class.
Changed the code to detect any exception when trying to run a :GVP after the initial connect.
Upgraded the Profile code to be contained inside a wrapper and started adding unit tests to cover.
2019-10-22 21:52:42 +00:00
ColinD 9505468efc Code inspection cleanup 2019-10-22 22:06:40 +01:00
ColinD 2cbb1fb68c Code inspection cleanup 2019-10-22 21:51:59 +01:00
ColinD ba0ae056ea Forcing the disconnect to make sure that the tests work as expected. 2019-10-22 21:40:45 +01:00
ColinD dff7bce6b0 Unit Testing for the connect method. 2019-10-22 21:27:07 +01:00
ColinD a155e27eac Upgraded the Profile code to be contained inside a wrapper and started adding unit tests to cover. 2019-10-21 21:16:09 +01:00
ColinD 438ec779b4 Changed the code to detect any exception when trying to run a :GVP after the initial connect. 2019-10-19 11:54:04 +01:00
ColinD 307517ded0 Updated nuget packages. Started working on unit testing for the sharedresources class. 2019-10-15 21:33:51 +01:00
ColinD 8efa8752df Corrected defect where the scope will not attempt to connect the serial port 2019-10-13 21:15:30 +01:00
ColinD 7f6f478dfc Modified the LX200 Classic connections, so that if a :GVP is returned when :GVP# is sent, it assumes an error. A timeout will be assumed to be an LX200 Classic. 2019-10-12 12:40:01 +01:00
ColinD 7a92581fa8 Moved the RA position report on connect to trigger for ALL connects, not just the first connection. 2019-10-05 13:47:14 +01:00
ColinD 7f8c2cb559 Removed the alignmode check as it is not supported on all telescopes.
Added current RA and dec to the log when the telescope connects.
2019-10-05 11:23:10 +01:00
ColinD 3dc87e3724 Added new alignment mode to the log 2019-10-04 20:42:46 +01:00
ColinD 670a5ccf81 Modified how the RA detection is done, and changed the message logs 2019-10-04 20:34:42 +01:00
ColinD 9af0613183 Modified how the old guiding method is implmented - it's now much simplified and uses the same move axis commands as normal slewing, which is what it does under the hood anyway. 2019-10-04 18:20:32 +01:00
ColinD 5df0e21a58 Another attempt at adding .net 4.5 checking 2019-10-03 23:34:13 +01:00
ColinD 149bad2d31 .net 4.5 is not being recognised as installed, so trying a different variable. 2019-10-03 23:12:27 +01:00
ColinD 276f0352e3 Added log message for when a pulse guide move is completed that will show the difference. 2019-10-02 18:55:24 +01:00
ColinD f22e9cdd02 Code inspections 2019-10-01 22:06:42 +01:00
ColinD ee3862f949 Code inspections 2019-10-01 22:03:57 +01:00
ColinD 2972ae31aa Code upgraded to use .net 4.5 2019-10-01 22:00:55 +01:00
ColinD 79cdd60d07 Duplicate reconcile 2019-10-01 21:51:06 +01:00
ColinD f92f21ab72 Code inspections 2019-10-01 21:44:36 +01:00
ColinD 2a56cfa700 Duplicate reconcile 2019-10-01 21:16:47 +01:00
ColinD babb2a7492 Code inspections 2019-10-01 20:57:49 +01:00
ColinD 23960d8c7c Code inspections 2019-10-01 19:42:40 +01:00
ColinD cb97358100 Code inspections 2019-10-01 19:37:39 +01:00
ColinD 28889bdb49 Code inspections 2019-10-01 19:12:34 +01:00
ColinD 5efde9f6e0 Code inspections 2019-10-01 19:03:48 +01:00
ColinD 12e46edc74 Code inspections 2019-10-01 18:55:20 +01:00
ColinD 9969fce375 Merge branch 'master' into develop 2019-09-30 23:30:44 +01:00
ColinD 97e77c839a Added extra # in front of every command as recommended by Meade. 2019-09-30 23:27:18 +01:00
ColinD 0ea195e073 Merge branch 'master' into develop 2019-09-30 22:28:10 +01:00
87 changed files with 10105 additions and 2591 deletions
+1 -1
View File
@@ -109,6 +109,7 @@ _TeamCity*
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
*ncrunchsolution.user
# MightyMoose
*.mm.*
@@ -217,5 +218,4 @@ _Pvt_Extensions
# nCrunch items
*.ncrunchsolution
*.DotSettings
*.ncrunchproject
+18 -11
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\NUnit.3.12.0\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.12.0\build\NUnit.props')" />
<Import Project="..\packages\NUnit.3.13.3\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.13.3\build\NUnit.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -53,23 +53,26 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\packages\Castle.Core.4.4.0\lib\net45\Castle.Core.dll</HintPath>
<Reference Include="Castle.Core, Version=5.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\packages\Castle.Core.5.1.0\lib\net462\Castle.Core.dll</HintPath>
</Reference>
<Reference Include="Moq, Version=4.12.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.12.0\lib\net45\Moq.dll</HintPath>
<Reference Include="JetBrains.Annotations, Version=4242.42.42.42, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
<HintPath>..\packages\JetBrains.Annotations.2022.3.1\lib\net20\JetBrains.Annotations.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.12.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.12.0\lib\net45\nunit.framework.dll</HintPath>
<Reference Include="Moq, Version=4.18.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.18.2\lib\net462\Moq.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.13.3.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.13.3\lib\net45\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.7.0.0-preview.2.22152.2\lib\net462\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.3\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
@@ -87,6 +90,10 @@
<Project>{64308775-bd4a-469c-bcab-3ed830b811af}</Project>
<Name>Meade.net.Telescope</Name>
</ProjectReference>
<ProjectReference Include="..\Meade.net\Meade.net.csproj">
<Project>{3689a2cb-94c5-4012-a5cf-7e7d1dd27143}</Project>
<Name>Meade.net</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
@@ -97,6 +104,6 @@
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\NUnit.3.12.0\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.12.0\build\NUnit.props'))" />
<Error Condition="!Exists('..\packages\NUnit.3.13.3\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.13.3\build\NUnit.props'))" />
</Target>
</Project>
+8 -7
View File
@@ -18,14 +18,14 @@ namespace AstroMath.UnitTests
[Test]
public void DegreesToRadians()
{
var radians = _astroMath.DegreesToRadians(90);
var radians = 90.0.DegreesToRadians();
Assert.That(radians, Is.EqualTo(1.5707963267948966));
}
[Test]
public void RadiansToDegrees()
{
var degrees = _astroMath.RadiansToDegrees(1.5707963267948966);
var degrees = 1.5707963267948966.RadiansToDegrees();
Assert.That(degrees, Is.EqualTo(90));
}
@@ -34,7 +34,7 @@ namespace AstroMath.UnitTests
public void DateTimeToDecimalHours_book()
{
DateTime dateTime = new DateTime(2019, 05, 18, 18, 31, 27, DateTimeKind.Utc);
var decimalHours = _astroMath.DateTimeToDecimalHours(dateTime);
var decimalHours = dateTime.DateTimeToDecimalHours();
Assert.That(decimalHours, Is.EqualTo(18.524166666666666));
}
@@ -43,7 +43,7 @@ namespace AstroMath.UnitTests
public void DateTimeToDecimalHours()
{
DateTime dateTime = new DateTime(2019, 05, 18, 22, 26, 15, DateTimeKind.Utc);
var decimalHours = _astroMath.DateTimeToDecimalHours(dateTime);
var decimalHours = dateTime.DateTimeToDecimalHours();
Assert.That(decimalHours, Is.EqualTo(22.4375));
}
@@ -52,7 +52,7 @@ namespace AstroMath.UnitTests
public void UTtoGST_book()
{
DateTime dateTime = new DateTime(1980, 04, 22, 14, 36, 51, 670, DateTimeKind.Utc);
double gst = _astroMath.UTtoGst(dateTime);
double gst = dateTime.UTtoGst();
Assert.That(gst, Is.EqualTo(4.667932706211154));
}
@@ -61,7 +61,7 @@ namespace AstroMath.UnitTests
public void UTtoGst()
{
DateTime dateTime = new DateTime(2019, 05, 18, 22, 26, 15, DateTimeKind.Utc);
double gst = _astroMath.UTtoGst(dateTime);
double gst = dateTime.UTtoGst();
Assert.That(gst, Is.EqualTo(14.191879687876451));
}
@@ -123,7 +123,8 @@ namespace AstroMath.UnitTests
var altAz = _astroMath.ConvertEqToHoz(hourAngle, latitude, equatorialCoordinates);
Assert.That(altAz.Altitude, Is.EqualTo(20.958562421092779));
Assert.That(altAz.Altitude, Is.GreaterThan(20.958562421092770));
Assert.That(altAz.Altitude, Is.LessThanOrEqualTo(20.958562421092779));
Assert.That(altAz.Azimuth, Is.EqualTo(281.2728706962269));
}
+4
View File
@@ -6,6 +6,10 @@
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
+6 -5
View File
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Castle.Core" version="4.4.0" targetFramework="net472" />
<package id="Moq" version="4.12.0" targetFramework="net472" />
<package id="NUnit" version="3.12.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.3" targetFramework="net472" />
<package id="Castle.Core" version="5.1.0" targetFramework="net472" />
<package id="JetBrains.Annotations" version="2022.3.1" targetFramework="net472" />
<package id="Moq" version="4.18.2" targetFramework="net472" />
<package id="NUnit" version="3.13.3" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="7.0.0-preview.2.22152.2" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
</packages>
+6 -1
View File
@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ASCOM.MeadeGeneric</RootNamespace>
<AssemblyName>ASCOM.MeadeGeneric.Test</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
@@ -54,10 +54,14 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<Reference Include="JetBrains.Annotations, Version=4242.42.42.42, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
<HintPath>..\packages\JetBrains.Annotations.2022.3.1\lib\net20\JetBrains.Annotations.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
@@ -71,6 +75,7 @@
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+2 -2
View File
@@ -14,9 +14,9 @@ using ASCOM.DriverAccess;
namespace ASCOM.MeadeGeneric
{
class Program
public static class Program
{
static void Main(string[] args)
public static void Main()
{
// Uncomment the code that's required
#if UseChooser
+1 -1
View File
@@ -1,3 +1,3 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="JetBrains.Annotations" version="2022.3.1" targetFramework="net48" />
</packages>
+75 -37
View File
@@ -15,6 +15,7 @@ namespace Meade.net.Focuser.UnitTests
{
private Mock<IUtil> _utilMock;
private Mock<ISharedResourcesWrapper> _sharedResourcesWrapperMock;
private Mock<ITraceLogger> _traceLoggerMock;
private ProfileProperties _profileProperties;
@@ -27,19 +28,26 @@ namespace Meade.net.Focuser.UnitTests
{
TraceLogger = false,
ComPort = "TestCom1",
Speed = 9600,
Parity = "None",
Handshake = "None",
StopBits = "One",
DataBits = 8,
GuideRateArcSecondsPerSecond = 1.23,
Precision = "Unchanged"
Precision = "Unchanged",
GuidingStyle = "Auto"
};
_utilMock = new Mock<IUtil>();
_sharedResourcesWrapperMock = new Mock<ISharedResourcesWrapper>();
_traceLoggerMock = new Mock<ITraceLogger>();
_sharedResourcesWrapperMock.Setup(x => x.Lock(It.IsAny<Action>())).Callback<Action>(action => { action(); });
_sharedResourcesWrapperMock = new Mock<ISharedResourcesWrapper>();
_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()
@@ -102,16 +110,17 @@ namespace Meade.net.Focuser.UnitTests
Assert.That(exception.Message, Is.EqualTo("Not connected to focuser when trying to execute: CommandBlind"));
}
[Test]
public void CommandBlind_WhenConnected_ThenSendsExpectedMessage()
[TestCase(false)]
[TestCase(true)]
public void CommandBlind_WhenConnected_ThenSendsExpectedMessage(bool raw)
{
string expectedMessage = "test blind Message";
ConnectFocuser();
_focuser.CommandBlind(expectedMessage, true);
_focuser.CommandBlind(expectedMessage, raw);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(expectedMessage), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(_traceLoggerMock.Object, expectedMessage, raw), Times.Once);
}
[Test]
@@ -123,16 +132,19 @@ namespace Meade.net.Focuser.UnitTests
Assert.That(exception.Message, Is.EqualTo("Not connected to focuser when trying to execute: CommandBool"));
}
[Test]
public void CommandBool_WhenConnected_ThenSendsExpectedMessage()
[TestCase(false)]
[TestCase(true)]
public void CommandBool_WhenConnected_ThenSendsExpectedMessage(bool raw)
{
string expectedMessage = "test blind Message";
_sharedResourcesWrapperMock.Setup(x => x.SendBool(_traceLoggerMock.Object, expectedMessage, raw)).Returns(true);
ConnectFocuser();
var exception = Assert.Throws<MethodNotImplementedException>(() => { _focuser.CommandBool(expectedMessage, true); });
var result = _focuser.CommandBool(expectedMessage, raw);
Assert.That(exception.Message, Is.EqualTo("Method CommandBool is not implemented in this driver."));
_sharedResourcesWrapperMock.Verify(x => x.SendBool(_traceLoggerMock.Object, expectedMessage, raw), Times.Once);
Assert.That(result, Is.True);
}
[Test]
@@ -152,11 +164,11 @@ namespace Meade.net.Focuser.UnitTests
ConnectFocuser();
_sharedResourcesWrapperMock.Setup(x => x.SendString(sendMessage)).Returns(() => expectedMessage);
_sharedResourcesWrapperMock.Setup(x => x.SendString(_traceLoggerMock.Object, sendMessage, true)).Returns(() => expectedMessage);
var actualMessage = _focuser.CommandString(sendMessage, true);
_sharedResourcesWrapperMock.Verify(x => x.SendString(sendMessage), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendString(_traceLoggerMock.Object, sendMessage, true), Times.Once);
Assert.That(actualMessage, Is.EqualTo(expectedMessage));
}
@@ -181,7 +193,7 @@ namespace Meade.net.Focuser.UnitTests
_sharedResourcesWrapperMock.Setup(x => x.FirmwareVersion).Returns(firmware);
_focuser.Connected = true;
_sharedResourcesWrapperMock.Verify(x => x.Connect("Serial", It.IsAny<string>()), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.Connect("Serial", It.IsAny<string>(), It.IsAny<ITraceLogger>()), Times.Once);
}
@@ -189,20 +201,20 @@ namespace Meade.net.Focuser.UnitTests
public void Connected_Set_SettingTrueWhenTrue_ThenDoesNothing()
{
ConnectFocuser();
_sharedResourcesWrapperMock.Verify(x => x.Connect(It.IsAny<string>(), It.IsAny<string>()), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.Connect(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<ITraceLogger>()), Times.Once);
//act
_focuser.Connected = true;
//assert
_sharedResourcesWrapperMock.Verify(x => x.Connect(It.IsAny<string>(), It.IsAny<string>()), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.Connect(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<ITraceLogger>()), Times.Once);
}
[Test]
public void Connected_Set_SettingFalseWhenTrue_ThenDisconnects()
{
ConnectFocuser();
_sharedResourcesWrapperMock.Verify(x => x.Connect(It.IsAny<string>(), It.IsAny<string>()), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.Connect(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<ITraceLogger>()), Times.Once);
//act
_focuser.Connected = false;
@@ -312,8 +324,7 @@ namespace Meade.net.Focuser.UnitTests
_focuser.Halt();
_sharedResourcesWrapperMock.Verify( x => x.SendBlind(":FQ#"), Times.AtLeastOnce);
_utilMock.Verify( x => x.WaitForMilliseconds(250), Times.AtLeastOnce);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(_traceLoggerMock.Object, "FQ", false), Times.AtLeastOnce);
}
[Test]
@@ -328,13 +339,13 @@ namespace Meade.net.Focuser.UnitTests
[TestCase(false)]
[TestCase(true)]
public void Link_Get_ReturnsSameValueAsConnected( bool connected)
public void Link_Get_ReturnsSameValueAsConnected(bool connected)
{
_sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(() => TelescopeList.Autostar497);
_sharedResourcesWrapperMock.Setup(x => x.FirmwareVersion).Returns(() => TelescopeList.Autostar497_31Ee);
_focuser.Connected = connected;
Assert.That( _focuser.Link, Is.EqualTo(connected));
Assert.That(_focuser.Link, Is.EqualTo(connected));
}
[TestCase(false)]
@@ -353,7 +364,7 @@ namespace Meade.net.Focuser.UnitTests
{
var result = _focuser.MaxIncrement;
Assert.That(result, Is.EqualTo(7000));
Assert.That(result, Is.EqualTo(30000));
}
[Test]
@@ -361,7 +372,7 @@ namespace Meade.net.Focuser.UnitTests
{
var result = _focuser.MaxStep;
Assert.That(result, Is.EqualTo(7000));
Assert.That(result, Is.EqualTo(30000));
}
[Test]
@@ -371,8 +382,8 @@ namespace Meade.net.Focuser.UnitTests
Assert.That(exception.Message, Is.EqualTo("Not connected to focuser when trying to execute: Move"));
}
[TestCase(-7001)]
[TestCase(7001)]
[TestCase(-30001)]
[TestCase(300001)]
public void Move_WhenLargerThanMaxIncrement_ThenThrowsException(int position)
{
ConnectFocuser();
@@ -388,34 +399,61 @@ namespace Meade.net.Focuser.UnitTests
_focuser.Move(0);
_utilMock.Verify( x => x.WaitForMilliseconds(It.IsAny<int>()), Times.Never);
_utilMock.Verify(x => x.WaitForMilliseconds(It.IsAny<int>()), Times.Never);
}
[TestCase(200)]
[TestCase(-200)]
public void Move_WhenIncrementIsNot0_ThenMovesFocuserAndStopsFocuser( int position)
public void Move_WhenIncrementIsNot0_ThenMovesFocuserAndStopsFocuser(int position)
{
_profileProperties.BacklashCompensation = 0;
ConnectFocuser();
_focuser.Move(position);
if (position < 0)
{
_sharedResourcesWrapperMock.Verify( x => x.SendBlind(":F-#"), Times.AtLeastOnce);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":F+#"), Times.Never);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(_traceLoggerMock.Object, "F-", false), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(_traceLoggerMock.Object, "F+", false), Times.Never);
}
else
{
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":F-#"), Times.Never);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":F+#"), Times.AtLeastOnce);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(_traceLoggerMock.Object, "F-", false), Times.Never);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(_traceLoggerMock.Object, "F+", false), Times.Once);
}
_sharedResourcesWrapperMock.Verify( x => x.Lock(It.IsAny<Action>()), Times.Once);
_utilMock.Verify(x => x.WaitForMilliseconds(250), Times.AtLeastOnce);
_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(100), Times.Once());
_utilMock.Verify(x => x.WaitForMilliseconds(1000), Times.Once());
}
[TestCase(200)]
[TestCase(-200)]
public void Move_WhenIncrementIsNot0_ThenMovesFocuserAndStopsFocuserWithBacklashCompensation(int position)
{
_profileProperties.BacklashCompensation = 3000;
ConnectFocuser();
_focuser.Move(position);
if (position < 0)
{
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(_traceLoggerMock.Object, "F-", false), Times.Once);
_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(_profileProperties.BacklashCompensation)), Times.Never);
_utilMock.Verify(x => x.WaitForMilliseconds(100), Times.Exactly(1));
}
else
{
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(_traceLoggerMock.Object, "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(_profileProperties.BacklashCompensation), Times.Once);
_utilMock.Verify(x => x.WaitForMilliseconds(100), Times.Exactly(2));
}
}
[Test]
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\NUnit.3.12.0\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.12.0\build\NUnit.props')" />
<Import Project="..\packages\NUnit.3.13.3\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.13.3\build\NUnit.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -36,55 +36,58 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="ASCOM.Astrometry, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Astrometry.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Astrometry.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Attributes, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Attributes.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Attributes.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Cache, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Cache.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Cache.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Controls, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Controls.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Controls.dll</HintPath>
</Reference>
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.DeviceInterfaces.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.DeviceInterfaces.dll</HintPath>
</Reference>
<Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.DriverAccess.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.DriverAccess.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Exceptions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Exceptions.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Exceptions.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Internal.Extensions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Internal.Extensions.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Internal.Extensions.dll</HintPath>
</Reference>
<Reference Include="ASCOM.SettingsProvider, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.SettingsProvider.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.SettingsProvider.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Utilities, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Utilities.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Utilities.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Utilities.Video, Version=6.1.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Utilities.Video.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Utilities.Video.dll</HintPath>
</Reference>
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\packages\Castle.Core.4.4.0\lib\net45\Castle.Core.dll</HintPath>
<Reference Include="Castle.Core, Version=5.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\packages\Castle.Core.5.1.0\lib\net462\Castle.Core.dll</HintPath>
</Reference>
<Reference Include="Moq, Version=4.12.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.12.0\lib\net45\Moq.dll</HintPath>
<Reference Include="JetBrains.Annotations, Version=4242.42.42.42, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
<HintPath>..\packages\JetBrains.Annotations.2022.3.1\lib\net20\JetBrains.Annotations.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.12.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.12.0\lib\net45\nunit.framework.dll</HintPath>
<Reference Include="Moq, Version=4.18.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.18.2\lib\net462\Moq.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.13.3.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.13.3\lib\net45\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.7.0.0-preview.2.22152.2\lib\net462\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.3\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
@@ -99,7 +102,6 @@
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="BootstrapAscomProfileStore.ps1" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
@@ -117,6 +119,6 @@
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\NUnit.3.12.0\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.12.0\build\NUnit.props'))" />
<Error Condition="!Exists('..\packages\NUnit.3.13.3\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.13.3\build\NUnit.props'))" />
</Target>
</Project>
+4
View File
@@ -6,6 +6,10 @@
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
+7 -6
View File
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ASCOM.Platform" version="6.4.2" targetFramework="net472" />
<package id="Castle.Core" version="4.4.0" targetFramework="net472" />
<package id="Moq" version="4.12.0" targetFramework="net472" />
<package id="NUnit" version="3.12.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.3" targetFramework="net472" />
<package id="ASCOM.Platform" version="6.5.2" targetFramework="net472" />
<package id="Castle.Core" version="5.1.0" targetFramework="net472" />
<package id="JetBrains.Annotations" version="2022.3.1" targetFramework="net472" />
<package id="Moq" version="4.18.2" targetFramework="net472" />
<package id="NUnit" version="3.13.3" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="7.0.0-preview.2.22152.2" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
</packages>
+5 -5
View File
@@ -21,13 +21,13 @@
Type="raw" />
</Property>
<Condition Message="This application requires Ascom Platform 6.4 SP1 or higher. Please install this before installing the driver.">
<![CDATA[Installed OR ASCOMPLATFORMVERSION >= "6.4.1"]]>
<Condition Message="This application requires Ascom Platform 6.6.0 or higher. Please install this before installing the driver.">
<![CDATA[Installed OR ASCOMPLATFORMVERSION >= "6.6.0"]]>
</Condition>
<PropertyRef Id="NETFRAMEWORK40FULL"/>
<Condition Message="This application requires .NET Framework 4.0 or higher. Please install the .NET Framework then run this installer again.">
<![CDATA[Installed OR NETFRAMEWORK40FULL]]>
<PropertyRef Id='WIXNETFX4RELEASEINSTALLED'/>
<Condition Message="This application requires .NET Framework 4.8 or higher. Please install the .NET Framework then run this installer again.">
<![CDATA[Installed OR (WIXNETFX4RELEASEINSTALLED >= "#528040")]]>
</Condition>
<!-- <Condition Message="Please use the correct installer for your operating system - x86 for 32-bit, x64 for 64-bit.">
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\NUnit.3.12.0\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.12.0\build\NUnit.props')" />
<Import Project="..\packages\NUnit.3.13.3\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.13.3\build\NUnit.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -57,55 +57,58 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="ASCOM.Astrometry, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Astrometry.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Astrometry.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Attributes, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Attributes.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Attributes.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Cache, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Cache.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Cache.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Controls, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Controls.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Controls.dll</HintPath>
</Reference>
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.DeviceInterfaces.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.DeviceInterfaces.dll</HintPath>
</Reference>
<Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.DriverAccess.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.DriverAccess.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Exceptions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Exceptions.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Exceptions.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Internal.Extensions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Internal.Extensions.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Internal.Extensions.dll</HintPath>
</Reference>
<Reference Include="ASCOM.SettingsProvider, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.SettingsProvider.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.SettingsProvider.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Utilities, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Utilities.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Utilities.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Utilities.Video, Version=6.1.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Utilities.Video.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Utilities.Video.dll</HintPath>
</Reference>
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\packages\Castle.Core.4.4.0\lib\net45\Castle.Core.dll</HintPath>
<Reference Include="Castle.Core, Version=5.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\packages\Castle.Core.5.1.0\lib\net462\Castle.Core.dll</HintPath>
</Reference>
<Reference Include="Moq, Version=4.12.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.12.0\lib\net45\Moq.dll</HintPath>
<Reference Include="JetBrains.Annotations, Version=4242.42.42.42, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
<HintPath>..\packages\JetBrains.Annotations.2022.3.1\lib\net20\JetBrains.Annotations.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.12.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.12.0\lib\net40\nunit.framework.dll</HintPath>
<Reference Include="Moq, Version=4.18.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.18.2\lib\net462\Moq.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.13.3.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.13.3\lib\net45\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard1.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.7.0.0-preview.2.22152.2\lib\net462\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.3\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
@@ -129,7 +132,6 @@
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="BootstrapAscomProfileStore.ps1" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
@@ -137,6 +139,6 @@
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\NUnit.3.12.0\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.12.0\build\NUnit.props'))" />
<Error Condition="!Exists('..\packages\NUnit.3.13.3\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.13.3\build\NUnit.props'))" />
</Target>
</Project>
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -4,7 +4,7 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="4.0.4.1" />
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ASCOM.Platform" version="6.4.2" targetFramework="net472" />
<package id="Castle.Core" version="4.4.0" targetFramework="net45" />
<package id="Moq" version="4.12.0" targetFramework="net45" />
<package id="NUnit" version="3.12.0" targetFramework="net40" requireReinstallation="true" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net45" requireReinstallation="true" />
<package id="System.Threading.Tasks.Extensions" version="4.5.3" targetFramework="net472" />
<package id="ASCOM.Platform" version="6.5.2" targetFramework="net472" />
<package id="Castle.Core" version="5.1.0" targetFramework="net472" />
<package id="JetBrains.Annotations" version="2022.3.1" targetFramework="net472" />
<package id="Moq" version="4.18.2" targetFramework="net472" />
<package id="NUnit" version="3.13.3" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="7.0.0-preview.2.22152.2" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
</packages>
+12
View File
@@ -0,0 +1,12 @@
namespace ASCOM.Meade.net
{
public enum Alignment
{
NeedsAlignment,
OneStarAligned,
TwoStarAligned,
ThreeStarAligned,
AlignedOnHome,
ScopeWasParked,
}
}
+16
View File
@@ -0,0 +1,16 @@
using ASCOM.DeviceInterface;
namespace ASCOM.Meade.net
{
public class AlignmentStatus
{
public AlignmentModes AlignmentMode { get; set; }
public bool Tracking { get; set; }
public Alignment Status { get; set; }
public override string ToString()
{
return $"AlignmentStatus AlignmentMode={AlignmentMode};Tracking={Tracking};Status={Status}";
}
}
}
@@ -0,0 +1,79 @@
using System;
using ASCOM.Utilities;
namespace ASCOM.Meade.net.AstroMaths
{
public static class AstroMathExtensions
{
public static double DegreesToRadians(this double degrees)
{
return (Math.PI / 180) * degrees;
}
public static double RadiansToDegrees(this double radians)
{
double degrees = (180 / Math.PI) * radians;
return degrees;
}
public static double DateTimeToDecimalHours(this DateTime utcDateTime)
{
double sec = utcDateTime.Second;
double min = utcDateTime.Minute;
double hour = utcDateTime.Hour;
var a = Math.Abs(sec) / 60;
var b = (Math.Abs(min) + a) / 60;
var c = Math.Abs(hour) + b;
var d = c;
if ((hour < 0) || (min < 0) || (sec < 0))
d = -c;
return d;
}
public static double UTtoGst( this DateTime utcDateTime)
{
Util util = new Util();
var jd = util.DateUTCToJulian(utcDateTime) - 0.5;
if ((jd % 1) <= 0.5)
jd = Math.Floor(jd);
else
jd = Math.Floor(jd) + 0.5;
var s = jd - 2451545.0;
var t = s / 36525.0;
var t0 = 6.697374558 + (2400.051336 * t) + (0.000025862 * (t * t));
while (t0 < 0)
{
t0 += 24;
}
while (t0 >= 24)
{
t0 -= 24;
}
var ut = utcDateTime.DateTimeToDecimalHours();
var a = ut * 1.002737909;
var t1 = t0 + a;
while (t1 < 0)
{
t1 += 24;
}
while (t1 >= 24)
{
t1 -= 24;
}
return t1;
}
}
}
+14 -90
View File
@@ -1,5 +1,4 @@
using System;
using ASCOM.Utilities;
namespace ASCOM.Meade.net.AstroMaths
{
@@ -10,7 +9,7 @@ namespace ASCOM.Meade.net.AstroMaths
public double RightAscensionToHourAngle(DateTime utcDateTime, double longitude, double rightAscension)
{
//var ut = DateTimeToDecimalHours( utcDateTime);
var gst = UTtoGst( utcDateTime);
var gst = utcDateTime.UTtoGst();
var lst = GsTtoLst( gst, longitude);
var raHours = rightAscension;
var h1 = lst - raHours;
@@ -22,9 +21,9 @@ namespace ASCOM.Meade.net.AstroMaths
return h;
}
public double HourAngleToRightAscension(DateTime utcDateTime, double longitude, double hourAngle )
private double HourAngleToRightAscension(DateTime utcDateTime, double longitude, double hourAngle )
{
var gst = UTtoGst(utcDateTime);
var gst = utcDateTime.UTtoGst();
var lst = GsTtoLst( gst, longitude);
var raHours = hourAngle;
var h1 = lst - raHours;
@@ -39,17 +38,17 @@ namespace ASCOM.Meade.net.AstroMaths
public EquatorialCoordinates ConvertHozToEq( DateTime utcDateTime, double latitude, double longitude, HorizonCoordinates altAz)
{
var az = DegreesToRadians(altAz.Azimuth);
var alt = DegreesToRadians(altAz.Altitude);
var lat = DegreesToRadians(latitude);
var az = altAz.Azimuth.DegreesToRadians();
var alt = altAz.Altitude.DegreesToRadians();
var lat = latitude.DegreesToRadians();
var sinDec = Math.Sin(alt) * Math.Sin(lat) + Math.Cos(alt) * Math.Cos(lat) * Math.Cos(az);
var dec = RadiansToDegrees(Math.Asin(sinDec));
var dec = Math.Asin(sinDec).RadiansToDegrees();
var y = -Math.Cos(alt) * Math.Cos(lat) * Math.Sin(az);
var x = Math.Sin(alt) - Math.Sin(lat) * sinDec;
var upperA = Math.Atan2(y,x);
var upperB = RadiansToDegrees(upperA);
var upperB = upperA.RadiansToDegrees();
var ha = upperB;
@@ -72,19 +71,20 @@ namespace ASCOM.Meade.net.AstroMaths
public HorizonCoordinates ConvertEqToHoz(double hourAngle, double latitude, EquatorialCoordinates raDec)
{
var h = hourAngle * 15;
var h1 = DegreesToRadians(h);
var d = DegreesToRadians(raDec.Declination);
var lat = DegreesToRadians(latitude);
var h1 = h.DegreesToRadians();
var d = raDec.Declination.DegreesToRadians();
var lat = latitude.DegreesToRadians();
var sinA = Math.Sin(d) * Math.Sin(lat) + Math.Cos(d) * Math.Cos(lat) * Math.Cos(h1);
var y = -Math.Cos(d) * Math.Cos(lat) * Math.Sin(h1);
var x = Math.Sin(d) - Math.Sin(lat) * sinA;
var upperA = Math.Atan2(y, x);
var upperB = RadiansToDegrees(upperA);
var upperB = upperA.RadiansToDegrees();
var horizonCoordinates = new HorizonCoordinates
{
Altitude = RadiansToDegrees(Math.Asin(sinA)), Azimuth = upperB
Altitude = Math.Asin(sinA).RadiansToDegrees(),
Azimuth = upperB
};
@@ -96,82 +96,6 @@ namespace ASCOM.Meade.net.AstroMaths
return horizonCoordinates;
}
//todo convert to extension method
public double DegreesToRadians(double degrees)
{
return (Math.PI / 180) * degrees;
}
//todo convert to extension method
public double RadiansToDegrees(double radians)
{
double degrees = (180 / Math.PI) * radians;
return degrees;
}
//todo convert to extension method
public double DateTimeToDecimalHours( DateTime utcDateTime)
{
double sec = utcDateTime.Second;
double min = utcDateTime.Minute;
double hour = utcDateTime.Hour;
var a = Math.Abs(sec) / 60;
var b = (Math.Abs(min) + a) / 60;
var c = Math.Abs(hour) + b;
var d = c;
if ((hour < 0) || (min < 0) || (sec < 0))
d = -c;
return d;
}
//todo convert to extension method
public double UTtoGst(DateTime utcDateTime)
{
Util util = new Util();
var jd = util.DateUTCToJulian(utcDateTime) - 0.5;
if ((jd % 1) <= 0.5 )
jd = Math.Floor( jd );
else
jd = Math.Floor( jd ) + 0.5;
var s = jd - 2451545.0;
var t = s / 36525.0;
var t0 = 6.697374558 + (2400.051336 * t ) +(0.000025862 * (t * t) );
while (t0 < 0)
{
t0 += 24;
}
while (t0 >= 24)
{
t0 -= 24;
}
var ut = DateTimeToDecimalHours(utcDateTime);
var a = ut * 1.002737909;
var t1 = t0 + a;
while (t1 < 0)
{
t1 += 24;
}
while (t1 >= 24)
{
t1 -= 24;
}
return t1;
}
public double GsTtoLst(double gst, double longitude)
{
var l = longitude/ 15;
@@ -5,13 +5,13 @@ namespace ASCOM.Meade.net.AstroMaths
public interface IAstroMaths
{
double RightAscensionToHourAngle(DateTime utcDateTime, double longitude, double rightAscension);
double HourAngleToRightAscension(DateTime utcDateTime, double longitude, double hourAngle );
//double HourAngleToRightAscension(DateTime utcDateTime, double longitude, double hourAngle );
EquatorialCoordinates ConvertHozToEq( DateTime utcDateTime, double latitude, double longitude, HorizonCoordinates altAz);
HorizonCoordinates ConvertEqToHoz(double hourAngle, double latitude, EquatorialCoordinates raDec);
double DegreesToRadians(double degrees);
double RadiansToDegrees(double radians);
double DateTimeToDecimalHours( DateTime utcDateTime);
double UTtoGst(DateTime utcDateTime);
double GsTtoLst(double gst, double longitude);
//double DegreesToRadians(double degrees);
//double RadiansToDegrees(double radians);
//double DateTimeToDecimalHours( DateTime utcDateTime);
//double UTtoGst(DateTime utcDateTime);
//double GsTtoLst(double gst, double longitude);
}
}
+9
View File
@@ -0,0 +1,9 @@
using System;
namespace ASCOM.Meade.net
{
public class Clock : IClock
{
public DateTime UtcNow => DateTime.UtcNow;
}
}
+9
View File
@@ -0,0 +1,9 @@
namespace ASCOM.Meade.net
{
public enum ComparisonResult
{
Lower,
Equals,
Greater
}
}
+13
View File
@@ -10,5 +10,18 @@ namespace ASCOM.Meade.net
return false;
return true;
}
public static ComparisonResult Compare(this double value, double comparison)
{
var result = value.CompareTo(comparison);
if (result < 0)
return ComparisonResult.Lower;
if (result == 0)
return ComparisonResult.Equals;
return ComparisonResult.Greater;
}
}
}
@@ -0,0 +1,10 @@
namespace System
{
static class DoubelExtensions
{
public static bool Between(this double value, double lower, double higher)
{
return value >= lower & value <= higher;
}
}
}
+9
View File
@@ -0,0 +1,9 @@
using System;
namespace ASCOM.Meade.net
{
public interface IClock
{
DateTime UtcNow { get; }
}
}
+29 -14
View File
@@ -15,7 +15,7 @@
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>3.5</OldToolsVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<ApplicationIcon>ASCOM.ico</ApplicationIcon>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>ASCOMDriverTemplate.snk</AssemblyOriginatorKeyFile>
@@ -62,44 +62,49 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>..\bin\Release\</OutputPath>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<OutputPath>..\bin\Debug\</OutputPath>
<PlatformTarget>AnyCPU</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="ASCOM.Astrometry, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Astrometry.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Astrometry.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Attributes, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Attributes.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Attributes.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Cache, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Cache.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Cache.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Controls, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Controls.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Controls.dll</HintPath>
</Reference>
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.DeviceInterfaces.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.DeviceInterfaces.dll</HintPath>
</Reference>
<Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.DriverAccess.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.DriverAccess.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Exceptions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Exceptions.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Exceptions.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Internal.Extensions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Internal.Extensions.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Internal.Extensions.dll</HintPath>
</Reference>
<Reference Include="ASCOM.SettingsProvider, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.SettingsProvider.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.SettingsProvider.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Utilities, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Utilities.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Utilities.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Utilities.Video, Version=6.1.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Utilities.Video.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Utilities.Video.dll</HintPath>
</Reference>
<Reference Include="JetBrains.Annotations, Version=4242.42.42.42, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
<HintPath>..\packages\JetBrains.Annotations.2022.3.1\lib\net20\JetBrains.Annotations.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.configuration" />
@@ -113,12 +118,18 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Alignment.cs" />
<Compile Include="AlignmentStatus.cs" />
<Compile Include="AstroMaths\AltitudeData.cs" />
<Compile Include="AstroMaths\AstroMathExtensions.cs" />
<Compile Include="AstroMaths\AstroMaths.cs" />
<Compile Include="AstroMaths\EquatorialCoordinates.cs" />
<Compile Include="AstroMaths\HorizonCoordinates.cs" />
<Compile Include="AstroMaths\IAstroMaths.cs" />
<Compile Include="Clock.cs" />
<Compile Include="ComparisonResult.cs" />
<Compile Include="DoubleExtensions.cs" />
<Compile Include="ExtensionMethods\DoubelExtensions.cs" />
<Compile Include="IClock.cs" />
<Compile Include="StringExtensions.cs" />
<Compile Include="Telescope.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
@@ -145,7 +156,6 @@
<None Include="app.config" />
<None Include="ASCOM.png" />
<None Include="ASCOMDriverTemplate.snk" />
<None Include="BootstrapAscomProfileStore.ps1" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
@@ -177,11 +187,16 @@
<Name>Meade.net</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
@@ -1,5 +1,8 @@
<ProjectConfiguration>
<Settings>
<HiddenComponentWarnings>
<Value>CopyReferencedAssembliesToWorkspaceIsOn</Value>
</HiddenComponentWarnings>
<UseCPUArchitecture>x86</UseCPUArchitecture>
</Settings>
</ProjectConfiguration>
@@ -5,7 +5,6 @@ using System.Runtime.InteropServices;
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
// TODO - Add your authorship information here
[assembly: AssemblyTitle("ASCOM.Meade.net.Telescope")]
[assembly: AssemblyDescription("ASCOM Telescope driver for Meade.net")]
[assembly: AssemblyConfiguration("")]
@@ -18,7 +17,7 @@ using System.Runtime.InteropServices;
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(true)]
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("8b9fccb9-87ae-42f7-90af-079e13de6efb")]
@@ -33,6 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
//
// TODO - Set your driver's version here
[assembly: AssemblyVersion("0.0.0.0")]
[assembly: AssemblyFileVersion("0.0.0.0")]
+19 -25
View File
@@ -8,16 +8,10 @@
// </auto-generated>
//------------------------------------------------------------------------------
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Drawing;
using System.Globalization;
using System.Resources;
using System.Runtime.CompilerServices;
namespace ASCOM.Meade.net.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
@@ -25,27 +19,27 @@ namespace ASCOM.Meade.net.Properties {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[DebuggerNonUserCode()]
[CompilerGenerated()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static ResourceManager resourceMan;
private static global::System.Resources.ResourceManager resourceMan;
private static CultureInfo resourceCulture;
private static global::System.Globalization.CultureInfo resourceCulture;
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static ResourceManager ResourceManager {
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (ReferenceEquals(resourceMan, null)) {
ResourceManager temp = new ResourceManager("ASCOM.Meade.net.Properties.Resources", typeof(Resources).Assembly);
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ASCOM.Meade.net.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
@@ -56,8 +50,8 @@ namespace ASCOM.Meade.net.Properties {
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static CultureInfo Culture {
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
@@ -69,20 +63,20 @@ namespace ASCOM.Meade.net.Properties {
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static Bitmap ASCOM {
internal static System.Drawing.Bitmap ASCOM {
get {
object obj = ResourceManager.GetObject("ASCOM", resourceCulture);
return ((Bitmap)(obj));
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static Icon DefaultIcon {
internal static System.Drawing.Icon DefaultIcon {
get {
object obj = ResourceManager.GetObject("DefaultIcon", resourceCulture);
return ((Icon)(obj));
return ((System.Drawing.Icon)(obj));
}
}
+4 -8
View File
@@ -8,18 +8,14 @@
// </auto-generated>
//------------------------------------------------------------------------------
using System.CodeDom.Compiler;
using System.Configuration;
using System.Runtime.CompilerServices;
namespace ASCOM.Meade.net.Properties {
[CompilerGenerated()]
[GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.0.0.0")]
internal sealed partial class Settings : ApplicationSettingsBase {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.4.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(Synchronized(new Settings())));
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
+16 -11
View File
@@ -33,7 +33,7 @@ namespace ASCOM.Meade.net
public void Dispose()
{
// TODO Add any required object cleanup here
// Add any required object cleanup here
}
public double Maximum { get; set; }
@@ -82,16 +82,17 @@ namespace ASCOM.Meade.net
switch (axis)
{
case TelescopeAxes.axisPrimary:
case TelescopeAxes.axisSecondary:
// TODO Initialize this array with any Primary axis rates that your driver may provide
// Example: m_Rates = new Rate[] { new Rate(10.5, 30.2), new Rate(54.0, 43.6) }
//this.rates = new Rate[0];
_rates = new[] { new Rate(1, 1), new Rate(2, 2), new Rate(3, 3), new Rate(4, 4) };
break;
case TelescopeAxes.axisSecondary:
// TODO Initialize this array with any Secondary axis rates that your driver may provide
//this.rates = new Rate[0];
_rates = new[] { new Rate(1, 1), new Rate(2, 2), new Rate(3, 3), new Rate(4, 4) };
break;
//// TODO Initialize this array with any Secondary axis rates that your driver may provide
////this.rates = new Rate[0];
//_rates = new[] { new Rate(1, 1), new Rate(2, 2), new Rate(3, 3), new Rate(4, 4) };
//break;
case TelescopeAxes.axisTertiary:
// TODO Initialize this array with any Tertiary axis rates that your driver may provide
_rates = new Rate[0];
@@ -105,7 +106,7 @@ namespace ASCOM.Meade.net
public void Dispose()
{
// TODO Add any required object cleanup here
// Add any required object cleanup here
}
public IEnumerator GetEnumerator()
@@ -148,15 +149,19 @@ namespace ASCOM.Meade.net
// Default constructor - Internal prevents public creation
// of instances. Returned by Telescope.AxisRates.
//
internal TrackingRates()
internal TrackingRates(bool supportsLunar)
{
//
// This array must hold ONE or more DriveRates values, indicating
// the tracking rates supported by your telescope. The one value
// (tracking rate) that MUST be supported is driveSidereal!
//
_trackingRates = new[] { DriveRates.driveSidereal, DriveRates.driveLunar };
// TODO Initialize this array with any additional tracking rates that your driver may provide
if (supportsLunar)
{
_trackingRates = new[] {DriveRates.driveSidereal, DriveRates.driveLunar};
}
else
_trackingRates = new[] { DriveRates.driveSidereal };
}
#region ITrackingRates Members
@@ -175,7 +180,7 @@ namespace ASCOM.Meade.net
public void Dispose()
{
// TODO Add any required object cleanup here
// Add any required object cleanup here
}
public DriveRates this[int index] => _trackingRates[index - 1];
+4 -4
View File
@@ -7,10 +7,10 @@ namespace ASCOM.Meade.net
return int.Parse(str);
}
public static double ToDouble(this string str)
{
return double.Parse(str);
}
//public static double ToDouble(this string str)
//{
// return double.Parse(str);
//}
public static int Position(this string str, char find, int instance)
{
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -5,4 +5,4 @@
<section name="ASCOM.DeviceName.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</sectionGroup>
</configSections>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>
+2 -1
View File
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ASCOM.Platform" version="6.4.2" targetFramework="net40" />
<package id="ASCOM.Platform" version="6.5.2" targetFramework="net472" />
<package id="JetBrains.Annotations" version="2022.3.1" targetFramework="net472" />
</packages>
@@ -0,0 +1,36 @@
<#
This script initializes a bare minimum set of registry entries required for ASCOM.Utilities.Profile to work
without throwing any exceptions. When building on a build server, or on a computer without the ASCOM Platform installed,
it may be useful to execute this script as a build step prior to running any unit tests, or calling any code that relies on
ASCOM.Utilities.Profile. The alternative is to install the ASCOM Platform on the build agent.
NOTE: This script equires elevated permissions because it creates registry keys in the LocalMachine hive.
#>
$wow = Test-Path HKLM:\SOFTWARE\Wow6432Node
if ($wow)
{
$root = "HKLM:\SOFTWARE\Wow6432Node"
}
else
{
$root = "HKLM:\SOFTWARE"
}
$ascomRoot = $root + "\ASCOM"
if (Test-Path $ascomRoot)
{
<# Don't upset an already-existing ASCOM registry #>
exit
}
<# Create the ASCOM root key and set it's ACL to allow all users read/write access #>
New-Item -Path $root -Name ASCOM Force
$ascomAcl = Get-Acl $ascomRoot
$aclRule = New-Object System.Security.AccessControl.RegistryAccessRule ("Users","FullControl","Allow")
$ascomAcl.SetAccessRule($aclRule)
$ascomAcl | Set-Acl -Path $ascomRoot
<# Now create the bare minimum keys required so that ASCOM.Utilities.Profile doesn't crash and burn #>
New-ItemProperty -Path $ascomRoot -Name PlatformVersion -Value "6.1" -PropertyType String Force
New-ItemProperty -Path $ascomRoot -Name SerTraceFile -Value "C:\SerialTraceAuto.txt" -PropertyType String Force
@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\NUnit.3.13.3\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.13.3\build\NUnit.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{21EF28B4-D574-4A2D-A61D-5DF96AF46AB2}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Meade.net.UnitTests</RootNamespace>
<AssemblyName>Meade.net.UnitTests</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="ASCOM.Astrometry, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Astrometry.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Attributes, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Attributes.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Cache, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Cache.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Controls, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Controls.dll</HintPath>
</Reference>
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.DeviceInterfaces.dll</HintPath>
</Reference>
<Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.DriverAccess.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Exceptions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Exceptions.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Internal.Extensions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Internal.Extensions.dll</HintPath>
</Reference>
<Reference Include="ASCOM.SettingsProvider, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.SettingsProvider.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Utilities, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Utilities.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Utilities.Video, Version=6.1.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Utilities.Video.dll</HintPath>
</Reference>
<Reference Include="Castle.Core, Version=5.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\packages\Castle.Core.5.1.0\lib\net462\Castle.Core.dll</HintPath>
</Reference>
<Reference Include="JetBrains.Annotations, Version=4242.42.42.42, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
<HintPath>..\packages\JetBrains.Annotations.2022.3.1\lib\net20\JetBrains.Annotations.dll</HintPath>
</Reference>
<Reference Include="Moq, Version=4.18.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.18.2\lib\net462\Moq.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.13.3.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.13.3\lib\net45\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.7.0.0-preview.2.22152.2\lib\net462\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="SharedResourcesUnitTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ThreadSafeBoolTests.cs" />
<Compile Include="ThreadSafeDateTimeTests.cs" />
<Compile Include="ThreadSafeEnumTests.cs" />
<Compile Include="ThreadSafeNullableDoubleTests.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Meade.net\Meade.net.csproj">
<Project>{3689a2cb-94c5-4012-a5cf-7e7d1dd27143}</Project>
<Name>Meade.net</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\NUnit.3.13.3\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.13.3\build\NUnit.props'))" />
</Target>
</Project>
@@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Meade.net.UnitTests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Meade.net.UnitTests")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("21ef28b4-d574-4a2d-a61d-5df96af46ab2")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,39 @@
using ASCOM.Meade.net;
using NUnit.Framework;
namespace Meade.net.UnitTests
{
public class ThreadSafeBoolTests
{
[TestCase(false)]
[TestCase(true)]
public void When_Assigned_ThenValueIsSame(bool value)
{
// given
ThreadSafeValue<bool> sut = value;
// when
bool actual = sut;
// then
Assert.That(actual, Is.EqualTo(value));
}
[TestCase(false, false)]
[TestCase(false, true)]
[TestCase(true, false)]
[TestCase(true, true)]
public void When_SetValue_ThenValueIsUpdated(bool initialValue, bool setValue)
{
// given
ThreadSafeValue<bool> sut = initialValue;
// when
sut.Set(setValue);
bool afterset = sut;
// then
Assert.That(afterset, Is.EqualTo(setValue));
}
}
}
@@ -0,0 +1,61 @@
using ASCOM.Meade.net;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Globalization;
namespace Meade.net.UnitTests
{
public class ThreadSafeDateTimeTests
{
[TestCaseSource(nameof(DateTimeSource))]
public void When_Assigned_ThenValueIsSame(DateTime value)
{
// given
ThreadSafeValue<DateTime> sut = value;
// when
DateTime actual = sut;
// then
Assert.That(actual, Is.EqualTo(value));
}
[TestCaseSource(nameof(DateTimeSetSource))]
public void When_SetValue_ThenValueIsUpdated(DateTime initialValue, DateTime setValue)
{
// given
ThreadSafeValue<DateTime> sut = initialValue;
// when
sut.Set(setValue);
DateTime afterset = sut;
// then
Assert.That(afterset, Is.EqualTo(setValue));
}
static readonly DateTime Example1 = DateTimeOffset.Parse("2012-05-09T02:10:31.296761Z", CultureInfo.InvariantCulture).UtcDateTime;
static readonly DateTime Example2 = DateTimeOffset.Parse("2051-03-09T23:15:11.556081Z", CultureInfo.InvariantCulture).UtcDateTime;
static IEnumerable<DateTime> DateTimeSource => new[]
{
DateTime.MinValue,
Example1,
Example2
};
static IEnumerable<TestCaseData> DateTimeSetSource => new[]
{
new TestCaseData(DateTime.MinValue, Example1),
new TestCaseData(DateTime.MinValue, Example2),
new TestCaseData(DateTime.MinValue, DateTime.MinValue),
new TestCaseData(Example1, Example1),
new TestCaseData(Example1, Example2),
new TestCaseData(Example1, DateTime.MinValue),
new TestCaseData(Example2, Example1),
new TestCaseData(Example2, Example2),
new TestCaseData(Example2, DateTime.MinValue)
};
}
}
@@ -0,0 +1,46 @@
using ASCOM.DeviceInterface;
using ASCOM.Meade.net;
using NUnit.Framework;
namespace Meade.net.UnitTests
{
public class ThreadSafeEnumTests
{
[TestCase(PierSide.pierUnknown)]
[TestCase(PierSide.pierEast)]
[TestCase(PierSide.pierWest)]
public void When_Assigned_ThenValueIsSame(PierSide value)
{
// given
ThreadSafeValue<PierSide> sut = value;
// when
PierSide actual = sut;
// then
Assert.That(actual, Is.EqualTo(value));
}
[TestCase(PierSide.pierUnknown, PierSide.pierUnknown)]
[TestCase(PierSide.pierUnknown, PierSide.pierEast)]
[TestCase(PierSide.pierUnknown, PierSide.pierWest)]
[TestCase(PierSide.pierEast, PierSide.pierUnknown)]
[TestCase(PierSide.pierEast, PierSide.pierEast)]
[TestCase(PierSide.pierEast, PierSide.pierWest)]
[TestCase(PierSide.pierWest, PierSide.pierUnknown)]
[TestCase(PierSide.pierWest, PierSide.pierEast)]
[TestCase(PierSide.pierWest, PierSide.pierWest)]
public void When_SetValue_ThenValueIsUpdated(PierSide initialValue, PierSide setValue)
{
// given
ThreadSafeValue<PierSide> sut = initialValue;
// when
sut.Set(setValue);
PierSide afterset = sut;
// then
Assert.That(afterset, Is.EqualTo(setValue));
}
}
}
@@ -0,0 +1,45 @@
using ASCOM.Meade.net;
using NUnit.Framework;
namespace Meade.net.UnitTests
{
public class ThreadSafeNullableDoubleTests
{
[TestCase(0.1d)]
[TestCase(-12.34d)]
[TestCase(0d)]
[TestCase(null)]
public void When_Assigned_ThenValueIsSame(double? value)
{
// given
ThreadSafeValue<double?> sut = value;
// when
double? actual = sut;
// then
Assert.That(actual, Is.EqualTo(value));
}
[TestCase(0.1d, 0.2d)]
[TestCase(-12.34d, 5d)]
[TestCase(0d, 1d)]
[TestCase(null, 2d)]
[TestCase(0.1d, null)]
[TestCase(-12.34d, null)]
[TestCase(0d, null)]
[TestCase(null, null)]
public void When_SetValue_ThenValueIsUpdated(double? initialValue, double? setValue)
{
// given
ThreadSafeValue<double?> sut = initialValue;
// when
sut.Set(setValue);
double? afterset = sut;
// then
Assert.That(afterset, Is.EqualTo(setValue));
}
}
}
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
+11
View File
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ASCOM.Platform" version="6.5.2" targetFramework="net472" />
<package id="Castle.Core" version="5.1.0" targetFramework="net472" />
<package id="JetBrains.Annotations" version="2022.3.1" targetFramework="net472" />
<package id="Moq" version="4.18.2" targetFramework="net472" />
<package id="NUnit" version="3.13.3" targetFramework="net472" />
<package id="NUnit.ConsoleRunner" version="3.15.2" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="7.0.0-preview.2.22152.2" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
</packages>
+100 -167
View File
@@ -2,7 +2,6 @@
using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.InteropServices;
using ASCOM.DeviceInterface;
@@ -19,7 +18,7 @@ namespace ASCOM.Meade.net
// The ClassInterface/None addribute prevents an empty interface called
// _Meade.net from being created and used as the [default] interface
//
// TODO Replace the not implemented exceptions with code to implement the function or
// Replace the not implemented exceptions with code to implement the function or
// throw the appropriate ASCOM exception.
//
@@ -30,7 +29,8 @@ namespace ASCOM.Meade.net
[ProgId("ASCOM.MeadeGeneric.focuser")]
[ServedClassName("Meade Generic")]
[ClassInterface(ClassInterfaceType.None)]
public class Focuser : ReferenceCountedObjectBase, IFocuserV3
[ComVisible(true)]
public class Focuser : MeadeTelescopeBase, IFocuserV3
{
/// <summary>
/// ASCOM DeviceID (COM ProgID) for this driver.
@@ -38,26 +38,12 @@ namespace ASCOM.Meade.net
/// </summary>
//internal static string driverID = "ASCOM.Meade.net.Focuser";
private static readonly string DriverId = Marshal.GenerateProgIdForType(MethodBase.GetCurrentMethod().DeclaringType ?? throw new System.InvalidOperationException());
// TODO Change the descriptive string for your driver then remove this line
/// <summary>
/// Driver description that displays in the ASCOM Chooser.
/// </summary>
private static readonly string DriverDescription = "Meade Generic";
private static string _comPort; // Variables to hold the currrent device configuration
/// <summary>
/// Private variable to hold an ASCOM Utilities object
/// </summary>
private readonly IUtil _utilities;
/// <summary>
/// Variable to hold the trace logger object (creates a diagnostic log file with information that you specify)
/// </summary>
private static TraceLogger _tl;
private readonly ISharedResourcesWrapper _sharedResourcesWrapper;
/// <summary>
/// Initializes a new instance of the <see cref="Meade.net"/> class.
/// Must be public for COM registration.
@@ -67,33 +53,17 @@ namespace ASCOM.Meade.net
//todo move this out to IOC
var util = new Util(); //Initialise util object
_utilities = util;
_sharedResourcesWrapper = new SharedResourcesWrapper();
Initialise();
Initialise(nameof(Focuser));
}
public Focuser(IUtil util, ISharedResourcesWrapper sharedResourcesWrapper)
public Focuser(IUtil util, ISharedResourcesWrapper sharedResourcesWrapper, ITraceLogger traceLogger) : base(sharedResourcesWrapper)
{
_utilities = util;
_sharedResourcesWrapper = sharedResourcesWrapper;
Initialise();
Initialise(nameof(Focuser), traceLogger);
}
private void Initialise()
{
//todo move the TraceLogger out to a factory class.
_tl = new TraceLogger("", "Meade.Generic.focusser");
ReadProfile(); // Read device configuration from the ASCOM Profile store
IsConnected = false; // Initialise connected to false
LogMessage("Focuser", "Completed initialisation");
LogMessage("Focuser", $"Driver version: {DriverVersion}");
}
//
// PUBLIC COM INTERFACE IFocuserV3 IMPLEMENTATION
//
@@ -108,17 +78,17 @@ namespace ASCOM.Meade.net
/// </summary>
public void SetupDialog()
{
_tl.LogMessage("SetupDialog", "Opening setup dialog");
_sharedResourcesWrapper.SetupDialog();
Tl.LogMessage("SetupDialog", "Opening setup dialog", false);
SharedResourcesWrapper.SetupDialog();
ReadProfile();
_tl.LogMessage("SetupDialog", "complete");
Tl.LogMessage("SetupDialog", "complete", false);
}
public ArrayList SupportedActions
{
get
{
_tl.LogMessage("SupportedActions Get", "Returning empty arraylist");
Tl.LogMessage("SupportedActions Get", "Returning empty arraylist", false);
return new ArrayList();
}
}
@@ -131,41 +101,48 @@ namespace ASCOM.Meade.net
public void CommandBlind(string command, bool raw)
{
LogMessage("CommandBlind", "raw: {0} command {0}", raw, command);
CheckConnected("CommandBlind");
// Call CommandString and return as soon as it finishes
//this.CommandString(command, raw);
_sharedResourcesWrapper.SendBlind(command);
SharedResourcesWrapper.SendBlind(Tl, command, raw);
// or
//throw new ASCOM.MethodNotImplementedException("CommandBlind");
// DO NOT have both these sections! One or the other
LogMessage("CommandBlind", "Completed");
}
public bool CommandBool(string command, bool raw)
{
LogMessage("CommandBool", "raw: {0} command {0}", raw, command);
CheckConnected("CommandBool");
//string ret = CommandString(command, raw);
// TODO decode the return string and return true or false
var result = SharedResourcesWrapper.SendBool(Tl, command, raw);
LogMessage("CommandBool", "Completed: {0}", result);
return result;
// or
throw new MethodNotImplementedException("CommandBool");
//throw new MethodNotImplementedException("CommandBool");
// DO NOT have both these sections! One or the other
}
public string CommandString(string command, bool raw)
{
LogMessage("CommandString", "raw: {0} command {0}", raw, command);
CheckConnected("CommandString");
// it's a good idea to put all the low level communication with the device here,
// then all communication calls this function
// you need something to ensure that only one command is in progress at a time
return _sharedResourcesWrapper.SendString(command);
var result = SharedResourcesWrapper.SendString(Tl, command, raw);
LogMessage("CommandBool", "Completed: {0}", result);
return result;
//throw new ASCOM.MethodNotImplementedException("CommandString");
}
public void Dispose()
{
// Clean up the tracelogger and util objects
_tl.Enabled = false;
_tl.Dispose();
_tl = null;
Tl.Enabled = false;
//Tl.Dispose();
//Tl = null;
}
public bool Connected
@@ -177,7 +154,7 @@ namespace ASCOM.Meade.net
}
set
{
_tl.LogMessage("Connected", "Set {0}", value);
Tl.LogMessage("Connected", "Set {0}", value);
if (value == IsConnected)
return;
@@ -186,63 +163,31 @@ namespace ASCOM.Meade.net
try
{
ReadProfile();
_sharedResourcesWrapper.Connect("Serial", DriverId);
SharedResourcesWrapper.Connect("Serial", DriverId, Tl);
try
{
IsConnected = true;
}
catch (Exception)
{
_sharedResourcesWrapper.Disconnect("Serial", DriverId);
SharedResourcesWrapper.Disconnect("Serial", DriverId);
throw;
}
}
catch (Exception ex)
{
LogMessage("Connected Set", "Error connecting to port {0} - {1}", _comPort, ex.Message);
LogMessage("Connected Set", "Error connecting to port {0} - {1}", _profileProperties.ComPort, ex.Message);
}
}
else
{
LogMessage("Connected Set", "Disconnecting from port {0}", _comPort);
_sharedResourcesWrapper.Disconnect("Serial", DriverId);
LogMessage("Connected Set", "Disconnecting from port {0}", _profileProperties.ComPort);
SharedResourcesWrapper.Disconnect("Serial", DriverId);
IsConnected = false;
}
}
}
public string Description
{
// TODO customise this device description
get
{
_tl.LogMessage("Description Get", DriverDescription);
return DriverDescription;
}
}
public string DriverInfo
{
get
{
// TODO customise this driver description
string driverInfo = $"{Description} .net driver. Version: {DriverVersion}";
LogMessage("DriverInfo Get", driverInfo);
return driverInfo;
}
}
public string DriverVersion
{
get
{
Version version = Assembly.GetExecutingAssembly().GetName().Version;
string driverVersion = $"{version.Major}.{version.Minor}.{version.Build}.{version.Revision}";
LogMessage("DriverVersion Get", driverVersion);
return driverVersion;
}
}
public short InterfaceVersion
{
// set by the driver wizard
@@ -259,7 +204,7 @@ namespace ASCOM.Meade.net
{
//string name = "Short driver name - please customise";
string name = DriverDescription;
_tl.LogMessage("Name Get", name);
Tl.LogMessage("Name Get", name, false);
return name;
}
}
@@ -274,35 +219,29 @@ namespace ASCOM.Meade.net
{
CheckConnected("Absolute Get");
_tl.LogMessage("Absolute Get", false.ToString());
Tl.LogMessage("Absolute Get", false.ToString(), false);
return false; // This is a relative focuser
}
}
public void Halt()
{
_tl.LogMessage("Halt", "Halting");
Tl.LogMessage("Halt", "Halting", false);
CheckConnected("Halt");
//A single halt command is sometimes missed by the #909 apm, so let's do it a few times to be safe.
//todo make this mockable
Stopwatch stopwatch = Stopwatch.StartNew();
while (stopwatch.ElapsedMilliseconds < 1000)
{
_sharedResourcesWrapper.SendBlind(":FQ#");
//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(Tl, "FQ");
//:FQ# Halt Focuser Motion
//Returns: Nothing
_utilities.WaitForMilliseconds(250);
}
}
public bool IsMoving
{
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
}
}
@@ -311,45 +250,42 @@ namespace ASCOM.Meade.net
{
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
}
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
}
}
private readonly int _maxIncrement = 7000;
private readonly int _maxIncrement = 30000;
public int MaxIncrement
{
get
{
_tl.LogMessage("MaxIncrement Get", _maxIncrement.ToString());
Tl.LogMessage("MaxIncrement Get", _maxIncrement.ToString(), false);
return _maxIncrement; // Maximum change in one move
}
}
private readonly int _maxStep = 7000;
private readonly int _maxStep = 30000;
public int MaxStep
{
get
{
_tl.LogMessage("MaxStep Get", _maxStep.ToString());
Tl.LogMessage("MaxStep Get", _maxStep.ToString(), false);
return _maxStep;
}
}
public void Move(int position)
{
_tl.LogMessage("Move", position.ToString());
Tl.LogMessage("Move", position.ToString(), false);
CheckConnected("Move");
//todo implement backlash compensation
//todo implement direction reverse
//todo implement dynamic braking
if (position < -MaxIncrement || position > MaxIncrement)
{
throw new InvalidValueException($"position out of range {-MaxIncrement} < {position} < {MaxIncrement}");
@@ -358,45 +294,72 @@ namespace ASCOM.Meade.net
if (position == 0)
return;
MoveFocuser(position > 0, Math.Abs(position));
var direction = position > 0;
if (_profileProperties.ReverseFocusDirection)
direction = !direction;
//backlash compensation.
var backlashCompensationSteps = direction ? Math.Abs(_profileProperties.BacklashCompensation) : 0;
var steps = Math.Abs(position) + backlashCompensationSteps;
MoveFocuser(direction, steps);
//todo refactor the backlash compensation to combine the commands into as few moves as practicle.
//ApplyBacklashCompensation(direction);
if (direction & backlashCompensationSteps != 0)
{
Tl.LogMessage("Move", "Applying backlash compensation", false);
MoveFocuser(!direction, backlashCompensationSteps);
}
DynamicBreaking(direction);
//todo implement dynamic braking
//dynamic breaking is sending the command to move in the opposite direction immediatly followed by the command to stop.
}
private void DynamicBreaking(bool directionOut)
{
if (!_profileProperties.DynamicBreaking)
return;
Tl.LogMessage("Move", "Applying dynamic breaking", false);
PerformFocuserMove(directionOut);
Halt();
}
private void MoveFocuser(bool directionOut, int steps)
{
_sharedResourcesWrapper.Lock(() =>
{
//_sharedResourcesWrapper.SendBlind(":FF#");
//_sharedResourcesWrapper.SendBlind("FF");
//:FF# Set Focus speed to fastest setting
//Returns: Nothing
//:FS# Set Focus speed to slowest setting
//Returns: Nothing
//:F<n># Autostar, Autostar II set focuser speed to <n> where <n> is an ASCII digit 1..4
//:F<n># Autostar, Autostar II - set focuser speed to <n> where <n> is an ASCII digit 1..4
//Returns: Nothing
//All others Not Supported
//All others - Not Supported
_utilities.WaitForMilliseconds(100);
//A Single focus command sometimes gets lost on the #909, so sending lots of them solves the issue.
//todo make this mockable
Stopwatch stopwatch = Stopwatch.StartNew();
while (stopwatch.ElapsedMilliseconds < steps)
PerformFocuserMove(directionOut);
_utilities.WaitForMilliseconds(steps);
Halt();
}
private void PerformFocuserMove(bool directionOut)
{
_sharedResourcesWrapper.SendBlind(directionOut ? ":F+#" : ":F-#");
SharedResourcesWrapper.SendBlind(Tl, directionOut ? "F+" : "F-");
//:F+# Start Focuser moving inward (toward objective)
//Returns: None
//:F-# Start Focuser moving outward (away from objective)
//Returns: None
_utilities.WaitForMilliseconds(250);
}
Halt();
//This gives the focuser time to physically stop.
_utilities.WaitForMilliseconds(1000);
});
}
public int Position => throw new PropertyNotImplementedException("Position", false);
@@ -405,7 +368,7 @@ namespace ASCOM.Meade.net
{
get
{
_tl.LogMessage("StepSize Get", "Not implemented");
Tl.LogMessage("StepSize Get", "Not implemented", false);
throw new PropertyNotImplementedException("StepSize", false);
}
}
@@ -414,13 +377,13 @@ namespace ASCOM.Meade.net
{
get
{
_tl.LogMessage("TempComp Get", false.ToString());
Tl.LogMessage("TempComp Get", false.ToString(), false);
return false;
}
// ReSharper disable once ValueParameterNotUsed
set
{
_tl.LogMessage("TempComp Set", "Not implemented");
Tl.LogMessage("TempComp Set", "Not implemented", false);
throw new PropertyNotImplementedException("TempComp", false);
}
}
@@ -429,7 +392,7 @@ namespace ASCOM.Meade.net
{
get
{
_tl.LogMessage("TempCompAvailable Get", false.ToString());
Tl.LogMessage("TempCompAvailable Get", false.ToString(), false);
return false; // Temperature compensation is not available in this driver
}
}
@@ -438,7 +401,7 @@ namespace ASCOM.Meade.net
{
get
{
_tl.LogMessage("Temperature Get", "Not implemented");
Tl.LogMessage("Temperature Get", "Not implemented", false);
throw new PropertyNotImplementedException("Temperature", false);
}
}
@@ -461,9 +424,9 @@ namespace ASCOM.Meade.net
/// <param name="bRegister">If <c>true</c>, registers the driver, otherwise unregisters it.</param>
private static void RegUnregAscom(bool bRegister)
{
using (var p = new Profile())
using (IProfileWrapper p = ProfileFactory.Create())
{
p.DeviceType = "Focuser";
p.DeviceType = nameof(Focuser);
if (bRegister)
{
p.Register(DriverId, DriverDescription);
@@ -523,11 +486,6 @@ namespace ASCOM.Meade.net
#endregion
/// <summary>
/// Returns true if there is a valid connection to the driver hardware
/// </summary>
private bool IsConnected { get; set; }
/// <summary>
/// Use this function to throw an exception if we aren't connected to the hardware
/// </summary>
@@ -539,31 +497,6 @@ namespace ASCOM.Meade.net
throw new NotConnectedException($"Not connected to focuser when trying to execute: {message}");
}
}
/// <summary>
/// Read the device configuration from the ASCOM Profile store
/// </summary>
private void ReadProfile()
{
var profileProperties = _sharedResourcesWrapper.ReadProfile();
_tl.Enabled = profileProperties.TraceLogger;
_comPort = profileProperties.ComPort;
LogMessage("ReadProfile", $"Trace logger enabled: {_tl.Enabled}");
LogMessage("ReadProfile", $"Com Port: {_comPort}");
}
/// <summary>
/// Log helper function that takes formatted strings and arguments
/// </summary>
/// <param name="identifier"></param>
/// <param name="message"></param>
/// <param name="args"></param>
private static void LogMessage(string identifier, string message, params object[] args)
{
var msg = string.Format(message, args);
_tl.LogMessage(identifier, msg);
}
#endregion
}
}
+17 -13
View File
@@ -15,7 +15,7 @@
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>3.5</OldToolsVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<ApplicationIcon>ASCOM.ico</ApplicationIcon>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>ASCOMDriverTemplate.snk</AssemblyOriginatorKeyFile>
@@ -69,6 +69,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>..\bin\Release\</OutputPath>
@@ -78,40 +79,44 @@
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="ASCOM.Astrometry, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Astrometry.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Astrometry.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Attributes, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Attributes.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Attributes.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Cache, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Cache.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Cache.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Controls, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Controls.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Controls.dll</HintPath>
</Reference>
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.DeviceInterfaces.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.DeviceInterfaces.dll</HintPath>
</Reference>
<Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.DriverAccess.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.DriverAccess.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Exceptions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Exceptions.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Exceptions.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Internal.Extensions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Internal.Extensions.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Internal.Extensions.dll</HintPath>
</Reference>
<Reference Include="ASCOM.SettingsProvider, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.SettingsProvider.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.SettingsProvider.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Utilities, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Utilities.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Utilities.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Utilities.Video, Version=6.1.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Utilities.Video.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Utilities.Video.dll</HintPath>
</Reference>
<Reference Include="JetBrains.Annotations, Version=4242.42.42.42, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
<HintPath>..\packages\JetBrains.Annotations.2022.3.1\lib\net20\JetBrains.Annotations.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.configuration" />
@@ -149,7 +154,6 @@
<None Include="app.config" />
<None Include="ASCOM.png" />
<None Include="ASCOMDriverTemplate.snk" />
<None Include="BootstrapAscomProfileStore.ps1" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
@@ -1,5 +1,8 @@
<ProjectConfiguration>
<Settings>
<HiddenComponentWarnings>
<Value>CopyReferencedAssembliesToWorkspaceIsOn</Value>
</HiddenComponentWarnings>
<UseCPUArchitecture>x86</UseCPUArchitecture>
</Settings>
</ProjectConfiguration>
+1 -3
View File
@@ -5,7 +5,6 @@ using System.Runtime.InteropServices;
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
// TODO - Add your authorship information here
[assembly: AssemblyTitle("ASCOM.Meade.net.Focuser")]
[assembly: AssemblyDescription("ASCOM Focuser driver for Meade.net")]
[assembly: AssemblyConfiguration("")]
@@ -18,7 +17,7 @@ using System.Runtime.InteropServices;
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(true)]
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("4ad7a6d4-6d54-4a9a-bbf3-895353e318f8")]
@@ -33,6 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
//
// TODO - Set your driver's version here
[assembly: AssemblyVersion("0.0.0.0")]
[assembly: AssemblyFileVersion("0.0.0.0")]
+19 -25
View File
@@ -8,16 +8,10 @@
// </auto-generated>
//------------------------------------------------------------------------------
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Drawing;
using System.Globalization;
using System.Resources;
using System.Runtime.CompilerServices;
namespace ASCOM.Meade.net.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
@@ -25,27 +19,27 @@ namespace ASCOM.Meade.net.Properties {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[DebuggerNonUserCode()]
[CompilerGenerated()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static ResourceManager resourceMan;
private static global::System.Resources.ResourceManager resourceMan;
private static CultureInfo resourceCulture;
private static global::System.Globalization.CultureInfo resourceCulture;
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static ResourceManager ResourceManager {
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (ReferenceEquals(resourceMan, null)) {
ResourceManager temp = new ResourceManager("ASCOM.Meade.net.Properties.Resources", typeof(Resources).Assembly);
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ASCOM.Meade.net.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
@@ -56,8 +50,8 @@ namespace ASCOM.Meade.net.Properties {
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static CultureInfo Culture {
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
@@ -69,20 +63,20 @@ namespace ASCOM.Meade.net.Properties {
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static Bitmap ASCOM {
internal static System.Drawing.Bitmap ASCOM {
get {
object obj = ResourceManager.GetObject("ASCOM", resourceCulture);
return ((Bitmap)(obj));
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static Icon DefaultIcon {
internal static System.Drawing.Icon DefaultIcon {
get {
object obj = ResourceManager.GetObject("DefaultIcon", resourceCulture);
return ((Icon)(obj));
return ((System.Drawing.Icon)(obj));
}
}
}
+4 -8
View File
@@ -8,18 +8,14 @@
// </auto-generated>
//------------------------------------------------------------------------------
using System.CodeDom.Compiler;
using System.Configuration;
using System.Runtime.CompilerServices;
namespace ASCOM.Meade.net.Properties {
[CompilerGenerated()]
[GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.0.0.0")]
internal sealed partial class Settings : ApplicationSettingsBase {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.4.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(Synchronized(new Settings())));
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
+1 -1
View File
@@ -5,4 +5,4 @@
<section name="ASCOM.DeviceName.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</sectionGroup>
</configSections>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>
+2 -1
View File
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ASCOM.Platform" version="6.4.2" targetFramework="net40" />
<package id="ASCOM.Platform" version="6.5.2" targetFramework="net472" />
<package id="JetBrains.Annotations" version="2022.3.1" targetFramework="net472" />
</packages>
+15
View File
@@ -25,6 +25,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Meade.net.Telescope.UnitTes
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Meade.net.Focuser.UnitTests", "Meade.net.Focuser.UnitTests\Meade.net.Focuser.UnitTests.csproj", "{A3991FA7-23C3-405A-96F9-5AB03AC58F30}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Meade.net.UnitTests", "Meade.net.UnitTests\Meade.net.UnitTests.csproj", "{21EF28B4-D574-4A2D-A61D-5DF96AF46AB2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -137,6 +139,18 @@ Global
{A3991FA7-23C3-405A-96F9-5AB03AC58F30}.Release|x64.Build.0 = Release|Any CPU
{A3991FA7-23C3-405A-96F9-5AB03AC58F30}.Release|x86.ActiveCfg = Release|Any CPU
{A3991FA7-23C3-405A-96F9-5AB03AC58F30}.Release|x86.Build.0 = Release|Any CPU
{21EF28B4-D574-4A2D-A61D-5DF96AF46AB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{21EF28B4-D574-4A2D-A61D-5DF96AF46AB2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{21EF28B4-D574-4A2D-A61D-5DF96AF46AB2}.Debug|x64.ActiveCfg = Debug|Any CPU
{21EF28B4-D574-4A2D-A61D-5DF96AF46AB2}.Debug|x64.Build.0 = Debug|Any CPU
{21EF28B4-D574-4A2D-A61D-5DF96AF46AB2}.Debug|x86.ActiveCfg = Debug|Any CPU
{21EF28B4-D574-4A2D-A61D-5DF96AF46AB2}.Debug|x86.Build.0 = Debug|Any CPU
{21EF28B4-D574-4A2D-A61D-5DF96AF46AB2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{21EF28B4-D574-4A2D-A61D-5DF96AF46AB2}.Release|Any CPU.Build.0 = Release|Any CPU
{21EF28B4-D574-4A2D-A61D-5DF96AF46AB2}.Release|x64.ActiveCfg = Release|Any CPU
{21EF28B4-D574-4A2D-A61D-5DF96AF46AB2}.Release|x64.Build.0 = Release|Any CPU
{21EF28B4-D574-4A2D-A61D-5DF96AF46AB2}.Release|x86.ActiveCfg = Release|Any CPU
{21EF28B4-D574-4A2D-A61D-5DF96AF46AB2}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -147,6 +161,7 @@ Global
{AD4959DD-33D7-4C3F-8DB0-7361D8E74A95} = {0958D817-269C-44BE-BEFB-F3E6A409DE91}
{B7EEEEFD-5BFF-443D-981C-7B8AB5DFDE33} = {0958D817-269C-44BE-BEFB-F3E6A409DE91}
{A3991FA7-23C3-405A-96F9-5AB03AC58F30} = {0958D817-269C-44BE-BEFB-F3E6A409DE91}
{21EF28B4-D574-4A2D-A61D-5DF96AF46AB2} = {0958D817-269C-44BE-BEFB-F3E6A409DE91}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3C0509DC-C7F5-48DC-920D-DCFD9C879BD2}
+6
View File
@@ -0,0 +1,6 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/Housekeeping/ExcludedProjects/ProjectMasksToIgnore/=_002A_002A_005C_002A_002EUnitTests/@EntryIndexedValue">False</s:Boolean>
<s:Boolean x:Key="/Default/Housekeeping/ExcludedProjects/ProjectMasksToIgnore/=_002A_002A_005C_002A_002EUnitTests/@EntryIndexRemoved">True</s:Boolean>
<s:Boolean x:Key="/Default/Housekeeping/ExcludedProjects/ProjectMasksToIgnore/=_002A_002EUnitTests_002E_002A/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=ASCOM/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Autostar/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
+4
View File
@@ -2,6 +2,10 @@
<Settings>
<AllowParallelTestExecution>True</AllowParallelTestExecution>
<CopyReferencedAssembliesToWorkspace>True</CopyReferencedAssembliesToWorkspace>
<MetricsExclusionList>
<Value>FocuserTestConsole\FocuserTestConsole.csproj</Value>
<Value>TelescopeTestConsole\TelescopeTestConsole.csproj</Value>
</MetricsExclusionList>
<SolutionConfigured>True</SolutionConfigured>
</Settings>
</SolutionConfiguration>
-16
View File
@@ -1,16 +0,0 @@
<SolutionConfiguration>
<Settings>
<AutoEnable>True</AutoEnable>
<CurrentEngineMode>Run all tests automatically [Global]</CurrentEngineMode>
<MetricsTreeShowTestProjects>False</MetricsTreeShowTestProjects>
<StatusIndicatorSplitterDistance>25</StatusIndicatorSplitterDistance>
<TestsWindowMenuOptions>
<VerticalSplitMenuOption>false</VerticalSplitMenuOption>
<ShowPassingTestsMenuOption>false</ShowPassingTestsMenuOption>
<ShowFailingTestsMenuOption>true</ShowFailingTestsMenuOption>
<ShowUnexecutedTestsMenuOption>true</ShowUnexecutedTestsMenuOption>
<ShowIgnoredTestsMenuOption>false</ShowIgnoredTestsMenuOption>
</TestsWindowMenuOptions>
<TestsWindowSplitterDistance>451</TestsWindowSplitterDistance>
</Settings>
</SolutionConfiguration>
+1 -1
View File
@@ -2,7 +2,7 @@ namespace ASCOM.Meade.net
{
public class ConnectionInfo
{
public int Connections { get; set; }
//public int Connections { get; set; }
public int SameDevice { get; set; }
}
}
+39
View File
@@ -0,0 +1,39 @@
using System;
using System.Linq;
using System.Reflection;
namespace ASCOM.Meade.net
{
public static class EnumExtensionMethods
{
public static string GetDescription(this Enum GenericEnum)
{
var genericEnumType = GenericEnum.GetType();
var memberInfo = genericEnumType.GetMember(GenericEnum.ToString());
if (memberInfo.Length > 0)
{
var _Attribs = memberInfo[0]
.GetCustomAttributes(typeof(System.ComponentModel.DescriptionAttribute), false);
if (_Attribs.Any())
{
return ((System.ComponentModel.DescriptionAttribute) _Attribs.ElementAt(0)).Description;
}
}
return GenericEnum.ToString();
}
public static T GetValueFromDescription<T>( string description) where T : Enum
{
foreach (T value in Enum.GetValues(typeof(T)))
{
if (value.GetDescription() == description)
{
return value;
}
}
return default;
}
}
}
+21 -14
View File
@@ -173,8 +173,10 @@ namespace ASCOM.Meade.net
_sComObjectTypes = new ArrayList();
// put everything into one folder, the same as the server.
string assyPath = Assembly.GetEntryAssembly().Location;
string assyPath = Assembly.GetEntryAssembly()?.Location;
assyPath = Path.GetDirectoryName(assyPath);
if (assyPath == null)
throw new System.InvalidOperationException();
DirectoryInfo d = new DirectoryInfo(assyPath);
foreach (FileInfo fi in d.GetFiles("*.dll"))
@@ -295,9 +297,9 @@ namespace ASCOM.Meade.net
//
using (RegistryKey key = Registry.ClassesRoot.CreateSubKey("APPID\\" + _sAppId))
{
key.SetValue(null, assyDescription);
key.SetValue("AppID", _sAppId);
key.SetValue("AuthenticationLevel", 1, RegistryValueKind.DWord);
key?.SetValue(null, assyDescription);
key?.SetValue("AppID", _sAppId);
key?.SetValue("AuthenticationLevel", 1, RegistryValueKind.DWord);
}
//
// HKCR\APPID\exename.ext
@@ -305,7 +307,7 @@ namespace ASCOM.Meade.net
using (RegistryKey key = Registry.ClassesRoot.CreateSubKey(
$"APPID\\{Application.ExecutablePath.Substring(Application.ExecutablePath.LastIndexOf('\\') + 1)}"))
{
key.SetValue("AppID", _sAppId);
key?.SetValue("AppID", _sAppId);
}
}
catch (Exception ex)
@@ -333,20 +335,25 @@ namespace ASCOM.Meade.net
using (RegistryKey key = Registry.ClassesRoot.CreateSubKey($"CLSID\\{clsid}"))
{
key.SetValue(null, progid); // Could be assyTitle/Desc??, but .NET components show ProgId here
key.SetValue("AppId", _sAppId);
key?.SetValue(null, progid); // Could be assyTitle/Desc??, but .NET components show ProgId here
key?.SetValue("AppId", _sAppId);
if (key != null)
{
using (RegistryKey key2 = key.CreateSubKey("Implemented Categories"))
{
key2.CreateSubKey("{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}");
key2?.CreateSubKey("{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}");
}
using (RegistryKey key2 = key.CreateSubKey("ProgId"))
{
key2.SetValue(null, progid);
key2?.SetValue(null, progid);
}
key.CreateSubKey("Programmable");
using (RegistryKey key2 = key.CreateSubKey("LocalServer32"))
{
key2.SetValue(null, Application.ExecutablePath);
key2?.SetValue(null, Application.ExecutablePath);
}
}
}
//
@@ -354,10 +361,10 @@ namespace ASCOM.Meade.net
//
using (RegistryKey key = Registry.ClassesRoot.CreateSubKey(progid))
{
key.SetValue(null, assyTitle);
key?.SetValue(null, assyTitle);
using (RegistryKey key2 = key.CreateSubKey("CLSID"))
{
key2.SetValue(null, clsid);
key2?.SetValue(null, clsid);
}
}
//
@@ -388,7 +395,7 @@ namespace ASCOM.Meade.net
//
// Remove all traces of this from the registry.
//
// **TODO** If the above does AppID/DCOM stuff, this would have
// If the above does AppID/DCOM stuff, this would have
// to remove that stuff too.
//
private static void UnregisterObjects()
@@ -492,7 +499,7 @@ namespace ASCOM.Meade.net
bool bRet = true;
//
//**TODO** -Embedding is "ActiveX start". Prohibit non_AX starting?
// -Embedding is "ActiveX start". Prohibit non_AX starting?
//
if (args.Length > 0)
{
+25 -13
View File
@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ASCOM.Meade.net</RootNamespace>
<AssemblyName>ASCOM.Meade.net.Server</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>2.0</OldToolsVersion>
@@ -82,40 +82,44 @@
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="ASCOM.Astrometry, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Astrometry.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Astrometry.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Attributes, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Attributes.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Attributes.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Cache, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Cache.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Cache.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Controls, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Controls.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Controls.dll</HintPath>
</Reference>
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.DeviceInterfaces.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.DeviceInterfaces.dll</HintPath>
</Reference>
<Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.DriverAccess.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.DriverAccess.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Exceptions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Exceptions.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Exceptions.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Internal.Extensions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Internal.Extensions.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Internal.Extensions.dll</HintPath>
</Reference>
<Reference Include="ASCOM.SettingsProvider, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.SettingsProvider.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.SettingsProvider.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Utilities, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Utilities.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Utilities.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Utilities.Video, Version=6.1.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Utilities.Video.dll</HintPath>
<HintPath>..\packages\ASCOM.Platform.6.5.2\lib\net40\ASCOM.Utilities.Video.dll</HintPath>
</Reference>
<Reference Include="JetBrains.Annotations, Version=4242.42.42.42, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
<HintPath>..\packages\JetBrains.Annotations.2022.3.1\lib\net20\JetBrains.Annotations.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Drawing" />
@@ -125,6 +129,7 @@
<Compile Include="AssemblyInfo.cs" />
<Compile Include="ClassFactory.cs" />
<Compile Include="ConnectionInfo.cs" />
<Compile Include="EnumExtensionMethods.cs" />
<Compile Include="frmMain.cs">
<SubType>Form</SubType>
</Compile>
@@ -132,11 +137,18 @@
<DependentUpon>frmMain.cs</DependentUpon>
</Compile>
<Compile Include="GarbageCollection.cs" />
<Compile Include="AstroMaths\HorizonCoordinates.cs" />
<Compile Include="LocalServer.cs" />
<Compile Include="MeadeTelescopeBase.cs" />
<Compile Include="ParkedBehaviour.cs" />
<Compile Include="ParkedPosition.cs" />
<Compile Include="ProfileFactory.cs" />
<Compile Include="ProfileProperties.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TelescopeList.cs" />
<Compile Include="ThreadSafeValue.cs" />
<Compile Include="Win32Utilities.cs" />
<Compile Include="Wrapper\IProfileWrapper.cs" />
<Compile Include="Wrapper\SharedResourcesWrapper.cs" />
<EmbeddedResource Include="frmMain.resx">
<SubType>Designer</SubType>
@@ -167,7 +179,6 @@
<ItemGroup>
<Content Include="ASCOM.ico" />
<Content Include="ASCOM.png" />
<None Include="BootstrapAscomProfileStore.ps1" />
<None Include="packages.config" />
<None Include="Resources\ASCOM.bmp" />
</ItemGroup>
@@ -192,6 +203,7 @@
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
+141
View File
@@ -0,0 +1,141 @@
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using ASCOM.Meade.net.Wrapper;
using ASCOM.Utilities;
using ASCOM.Utilities.Interfaces;
namespace ASCOM.Meade.net
{
[ComVisible(false)]
public class MeadeTelescopeBase : ReferenceCountedObjectBase
{
/// <summary>
/// Variable to hold the trace logger object (creates a diagnostic log file with information that you specify)
/// </summary>
protected static ITraceLogger Tl;
/// <summary>
/// Driver description that displays in the ASCOM Chooser.
/// </summary>
protected static readonly string DriverDescription = "Meade Generic";
protected readonly ISharedResourcesWrapper SharedResourcesWrapper;
protected ProfileProperties _profileProperties;
public MeadeTelescopeBase()
{
SharedResourcesWrapper = new SharedResourcesWrapper();
}
public MeadeTelescopeBase(ISharedResourcesWrapper sharedResourcesWrapper)
{
SharedResourcesWrapper = sharedResourcesWrapper;
}
protected void Initialise(string className, ITraceLogger traceLogger = null)
{
Tl = traceLogger ?? new TraceLogger("", $"Meade.Generic.{className}");
ReadProfile(); // Read device configuration from the ASCOM Profile store
IsConnected = false; // Initialise connected to false
LogMessage(className, "Completed initialisation");
LogMessage(className, $"Driver version: {DriverVersion}");
}
/// <summary>
/// Read the device configuration from the ASCOM Profile store
/// </summary>
protected void ReadProfile()
{
_profileProperties = SharedResourcesWrapper.ReadProfile();
Tl.Enabled = _profileProperties.TraceLogger;
LogMessage("ReadProfile", $"Trace logger enabled: {Tl.Enabled}");
LogMessage("ReadProfile", $"Com Port: {_profileProperties.ComPort}");
LogMessage("ReadProfile", $"Backlash Steps: {_profileProperties.BacklashCompensation}");
LogMessage("ReadProfile", $"Dynamic breaking: {_profileProperties.DynamicBreaking}");
LogMessage("ReadProfile", $"Guide Rate: {_profileProperties.GuideRateArcSecondsPerSecond}");
LogMessage("ReadProfile", $"Precision: {_profileProperties.Precision}");
LogMessage("ReadProfile", $"Guiding Style: {_profileProperties.GuidingStyle}");
LogMessage("ReadProfile", $"Site Elevation: {_profileProperties.SiteElevation}");
LogMessage("ReadProfile", $"Settle Time after slew: {_profileProperties.SettleTime}");
LogMessage("ReadProfile", $"Send date and time on connect: {_profileProperties.SendDateTime}");
LogMessage("ReadProfile", $"Override attempt to bypass intro prompts: {_profileProperties.IntroPromptBypassOverride}");
LogMessage("ReadProfile", $"Parked Behaviour: {_profileProperties.ParkedBehaviour}");
LogMessage("ReadProfile", $"Parked Alt: {_profileProperties.ParkedAlt}");
LogMessage("ReadProfile", $"Parked Az: {_profileProperties.ParkedAz}");
LogMessage("ReadProfile", $"Focal Length: {_profileProperties.FocalLength}");
LogMessage("ReadProfile", $"Aperture Area: {_profileProperties.ApertureArea}");
LogMessage("ReadProfile", $"Aperture Area: {_profileProperties.ApertureDiameter}");
}
/// <summary>
/// Log helper function that takes formatted strings and arguments
/// </summary>
/// <param name="identifier"></param>
/// <param name="message"></param>
/// <param name="args"></param>
public static void LogMessage(string identifier, string message, params object[] args)
{
var msg = string.Format(message, args);
Tl.LogMessage(identifier, msg, false);
}
/// <summary>
/// Returns true if there is a valid connection to the driver hardware
/// </summary>
protected bool IsConnected { get; set; }
public string Description
{
get
{
Tl.LogMessage("Description Get", DriverDescription, false);
return DriverDescription;
}
}
public string DriverInfo
{
get
{
string driverInfo = $"{Description} .net driver. Version: {DriverVersion}";
LogMessage("DriverInfo Get", driverInfo);
return driverInfo;
}
}
public string DriverVersion
{
get
{
Version version = Assembly.GetExecutingAssembly().GetName().Version;
string driverVersion = $"{version.Major}.{version.Minor}.{version.Build}.{version.Revision}";
LogMessage("DriverVersion Get", driverVersion);
return driverVersion;
}
}
#region ASCOM Registration
private static IProfileFactory _profileFactory;
public static IProfileFactory ProfileFactory
{
get => _profileFactory ?? (_profileFactory = new ProfileFactory());
set => _profileFactory = value;
}
#endregion
protected void UpdateSiteElevation()
{
var profileProperties = SharedResourcesWrapper.ReadProfile();
profileProperties.SiteElevation = _profileProperties.SiteElevation;
SharedResourcesWrapper.WriteProfile(profileProperties);
}
}
}
+14
View File
@@ -0,0 +1,14 @@
using System.ComponentModel;
namespace ASCOM.Meade.net
{
public enum ParkedBehaviour
{
[Description("No Coordinates")]
NoCoordinates,
[Description("Last Good Position")]
LastGoodPosition,
[Description("Report coordinates as")]
ReportCoordinates
}
}
+12
View File
@@ -0,0 +1,12 @@
namespace ASCOM.Meade.net
{
public class ParkedPosition
{
public double Altitude { get; set; }
public double Azimuth { get; set; }
public double RightAscension { get; set; }
public double Declination { get; set; }
public double SiteLongitude { get; set; }
public double SiteLatitude { get; set; }
}
}
+17
View File
@@ -0,0 +1,17 @@
using ASCOM.Meade.net.Wrapper;
namespace ASCOM.Meade.net
{
public interface IProfileFactory
{
IProfileWrapper Create();
}
public class ProfileFactory : IProfileFactory
{
public IProfileWrapper Create()
{
return new ProfileWrapper();
}
}
}
+20
View File
@@ -7,5 +7,25 @@ namespace ASCOM.Meade.net
public bool TraceLogger { get; set; }
public double GuideRateArcSecondsPerSecond { get; set; }
public string Precision { get; set; }
public string GuidingStyle { get; set; }
public int BacklashCompensation { get; set; }
public bool ReverseFocusDirection { get; set; }
public bool DynamicBreaking { get; set; }
public bool RtsDtrEnabled { get; set; }
public double SiteElevation { get; set; }
public short SettleTime { get; set; }
public int DataBits { get; set; }
public string StopBits { get; set; }
public string Parity { get; set; }
public int Speed { get; set; }
public string Handshake { get; set; }
public bool SendDateTime { get; set; }
public ParkedBehaviour ParkedBehaviour { get; set; }
public double ParkedAlt { get; set; }
public double ParkedAz { get; set; }
public double FocalLength { get; set; }
public double ApertureArea { get; set; }
public double ApertureDiameter { get; set; }
public bool IntroPromptBypassOverride { get; set; }
}
}
+18
View File
@@ -135,5 +135,23 @@ namespace ASCOM.Meade.net.Properties {
return ResourceManager.GetString("SetupDialogForm_TextBox1_TextChanged___0_00_0___of_sidereal_rate_", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Please enter only numbers..
/// </summary>
internal static string SetupDialogForm_txtElevation_TextChanged_1_Please_enter_only_numbers_ {
get {
return ResourceManager.GetString("SetupDialogForm_txtElevation_TextChanged_1_Please_enter_only_numbers_", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Please enter only numbers..
/// </summary>
internal static string SetupDialogForm_txtFocalLength_TextChanged_1_Please_enter_only_numbers_ {
get {
return ResourceManager.GetString("SetupDialogForm_txtFocalLength_TextChanged_1_Please_enter_only_numbers_", resourceCulture);
}
}
}
}
+6
View File
@@ -144,4 +144,10 @@ Valid are : -register, -unregister and -embedding</value>
<data name="SetupDialogForm_SetupDialogForm__0__Settings___1__" xml:space="preserve">
<value>{0} Settings ({1})</value>
</data>
<data name="SetupDialogForm_txtElevation_TextChanged_1_Please_enter_only_numbers_" xml:space="preserve">
<value>Please enter only numbers.</value>
</data>
<data name="SetupDialogForm_txtFocalLength_TextChanged_1_Please_enter_only_numbers_" xml:space="preserve">
<value>Please enter only numbers.</value>
</data>
</root>
+256 -3
View File
@@ -1,11 +1,14 @@
using System;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO.Ports;
using System.Linq;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using ASCOM.Meade.net.Properties;
using ASCOM.Utilities;
namespace ASCOM.Meade.net
{
@@ -19,6 +22,50 @@ namespace ASCOM.Meade.net
var assemblyInfo = new AssemblyInfo();
Text = string.Format(Resources.SetupDialogForm_SetupDialogForm__0__Settings___1__, assemblyInfo.Product, assemblyInfo.AssemblyVersion);
SetItemsFromEnum(cboStopBits.Items, typeof(SerialStopBits));
SetItemsFromEnum(cboParity.Items, typeof(SerialParity));
SetItemFromEnumValues(cboSpeed.Items, SerialSpeed.ps1200, SerialSpeed.ps57600);
SetItemsFromEnum(cboHandShake.Items, typeof(SerialHandshake));
SetItemsFromEnum(cboParkedBehaviour.Items, typeof(ParkedBehaviour));
}
private void SetItemsFromEnum(IList items, Type enumItems)
{
items.Clear();
foreach (var value in Enum.GetValues(enumItems) )
{
var val = value as Enum;
items.Add(val.GetDescription());
}
}
//private void SetItemsFromEnumValues(IList items, Type enumItems)
//{
// items.Clear();
// foreach (int item in Enum.GetValues(enumItems))
// {
// items.Add(item);
// }
//}
private void SetItemFromEnumValues<T>(IList items, T minValue, T maxValue)
{
items.Clear();
var type = typeof(T);
var intMinValue = (int)Convert.ChangeType(minValue, typeof(int));
var intMaxValue = (int)Convert.ChangeType(maxValue, typeof(int));
foreach (int item in Enum.GetValues(type))
{
if ((item >= intMinValue) && (item <= intMaxValue))
items.Add(item);
}
}
public sealed override string Text
@@ -54,14 +101,15 @@ namespace ASCOM.Meade.net
chkTrace.Checked = profileProperties.TraceLogger;
// set the list of com ports to those that are currently available
comboBoxComPort.Items.Clear();
comboBoxComPort.Items.AddRange(SerialPort
.GetPortNames()); // use System.IO because it's static
comboBoxComPort.Items.AddRange(SerialPort.GetPortNames().ToArray<object>()); // use System.IO because it's static
// select the current port if possible
if (comboBoxComPort.Items.Contains(profileProperties.ComPort))
{
comboBoxComPort.SelectedItem = profileProperties.ComPort;
}
cbxRtsDtr.Checked = profileProperties.RtsDtrEnabled;
txtGuideRate.Text = profileProperties.GuideRateArcSecondsPerSecond.ToString(CultureInfo.CurrentCulture);
try
{
@@ -71,6 +119,121 @@ namespace ASCOM.Meade.net
{
cboPrecision.SelectedItem = "Unchanged";
}
try
{
cboGuidingStyle.SelectedItem = profileProperties.GuidingStyle;
}
catch (Exception)
{
cboGuidingStyle.SelectedItem = "Auto";
}
numDatabits.Value = profileProperties.DataBits;
try
{
cboStopBits.SelectedItem = profileProperties.StopBits;
}
catch (Exception)
{
cboStopBits.SelectedItem = "One";
}
try
{
cboParity.SelectedItem = profileProperties.Parity;
}
catch (Exception)
{
cboParity.SelectedItem = "None";
}
try
{
cboSpeed.SelectedItem = profileProperties.Speed;
}
catch (Exception)
{
cboParity.SelectedItem = "9600";
}
try
{
cboHandShake.SelectedItem = profileProperties.Handshake;
}
catch (Exception)
{
cboHandShake.SelectedItem = "None";
}
txtBacklashSteps.Text = profileProperties.BacklashCompensation.ToString(CultureInfo.CurrentCulture);
txtElevation.Text = profileProperties.SiteElevation.ToString(CultureInfo.CurrentCulture);
cbxReverseDirection.Checked = profileProperties.ReverseFocusDirection;
cbxDynamicBreaking.Checked = profileProperties.DynamicBreaking;
nudSettleTime.Value = profileProperties.SettleTime;
cbxSendDateTime.Checked = profileProperties.SendDateTime;
cbxIntroPromptBypassOverride.Checked = profileProperties.IntroPromptBypassOverride;
try
{
cboParkedBehaviour.SelectedItem = profileProperties.ParkedBehaviour.GetDescription();
}
catch (Exception)
{
cboParkedBehaviour.SelectedItem = ParkedBehaviour.NoCoordinates.GetDescription();
}
try
{
txtParkedAlt.Text = profileProperties.ParkedAlt.ToString(CultureInfo.CurrentCulture);
}
catch (Exception)
{
txtParkedAlt.Text = "0";
}
try
{
txtParkedAz.Text = profileProperties.ParkedAz.ToString(CultureInfo.CurrentCulture);
}
catch (Exception)
{
txtParkedAz.Text = "180";
}
try
{
txtFocalLength.Text = profileProperties.FocalLength.ToString(CultureInfo.CurrentCulture);
}
catch (Exception)
{
txtFocalLength.Text = "2000";
}
try
{
txtApertureArea.Text = profileProperties.ApertureArea.ToString(CultureInfo.CurrentCulture);
}
catch (Exception)
{
txtApertureArea.Text = "32685";
}
try
{
txtApertureDiameter.Text = profileProperties.ApertureDiameter.ToString(CultureInfo.CurrentCulture);
}
catch (Exception)
{
txtApertureDiameter.Text = "203";
}
UpdateParkedItemsEnabled();
}
public ProfileProperties GetProfile()
@@ -79,8 +242,28 @@ namespace ASCOM.Meade.net
{
TraceLogger = chkTrace.Checked,
ComPort = comboBoxComPort.SelectedItem.ToString(),
RtsDtrEnabled = cbxRtsDtr.Checked,
DataBits = Convert.ToInt32(numDatabits.Value),
StopBits = cboStopBits.SelectedItem.ToString(),
Parity = cboParity.SelectedItem.ToString(),
Speed = Convert.ToInt32(cboSpeed.SelectedItem),
Handshake = cboHandShake.SelectedItem.ToString(),
GuideRateArcSecondsPerSecond = double.Parse(txtGuideRate.Text.Trim()),
Precision = cboPrecision.SelectedItem.ToString()
Precision = cboPrecision.SelectedItem.ToString(),
GuidingStyle = cboGuidingStyle.SelectedItem.ToString(),
BacklashCompensation = int.Parse(txtBacklashSteps.Text),
ReverseFocusDirection = cbxReverseDirection.Checked,
DynamicBreaking = cbxDynamicBreaking.Checked,
SiteElevation = double.Parse(txtElevation.Text),
SettleTime = Convert.ToInt16(nudSettleTime.Value),
SendDateTime = cbxSendDateTime.Checked,
IntroPromptBypassOverride = cbxIntroPromptBypassOverride.Checked,
ParkedBehaviour = EnumExtensionMethods.GetValueFromDescription<ParkedBehaviour>(cboParkedBehaviour.SelectedItem.ToString()),
ParkedAlt = double.Parse(txtParkedAlt.Text),
ParkedAz = double.Parse(txtParkedAz.Text),
FocalLength = double.Parse(txtFocalLength.Text),
ApertureArea = double.Parse(txtApertureArea.Text),
ApertureDiameter = double.Parse(txtApertureDiameter.Text)
};
return profileProperties;
@@ -139,5 +322,75 @@ namespace ASCOM.Meade.net
//txtGuideRate.Enabled = false;
//cboPrecision.Enabled = false;
}
private void txtElevation_TextChanged_1(object sender, EventArgs e)
{
if (System.Text.RegularExpressions.Regex.IsMatch(txtElevation.Text, "[^0-9]"))
{
MessageBox.Show(Resources.SetupDialogForm_txtElevation_TextChanged_1_Please_enter_only_numbers_);
txtElevation.Text = txtElevation.Text.Remove(txtElevation.Text.Length - 1);
}
}
private void txtBacklashSteps_TextChanged(object sender, EventArgs e)
{
if (System.Text.RegularExpressions.Regex.IsMatch(txtBacklashSteps.Text, "[^0-9]"))
{
MessageBox.Show(Resources.SetupDialogForm_txtElevation_TextChanged_1_Please_enter_only_numbers_);
txtBacklashSteps.Text = txtElevation.Text.Remove(txtBacklashSteps.Text.Length - 1);
}
}
private void cboParkedBehaviour_SelectionChangeCommitted(object sender, EventArgs e)
{
UpdateParkedItemsEnabled();
}
private void UpdateParkedItemsEnabled()
{
txtParkedAlt.Enabled = cboParkedBehaviour.SelectedItem?.ToString() == "Report coordinates as";
txtParkedAz.Enabled = txtParkedAlt.Enabled;
}
private void txtParkedAlt_TextChanged(object sender, EventArgs e)
{
if (System.Text.RegularExpressions.Regex.IsMatch(txtParkedAlt.Text, "[^0-9]"))
{
MessageBox.Show(Resources.SetupDialogForm_txtElevation_TextChanged_1_Please_enter_only_numbers_);
txtParkedAlt.Text = txtParkedAlt.Text.Remove(txtParkedAlt.Text.Length - 1);
}
}
private void txtParkedAz_TextChanged(object sender, EventArgs e)
{
if (System.Text.RegularExpressions.Regex.IsMatch(txtParkedAz.Text, "[^0-9]"))
{
MessageBox.Show(Resources.SetupDialogForm_txtElevation_TextChanged_1_Please_enter_only_numbers_);
txtParkedAz.Text = txtParkedAz.Text.Remove(txtParkedAz.Text.Length - 1);
}
}
private void txt_FocalLength_TextChanged_1(object sender, EventArgs e)
{
if (System.Text.RegularExpressions.Regex.IsMatch(txtFocalLength.Text, "[^0-9]"))
{
MessageBox.Show(Resources.SetupDialogForm_txtFocalLength_TextChanged_1_Please_enter_only_numbers_);
txtFocalLength.Text = txtFocalLength.Text.Remove(txtFocalLength.Text.Length - 1);
}
}
private void button1_Click(object sender, EventArgs e)
{
string myDocumentsPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
Process.Start(new ProcessStartInfo()
{
FileName = $"{myDocumentsPath}\\ASCOM",
UseShellExecute = true,
Verb = "open"
});
}
}
}
+422
View File
@@ -31,6 +31,7 @@ namespace ASCOM.Meade.net
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SetupDialogForm));
this.cmdOK = new System.Windows.Forms.Button();
this.cmdCancel = new System.Windows.Forms.Button();
@@ -45,7 +46,56 @@ namespace ASCOM.Meade.net
this.lblPercentOfSiderealRate = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.cboPrecision = new System.Windows.Forms.ComboBox();
this.label6 = new System.Windows.Forms.Label();
this.cboGuidingStyle = new System.Windows.Forms.ComboBox();
this.label7 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.txtBacklashSteps = new System.Windows.Forms.TextBox();
this.label9 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.label11 = new System.Windows.Forms.Label();
this.cbxReverseDirection = new System.Windows.Forms.CheckBox();
this.cbxDynamicBreaking = new System.Windows.Forms.CheckBox();
this.cbxRtsDtr = new System.Windows.Forms.CheckBox();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.cbxSendDateTime = new System.Windows.Forms.CheckBox();
this.label12 = new System.Windows.Forms.Label();
this.txtElevation = new System.Windows.Forms.TextBox();
this.label13 = new System.Windows.Forms.Label();
this.label14 = new System.Windows.Forms.Label();
this.nudSettleTime = new System.Windows.Forms.NumericUpDown();
this.label15 = new System.Windows.Forms.Label();
this.label16 = new System.Windows.Forms.Label();
this.cboStopBits = new System.Windows.Forms.ComboBox();
this.numDatabits = new System.Windows.Forms.NumericUpDown();
this.cboParity = new System.Windows.Forms.ComboBox();
this.cboSpeed = new System.Windows.Forms.ComboBox();
this.cboHandShake = new System.Windows.Forms.ComboBox();
this.label17 = new System.Windows.Forms.Label();
this.label18 = new System.Windows.Forms.Label();
this.label19 = new System.Windows.Forms.Label();
this.label20 = new System.Windows.Forms.Label();
this.label21 = new System.Windows.Forms.Label();
this.cboParkedBehaviour = new System.Windows.Forms.ComboBox();
this.label22 = new System.Windows.Forms.Label();
this.label23 = new System.Windows.Forms.Label();
this.label24 = new System.Windows.Forms.Label();
this.txtParkedAlt = new System.Windows.Forms.TextBox();
this.txtParkedAz = new System.Windows.Forms.TextBox();
this.label25 = new System.Windows.Forms.Label();
this.txtFocalLength = new System.Windows.Forms.TextBox();
this.label26 = new System.Windows.Forms.Label();
this.label27 = new System.Windows.Forms.Label();
this.txtApertureDiameter = new System.Windows.Forms.TextBox();
this.label28 = new System.Windows.Forms.Label();
this.label29 = new System.Windows.Forms.Label();
this.txtApertureArea = new System.Windows.Forms.TextBox();
this.label30 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.cbxIntroPromptBypassOverride = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.picASCOM)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudSettleTime)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numDatabits)).BeginInit();
this.SuspendLayout();
//
// cmdOK
@@ -105,6 +155,7 @@ namespace ASCOM.Meade.net
//
resources.ApplyResources(this.txtGuideRate, "txtGuideRate");
this.txtGuideRate.Name = "txtGuideRate";
this.toolTip1.SetToolTip(this.txtGuideRate, resources.GetString("txtGuideRate.ToolTip"));
this.txtGuideRate.TextChanged += new System.EventHandler(this.TextBox1_TextChanged);
//
// label4
@@ -133,10 +184,332 @@ namespace ASCOM.Meade.net
resources.ApplyResources(this.cboPrecision, "cboPrecision");
this.cboPrecision.Name = "cboPrecision";
//
// label6
//
resources.ApplyResources(this.label6, "label6");
this.label6.Name = "label6";
//
// cboGuidingStyle
//
this.cboGuidingStyle.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboGuidingStyle.FormattingEnabled = true;
this.cboGuidingStyle.Items.AddRange(new object[] {
resources.GetString("cboGuidingStyle.Items"),
resources.GetString("cboGuidingStyle.Items1"),
resources.GetString("cboGuidingStyle.Items2")});
resources.ApplyResources(this.cboGuidingStyle, "cboGuidingStyle");
this.cboGuidingStyle.Name = "cboGuidingStyle";
//
// label7
//
resources.ApplyResources(this.label7, "label7");
this.label7.Name = "label7";
//
// label8
//
resources.ApplyResources(this.label8, "label8");
this.label8.Name = "label8";
//
// txtBacklashSteps
//
resources.ApplyResources(this.txtBacklashSteps, "txtBacklashSteps");
this.txtBacklashSteps.Name = "txtBacklashSteps";
this.txtBacklashSteps.TextChanged += new System.EventHandler(this.txtBacklashSteps_TextChanged);
//
// label9
//
resources.ApplyResources(this.label9, "label9");
this.label9.Name = "label9";
//
// label10
//
resources.ApplyResources(this.label10, "label10");
this.label10.Name = "label10";
//
// label11
//
resources.ApplyResources(this.label11, "label11");
this.label11.Name = "label11";
//
// cbxReverseDirection
//
resources.ApplyResources(this.cbxReverseDirection, "cbxReverseDirection");
this.cbxReverseDirection.Name = "cbxReverseDirection";
this.cbxReverseDirection.UseVisualStyleBackColor = true;
//
// cbxDynamicBreaking
//
resources.ApplyResources(this.cbxDynamicBreaking, "cbxDynamicBreaking");
this.cbxDynamicBreaking.Name = "cbxDynamicBreaking";
this.cbxDynamicBreaking.UseVisualStyleBackColor = true;
//
// cbxRtsDtr
//
resources.ApplyResources(this.cbxRtsDtr, "cbxRtsDtr");
this.cbxRtsDtr.Name = "cbxRtsDtr";
this.toolTip1.SetToolTip(this.cbxRtsDtr, resources.GetString("cbxRtsDtr.ToolTip"));
this.cbxRtsDtr.UseVisualStyleBackColor = true;
//
// cbxSendDateTime
//
resources.ApplyResources(this.cbxSendDateTime, "cbxSendDateTime");
this.cbxSendDateTime.Name = "cbxSendDateTime";
this.toolTip1.SetToolTip(this.cbxSendDateTime, resources.GetString("cbxSendDateTime.ToolTip"));
this.cbxSendDateTime.UseVisualStyleBackColor = true;
//
// label12
//
resources.ApplyResources(this.label12, "label12");
this.label12.Name = "label12";
//
// txtElevation
//
resources.ApplyResources(this.txtElevation, "txtElevation");
this.txtElevation.Name = "txtElevation";
this.txtElevation.TextChanged += new System.EventHandler(this.txtElevation_TextChanged_1);
//
// label13
//
resources.ApplyResources(this.label13, "label13");
this.label13.Name = "label13";
//
// label14
//
resources.ApplyResources(this.label14, "label14");
this.label14.Name = "label14";
//
// nudSettleTime
//
resources.ApplyResources(this.nudSettleTime, "nudSettleTime");
this.nudSettleTime.Maximum = new decimal(new int[] {
32767,
0,
0,
0});
this.nudSettleTime.Name = "nudSettleTime";
//
// label15
//
resources.ApplyResources(this.label15, "label15");
this.label15.Name = "label15";
//
// label16
//
resources.ApplyResources(this.label16, "label16");
this.label16.Name = "label16";
//
// cboStopBits
//
this.cboStopBits.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboStopBits.FormattingEnabled = true;
resources.ApplyResources(this.cboStopBits, "cboStopBits");
this.cboStopBits.Name = "cboStopBits";
//
// numDatabits
//
resources.ApplyResources(this.numDatabits, "numDatabits");
this.numDatabits.Maximum = new decimal(new int[] {
32767,
0,
0,
0});
this.numDatabits.Name = "numDatabits";
//
// cboParity
//
this.cboParity.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboParity.FormattingEnabled = true;
resources.ApplyResources(this.cboParity, "cboParity");
this.cboParity.Name = "cboParity";
//
// cboSpeed
//
this.cboSpeed.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboSpeed.FormattingEnabled = true;
resources.ApplyResources(this.cboSpeed, "cboSpeed");
this.cboSpeed.Name = "cboSpeed";
//
// cboHandShake
//
this.cboHandShake.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboHandShake.FormattingEnabled = true;
resources.ApplyResources(this.cboHandShake, "cboHandShake");
this.cboHandShake.Name = "cboHandShake";
//
// label17
//
resources.ApplyResources(this.label17, "label17");
this.label17.Name = "label17";
//
// label18
//
resources.ApplyResources(this.label18, "label18");
this.label18.Name = "label18";
//
// label19
//
resources.ApplyResources(this.label19, "label19");
this.label19.Name = "label19";
//
// label20
//
resources.ApplyResources(this.label20, "label20");
this.label20.Name = "label20";
//
// label21
//
resources.ApplyResources(this.label21, "label21");
this.label21.Name = "label21";
//
// cboParkedBehaviour
//
this.cboParkedBehaviour.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboParkedBehaviour.FormattingEnabled = true;
this.cboParkedBehaviour.Items.AddRange(new object[] {
resources.GetString("cboParkedBehaviour.Items"),
resources.GetString("cboParkedBehaviour.Items1"),
resources.GetString("cboParkedBehaviour.Items2")});
resources.ApplyResources(this.cboParkedBehaviour, "cboParkedBehaviour");
this.cboParkedBehaviour.Name = "cboParkedBehaviour";
this.cboParkedBehaviour.SelectionChangeCommitted += new System.EventHandler(this.cboParkedBehaviour_SelectionChangeCommitted);
//
// label22
//
resources.ApplyResources(this.label22, "label22");
this.label22.Name = "label22";
//
// label23
//
resources.ApplyResources(this.label23, "label23");
this.label23.Name = "label23";
//
// label24
//
resources.ApplyResources(this.label24, "label24");
this.label24.Name = "label24";
//
// txtParkedAlt
//
resources.ApplyResources(this.txtParkedAlt, "txtParkedAlt");
this.txtParkedAlt.Name = "txtParkedAlt";
this.txtParkedAlt.TextChanged += new System.EventHandler(this.txtParkedAlt_TextChanged);
//
// txtParkedAz
//
resources.ApplyResources(this.txtParkedAz, "txtParkedAz");
this.txtParkedAz.Name = "txtParkedAz";
this.txtParkedAz.TextChanged += new System.EventHandler(this.txtParkedAz_TextChanged);
//
// label25
//
resources.ApplyResources(this.label25, "label25");
this.label25.Name = "label25";
//
// txtFocalLength
//
resources.ApplyResources(this.txtFocalLength, "txtFocalLength");
this.txtFocalLength.Name = "txtFocalLength";
this.txtFocalLength.TextChanged += new System.EventHandler(this.txt_FocalLength_TextChanged_1);
//
// label26
//
resources.ApplyResources(this.label26, "label26");
this.label26.Name = "label26";
//
// label27
//
resources.ApplyResources(this.label27, "label27");
this.label27.Name = "label27";
//
// txtApertureDiameter
//
resources.ApplyResources(this.txtApertureDiameter, "txtApertureDiameter");
this.txtApertureDiameter.Name = "txtApertureDiameter";
//
// label28
//
resources.ApplyResources(this.label28, "label28");
this.label28.Name = "label28";
//
// label29
//
resources.ApplyResources(this.label29, "label29");
this.label29.Name = "label29";
//
// txtApertureArea
//
resources.ApplyResources(this.txtApertureArea, "txtApertureArea");
this.txtApertureArea.Name = "txtApertureArea";
//
// label30
//
resources.ApplyResources(this.label30, "label30");
this.label30.Name = "label30";
//
// button1
//
resources.ApplyResources(this.button1, "button1");
this.button1.Name = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// cbxIntroPromptBypassOverride
//
resources.ApplyResources(this.cbxIntroPromptBypassOverride, "cbxIntroPromptBypassOverride");
this.cbxIntroPromptBypassOverride.Name = "cbxIntroPromptBypassOverride";
this.toolTip1.SetToolTip(this.cbxIntroPromptBypassOverride, resources.GetString("cbxIntroPromptBypassOverride.ToolTip"));
this.cbxIntroPromptBypassOverride.UseVisualStyleBackColor = true;
//
// SetupDialogForm
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.cbxIntroPromptBypassOverride);
this.Controls.Add(this.button1);
this.Controls.Add(this.label29);
this.Controls.Add(this.txtApertureArea);
this.Controls.Add(this.label30);
this.Controls.Add(this.label27);
this.Controls.Add(this.txtApertureDiameter);
this.Controls.Add(this.label28);
this.Controls.Add(this.label26);
this.Controls.Add(this.txtFocalLength);
this.Controls.Add(this.label25);
this.Controls.Add(this.txtParkedAz);
this.Controls.Add(this.txtParkedAlt);
this.Controls.Add(this.label24);
this.Controls.Add(this.label23);
this.Controls.Add(this.label22);
this.Controls.Add(this.cboParkedBehaviour);
this.Controls.Add(this.cbxSendDateTime);
this.Controls.Add(this.label21);
this.Controls.Add(this.label20);
this.Controls.Add(this.label19);
this.Controls.Add(this.label18);
this.Controls.Add(this.label17);
this.Controls.Add(this.cboHandShake);
this.Controls.Add(this.cboSpeed);
this.Controls.Add(this.cboParity);
this.Controls.Add(this.numDatabits);
this.Controls.Add(this.cboStopBits);
this.Controls.Add(this.label16);
this.Controls.Add(this.label15);
this.Controls.Add(this.nudSettleTime);
this.Controls.Add(this.label14);
this.Controls.Add(this.label13);
this.Controls.Add(this.txtElevation);
this.Controls.Add(this.label12);
this.Controls.Add(this.cbxRtsDtr);
this.Controls.Add(this.cbxDynamicBreaking);
this.Controls.Add(this.cbxReverseDirection);
this.Controls.Add(this.label11);
this.Controls.Add(this.label10);
this.Controls.Add(this.txtBacklashSteps);
this.Controls.Add(this.label9);
this.Controls.Add(this.label8);
this.Controls.Add(this.label7);
this.Controls.Add(this.cboGuidingStyle);
this.Controls.Add(this.label6);
this.Controls.Add(this.cboPrecision);
this.Controls.Add(this.label5);
this.Controls.Add(this.lblPercentOfSiderealRate);
@@ -158,6 +531,8 @@ namespace ASCOM.Meade.net
this.TopMost = true;
this.Shown += new System.EventHandler(this.SetupDialogForm_Shown);
((System.ComponentModel.ISupportInitialize)(this.picASCOM)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nudSettleTime)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numDatabits)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -178,5 +553,52 @@ namespace ASCOM.Meade.net
private Label lblPercentOfSiderealRate;
private Label label5;
private ComboBox cboPrecision;
private Label label6;
private ComboBox cboGuidingStyle;
private Label label7;
private Label label8;
private TextBox txtBacklashSteps;
private Label label9;
private Label label10;
private Label label11;
private CheckBox cbxReverseDirection;
private CheckBox cbxDynamicBreaking;
private CheckBox cbxRtsDtr;
private ToolTip toolTip1;
private Label label12;
private TextBox txtElevation;
private Label label13;
private Label label14;
private NumericUpDown nudSettleTime;
private Label label15;
private Label label16;
private ComboBox cboStopBits;
private NumericUpDown numDatabits;
private ComboBox cboParity;
private ComboBox cboSpeed;
private ComboBox cboHandShake;
private Label label17;
private Label label18;
private Label label19;
private Label label20;
private Label label21;
private CheckBox cbxSendDateTime;
private ComboBox cboParkedBehaviour;
private Label label22;
private Label label23;
private Label label24;
private TextBox txtParkedAlt;
private TextBox txtParkedAz;
private Label label25;
private TextBox txtFocalLength;
private Label label26;
private Label label27;
private TextBox txtApertureDiameter;
private Label label28;
private Label label29;
private TextBox txtApertureArea;
private Label label30;
private Button button1;
private CheckBox cbxIntroPromptBypassOverride;
}
}
File diff suppressed because it is too large Load Diff
+419 -45
View File
@@ -17,8 +17,13 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Forms;
using ASCOM.DeviceInterface;
using ASCOM.Meade.net.Wrapper;
using ASCOM.Utilities;
using ASCOM.Utilities.Interfaces;
namespace ASCOM.Meade.net
{
@@ -36,7 +41,7 @@ namespace ASCOM.Meade.net
private static readonly object LockObject = new object();
// Shared serial port. This will allow multiple drivers to use one single serial port.
private static Serial _sSharedSerial; // Shared serial port
private static ISerial _sSharedSerial; // Shared serial port
//
// Public access to shared resources
@@ -59,16 +64,29 @@ namespace ASCOM.Meade.net
//
/// <summary>
/// Shared serial port
/// Shared serial port. Do not directly access this method.
/// </summary>
private static Serial SharedSerial => _sSharedSerial ?? (_sSharedSerial = new Serial());
public static ISerial SharedSerial
{
get => _sSharedSerial ?? (_sSharedSerial = new Serial());
set => _sSharedSerial = value;
}
public static void SendBlind(string message)
public static IProfileFactory ProfileFactory
{
get => _profileFactory ?? (_profileFactory = new ProfileFactory());
set => _profileFactory = value;
}
//todo add code to ensure that there is a minimum gap between commands. 5ms as default.
public static void SendBlind(ITraceLogger traceLogger, string message, bool raw = false)
{
lock (LockObject)
{
SharedSerial.ClearBuffers();
SharedSerial.Transmit(message);
var encodedMessage = raw ? message : $"#:{message}#";
traceLogger.LogMessage("SendBlind", $"Transmitting {encodedMessage}", false);
SharedSerial.Transmit(encodedMessage);
}
}
@@ -79,24 +97,71 @@ namespace ASCOM.Meade.net
/// and that the reply will always be terminated by a "#" character.
/// </summary>
/// <param name="message"></param>
/// <param name="raw"></param>
/// <returns></returns>
public static string SendString(string message)
public static string SendString(ITraceLogger traceLogger, string message, bool raw = false)
{
lock (LockObject)
{
SharedSerial.ClearBuffers();
SharedSerial.Transmit(message);
return SharedSerial.ReceiveTerminated("#").TrimEnd('#');
var encodedMessage = raw ? message : $"#:{message}#";
traceLogger.LogMessage("SendString", $"Transmitting {encodedMessage}", false);
SharedSerial.Transmit(encodedMessage);
try
{
var result = SharedSerial.ReceiveTerminated("#");
traceLogger.LogMessage("SendString", $"Received {result}", false);
return result.TrimEnd('#');
}
catch (COMException ex)
{
traceLogger.LogIssue("SendString", ex.Message);
if (ex.Message.Contains("Timed out waiting for received data"))
throw new TimeoutException(ex.Message, ex);
throw;
}
}
}
public static string SendChar(string message)
public static bool SendBool(ITraceLogger traceLogger, string command, bool raw = false)
{
var result = SendChar(traceLogger, command, raw);
return result == "1";
}
public static string SendChar(ITraceLogger traceLogger, string command, bool raw = false)
{
return SendChars(traceLogger, command, raw, count: 1);
}
public static string SendChars(ITraceLogger traceLogger, string command, bool raw = false, int count = 1)
{
lock (LockObject)
{
SharedSerial.ClearBuffers();
SharedSerial.Transmit(message);
return SharedSerial.ReceiveCounted(1);
var encodedMessage = raw ? command : $"#:{command}#";
traceLogger.LogMessage("SendChars", $"Transmitting {encodedMessage}", false);
SharedSerial.Transmit(encodedMessage);
try
{
var result = SharedSerial.ReceiveCounted(count);
traceLogger.LogMessage("SendChars", $"Received {result}", false);
return result;
}
catch (COMException ex)
{
traceLogger.LogIssue("SendString", ex.Message);
if (ex.Message.Contains("Timed out waiting for received data"))
throw new TimeoutException(ex.Message, ex);
throw;
}
}
}
@@ -124,42 +189,124 @@ namespace ASCOM.Meade.net
// Constants used for Profile persistence
private const string ComPortProfileName = "COM Port";
private const string RtsDtrProfileName = "Rts / Dtr";
private const string TraceStateProfileName = "Trace Level";
private const string GuideRateProfileName = "Guide Rate Arc Seconds Per Second";
private const string PrecisionProfileName = "Precision";
private const string GuidingStyleProfileName = "Guiding Style";
private const string BacklashCompensationName = "Backlash Compensation";
private const string ReverseFocusDirectionName = "Reverse Focuser Direction";
private const string DynamicBreakingName = "Dynamic Breaking";
private const string SiteElevationName = "Site Elevation";
private const string SettleTimeName = "Settle Time";
private const string SpeedName = "Speed";
private const string DataBitsName = "Data Bits";
private const string StopBitsName = "Stop Bits";
private const string HandShakeName = "Hand Shake";
private const string ParityName = "Parity";
private const string SendDateTimeName = "Send Date and time on connect";
private const string OverrideBypassIntroPromptsName = "Override bypass intro prompts";
private const string ParkedBehaviourName = "Parked Behaviour";
private const string ParkedAltName = "Parked Altitude";
private const string ParkedAzimuthName = "Parked Azimuth";
private const string FocalLengthName = "Focal Length (mm)";
private const string ApertureAreaName = "Aperture Area (mm²)";
private const string ApertureDiameterName = "Aperture Diameter (mm)";
public static void WriteProfile(ProfileProperties profileProperties)
{
lock (LockObject)
{
using (Profile driverProfile = new Profile())
using (IProfileWrapper driverProfile = ProfileFactory.Create())
{
driverProfile.DeviceType = "Telescope";
driverProfile.WriteValue(DriverId, TraceStateProfileName, profileProperties.TraceLogger.ToString());
driverProfile.WriteValue(DriverId, ComPortProfileName, profileProperties.ComPort);
driverProfile.WriteValue(DriverId, GuideRateProfileName, profileProperties.GuideRateArcSecondsPerSecond.ToString(CultureInfo.CurrentCulture));
driverProfile.WriteValue(DriverId, RtsDtrProfileName, profileProperties.RtsDtrEnabled.ToString());
driverProfile.WriteValue(DriverId, SpeedName, profileProperties.Speed.ToString(CultureInfo.InvariantCulture));
driverProfile.WriteValue(DriverId, DataBitsName, profileProperties.DataBits.ToString(CultureInfo.InvariantCulture));
driverProfile.WriteValue(DriverId, StopBitsName, profileProperties.StopBits);
driverProfile.WriteValue(DriverId, HandShakeName, profileProperties.Handshake);
driverProfile.WriteValue(DriverId, ParityName, profileProperties.Parity);
driverProfile.WriteValue(DriverId, GuideRateProfileName, profileProperties.GuideRateArcSecondsPerSecond.ToString(CultureInfo.InvariantCulture));
driverProfile.WriteValue(DriverId, PrecisionProfileName, profileProperties.Precision);
driverProfile.WriteValue(DriverId, GuidingStyleProfileName, profileProperties.GuidingStyle);
driverProfile.WriteValue(DriverId, BacklashCompensationName, profileProperties.BacklashCompensation.ToString());
driverProfile.WriteValue(DriverId, ReverseFocusDirectionName, profileProperties.ReverseFocusDirection.ToString());
driverProfile.WriteValue(DriverId, DynamicBreakingName, profileProperties.DynamicBreaking.ToString());
driverProfile.WriteValue(DriverId, SiteElevationName, profileProperties.SiteElevation.ToString(CultureInfo.InvariantCulture));
driverProfile.WriteValue(DriverId, SettleTimeName, profileProperties.SettleTime.ToString());
driverProfile.WriteValue(DriverId, SendDateTimeName, profileProperties.SendDateTime.ToString());
driverProfile.WriteValue(DriverId, OverrideBypassIntroPromptsName, profileProperties.IntroPromptBypassOverride.ToString());
driverProfile.WriteValue(DriverId, ParkedBehaviourName, profileProperties.ParkedBehaviour.GetDescription());
driverProfile.WriteValue(DriverId, ParkedAltName, profileProperties.ParkedAlt.ToString(CultureInfo.InvariantCulture));
driverProfile.WriteValue(DriverId, ParkedAzimuthName, profileProperties.ParkedAz.ToString(CultureInfo.InvariantCulture));
driverProfile.WriteValue(DriverId, FocalLengthName, profileProperties.FocalLength.ToString(CultureInfo.InvariantCulture));
driverProfile.WriteValue(DriverId, ApertureAreaName, profileProperties.ApertureArea.ToString(CultureInfo.InvariantCulture));
driverProfile.WriteValue(DriverId, ApertureDiameterName, profileProperties.ApertureDiameter.ToString(CultureInfo.InvariantCulture));
}
}
}
private const string ComPortDefault = "COM1";
private const string RtsDtrDefault = "false";
private const string TraceStateDefault = "false";
private const string GuideRateProfileNameDefault = "10.077939"; //67% of sidereal rate
private const string PrecisionDefault = "Unchanged";
private const string GuidingStyleDefault = "Auto";
private const string BacklashCompensationDefault = "3000";
private const string ReverseFocuserDiectionDefault = "true";
private const string DynamicBreakingDefault = "true";
private const string SiteElevationDefault = "0";
private const string SettleTimeDefault = "2";
private const string SpeedDefault = "9600";
private const string DataBitsDefault = "8";
private const string StopBitsDefault = "One";
private const string HandShakeDefault = "None";
private const string ParityDefault = "None";
private const string SendDateTimeDefault = "false";
private const string OverrideBypassIntroPromptsDefault = "false";
private const string ParkedBehaviourDefault = "No Coordinates";
private const string ParkedAltDefault = "0";
private const string ParkedAzimuthDefault = "180";
private const string FocalLengthDefault = "2000";
private const string ApertureAreaDefault = "32685";
private const string ApertureDiameterDefault = "203";
public static ProfileProperties ReadProfile()
{
lock (LockObject)
{
ProfileProperties profileProperties = new ProfileProperties();
using (Profile driverProfile = new Profile())
using (IProfileWrapper driverProfile = ProfileFactory.Create())
{
driverProfile.DeviceType = "Telescope";
profileProperties.ComPort = driverProfile.GetValue(DriverId, ComPortProfileName, string.Empty, ComPortDefault);
profileProperties.RtsDtrEnabled = Convert.ToBoolean(driverProfile.GetValue(DriverId, RtsDtrProfileName, string.Empty, RtsDtrDefault));
profileProperties.TraceLogger = Convert.ToBoolean(driverProfile.GetValue(DriverId, TraceStateProfileName, string.Empty, TraceStateDefault));
profileProperties.GuideRateArcSecondsPerSecond = double.Parse(driverProfile.GetValue(DriverId, GuideRateProfileName, string.Empty, GuideRateProfileNameDefault));
profileProperties.GuideRateArcSecondsPerSecond = double.Parse(driverProfile.GetValue(DriverId, GuideRateProfileName, string.Empty, GuideRateProfileNameDefault), NumberFormatInfo.InvariantInfo);
profileProperties.Precision = driverProfile.GetValue(DriverId, PrecisionProfileName, string.Empty, PrecisionDefault);
profileProperties.GuidingStyle = driverProfile.GetValue(DriverId, GuidingStyleProfileName, string.Empty, GuidingStyleDefault);
profileProperties.BacklashCompensation = Convert.ToInt32(driverProfile.GetValue(DriverId, BacklashCompensationName, string.Empty, BacklashCompensationDefault));
profileProperties.ReverseFocusDirection = Convert.ToBoolean(driverProfile.GetValue(DriverId, ReverseFocusDirectionName, string.Empty, ReverseFocuserDiectionDefault));
profileProperties.DynamicBreaking = Convert.ToBoolean(driverProfile.GetValue(DriverId, DynamicBreakingName, string.Empty, DynamicBreakingDefault));
profileProperties.SiteElevation = Convert.ToInt32(driverProfile.GetValue(DriverId, SiteElevationName, string.Empty, SiteElevationDefault));
profileProperties.SettleTime = Convert.ToInt16(driverProfile.GetValue(DriverId, SettleTimeName, string.Empty, SettleTimeDefault));
profileProperties.StopBits = driverProfile.GetValue(DriverId, StopBitsName, string.Empty, StopBitsDefault);
profileProperties.DataBits = Convert.ToInt32(driverProfile.GetValue(DriverId, DataBitsName, string.Empty, DataBitsDefault));
profileProperties.Handshake = driverProfile.GetValue(DriverId, HandShakeName, string.Empty, HandShakeDefault);
profileProperties.Speed = Convert.ToInt32(driverProfile.GetValue(DriverId, SpeedName, string.Empty, SpeedDefault));
profileProperties.Parity = driverProfile.GetValue(DriverId, ParityName, string.Empty, ParityDefault);
profileProperties.SendDateTime = Convert.ToBoolean(driverProfile.GetValue(DriverId, SendDateTimeName, string.Empty, SendDateTimeDefault));
profileProperties.IntroPromptBypassOverride = Convert.ToBoolean(driverProfile.GetValue(DriverId, OverrideBypassIntroPromptsName, string.Empty, OverrideBypassIntroPromptsDefault));
profileProperties.ParkedBehaviour = EnumExtensionMethods.GetValueFromDescription<ParkedBehaviour>(driverProfile.GetValue(DriverId, ParkedBehaviourName, string.Empty, ParkedBehaviourDefault));
profileProperties.ParkedAlt = double.Parse(driverProfile.GetValue(DriverId, ParkedAltName, string.Empty, ParkedAltDefault), NumberFormatInfo.InvariantInfo);
profileProperties.ParkedAz = double.Parse(driverProfile.GetValue(DriverId, ParkedAzimuthName, string.Empty, ParkedAzimuthDefault), NumberFormatInfo.InvariantInfo);
profileProperties.FocalLength = double.Parse(driverProfile.GetValue(DriverId, FocalLengthName, string.Empty, FocalLengthDefault), NumberFormatInfo.InvariantInfo);
profileProperties.ApertureArea = double.Parse(driverProfile.GetValue(DriverId, ApertureAreaName, string.Empty, ApertureAreaDefault), NumberFormatInfo.InvariantInfo);
profileProperties.ApertureDiameter = double.Parse(driverProfile.GetValue(DriverId, ApertureDiameterName, string.Empty, ApertureDiameterDefault), NumberFormatInfo.InvariantInfo);
}
return profileProperties;
@@ -171,6 +318,8 @@ namespace ASCOM.Meade.net
#region SetupDialog
public static void SetupDialog()
{
try
{
var profileProperties = ReadProfile();
@@ -188,10 +337,17 @@ namespace ASCOM.Meade.net
{
profileProperties = f.GetProfile();
WriteProfile(profileProperties); // Persist device configuration values to the ASCOM Profile store
WriteProfile(
profileProperties); // Persist device configuration values to the ASCOM Profile store
}
}
}
catch (Exception e)
{
Console.WriteLine(e);
throw;
}
}
#endregion
@@ -217,6 +373,7 @@ namespace ASCOM.Meade.net
private static readonly Dictionary<string, DeviceHardware> ConnectedDevices = new Dictionary<string, DeviceHardware>();
private static readonly Dictionary<string, DeviceHardware> ConnectedDeviceIds = new Dictionary<string, DeviceHardware>();
private static IProfileFactory _profileFactory;
/// <summary>
@@ -225,46 +382,170 @@ namespace ASCOM.Meade.net
/// </summary>
/// <param name="deviceId"></param>
/// <param name="driverId"></param>
public static ConnectionInfo Connect(string deviceId, string driverId)
/// <param name="traceLogger"></param>
public static ConnectionInfo Connect(string deviceId, string driverId, ITraceLogger traceLogger)
{
lock (LockObject)
{
if (!ConnectedDevices.ContainsKey(deviceId))
ConnectedDevices.Add(deviceId, new DeviceHardware());
ConnectedDevices[deviceId].Count++; // increment the value
if (!ConnectedDeviceIds.ContainsKey(driverId))
ConnectedDeviceIds.Add(driverId, new DeviceHardware());
ConnectedDeviceIds[driverId].Count++; // increment the value
if (deviceId == "Serial")
{
if (ConnectedDevices[deviceId].Count == 1)
if (ConnectedDevices[deviceId].Count == 0)
{
var profileProperties = ReadProfile();
SharedSerial.PortName = profileProperties.ComPort;
SharedSerial.DTREnable = false;
SharedSerial.RTSEnable = false;
SharedSerial.DataBits = 8;
SharedSerial.StopBits = SerialStopBits.One;
SharedSerial.Parity = SerialParity.None;
SharedSerial.DTREnable = profileProperties.RtsDtrEnabled;
SharedSerial.RTSEnable = profileProperties.RtsDtrEnabled;
SharedSerial.DataBits = profileProperties.DataBits;
SharedSerial.StopBits = (SerialStopBits)Enum.Parse(typeof(SerialStopBits), profileProperties.StopBits);
SharedSerial.Parity = (SerialParity)Enum.Parse(typeof(SerialParity), profileProperties.Parity);
SharedSerial.Handshake = (SerialHandshake)Enum.Parse(typeof(SerialHandshake), profileProperties.Handshake);
SharedSerial.ReceiveTimeout = 5; //5 second timeout;
SharedSerial.Speed = SerialSpeed.ps9600;
SharedSerial.Handshake = SerialHandshake.None;
var wantedSpeed = (SerialSpeed)profileProperties.Speed;
if (wantedSpeed != SerialSpeed.ps9600)
{
SharedSerial.Speed = wantedSpeed;
SharedSerial.Connected = true;
ProductName = SendString(":GVP#");
FirmwareVersion = SendString(":GVN#");
var speedRampNeeded = false;
//Test if communication is working.
try
{
string utcOffSet = SendString( traceLogger, "GG");
}
catch (Exception)
{
speedRampNeeded = true;
}
if (speedRampNeeded)
{
SharedSerial.Connected = false;
SharedSerial.Speed = SerialSpeed.ps9600;
SharedSerial.Connected = true;
int newSpeedIndex = GetSpeedIndex(wantedSpeed);
//:SBn# Set Baud Rate n, where n is an ASCII digit (1..9) with the following interpertation
// 1 56.7K
// 2 38.4K
// 3 28.8K
// 4 19.2K
// 5 14.4K
// 6 9600
// 7 4800
// 8 2400
// 9 1200
//Returns:
// 1 At the current baud rate and then changes to the new rate for further communication
//SendBlind($"SB{newSpeedIndex}");
try
{
var speedChanged = SendChar(traceLogger, $"SB{newSpeedIndex}");
if (speedChanged == "1")
{
SharedSerial.Connected = false;
SharedSerial.Speed = wantedSpeed;
traceLogger.LogIssue("Connect",
$"Telescope serial port speed change, connecting at {SharedSerial.Speed}.");
}
else
{
throw new Exception("Autostar not signalled speed change.");
}
}
catch (Exception)
{
SharedSerial.Connected = false;
SharedSerial.Speed = SerialSpeed.ps9600;
traceLogger.LogIssue("Connect", $"Telescope not responding to speed change, connecting at {SharedSerial.Speed}.");
}
}
}
SharedSerial.Connected = true;
try
{
ProductName = SendString(traceLogger, "GVP");
FirmwareVersion = SendString(traceLogger, "GVN");
}
catch (Exception ex)
{
traceLogger.LogIssue("Connect", $"Error getting telescope information \"{ex.Message}\" setting to LX200 Classic mode.");
ProductName = TelescopeList.LX200CLASSIC;
FirmwareVersion = "Unknown";
}
if (ProductName == ":GVP")
{
traceLogger.LogIssue("Connect", "Serial port is looping back data, something is wrong with the hardware.");
//This means that the serial port is looping back what's been sent, something is very wrong.
SharedSerial.Connected = false;
throw new Exception("Serial port is looping back data, something is wrong with the hardware.");
}
try
{
string utcOffSet = SendString(traceLogger, "GG");
//:GG# Get UTC offset time
//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
//sHH# form is returned, otherwise the longer form is returned.
if (!double.TryParse(utcOffSet, out var utcOffsetHours))
{
var message = "Unable to decode response from the telescope, This is likely a hardware serial communications error.";
traceLogger.LogIssue("Connect", message);
throw new Exception(message);
}
traceLogger.LogMessage("Connect", $"Offset from UTC: {utcOffsetHours}", false);
}
catch (Exception)
{
SharedSerial.Connected = false;
throw;
}
}
}
else
throw new ArgumentException($"deviceId {deviceId} not currently supported");
ConnectedDevices[deviceId].Count++; // increment the value
ConnectedDeviceIds[driverId].Count++; // increment the value
return new ConnectionInfo
{
Connections = ConnectedDevices[deviceId].Count,
//Connections = ConnectedDevices[deviceId].Count,
SameDevice = ConnectedDeviceIds[driverId].Count
};
}
}
private static int GetSpeedIndex(SerialSpeed speed)
{
switch (speed)
{
case SerialSpeed.ps57600: return 1;
case SerialSpeed.ps38400: return 2;
case SerialSpeed.ps28800: return 3;
case SerialSpeed.ps19200: return 4;
case SerialSpeed.ps14400: return 5;
case SerialSpeed.ps9600: return 6;
case SerialSpeed.ps4800: return 7;
case SerialSpeed.ps2400: return 8;
case SerialSpeed.ps1200: return 9;
default: throw new NotSupportedException($"{SpeedDefault} not supported");
}
}
public static void Disconnect(string deviceId, string driverId)
{
lock (LockObject)
@@ -302,22 +583,6 @@ namespace ASCOM.Meade.net
#endregion
public static void Lock(Action action)
{
lock (LockObject)
{
action();
}
}
public static T Lock<T>(Func<T> func)
{
lock (LockObject)
{
return func();
}
}
/// <summary>
/// Skeleton of a hardware class, all this does is hold a count of the connections,
/// in reality extra code will be needed to handle the hardware in some way
@@ -331,5 +596,114 @@ namespace ASCOM.Meade.net
Count = 0;
}
}
public static void SetParked(bool atPark, ParkedPosition parkedPosition, bool restartTracking)
{
IsParked = atPark;
ParkedPosition = parkedPosition;
RestartTracking = restartTracking;
}
private static readonly ThreadSafeValue<bool> _restartTracking = false;
public static bool RestartTracking
{
get => _restartTracking;
private set => _restartTracking.Set(value);
}
private static ParkedPosition _parkedPosition;
public static ParkedPosition ParkedPosition
{
get => _parkedPosition;
private set => Interlocked.Exchange(ref _parkedPosition, value);
}
private static readonly ThreadSafeValue<bool> _isParked = false;
public static bool IsParked
{
get => _isParked;
private set => _isParked.Set(value);
}
private static readonly ThreadSafeValue<AlignmentModes> _alignmentMode = AlignmentModes.algAltAz;
public static AlignmentModes AlignmentMode
{
get => _alignmentMode;
set => _alignmentMode.Set(value);
}
private static readonly ThreadSafeValue<PierSide> _sideOfPier = PierSide.pierUnknown;
/// <summary>
/// Start with <see cref="PierSide.pierUnknown"/>.
/// As we do not know the physical declination axis position, we have to keep track manually.
/// </summary>
public static PierSide SideOfPier
{
get => _sideOfPier;
internal set => _sideOfPier.Set(value);
}
private static readonly ThreadSafeValue<double?> _targetRightAscension = null as double?;
public static double? TargetRightAscension
{
get => _targetRightAscension;
internal set => _targetRightAscension.Set(value);
}
private static readonly ThreadSafeValue<double?> _targetDeclination = null as double?;
public static double? TargetDeclination
{
get => _targetDeclination;
internal set => _targetDeclination.Set(value);
}
private static int _slewSettleTime;
public static short SlewSettleTime
{
get => Convert.ToInt16(_slewSettleTime);
internal set => Interlocked.Exchange(ref _slewSettleTime, value);
}
private static readonly ThreadSafeValue<bool> _isLongFormat = false;
public static bool IsLongFormat
{
get => _isLongFormat;
internal set => _isLongFormat.Set(value);
}
private static readonly ThreadSafeValue<bool> _movingPrimary = false;
public static bool MovingPrimary
{
get => _movingPrimary;
internal set => _movingPrimary.Set(value);
}
private static readonly ThreadSafeValue<bool> _movingSecondary = false;
public static bool MovingSecondary
{
get => _movingSecondary;
internal set => _movingSecondary.Set(value);
}
private static readonly ThreadSafeValue<DateTime> _earliestNonSlewingTime = DateTime.MinValue;
public static DateTime EarliestNonSlewingTime
{
get => _earliestNonSlewingTime;
internal set => _earliestNonSlewingTime.Set(value);
}
private static readonly ThreadSafeValue<bool> _isTargetCoordinateInitRequired = true;
public static bool IsTargetCoordinateInitRequired
{
get => _isTargetCoordinateInitRequired;
internal set => _isTargetCoordinateInitRequired.Set(value);
}
private static readonly ThreadSafeValue<bool> _isGuiding = false;
public static bool IsGuiding
{
get => _isGuiding;
internal set => _isGuiding.Set(value);
}
}
}
+30 -7
View File
@@ -4,30 +4,53 @@
{
#region Autostar 497/Audiostar
public static readonly string Autostar497 = "Autostar";
public const string Audiostar = "Audiostar"; //This is a synonym for Autostar which can be returned by some of the Audiostar firmware revisions A1f7
public const string Autostar497 = "Autostar";
//Autostar/Audiostar firmware revisions
// ReSharper disable once InconsistentNaming
public static readonly string Autostar497_30Ee = "30Ee";
public const string Autostar497_30Ee = "30Ee";
// ReSharper disable once InconsistentNaming
public static readonly string Autostar497_31Ee = "31Ee";
public const string Autostar497_31Ee = "31Ee";
// ReSharper disable once InconsistentNaming
public static readonly string Autostar497_43Eg = "43Eg";
public const string Autostar497_43Eg = "43Eg";
// ReSharper disable once InconsistentNaming
public const string AudioStar_A1F7 = "A1F7";
// ReSharper disable once InconsistentNaming
public const string AudioStar_A4S4 = "A4S4";
#endregion
#region LX200GPS
// ReSharper disable once InconsistentNaming
public static readonly string LX200GPS = "LX2001";
public const string LX200GPS = "LX2001";
public const string LX200GPS_42F = "4.2f";
// ReSharper disable once InconsistentNaming
public static readonly string LX200GPS_42G = "4.2G";
public const string LX200GPS_42G = "4.2g";
public const string LX200GPS_4G0M = "4G0m";
#endregion
#region LX800
public const string LX800 = "LX800";
public const string LX800_11i = "1.1i";
#endregion
#region LX200EMC
// ReSharper disable once InconsistentNaming
public static readonly string LX200CLASSIC = ":GVP"; //GVP command is not supported!
public const string LX200CLASSIC = "LX200 Classic"; //GVP command is not supported!
#endregion
#region RCX400
// ReSharper disable once InconsistentNaming
public const string RCX400 = "RCX400";
public const string RCX400_22I = "2.2i";
#endregion
}
}
+18
View File
@@ -0,0 +1,18 @@
using JetBrains.Annotations;
using System.Threading;
namespace ASCOM.Meade.net
{
public class ThreadSafeValue<T>
{
private object _value;
public ThreadSafeValue(in T value) => _value = value;
public void Set(in T value) => Interlocked.Exchange(ref _value, value);
public static implicit operator ThreadSafeValue<T>(in T value) => new ThreadSafeValue<T>(value);
public static implicit operator T([NotNull] ThreadSafeValue<T> @this) => (T)(@this?._value ?? default);
}
}
+139
View File
@@ -0,0 +1,139 @@
using System;
using System.Collections;
using ASCOM.Utilities;
using ASCOM.Utilities.Interfaces;
namespace ASCOM.Meade.net.Wrapper
{
public interface IProfileWrapper : IProfile, IProfileExtra, IDisposable
{
}
public class ProfileWrapper : IProfileWrapper
{
private readonly Profile _profile = new Profile();
public ArrayList RegisteredDevices(string deviceType)
{
return _profile.RegisteredDevices(deviceType);
}
public bool IsRegistered(string driverId)
{
return _profile.IsRegistered(driverId);
}
public void Register(string driverId, string descriptiveName)
{
_profile.Register(driverId, descriptiveName);
}
public void Unregister(string driverId)
{
_profile.Unregister(driverId);
}
public string GetValue(string driverId, string name, string subKey, string defaultValue)
{
return _profile.GetValue(driverId, name, subKey, defaultValue);
}
public void WriteValue(string driverId, string name, string value, string subKey)
{
_profile.WriteValue(driverId, name, value);
}
public ArrayList Values(string driverId, string subKey)
{
return _profile.Values(driverId, subKey);
}
public void DeleteValue(string driverId, string name, string subKey)
{
_profile.DeleteValue(driverId, name, subKey);
}
public void CreateSubKey(string driverId, string subKey)
{
_profile.CreateSubKey(driverId, subKey);
}
public ArrayList SubKeys(string driverId, string subKey)
{
return _profile.SubKeys(driverId, subKey);
}
public void DeleteSubKey(string driverId, string subKey)
{
_profile.DeleteSubKey(driverId, subKey);
}
public string GetProfileXML(string deviceId)
{
return _profile.GetProfileXML(deviceId);
}
public void SetProfileXML(string deviceId, string xml)
{
_profile.SetProfileXML(deviceId, xml);
}
public string DeviceType
{
get => _profile.DeviceType;
set => _profile.DeviceType = value;
}
public ArrayList RegisteredDeviceTypes => _profile.RegisteredDeviceTypes;
public void MigrateProfile(string currentPlatformVersion)
{
_profile.MigrateProfile(currentPlatformVersion);
}
public void DeleteValue(string driverId, string name)
{
_profile.DeleteValue(driverId, name);
}
public string GetValue(string driverId, string name)
{
return _profile.GetValue(driverId, name);
}
public string GetValue(string driverId, string name, string subKey)
{
return _profile.GetValue(driverId, name, subKey);
}
public ArrayList SubKeys(string driverId)
{
return _profile.SubKeys(driverId);
}
public ArrayList Values(string driverId)
{
return _profile.Values(driverId);
}
public void WriteValue(string driverId, string name, string value)
{
_profile.WriteValue(driverId, name, value);
}
public ASCOMProfile GetProfile(string driverId)
{
return _profile.GetProfile(driverId);
}
public void SetProfile(string driverId, ASCOMProfile xmlProfileKey)
{
_profile.SetProfile(driverId, xmlProfileKey);
}
public void Dispose()
{
_profile.Dispose();
}
}
}
+113 -19
View File
@@ -1,22 +1,23 @@
using System;
using ASCOM.DeviceInterface;
using ASCOM.Utilities.Interfaces;
namespace ASCOM.Meade.net.Wrapper
{
public interface ISharedResourcesWrapper
{
ConnectionInfo Connect(string deviceId, string driverId);
ConnectionInfo Connect(string deviceId, string driverId, ITraceLogger traceLogger);
void Disconnect(string deviceId, string driverId);
string ProductName { get; }
string FirmwareVersion { get; }
void Lock(Action action);
T Lock<T>(Func<T> func);
string SendString(string message);
void SendBlind(string message);
string SendChar(string message);
string SendString(ITraceLogger traceLogger, string message, bool raw = false);
void SendBlind(ITraceLogger traceLogger, string message, bool raw = false);
bool SendBool(ITraceLogger traceLogger, string command, bool raw = false);
string SendChar(ITraceLogger traceLogger, string message, bool raw = false);
string SendChars(ITraceLogger traceLogger, string message, bool raw = false, int count = 1);
string ReadTerminated();
@@ -25,13 +26,35 @@ namespace ASCOM.Meade.net.Wrapper
void SetupDialog();
void WriteProfile(ProfileProperties profileProperties);
void ReadCharacters(int throwAwayCharacters);
void SetParked(bool atPark, ParkedPosition parkedPosition, bool restartTracking);
bool IsParked { get; }
ParkedPosition ParkedPosition { get; }
bool RestartTracking { get; }
double? TargetRightAscension { get; set; }
double? TargetDeclination { get; set; }
short SlewSettleTime { get; set; }
bool IsLongFormat { get; set; }
bool MovingPrimary { get; set; }
bool MovingSecondary { get; set; }
DateTime EarliestNonSlewingTime { get; set; }
bool IsTargetCoordinateInitRequired { get; set; }
bool IsGuiding { get; set; }
}
public class SharedResourcesWrapper : ISharedResourcesWrapper
{
public ConnectionInfo Connect(string deviceId, string driverId)
public ConnectionInfo Connect(string deviceId, string driverId, ITraceLogger traceLogger)
{
return SharedResources.Connect(deviceId, driverId);
return SharedResources.Connect(deviceId, driverId, traceLogger);
}
public void Disconnect(string deviceId, string driverId)
@@ -43,29 +66,29 @@ namespace ASCOM.Meade.net.Wrapper
public string FirmwareVersion => SharedResources.FirmwareVersion;
public void Lock(Action action)
public string SendString(ITraceLogger traceLogger, string message, bool raw = false)
{
SharedResources.Lock(action);
return SharedResources.SendString(traceLogger, message, raw);
}
public T Lock<T>(Func<T> func)
public void SendBlind(ITraceLogger traceLogger, string message, bool raw = false)
{
return SharedResources.Lock(func);
SharedResources.SendBlind(traceLogger, message, raw);
}
public string SendString(string message)
public bool SendBool(ITraceLogger traceLogger, string command, bool raw = false)
{
return SharedResources.SendString(message);
return SharedResources.SendBool(traceLogger, command, raw);
}
public void SendBlind(string message)
public string SendChar(ITraceLogger traceLogger, string message, bool raw = false)
{
SharedResources.SendBlind(message);
return SharedResources.SendChar(traceLogger, message, raw);
}
public string SendChar(string message)
public string SendChars(ITraceLogger traceLogger, string message, bool raw = false, int count = 1)
{
return SharedResources.SendChar(message);
return SharedResources.SendChars(traceLogger, message, raw, count);
}
public string ReadTerminated()
@@ -92,5 +115,76 @@ namespace ASCOM.Meade.net.Wrapper
{
SharedResources.WriteProfile(profileProperties);
}
public void SetParked(bool atPark, ParkedPosition parkedPosition, bool restartTracking)
{
SharedResources.SetParked(atPark, parkedPosition, restartTracking);
}
public bool IsParked => SharedResources.IsParked;
public bool RestartTracking => SharedResources.RestartTracking;
public ParkedPosition ParkedPosition => SharedResources.ParkedPosition;
public PierSide SideOfPier
{
get => SharedResources.SideOfPier;
set => SharedResources.SideOfPier = value;
}
public double? TargetRightAscension
{
get => SharedResources.TargetRightAscension;
set => SharedResources.TargetRightAscension = value;
}
public double? TargetDeclination
{
get => SharedResources.TargetDeclination;
set => SharedResources.TargetDeclination = value;
}
public short SlewSettleTime
{
get => SharedResources.SlewSettleTime;
set => SharedResources.SlewSettleTime = value;
}
public bool IsLongFormat
{
get => SharedResources.IsLongFormat;
set => SharedResources.IsLongFormat = value;
}
public bool MovingPrimary
{
get => SharedResources.MovingPrimary;
set => SharedResources.MovingPrimary = value;
}
public bool MovingSecondary
{
get => SharedResources.MovingSecondary;
set => SharedResources.MovingSecondary = value;
}
public DateTime EarliestNonSlewingTime
{
get => SharedResources.EarliestNonSlewingTime;
set => SharedResources.EarliestNonSlewingTime = value;
}
public bool IsTargetCoordinateInitRequired
{
get => SharedResources.IsTargetCoordinateInitRequired;
set => SharedResources.IsTargetCoordinateInitRequired = value;
}
public bool IsGuiding
{
get => SharedResources.IsGuiding;
set => SharedResources.IsGuiding = value;
}
}
}
+1 -1
View File
@@ -1,3 +1,3 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>
+2 -1
View File
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ASCOM.Platform" version="6.4.2" targetFramework="net40" />
<package id="ASCOM.Platform" version="6.5.2" targetFramework="net472" />
<package id="JetBrains.Annotations" version="2022.3.1" targetFramework="net472" />
</packages>
+49 -9
View File
@@ -9,26 +9,29 @@
#define UseChooser
using System;
using System.Linq;
using System.Threading;
using ASCOM.DeviceInterface;
using ASCOM.DriverAccess;
namespace ASCOM.Meade.net
{
class Program
public static class Program
{
static void Main(string[] args)
public static void Main()
{
// Uncomment the code that's required
#if UseChooser
//#if UseChooser
// choose the device
string id = Telescope.Choose("ASCOM.MeadeGeneric.Telescope");
string id = Telescope.Choose("ASCOM.Meade.net.Telescope");
if (string.IsNullOrEmpty(id))
return;
// create this device
Telescope device = new Telescope(id);
#else
//#else
// this can be replaced by this code, it avoids the chooser and creates the driver class directly.
ASCOM.DriverAccess.Telescope device = new ASCOM.DriverAccess.Telescope("ASCOM.Meade.net.Telescope");
#endif
//ASCOM.DriverAccess.Telescope device = new ASCOM.DriverAccess.Telescope("ASCOM.Meade.net.Telescope");
//#endif
// now run some tests, adding code to your driver so that the tests will pass.
// these first tests are common to all drivers.
@@ -50,8 +53,45 @@ namespace ASCOM.Meade.net
//Console.WriteLine($"Ra {device.RightAscension}");
//Console.WriteLine($"Dec {device.Declination}");
Console.WriteLine($"Altitude {device.Altitude}");
Console.WriteLine($"Azimuth {device.Azimuth}");
//Console.WriteLine($"Altitude {device.Altitude}");
//Console.WriteLine($"Azimuth {device.Azimuth}");
var seconds = 10;
Console.WriteLine("Slewing tests 10 second in each direction");
Console.WriteLine("test 1");
device.MoveAxis(TelescopeAxes.axisPrimary, 4);
Thread.Sleep(seconds * 1000);
device.MoveAxis(TelescopeAxes.axisPrimary, 0);
Console.WriteLine("test 2");
device.MoveAxis(TelescopeAxes.axisPrimary, -4);
Thread.Sleep(seconds * 1000);
device.MoveAxis(TelescopeAxes.axisPrimary, 0);
Console.WriteLine("test 3");
device.MoveAxis(TelescopeAxes.axisSecondary, 4);
Thread.Sleep(seconds * 1000);
device.MoveAxis(TelescopeAxes.axisSecondary, 0);
Console.WriteLine("test 4");
device.MoveAxis(TelescopeAxes.axisSecondary, -4);
Thread.Sleep(seconds * 1000);
device.MoveAxis(TelescopeAxes.axisSecondary, 0);
Console.WriteLine("Slewing tests complete");
seconds = 120;
Console.WriteLine($"Guiding for {seconds} seconds!");
foreach( var direction in Enum.GetValues(typeof(GuideDirections)).Cast<GuideDirections>())
{
Console.WriteLine($"{direction.ToString()}");
device.PulseGuide(direction, seconds* 1000);
}
Console.WriteLine("Guiding Finished");
device.Connected = false;
Console.WriteLine("Press Enter to finish");
@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ASCOM.Meade.net</RootNamespace>
<AssemblyName>ASCOM.Meade.net.Test</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
@@ -54,10 +54,14 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<Reference Include="JetBrains.Annotations, Version=4242.42.42.42, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
<HintPath>..\packages\JetBrains.Annotations.2022.3.1\lib\net20\JetBrains.Annotations.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
@@ -71,6 +75,7 @@
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+1 -1
View File
@@ -1,3 +1,3 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="JetBrains.Annotations" version="2022.3.1" targetFramework="net48" />
</packages>
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>