Instrument Neutral Distributed Interface INDI 2.2.5
ikunfocuser_protocol.h
Go to the documentation of this file.
1/*
2 IKunFocuser protocol helpers
3 Copyright (C) 2026 IKunFocuser contributors
4 SPDX-License-Identifier: LGPL-2.1-or-later
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15*/
16
17#pragma once
18
19#include <cstdint>
20#include <string>
21
22namespace IKunFocuserProtocol
23{
24
26{
27 int64_t position { 0 };
28 bool moving { false };
29};
30
31bool parseMotionStatus(const std::string &response, MotionStatus &status);
32bool parseVersion(const std::string &response, int &version);
33bool parseJsonInteger(const std::string &json, const std::string &key, int64_t &value);
34bool parseJsonNumber(const std::string &json, const std::string &key, double &value);
35bool parseJsonBoolean(const std::string &json, const std::string &key, bool &value);
36bool isErrorResponse(const std::string &response);
37bool isSupportedIdentity(const std::string &response);
38const char *modelForVersion(int version);
39bool isSupportedVersion(int version);
40
41} // namespace IKunFocuserProtocol
a class to store JSON values
bool parseJsonBoolean(const std::string &json, const std::string &key, bool &value)
const char * modelForVersion(int version)
bool isSupportedIdentity(const std::string &response)
bool isErrorResponse(const std::string &response)
bool isSupportedVersion(int version)
bool parseJsonNumber(const std::string &json, const std::string &key, double &value)
bool parseMotionStatus(const std::string &response, MotionStatus &status)
bool parseVersion(const std::string &response, int &version)
bool parseJsonInteger(const std::string &json, const std::string &key, int64_t &value)