vdr 2.6.9
positioner.h
Go to the documentation of this file.
1/*
2 * positioner.h: Steerable dish positioning
3 *
4 * See the main source file 'vdr.c' for copyright information and
5 * how to reach the author.
6 *
7 * $Id: positioner.h 3.3 2013/12/28 11:15:56 kls Exp $
8 */
9
10#ifndef __POSITIONER_H
11#define __POSITIONER_H
12
13#include "thread.h"
14#include "tools.h"
15
30
32private:
33 mutable cMutex mutex;
36 int frontend; // file descriptor of the DVB frontend
37 mutable int lastLongitude; // the longitude the dish has last been moved to
38 int targetLongitude; // the longitude the dish is supposed to be moved to
39 mutable int lastHourAngle; // the hour angle the positioner has last been moved to
40 int targetHourAngle; // the hour angle the positioner is supposed to be moved to
43protected:
44 cPositioner(void);
45 virtual ~cPositioner();
49 int Frontend(void) const { return frontend; }
53 static int CalcHourAngle(int Longitude);
62 static int CalcLongitude(int HourAngle);
65 void StartMovementTimer(int Longitude);
69public:
84 static int NormalizeAngle(int Angle);
86 int Capabilities(void) const { return capabilities; }
92 static int HorizonLongitude(ePositionerDirection Direction);
98 int HardLimitLongitude(ePositionerDirection Direction) const;
103 int LastLongitude(void) const { return lastLongitude; }
105 int TargetLongitude(void) const { return targetLongitude; }
109 virtual cString Error(void) const { return NULL; }
113 virtual void Drive(ePositionerDirection Direction) {}
116 virtual void Step(ePositionerDirection Direction, uint Steps = 1) {}
122 virtual void Halt(void) {}
124 virtual void SetLimit(ePositionerDirection Direction) {}
127 virtual void DisableLimits(void) {}
129 virtual void EnableLimits(void) {}
131 virtual void StorePosition(uint Number) {}
135 virtual void RecalcPositions(uint Number) {}
139 virtual void GotoPosition(uint Number, int Longitude);
148 virtual void GotoAngle(int Longitude);
155 virtual int CurrentLongitude(void) const;
161 virtual bool IsMoving(void) const;
164 static cPositioner *GetPositioner(void);
167 static void DestroyPositioner(void);
169 };
170
171#endif //__POSITIONER_H
A steerable satellite dish generally points to the south on the northern hemisphere,...
Definition positioner.h:31
int LastLongitude(void) const
Returns the longitude the dish has last been moved to.
Definition positioner.h:103
static cPositioner * GetPositioner(void)
Returns a previously created positioner.
Definition positioner.c:133
virtual void SetLimit(ePositionerDirection Direction)
Set the soft limit of the dish movement in the given Direction to the current position.
Definition positioner.h:124
virtual void Step(ePositionerDirection Direction, uint Steps=1)
Move the dish the given number of Steps in the given Direction.
Definition positioner.h:116
virtual cString Error(void) const
Returns a short, single line string indicating an error condition (if the positioner is able to repor...
Definition positioner.h:109
void SetFrontend(int Frontend)
This function is called whenever the positioner is connected to a DVB frontend.
Definition positioner.h:89
virtual void DisableLimits(void)
Disables the soft limits for the dish movement.
Definition positioner.h:127
ePositionerCapabilities
Definition positioner.h:70
@ pcCanEnableLimits
Definition positioner.h:77
@ pcCanRecalcPositions
Definition positioner.h:79
@ pcCanDisableLimits
Definition positioner.h:76
@ pcCanStorePosition
Definition positioner.h:78
@ pcCanGotoPosition
Definition positioner.h:80
static cPositioner * positioner
Definition positioner.h:34
int Frontend(void) const
Returns the file descriptor of the DVB frontend the positioner is connected to.
Definition positioner.h:49
static void DestroyPositioner(void)
Destroys a previously created positioner.
Definition positioner.c:138
void StartMovementTimer(int Longitude)
Starts a timer that estimates how long it will take to move the dish from the current position to the...
Definition positioner.c:86
static int NormalizeAngle(int Angle)
Normalizes the given Angle into the range -1800...1800.
Definition positioner.c:42
virtual bool IsMoving(void) const
Returns true if the dish is currently moving as a result of a call to GotoPosition() or GotoAngle().
Definition positioner.c:127
cMutex mutex
Definition positioner.h:33
static int CalcHourAngle(int Longitude)
Takes the longitude and latitude of the dish location from the system setup and the given Longitude t...
Definition positioner.c:51
cTimeMs movementStart
Definition positioner.h:42
virtual void RecalcPositions(uint Number)
Take the difference between the current actual position of the dish and the position stored with the ...
Definition positioner.h:135
int targetLongitude
Definition positioner.h:38
virtual void StorePosition(uint Number)
Store the current position as a satellite position with the given Number.
Definition positioner.h:131
virtual int CurrentLongitude(void) const
Returns the longitude the dish currently points to.
Definition positioner.c:114
static int CalcLongitude(int HourAngle)
Returns the longitude of the satellite position the dish points at when the positioner is moved to th...
Definition positioner.c:59
virtual void Halt(void)
Stop any ongoing motion of the dish.
Definition positioner.h:122
virtual void EnableLimits(void)
Enables the soft limits for the dish movement.
Definition positioner.h:129
virtual void Drive(ePositionerDirection Direction)
Continuously move the dish to the given Direction until Halt() is called or it hits the soft or hard ...
Definition positioner.h:113
int lastLongitude
Definition positioner.h:37
virtual ~cPositioner()
Definition positioner.c:37
void SetCapabilities(int Capabilities)
A derived class shall call this function in its constructor to set the capability flags it supports.
Definition positioner.h:46
virtual void GotoPosition(uint Number, int Longitude)
Move the dish to the satellite position stored under the given Number.
Definition positioner.c:100
int lastHourAngle
Definition positioner.h:39
int Capabilities(void) const
Returns a flag word defining all the things this positioner is capable of.
Definition positioner.h:86
int HardLimitLongitude(ePositionerDirection Direction) const
Returns the longitude of the positioner's hard limit in the given Direction.
Definition positioner.c:81
static int HorizonLongitude(ePositionerDirection Direction)
Returns the longitude of the satellite position that is just at the horizon when looking in the given...
Definition positioner.c:69
int capabilities
Definition positioner.h:35
virtual void GotoAngle(int Longitude)
Move the dish to the given angular position.
Definition positioner.c:107
int targetHourAngle
Definition positioner.h:40
cPositioner(void)
Definition positioner.c:26
int TargetLongitude(void) const
Returns the longitude the dish is supposed to be moved to.
Definition positioner.h:105