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
|
/*******************************************************************************
Copyright(c) 2019 Christian Liska. All rights reserved.
Implementation based on Lacerta MFOC driver
(written 2018 by Franck Le Rhun and Christian Liska).
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*******************************************************************************/
#pragma once
#include "indifocuser.h"
class astromechanics_foc : public INDI::Focuser
{
public:
astromechanics_foc();
bool initProperties() override;
bool updateProperties() override;
const char *getDefaultName() override;
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
protected:
virtual bool Disconnect() override;
virtual bool Handshake() override;
virtual IPState MoveAbsFocuser(uint32_t targetTicks) override;
virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override;
private:
virtual uint32_t GetAbsFocuserPosition();
virtual bool SetApperture(uint32_t index);
INumberVectorProperty AppertureNP;
INumber AppertureN[1];
bool sendCommand(const char * cmd, char * res = nullptr, int cmd_len = -1, int res_len = -1);
void hexDump(char * buf, const char * data, int size);
std::vector<std::string> split(const std::string &input, const std::string ®ex);
// # is the stop char
static const char DRIVER_STOP_CHAR { 0x23 };
// Wait up to a maximum of 3 seconds for serial input
static constexpr const uint8_t DRIVER_TIMEOUT {3};
// Maximum buffer for sending/receving.
static constexpr const uint8_t DRIVER_LEN {64};
};
|