Instrument Neutral Distributed Interface INDI 2.2.5
ClInfo.hpp
Go to the documentation of this file.
1/* INDI Server for protocol version 1.7.
2 * Copyright (C) 2007 Elwood C. Downey <[email protected]>
3 2013 Jasem Mutlaq <[email protected]>
4 2022 Ludovic Pollet
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18*/
19#pragma once
20
21#include "indicore/indidevapi.h"
22#include "MsgQueue.hpp"
23#include "lilxml.h"
24
25class DvrInfo;
26class Property;
27
28/* info for each connected client */
29class ClInfo: public MsgQueue
30{
31 protected:
32 /* send message to each appropriate driver.
33 * also send all newXXX() to all other interested clients.
34 */
35 virtual void onMessage(XMLEle *root, std::list<int> &sharedBuffers);
36
37 /* Update the client property BLOB handling policy */
38 void crackBLOBHandling(const std::string &dev, const std::string &name, const char *enableBLOB);
39
40 /* close down the given client */
41 virtual void close();
42
43 public:
44 std::list<Property*> props; /* props we want */
45 int allprops = 0; /* saw getProperties w/o device */
46 BLOBHandling blob = B_NEVER; /* when to send setBLOBs */
47
49 virtual ~ClInfo();
50
51 /* return 0 if cp may be interested in dev/name else -1
52 */
53 int findDevice(const std::string &dev, const std::string &name) const;
54
55 /* add the given device and property to the props[] list of client if new.
56 */
57 void addDevice(const std::string &dev, const std::string &name, int isblob);
58
59 virtual void log(const std::string &log) const;
60
61 /* put Msg mp on queue of each chained server client, except notme.
62 */
63 static void q2Servers(DvrInfo *me, Msg *mp, XMLEle *root);
64
65 /* put Msg mp on queue of each client interested in dev/name, except notme.
66 * if BLOB always honor current mode.
67 */
68 static void q2Clients(ClInfo *notme, int isblob, const std::string &dev, const std::string &name, Msg *mp, XMLEle *root);
69
70 /* Reference to all active clients */
72};
int allprops
Definition ClInfo.hpp:45
static ConcurrentSet< ClInfo > clients
Definition ClInfo.hpp:71
virtual void log(const std::string &log) const
Definition ClInfo.cpp:320
static void q2Clients(ClInfo *notme, int isblob, const std::string &dev, const std::string &name, Msg *mp, XMLEle *root)
Definition ClInfo.cpp:109
static void q2Servers(DvrInfo *me, Msg *mp, XMLEle *root)
Definition ClInfo.cpp:195
void crackBLOBHandling(const std::string &dev, const std::string &name, const char *enableBLOB)
Definition ClInfo.cpp:283
BLOBHandling blob
Definition ClInfo.hpp:46
virtual void close()
Definition ClInfo.cpp:96
int findDevice(const std::string &dev, const std::string &name) const
Definition ClInfo.cpp:252
std::list< Property * > props
Definition ClInfo.hpp:44
virtual ~ClInfo()
Definition ClInfo.cpp:310
virtual void onMessage(XMLEle *root, std::list< int > &sharedBuffers)
Definition ClInfo.cpp:30
void addDevice(const std::string &dev, const std::string &name, int isblob)
Definition ClInfo.cpp:264
bool useSharedBuffer
Definition MsgQueue.hpp:66
Definition Msg.hpp:33
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:267
@ B_NEVER
Definition indidevapi.h:268
char * me
Definition indidriver.c:50
A little DOM-style library to handle parsing and processing an XML file.