Instrument Neutral Distributed Interface INDI  1.9.2
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 
23 namespace Connection
24 {
25 const char *CONNECTION_TAB = "Connection";
26 
27 Interface::Interface(INDI::DefaultDevice *dev, Type type) : m_Device(dev), m_Type(type)
28 {
29  // Default handshake
30  registerHandshake([]() { return true; });
31 }
32 
33 Interface::~Interface()
34 {
35 }
36 
37 const char *Interface::getDeviceName()
38 {
39  return m_Device->getDeviceName();
40 }
41 
42 bool Interface::ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
43 {
44  INDI_UNUSED(dev);
45  INDI_UNUSED(name);
46  INDI_UNUSED(states);
47  INDI_UNUSED(names);
48  INDI_UNUSED(n);
49  return false;
50 }
51 
52 bool Interface::ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
53 {
54  INDI_UNUSED(dev);
55  INDI_UNUSED(name);
56  INDI_UNUSED(values);
57  INDI_UNUSED(names);
59  return false;
60 }
61 
62 bool Interface::ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
63 {
64  INDI_UNUSED(dev);
65  INDI_UNUSED(name);
66  INDI_UNUSED(texts);
67  INDI_UNUSED(names);
69  return false;
70 }
71 
72 bool Interface::ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[],
73  char *formats[], char *names[], int n)
74 {
75  INDI_UNUSED(dev);
76  INDI_UNUSED(name);
77  INDI_UNUSED(sizes);
78  INDI_UNUSED(blobsizes);
79  INDI_UNUSED(blobs);
80  INDI_UNUSED(formats);
81  INDI_UNUSED(names);
82  INDI_UNUSED(n);
83  return false;
84 }
85 
86 bool Interface::saveConfigItems(FILE *fp)
87 {
89  return true;
90 }
91 
92 void Interface::registerHandshake(std::function<bool()> callback)
93 {
94  Handshake = callback;
95 }
96 }
connectioninterface.h
Pulsar2Commands::getDeviceName
const char * getDeviceName()
Definition: lx200pulsar2.cpp:454
INDI_UNUSED
#define INDI_UNUSED(x)
Definition: indidevapi.h:799
ISNewNumber
void ISNewNumber(const char *dev, const char *name, double *values, char *names[], int n)
Update the value of an existing number vector property.
type
__le16 type
Definition: pwc-ioctl.h:2
Connection::CONNECTION_TAB
const char * CONNECTION_TAB
CONNECTION_TAB Where all device connection settings (serial, usb, ethernet) are defined and controlle...
Definition: connectioninterface.cpp:41
defaultdevice.h
ISNewSwitch
void ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Update the value of an existing switch vector property.
Definition: defaultdevice.cpp:60
Connection::Interface::Interface
Interface(INDI::DefaultDevice *dev, Type type=CONNECTION_NONE)
Definition: connectioninterface.cpp:43
ISNewText
void ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
Update the value of an existing text vector property.
Definition: defaultdevice.cpp:76
Type
Holds the connection type.
Connection
Combines all INDI Connection Plugins. Each INDI connection plugin is responsible of managing communic...
Definition: arduino_st4.h:33
ISState
ISState
Switch state.
Definition: indiapi.h:148
ISNewBLOB
void ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n)
Update data of an existing blob vector property.
Definition: defaultdevice.cpp:84
INDI::DefaultDevice
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
Definition: defaultdevice.h:118