Instrument Neutral Distributed Interface INDI  2.0.2
abstractbaseclient_p.h
Go to the documentation of this file.
1 /*******************************************************************************
2  Copyright(c) 2016 Jasem Mutlaq. All rights reserved.
3  Copyright(c) 2022 Pawel Soja <kernel32.pl@gmail.com>
4 
5  INDI Qt Client
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License version 2 as published by the Free Software Foundation.
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  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 *******************************************************************************/
21 
22 #pragma once
23 
24 #include "watchdeviceproperty.h"
25 #include "indidevapi.h"
26 #include "indiuserio.h"
27 #include "indililxml.h"
28 
29 #include <atomic>
30 #include <string>
31 #include <map>
32 #include <set>
33 
34 namespace INDI
35 {
36 
37 struct BLOBMode
38 {
39  std::string device;
40  std::string property;
42 };
43 
44 class AbstractBaseClient;
46 {
47  public:
49  virtual ~AbstractBaseClientPrivate() = default;
50 
51  public:
52  virtual ssize_t sendData(const void *data, size_t size) = 0;
53 
54  public:
55  void clear();
56 
57  public:
59  int dispatchCommand(const INDI::LilXmlElement &root, char *errmsg);
60 
62  int deleteDevice(const char *devName, char *errmsg);
63 
65  int delPropertyCmd(const INDI::LilXmlElement &root, char *errmsg);
66 
68  int messageCmd(const INDI::LilXmlElement &root, char *errmsg);
69 
70  public:
71  void userIoGetProperties();
72 
73  public:
79  void setDriverConnection(bool status, const char *deviceName);
80 
81  public:
82  BLOBMode *findBLOBMode(const std::string &device, const std::string &property);
83 
84  public:
86 
87  std::list<BLOBMode> blobModes;
88 
89  std::string cServer {"localhost"};
90  uint32_t cPort {7624};
91 
92  std::atomic_bool sConnected {false};
93 
94  bool verbose {false};
95 
96  uint32_t timeout_sec {3}, timeout_us {0};
97 
99 
100  static userio io;
101 };
102 
103 }
hid_device * device
int dispatchCommand(const INDI::LilXmlElement &root, char *errmsg)
Dispatch command received from INDI server to respective devices handled by the client.
int messageCmd(const INDI::LilXmlElement &root, char *errmsg)
AbstractBaseClientPrivate(AbstractBaseClient *parent)
void setDriverConnection(bool status, const char *deviceName)
Connect/Disconnect to INDI driver.
int deleteDevice(const char *devName, char *errmsg)
Remove device.
virtual ~AbstractBaseClientPrivate()=default
int delPropertyCmd(const INDI::LilXmlElement &root, char *errmsg)
Delete property command.
virtual ssize_t sendData(const void *data, size_t size)=0
BLOBMode * findBLOBMode(const std::string &device, const std::string &property)
Interface to the reference INDI C API device implementation on the Device Driver side.
BLOBHandling
How drivers handle BLOBs incoming from snooping drivers.
Definition: indidevapi.h:266
Namespace to encapsulate INDI client, drivers, and mediator classes.
BLOBHandling blobMode
Definition: userio.h:29