예제 #1
0
        public QHYFilterWheel(string fwheel, IProfileService profileService)
        {
            this.profileService = profileService;
            StringBuilder FWheelId    = new StringBuilder(32);
            StringBuilder cameraModel = new StringBuilder(0);

            FWheelId.Append(fwheel);
            LibQHYCCD.N_GetQHYCCDModel(FWheelId, cameraModel);

            Info.Id = FWheelId;

            FWheelP = LibQHYCCD.N_OpenQHYCCD(Info.Id);

            if (LibQHYCCD.IsQHYCCDCFWPlugged(FWheelP) == LibQHYCCD.QHYCCD_SUCCESS)
            {
                Info.Positions = (uint)LibQHYCCD.GetQHYCCDParam(FWheelP, LibQHYCCD.CONTROL_ID.CONTROL_CFWSLOTSNUM);
            }
            else
            {
                Logger.Error($"QHYCFW: {Id} suddenly has no filter wheel!");
                return;
            }

            Info.Name = string.Format($"{cameraModel} {Info.Positions}-Slot Filter Wheel");

            LibQHYCCD.N_CloseQHYCCD(FWheelP);

            Logger.Debug($"QHYCFW: Found filter wheel: {Name}");
        }
예제 #2
0
        public async Task <bool> Connect(CancellationToken token)
        {
            return(await Task.Run(() => {
                byte[] position = new byte[1];

                Logger.Debug($"QHYCFW: Connecting to filter wheel {Name}");
                FWheelP = LibQHYCCD.N_OpenQHYCCD(Info.Id);

                Connected = true;
                return Connected;
            }));
        }