Instrument Neutral Distributed Interface INDI 2.2.5
connectioninterface.cpp
Go to the documentation of this file.
1/*******************************************************************************
2 Copyright(c) 2017 Jasem Mutlaq. All rights reserved.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation.
7
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
12
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
17*******************************************************************************/
18
19#include "connectioninterface.h"
20
21#include "defaultdevice.h"
22
23namespace Connection
24{
25const char *CONNECTION_TAB = "Connection";
26
27Interface::Interface(INDI::DefaultDevice *dev, Type type) : m_Device(dev), m_Type(type)
28{
29 // Default handshake
31 {
32 return true;
33 });
34}
35
39
41{
42 return m_Device->getDeviceName();
43}
44
45bool Interface::ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
46{
47 INDI_UNUSED(dev);
49 INDI_UNUSED(states);
50 INDI_UNUSED(names);
51 INDI_UNUSED(n);
52 return false;
53}
54
55bool Interface::ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
56{
57 INDI_UNUSED(dev);
59 INDI_UNUSED(values);
60 INDI_UNUSED(names);
61 INDI_UNUSED(n);
62 return false;
63}
64
65bool Interface::ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
66{
67 INDI_UNUSED(dev);
69 INDI_UNUSED(texts);
70 INDI_UNUSED(names);
71 INDI_UNUSED(n);
72 return false;
73}
74
75bool Interface::ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[],
76 char *formats[], char *names[], int n)
77{
78 INDI_UNUSED(dev);
80 INDI_UNUSED(sizes);
81 INDI_UNUSED(blobsizes);
82 INDI_UNUSED(blobs);
83 INDI_UNUSED(formats);
84 INDI_UNUSED(names);
85 INDI_UNUSED(n);
86 return false;
87}
88
90{
91 INDI_UNUSED(fp);
92 return true;
93}
94
95void Interface::registerHandshake(std::function<bool()> callback)
96{
97 Handshake = callback;
98}
99}
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
virtual bool ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n)
virtual std::string name()=0
Interface(INDI::DefaultDevice *dev, Type type=CONNECTION_NONE)
void registerHandshake(std::function< bool()> callback)
registerHandshake Register a handshake function to be called once the initial connection to the devic...
std::function< bool()> Handshake
INDI::DefaultDevice * m_Device
virtual bool saveConfigItems(FILE *fp)
const char * getDeviceName() const
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
ISState
Switch state.
Definition indiapi.h:148
#define INDI_UNUSED(x)
Definition indidevapi.h:132
Combines all INDI Connection Plugins. Each INDI connection plugin is responsible of managing communic...
Definition arduino_st4.h:34
const char * CONNECTION_TAB
uint16_t type
Definition pwc-ioctl.h:0
Holds the connection type.