vdr 2.6.1
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
31class cPositioner {
32private:
33 mutable cMutex mutex;
34 static cPositioner *positioner;
35 int capabilities;
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
41 int swingTime;
43protected:
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:
71 pcCanNothing = 0x0000,
72 pcCanDrive = 0x0001,
73 pcCanStep = 0x0002,
74 pcCanHalt = 0x0004,
75 pcCanSetLimits = 0x0008,
76 pcCanDisableLimits = 0x0010,
77 pcCanEnableLimits = 0x0020,
78 pcCanStorePosition = 0x0040,
79 pcCanRecalcPositions = 0x0080,
80 pcCanGotoPosition = 0x0100,
81 pcCanGotoAngle = 0x0200,
82 };
84 static int NormalizeAngle(int Angle);
86 int Capabilities(void) const { return capabilities; }
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;
167 static void DestroyPositioner(void);
169 };
170
171#endif //__POSITIONER_H
A steerable satellite dish generally points to the south on the northern hemisphere,...
int LastLongitude(void) const
Returns the longitude the dish has last been moved to.
Definition: positioner.h:103
static cPositioner * positioner
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 ~cPositioner()
static int CalcLongitude(int HourAngle)
Returns the longitude of the satellite position the dish points at when the positioner is moved to th...
static void DestroyPositioner(void)
Destroys a previously created positioner.
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
static cPositioner * GetPositioner(void)
Returns a previously created positioner.
virtual int CurrentLongitude(void) const
Returns the longitude the dish currently points to.
virtual void GotoPosition(uint Number, int Longitude)
Move the dish to the satellite position stored under the given Number.
int Frontend(void) const
Returns the file descriptor of the DVB frontend the positioner is connected to.
Definition: positioner.h:49
static int HorizonLongitude(ePositionerDirection Direction)
Returns the longitude of the satellite position that is just at the horizon when looking in the given...
virtual void GotoAngle(int Longitude)
Move the dish to the given angular position.
void StartMovementTimer(int Longitude)
Starts a timer that estimates how long it will take to move the dish from the current position to the...
static int CalcHourAngle(int Longitude)
Takes the longitude and latitude of the dish location from the system setup and the given Longitude t...
virtual bool IsMoving(void) const
Returns true if the dish is currently moving as a result of a call to GotoPosition() or GotoAngle().
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
static int NormalizeAngle(int Angle)
Normalizes the given Angle into the range -1800...1800.
virtual void StorePosition(uint Number)
Store the current position as a satellite position with the given Number.
Definition: positioner.h:131
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
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
int Capabilities(void) const
Returns a flag word defining all the things this positioner is capable of.
int HardLimitLongitude(ePositionerDirection Direction) const
Returns the longitude of the positioner's hard limit in the given Direction.
cPositioner(void)
int TargetLongitude(void) const
Returns the longitude the dish is supposed to be moved to.
Definition: positioner.h:105