Instrument Neutral Distributed Interface INDI  2.0.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, uint64_t timestamp = 0);
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 }
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
The RecorderInterface class is the base class for recorders.
void setSize(uint16_t width, uint16_t height=1)
bool isDirectRecording() const
void getStreamFrame(uint16_t *x, uint16_t *y, uint16_t *w, uint16_t *h) const
void newFrame(const uint8_t *buffer, uint32_t nbytes, uint64_t timestamp=0)
newFrame CCD drivers call this function when a new frame is received. It is then streamed,...
void setStreamingExposureEnabled(bool enable)
setStreamingExposureEnabled Can stream exposure time be changed?
std::shared_ptr< StreamManagerPrivate > d_ptr
bool setPixelFormat(INDI_PIXEL_FORMAT pixelFormat, uint8_t pixelDepth=8)
double getTargetExposure() const
bool isStreaming() const
bool setStream(bool enable)
setStream Enables (starts) or disables (stops) streaming.
double getTargetFPS() const
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
virtual void ISGetProperties(const char *dev)
virtual bool initProperties()
StreamManager(DefaultDevice *currentDevice)
bool isRecording() const
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
virtual bool saveConfigItems(FILE *fp)
RecorderInterface * getRecorder() const
virtual bool updateProperties()
const char * getDeviceName() const
ISState
Switch state.
Definition: indiapi.h:150
INDI_PIXEL_FORMAT
Definition: indibasetypes.h:70
Interface to the reference INDI C API device implementation on the Device Driver side.
std::vector< uint8_t > buffer
Namespace to encapsulate INDI client, drivers, and mediator classes.