Instrument Neutral Distributed Interface INDI  1.9.2
indipropertyswitch.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2021 by Pawel Soja <kernel32.pl@gmail.com>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Lesser General Public
6  License as published by the Free Software Foundation; either
7  version 2.1 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Lesser General Public License for more details.
13 
14  You should have received a copy of the GNU Lesser General Public
15  License along with this library; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 
19 #include "indipropertyswitch.h"
20 #include "indipropertyswitch_p.h"
21 
22 namespace INDI
23 {
24 
27 { }
28 
30 { }
31 
34 { }
35 
37 { }
38 
40 {
41  D_PTR(PropertySwitch);
42  d->property.reset();
43 }
44 
46 {
47  D_PTR(const PropertySwitch);
48  return d->property.findOnSwitchIndex();
49 }
50 
52 {
53  D_PTR(const PropertySwitch);
54  return d->property.findOnSwitch();
55 }
56 
57 bool PropertySwitch::update(const ISState states[], const char * const names[], int n)
58 {
59  D_PTR(PropertySwitch);
60  return d->property.update(states, names, n);
61 }
62 
64  const char *device, const char *name, const char *label, const char *group,
65  IPerm permission, ISRule rule, double timeout, IPState state
66 )
67 {
68  D_PTR(PropertySwitch);
69  d->property.setWidgets(d->widgets.data(), d->widgets.size());
70  d->property.fill(device, name, label, group, permission, rule, timeout, state);
71 }
72 
74 {
75  D_PTR(PropertySwitch);
76  d->property.setRule(rule);
77 }
78 
80 {
81  D_PTR(const PropertySwitch);
82  return d->property.getRule();
83 }
84 
85 const char * PropertySwitch::getRuleAsString() const
86 {
87  D_PTR(const PropertySwitch);
88  return d->property.getRuleAsString();
89 }
90 
91 }
IPState
IPState
Property state.
Definition: indiapi.h:158
INDI::PropertySwitch::~PropertySwitch
~PropertySwitch()
Definition: indipropertyswitch.cpp:36
ISwitch
One switch descriptor.
indipropertyswitch.h
INDI::PropertySwitch
Definition: indipropertyswitch.h:27
INDI::PropertySwitchPrivate::~PropertySwitchPrivate
virtual ~PropertySwitchPrivate()
Definition: indipropertyswitch.cpp:29
INDI::PropertySwitch::reset
void reset()
Definition: indipropertyswitch.cpp:39
INDI::PropertySwitch::setRule
void setRule(ISRule rule)
Definition: indipropertyswitch.cpp:73
INDI::PropertySwitch::PropertySwitch
PropertySwitch(size_t count)
Definition: indipropertyswitch.cpp:32
INDI::PropertySwitch::fill
void fill(const char *device, const char *name, const char *label, const char *group, IPerm permission, ISRule rule, double timeout, IPState state)
Definition: indipropertyswitch.cpp:63
INDI::PropertyBasicPrivateTemplate
Definition: indipropertybasic.h:34
INDI::PropertySwitch::update
bool update(const ISState states[], const char *const names[], int n)
Definition: indipropertyswitch.cpp:57
device
hid_device * device
Definition: activefocuser_utils.cpp:92
indipropertyswitch_p.h
INDI::PropertySwitchPrivate
Definition: indipropertyswitch_p.h:27
INDI::PropertySwitch::getRuleAsString
const char * getRuleAsString() const
Definition: indipropertyswitch.cpp:85
IPerm
IPerm
Permission hint, with respect to client.
Definition: indiapi.h:181
INDI::WidgetView< ISwitch >
Definition: indipropertyview.h:379
INDI::PropertySwitch::getRule
ISRule getRule() const
Definition: indipropertyswitch.cpp:79
INDI
Namespace to encapsulate INDI client, drivers, and mediator classes.
Definition: AlignmentSubsystemForClients.cpp:11
INDI::PropertyBasic
Definition: indipropertybasic.h:37
INDI::PropertySwitch::findOnSwitchIndex
int findOnSwitchIndex() const
Definition: indipropertyswitch.cpp:45
INDI::PropertySwitchPrivate::PropertySwitchPrivate
PropertySwitchPrivate(size_t count)
Definition: indipropertyswitch.cpp:25
ISState
ISState
Switch state.
Definition: indiapi.h:148
ISRule
ISRule
Switch vector rule hint.
Definition: indiapi.h:170
INDI::PropertySwitch::findOnSwitch
INDI::WidgetView< ISwitch > * findOnSwitch() const
Definition: indipropertyswitch.cpp:51