Instrument Neutral Distributed Interface INDI  1.9.2
streammanager.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2020 by Pawel Soja <kernel32.pl@gmail.com>
3  Copyright (C) 2015 by Jasem Mutlaq <mutlaqja@ikarustech.com>
4  Copyright (C) 2014 by geehalel <geehalel@gmail.com>
5 
6  Stream Recorder
7 
8  This library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Lesser General Public
10  License as published by the Free Software Foundation; either
11  version 2.1 of the License, or (at your option) any later version.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public
19  License along with this library; if not, write to the Free Software
20  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 
22 */
23 
24 #pragma once
25 
26 #include "indidevapi.h"
27 #include "indibasetypes.h"
28 #include "indimacros.h"
29 #include <memory>
30 
87 namespace INDI
88 {
89 
90 class CCD;
91 class SensorInterface;
92 class RecorderInterface;
93 class StreamManagerPrivate;
94 class DefaultDevice;
95 
97 {
98  DECLARE_PRIVATE(StreamManager)
99 
100 public:
101  StreamManager(DefaultDevice *currentDevice);
102  virtual ~StreamManager();
103 
104 public:
105  virtual void ISGetProperties(const char *dev);
106  virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n);
107  virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n);
108  virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n);
109 
110  virtual bool initProperties();
111  virtual bool updateProperties();
112  virtual bool saveConfigItems(FILE *fp);
113 
114 public:
118  void newFrame(const uint8_t *buffer, uint32_t nbytes);
119 
120  bool close();
121 
122 public:
127  void setStreamingExposureEnabled(bool enable);
128 
134  bool setStream(bool enable);
135  void setSize(uint16_t width, uint16_t height = 1);
136  bool setPixelFormat(INDI_PIXEL_FORMAT pixelFormat, uint8_t pixelDepth = 8);
137 
138 public:
139  bool isDirectRecording() const;
140  bool isStreaming() const;
141  bool isRecording() const;
142  bool isBusy() const;
143 
144 public:
145  double getTargetFPS() const;
146  double getTargetExposure() const;
147 
148  void getStreamFrame(uint16_t *x, uint16_t *y, uint16_t *w, uint16_t *h) const;
150 
151  const char *getDeviceName() const;
152 
153 protected:
154  std::shared_ptr<StreamManagerPrivate> d_ptr;
155 };
156 
157 }
INDI::StreamManager::isRecording
bool isRecording() const
Definition: streammanager.cpp:1258
INDI::StreamManager::setStream
bool setStream(bool enable)
setStream Enables (starts) or disables (stops) streaming.
Definition: streammanager.cpp:1119
INDI::StreamManager::close
bool close()
Definition: streammanager.cpp:532
INDI::StreamManager::newFrame
void newFrame(const uint8_t *buffer, uint32_t nbytes)
newFrame CCD drivers call this function when a new frame is received. It is then streamed,...
Definition: streammanager.cpp:342
INDI::StreamManager::StreamManager
StreamManager(DefaultDevice *currentDevice)
Definition: streammanager.cpp:73
indimacros.h
INDI::StreamManager::updateProperties
virtual bool updateProperties()
Definition: streammanager.cpp:253
INDI::StreamManager::isBusy
bool isBusy() const
Definition: streammanager.cpp:1264
INDI::StreamManager
Definition: streammanager.h:96
INDI::StreamManager::ISNewNumber
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
Definition: streammanager.cpp:1009
INDI::StreamManager::getRecorder
RecorderInterface * getRecorder() const
Definition: streammanager.cpp:1240
INDI::StreamManager::ISNewSwitch
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Definition: streammanager.cpp:892
INDI::StreamManager::setStreamingExposureEnabled
void setStreamingExposureEnabled(bool enable)
setStreamingExposureEnabled Can stream exposure time be changed?
Definition: streammanager.cpp:1281
INDI::StreamManager::ISGetProperties
virtual void ISGetProperties(const char *dev)
Definition: streammanager.cpp:202
INDI::StreamManager::saveConfigItems
virtual bool saveConfigItems(FILE *fp)
Definition: streammanager.cpp:1125
INDI::StreamManager::initProperties
virtual bool initProperties()
Definition: streammanager.cpp:175
INDI::StreamManager::setPixelFormat
bool setPixelFormat(INDI_PIXEL_FORMAT pixelFormat, uint8_t pixelDepth=8)
Definition: streammanager.cpp:568
indidevapi.h
Interface to the reference INDI C API device implementation on the Device Driver side.
INDI::StreamManager::isStreaming
bool isStreaming() const
Definition: streammanager.cpp:1252
INDI::StreamManager::ISNewText
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
Definition: streammanager.cpp:922
indibasetypes.h
INDI::StreamManager::getTargetFPS
double getTargetFPS() const
Definition: streammanager.cpp:1270
INDI::StreamManager::getStreamFrame
void getStreamFrame(uint16_t *x, uint16_t *y, uint16_t *w, uint16_t *h) const
Definition: streammanager.cpp:1157
INDI::StreamManager::isDirectRecording
bool isDirectRecording() const
Definition: streammanager.cpp:1246
INDI
Namespace to encapsulate INDI client, drivers, and mediator classes.
Definition: AlignmentSubsystemForClients.cpp:11
INDI::StreamManager::getTargetExposure
double getTargetExposure() const
Definition: streammanager.cpp:1275
INDI::StreamManager::d_ptr
std::shared_ptr< StreamManagerPrivate > d_ptr
Definition: streammanager.h:154
INDI::RecorderInterface
The RecorderInterface class is the base class for recorders.
Definition: recorderinterface.h:56
ISState
ISState
Switch state.
Definition: indiapi.h:148
INDI::StreamManager::~StreamManager
virtual ~StreamManager()
Definition: streammanager.cpp:77
INDI::StreamManager::getDeviceName
const char * getDeviceName() const
Definition: streammanager.cpp:85
INDI::DefaultDevice
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
Definition: defaultdevice.h:118
Aux::buffer
std::vector< uint8_t > buffer
Definition: celestronauxpacket.h:38
INDI_PIXEL_FORMAT
INDI_PIXEL_FORMAT
Definition: indibasetypes.h:63
INDI::StreamManager::setSize
void setSize(uint16_t width, uint16_t height=1)
Definition: streammanager.cpp:575