-
Notifications
You must be signed in to change notification settings - Fork 0
/
Driver.cs
1526 lines (1316 loc) · 50.8 KB
/
Driver.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//tabs=4
// --------------------------------------------------------------------------------
// ASCOM Camera Driver for LxWebcam
//
// Description: Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
// nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam
// erat, sed diam voluptua. At vero eos et accusam et justo duo
// dolores et ea rebum. Stet clita kasd gubergren, no sea takimata
// sanctus est Lorem ipsum dolor sit amet.
//
// Implements: ASCOM Camera interface version: 2
// Author: Lung-Kai Cheng <lkcheng89@gmail.com>
//
// Edit Log:
//
// Date Who Vers Description
// ----------- --- ----- -------------------------------------------------------
// dd-mmm-yyyy XXX 6.0.0 Initial edit, created from ASCOM driver template
// --------------------------------------------------------------------------------
//
#define Camera
using DirectShowLib;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Runtime.InteropServices;
using ASCOM;
using ASCOM.Astrometry;
using ASCOM.Astrometry.AstroUtils;
using ASCOM.Utilities;
using ASCOM.DeviceInterface;
using System.Globalization;
using System.Collections;
using System.IO.Ports;
using System.Threading;
using System.Drawing;
using System.Drawing.Imaging;
using System.Text.RegularExpressions;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
namespace ASCOM.LxWebcam
{
//
// Your driver's DeviceID is ASCOM.LxWebcam.Camera
//
// The Guid attribute sets the CLSID for ASCOM.LxWebcam.Camera
// The ClassInterface/None addribute prevents an empty interface called
// _LxWebcam from being created and used as the [default] interface
//
// TODO Replace the not implemented exceptions with code to implement the function or
// throw the appropriate ASCOM exception.
//
/// <summary>
/// ASCOM Camera Driver for LxWebcam.
/// </summary>
[Guid("68f32d94-e64a-4523-8955-52892c80cc85")]
[ClassInterface(ClassInterfaceType.None)]
public partial class Camera : ICameraV2
{
/// <summary>
/// ASCOM DeviceID (COM ProgID) for this driver.
/// The DeviceID is used by ASCOM applications to load the driver at runtime.
/// </summary>
internal static string driverID = "ASCOM.LxWebcam.Camera";
/// <summary>
/// Driver description that displays in the ASCOM Chooser.
/// </summary>
internal static string driverDescription = "LxWebcam";
internal static string webcamProfileName = "Webcam"; // Constants used for Profile persistence
internal static string webcamDefault = "Philips SPC 900NC PC Camera";
internal static string mediaTypeProfileName = "MediaType";
internal static string mediaTypeDefault = "";
internal static string pixelSizeXProfileName = "PixelSizeX";
internal static double pixelSizeXDefault = 5.6;
internal static string pixelSizeYProfileName = "PixelSizeY";
internal static double pixelSizeYDefault = 5.6;
internal static string comPortProfileName = "ComPort";
internal static string comPortDefault = "COM1";
internal static string baudRateProfileName = "BaudRate";
internal static int baudRateDefault = 9600;
internal static string parityProfileName = "Parity";
internal static Parity parityDefault = Parity.None;
internal static string dataBitsProfileName = "DataBits";
internal static int dataBitsDefault = 8;
internal static string stopBitsProfileName = "StopBits";
internal static StopBits stopBitsDefault = StopBits.One;
internal static string readTimeoutProfileName = "ReadTimeout";
internal static int readTimeoutDefault = 1000;
internal static string writeTimeoutProfileName = "WriteTimeout";
internal static int writeTimeoutDefault = 1000;
internal static string traceLoggerProfileName = "TraceLogger";
internal static bool traceLoggerDefault = false;
internal static string webcamName; // Variables to hold the currrent device configuration
internal static VideoInfoHeader mediaType;
internal static double pixelSizeX;
internal static double pixelSizeY;
internal static string comPortName;
internal static int baudRate;
internal static Parity parity;
internal static int dataBits;
internal static StopBits stopBits;
internal static int readTimeout;
internal static int writeTimeout;
internal static TraceLogger traceLogger;
internal Webcam webcam; // Initialise variables to hold values required for functionality tested by Conform
internal ComPort comPort;
internal int cameraXSize;
internal int cameraYSize;
internal int numX;
internal int numY;
internal int startX;
internal int startY;
internal double exposureMin;
internal double exposureMax;
internal DateTime exposureStart;
internal DateTime exposureAbort;
internal double exposureDuration;
internal bool imageReady;
internal int[,,] imageArray;
internal CameraStates cameraState;
internal int pulseGuideMin;
internal int pulseGuideMax;
internal Semaphore semaphore;
internal bool threadRunning;
internal Thread thread;
/// <summary>
/// Initializes a new instance of the <see cref="LxWebcam"/> class.
/// Must be public for COM registration.
/// </summary>
public Camera()
{
traceLogger = new TraceLogger("", "LxWebcam");
ReadProfile(); // Read device configuration from the ASCOM Profile store
traceLogger.LogMessage("Camera", "Starting initialisation");
webcam = null;
comPort = null;
cameraXSize = 0;
cameraYSize = 0;
numX = 0;
numY = 0;
startX = 0;
startY = 0;
exposureMin = double.NaN;
exposureMax = double.NaN;
exposureStart = DateTime.MinValue;
exposureAbort = DateTime.MinValue;
exposureDuration = double.NaN;
imageReady = false;
imageArray = null;
cameraState = CameraStates.cameraIdle;
pulseGuideMin = 0;
pulseGuideMax = 0;
semaphore = null;
threadRunning = false;
thread = null;
traceLogger.LogMessage("Camera", "Completed initialisation");
}
//
// PUBLIC COM INTERFACE ICameraV2 IMPLEMENTATION
//
#region Common properties and methods.
/// <summary>
/// Displays the Setup Dialog form.
/// If the user clicks the OK button to dismiss the form, then
/// the new settings are saved, otherwise the old values are reloaded.
/// THIS IS THE ONLY PLACE WHERE SHOWING USER INTERFACE IS ALLOWED!
/// </summary>
public void SetupDialog()
{
if (this.webcam != null && this.comPort != null)
{
System.Windows.Forms.MessageBox.Show("Already connected, just press OK");
}
using (SetupDialogForm F = new SetupDialogForm())
{
var result = F.ShowDialog();
if (result == System.Windows.Forms.DialogResult.OK)
{
WriteProfile(); // Persist device configuration values to the ASCOM Profile store
}
}
}
public ArrayList SupportedActions
{
get
{
LogMessage("SupportedActions_get", "[ ]");
return new ArrayList();
}
}
public string Action(string actionName, string actionParameters)
{
LogMessage("Action", "ActionNotImplementedException");
throw new ASCOM.ActionNotImplementedException(actionName);
}
public void CommandBlind(string command, bool raw)
{
LogMessage("CommandBlind", "MethodNotImplementedException");
throw new ASCOM.MethodNotImplementedException("CommandBlind");
}
public bool CommandBool(string command, bool raw)
{
LogMessage("CommandBool", "MethodNotImplementedException");
throw new ASCOM.MethodNotImplementedException("CommandBool");
}
public string CommandString(string command, bool raw)
{
LogMessage("CommandString", "MethodNotImplementedException");
throw new ASCOM.MethodNotImplementedException("CommandString");
}
public void Dispose()
{
traceLogger.Enabled = false;
traceLogger.Dispose();
traceLogger = null;
}
public bool Connected
{
get
{
bool connected = (this.webcam != null && this.comPort != null);
LogMessage("Connected_get", connected.ToString(CultureInfo.InvariantCulture));
return connected;
}
set
{
LogMessage("Connected_set", value.ToString(CultureInfo.InvariantCulture));
if (value)
{
bool connected = false;
do
{
if (this.webcam != null && this.comPort != null)
{
connected = true; break;
}
this.webcam = new Webcam(webcamName)
{
MediaType = mediaType,
};
try
{
this.webcam.Open();
}
catch (COMException e)
{
LogMessage("Connected_set", "[{0}] [{1}:0x{2:X08}][{3}]", webcamName, e.GetType(), e.ErrorCode, e.Message);
break;
}
catch (Exception e)
{
LogMessage("Connected_set", "[{0}] [{1}][{2}]", webcamName, e.GetType(), e.Message);
break;
}
this.cameraXSize = this.webcam.Width;
this.cameraYSize = this.webcam.Height;
this.numX = this.webcam.Width;
this.numY = this.webcam.Height;
this.comPort = new ComPort(comPortName)
{
BaudRate = baudRate,
Parity = parity,
DataBits = dataBits,
StopBits = stopBits,
ReadTimeout = readTimeout,
WriteTimeout = writeTimeout,
};
try
{
this.comPort.Open();
}
catch (Exception e)
{
LogMessage("Connected_set", "[{0}] [{1}][{2}]", comPortName, e.GetType(), e.Message);
break;
}
ComPort.Response response = this.comPort.Lx(true);
LogMessage("Connected_set", response.ToString());
if (response != ComPort.Response.OK)
{
break;
}
response = this.comPort.Amp(false);
LogMessage("Connected_set", response.ToString());
if (response != ComPort.Response.OK)
{
break;
}
response = this.comPort.Duration(ComPort.Exposure, out int min, out int max);
LogMessage("Connected_set", response.ToString());
if (response != ComPort.Response.OK)
{
break;
}
this.exposureMin = min / 1000.0;
this.exposureMax = max / 1000.0;
response = comPort.Duration(ComPort.PulseGuide, out pulseGuideMin, out pulseGuideMax);
LogMessage("Connected_set", response.ToString());
if (response != ComPort.Response.OK)
{
break;
}
this.semaphore = new Semaphore(0, 1);
this.threadRunning = true;
this.thread = new Thread(ExposureThread);
this.thread.Start();
connected = true;
}
while (false);
if (!connected)
{
if (this.webcam != null)
{
try
{
this.webcam.Close();
}
catch
{
}
finally
{
this.webcam = null;
}
}
if (this.comPort != null)
{
ComPort.Response response = comPort.Lx(false);
LogMessage("Connected_set", response.ToString());
response = comPort.Amp(true);
LogMessage("Connected_set", response.ToString());
try
{
this.comPort.Close();
}
catch
{
}
finally
{
this.comPort = null;
}
}
this.semaphore = null;
this.threadRunning = false;
this.thread = null;
}
}
else
{
this.threadRunning = false;
if (this.thread != null)
{
if (this.semaphore != null)
{
try
{
this.semaphore.Release();
}
catch
{
}
finally
{
this.semaphore = null;
}
}
try
{
this.thread.Join();
}
catch
{
}
finally
{
this.thread = null;
}
}
else if (this.semaphore != null)
{
this.semaphore = null;
}
if (this.webcam != null)
{
try
{
this.webcam.Close();
}
catch
{
}
finally
{
this.webcam = null;
}
}
if (this.comPort != null)
{
ComPort.Response response = comPort.Lx(false);
LogMessage("Connected_set", response.ToString());
response = comPort.Amp(true);
LogMessage("Connected_set", response.ToString());
try
{
this.comPort.Close();
}
catch
{
}
finally
{
this.comPort = null;
}
}
}
}
}
public string Description
{
get
{
LogMessage("Description_get", driverDescription);
return driverDescription;
}
}
public string DriverInfo
{
get
{
Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
string driverInfo = "LxWebcam Driver v" + String.Format(CultureInfo.InvariantCulture, "{0}.{1}", version.Major, version.Minor);
LogMessage("DriverInfo_get", driverInfo);
return driverInfo;
}
}
public string DriverVersion
{
get
{
Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
string driverVersion = String.Format(CultureInfo.InvariantCulture, "{0}.{1}", version.Major, version.Minor);
LogMessage("DriverVersion_get", driverVersion);
return driverVersion;
}
}
public short InterfaceVersion
{
get
{
LogMessage("InterfaceVersion_get", "2");
return Convert.ToInt16("2");
}
}
public string Name
{
get
{
string name = "LxWebcam";
LogMessage("Name_get", name);
return name;
}
}
#endregion
#region ICamera Implementation
private void ExposureThread()
{
while (true)
{
bool success;
try
{
success = this.semaphore.WaitOne();
}
catch
{
success = false;
}
if (!success || !this.threadRunning)
{
cameraState = CameraStates.cameraIdle; break;
}
int startX = this.startX;
int startY = this.startY;
int numX = this.numX;
int numY = this.numY;
HashSet<string> states = new HashSet<string>();
while (this.threadRunning)
{
ComPort.Response response = this.comPort.State(states);
LogMessage("ExposureThread", response.ToString());
if (response != ComPort.Response.OK)
{
success = false; break;
}
if (!states.Contains(ComPort.Exposure))
{
break;
}
cameraState = CameraStates.cameraExposing; Thread.Sleep(1);
}
if (!this.threadRunning)
{
this.cameraState = CameraStates.cameraIdle; break;
}
if (success && this.exposureStart > this.exposureAbort)
{
this.cameraState = CameraStates.cameraReading;
this.imageReady = this.webcam.Capture(out this.imageArray, startX, startY, numX, numY);
}
this.cameraState = CameraStates.cameraIdle;
}
}
public void AbortExposure()
{
this.CheckConnected("AbortExposure");
if (this.cameraState != CameraStates.cameraIdle)
{
this.exposureAbort = DateTime.Now;
ComPort.Response response = this.comPort.Stop();
LogMessage("AbortExposure", response.ToString());
if (response.Reply != "OK")
{
throw new InvalidOperationException("AbortExposure");
}
}
}
public short BayerOffsetX
{
get
{
short bayerOffsetX = 0;
LogMessage("BayerOffsetX_get", bayerOffsetX.ToString(CultureInfo.InvariantCulture));
return bayerOffsetX;
}
}
public short BayerOffsetY
{
get
{
short bayerOffsetY = 0;
LogMessage("BayerOffsetY_get", bayerOffsetY.ToString(CultureInfo.InvariantCulture));
return bayerOffsetY;
}
}
public short BinX
{
get
{
short binX = 1;
LogMessage("BinX_get", binX.ToString(CultureInfo.InvariantCulture));
return binX;
}
set
{
LogMessage("BinX_set", value.ToString(CultureInfo.InvariantCulture));
if (value != 1) throw new ASCOM.InvalidValueException("BinX", value.ToString(CultureInfo.InvariantCulture), "1");
}
}
public short BinY
{
get
{
short binY = 1;
LogMessage("BinY_get", binY.ToString(CultureInfo.InvariantCulture));
return binY;
}
set
{
LogMessage("BinY_set", value.ToString(CultureInfo.InvariantCulture));
if (value != 1) throw new ASCOM.InvalidValueException("BinY", value.ToString(CultureInfo.InvariantCulture), "1");
}
}
public double CCDTemperature
{
get
{
LogMessage("CCDTemperature_get", "PropertyNotImplementedException");
throw new ASCOM.PropertyNotImplementedException("CCDTemperature", false);
}
}
public CameraStates CameraState
{
get
{
this.CheckConnected("CameraState_get");
LogMessage("CameraState_get", this.cameraState.ToString());
return this.cameraState;
}
}
public int CameraXSize
{
get
{
this.CheckConnected("CameraXSize_get");
LogMessage("CameraXSize_get", this.cameraXSize.ToString(CultureInfo.InvariantCulture));
return this.cameraXSize;
}
}
public int CameraYSize
{
get
{
this.CheckConnected("CameraYSize_get");
LogMessage("CameraYSize_get", this.cameraYSize.ToString(CultureInfo.InvariantCulture));
return this.cameraYSize;
}
}
public bool CanAbortExposure
{
get
{
LogMessage("CanAbortExposure_get", true.ToString(CultureInfo.InvariantCulture));
return true;
}
}
public bool CanAsymmetricBin
{
get
{
LogMessage("CanAsymmetricBin_get", false.ToString(CultureInfo.InvariantCulture));
return false;
}
}
public bool CanFastReadout
{
get
{
LogMessage("CanFastReadout_get", false.ToString(CultureInfo.InvariantCulture));
return false;
}
}
public bool CanGetCoolerPower
{
get
{
LogMessage("CanGetCoolerPower_get", false.ToString(CultureInfo.InvariantCulture));
return false;
}
}
public bool CanPulseGuide
{
get
{
LogMessage("CanPulseGuide_get", true.ToString(CultureInfo.InvariantCulture));
return true;
}
}
public bool CanSetCCDTemperature
{
get
{
LogMessage("CanSetCCDTemperature_get", false.ToString(CultureInfo.InvariantCulture));
return false;
}
}
public bool CanStopExposure
{
get
{
LogMessage("CanStopExposure_get", true.ToString(CultureInfo.InvariantCulture));
return true;
}
}
public bool CoolerOn
{
get
{
LogMessage("CoolerOn_get", "PropertyNotImplementedException");
throw new ASCOM.PropertyNotImplementedException("CoolerOn", false);
}
set
{
LogMessage("CoolerOn_set", "PropertyNotImplementedException");
throw new ASCOM.PropertyNotImplementedException("CoolerOn", true);
}
}
public double CoolerPower
{
get
{
LogMessage("CoolerPower_get", "PropertyNotImplementedException");
throw new ASCOM.PropertyNotImplementedException("CoolerPower", false);
}
}
public double ElectronsPerADU
{
get
{
LogMessage("ElectronsPerADU_get", "PropertyNotImplementedException");
throw new ASCOM.PropertyNotImplementedException("ElectronsPerADU", false);
}
}
public double ExposureMax
{
get
{
this.CheckConnected("ExposureMax_get");
LogMessage("ExposureMax_get", this.exposureMax.ToString(CultureInfo.InvariantCulture));
return this.exposureMax;
}
}
public double ExposureMin
{
get
{
this.CheckConnected("ExposureMin_get");
LogMessage("ExposureMin_get", this.exposureMin.ToString(CultureInfo.InvariantCulture));
return this.exposureMin;
}
}
public double ExposureResolution
{
get
{
this.CheckConnected("ExposureResolution_get");
double resolution = 0.001;
LogMessage("ExposureResolution_get", resolution.ToString(CultureInfo.InvariantCulture));
return resolution;
}
}
public bool FastReadout
{
get
{
LogMessage("FastReadout_get", "PropertyNotImplementedException");
throw new ASCOM.PropertyNotImplementedException("FastReadout", false);
}
set
{
LogMessage("FastReadout_set", "PropertyNotImplementedException");
throw new ASCOM.PropertyNotImplementedException("FastReadout", true);
}
}
public double FullWellCapacity
{
get
{
LogMessage("FullWellCapacity_get", "PropertyNotImplementedException");
throw new ASCOM.PropertyNotImplementedException("FullWellCapacity", false);
}
}
public short Gain
{
get
{
LogMessage("Gain_get", "PropertyNotImplementedException");
throw new ASCOM.PropertyNotImplementedException("Gain", false);
}
set
{
LogMessage("Gain_set", "PropertyNotImplementedException");
throw new ASCOM.PropertyNotImplementedException("Gain", true);
}
}
public short GainMax
{
get
{
LogMessage("GainMax_get", "PropertyNotImplementedException");
throw new ASCOM.PropertyNotImplementedException("GainMax", false);
}
}
public short GainMin
{
get
{
LogMessage("GainMin_get", "PropertyNotImplementedException");
throw new ASCOM.PropertyNotImplementedException("GainMin", true);
}
}
public ArrayList Gains
{
get
{
LogMessage("Gains_get", "PropertyNotImplementedException");
throw new ASCOM.PropertyNotImplementedException("Gains", true);
}
}
public bool HasShutter
{
get
{
LogMessage("HasShutter_get", false.ToString(CultureInfo.InvariantCulture));
return false;
}
}
public double HeatSinkTemperature
{
get
{
LogMessage("HeatSinkTemperature_get", "PropertyNotImplementedException");
throw new ASCOM.PropertyNotImplementedException("HeatSinkTemperature", false);
}
}
public object ImageArray
{
get
{
CheckConnected("ImageArray_get");
if (!this.imageReady || this.imageArray == null)
{
LogMessage("ImageArray_get", "InvalidOperationException");
throw new ASCOM.InvalidOperationException();
}
return this.imageArray;
}
}
public object ImageArrayVariant
{
get
{
CheckConnected("ImageArrayVariant_get");
if (!this.imageReady || this.imageArray == null)
{
LogMessage("ImageArrayVariant_get", "InvalidOperationException");
throw new ASCOM.InvalidOperationException();
}
object[,,] imageArrayVariant = new object[this.numX, this.numY, 3];
for (int x = 0; x < this.numX; x++)
{
for (int y = 0; y < this.numY; y++)
{
imageArrayVariant[x, y, 0] = this.imageArray[x, y, 0];
imageArrayVariant[x, y, 1] = this.imageArray[x, y, 1];
imageArrayVariant[x, y, 2] = this.imageArray[x, y, 2];
}
}
return imageArrayVariant;
}
}
public bool ImageReady
{
get
{
CheckConnected("ImageReady_get");
LogMessage("ImageReady_get", this.imageReady.ToString(CultureInfo.InvariantCulture));
return imageReady;
}
}
public bool IsPulseGuiding
{
get
{
CheckConnected("IsPulseGuiding_get");
HashSet<string> states = new HashSet<string>();
ComPort.Response response = this.comPort.State(states);
LogMessage("IsPulseGuiding_get", response.ToString());
if (response != ComPort.Response.OK)
{
throw new InvalidOperationException("IsPulseGuiding_get");
}
return states.Contains(ComPort.PulseGuide);
}
}
public double LastExposureDuration
{
get
{
if (!this.imageReady)
{