stellarium: use upstream PR for indi 2+ support https://github.com/Stellarium/stellarium/pull/3269 Ride bump.diff -r1.66 -r1.67 pkgsrc/misc/stellarium/distinfo
(wiz)
@@ -1,11 +1,12 @@ | @@ -1,11 +1,12 @@ | |||
1 | $NetBSD: distinfo,v 1.66 2024/05/03 11:28:27 wiz Exp $ | 1 | $NetBSD: distinfo,v 1.67 2024/05/03 12:07:41 wiz Exp $ | |
2 | 2 | |||
3 | BLAKE2s (stellarium-24.1.tar.xz) = 36b925cca45bd87db014eaebff3f00166b565052877f95d6c0cc2328e7dc90bf | 3 | BLAKE2s (stellarium-24.1.tar.xz) = 36b925cca45bd87db014eaebff3f00166b565052877f95d6c0cc2328e7dc90bf | |
4 | SHA512 (stellarium-24.1.tar.xz) = 60e0e2afb214f4e2d9ba6640f4b699d18c97b05b9f33e9990787a87484c6bd1d7bc87685558956e6dc8a80e93abd8d7f677daeb55d38d8f4f8448e7936999246 | 4 | SHA512 (stellarium-24.1.tar.xz) = 60e0e2afb214f4e2d9ba6640f4b699d18c97b05b9f33e9990787a87484c6bd1d7bc87685558956e6dc8a80e93abd8d7f677daeb55d38d8f4f8448e7936999246 | |
5 | Size (stellarium-24.1.tar.xz) = 326391584 bytes | 5 | Size (stellarium-24.1.tar.xz) = 326391584 bytes | |
6 | SHA1 (patch-CMakeLists.txt) = d556dff660e0031a98a3484bbac3b3bd29f4d1e1 | 6 | SHA1 (patch-CMakeLists.txt) = d556dff660e0031a98a3484bbac3b3bd29f4d1e1 | |
7 | SHA1 (patch-data_CMakeLists.txt) = 29a5c1c8eb64baff1ef7bf64e3c0ea6bcdc7704f | 7 | SHA1 (patch-data_CMakeLists.txt) = 29a5c1c8eb64baff1ef7bf64e3c0ea6bcdc7704f | |
8 | SHA1 (patch-doc_CMakeLists.txt) = 4521054b8915661a4b50cea5e65ed7ccf80ce65e | 8 | SHA1 (patch-doc_CMakeLists.txt) = 4521054b8915661a4b50cea5e65ed7ccf80ce65e | |
9 | SHA1 (patch-plugins_TelescopeControl_src_INDI_INDIConnection.hpp) = 7283a90bb29eb28ef57de3846adde050f75c2c5b | 9 | SHA1 (patch-plugins_TelescopeControl_src_INDI_INDIConnection.cpp) = 153a3677ca8758a71bcb08b4b380fb2dffba26c5 | |
10 | SHA1 (patch-plugins_TelescopeControl_src_INDI_INDIConnection.hpp) = ab3a0b572a194333823ecfb681a0df4e8cced0fd | |||
10 | SHA1 (patch-src_CMakeLists.txt) = aebac5163a125a26ef04008e8ef30d7a07e04991 | 11 | SHA1 (patch-src_CMakeLists.txt) = aebac5163a125a26ef04008e8ef30d7a07e04991 | |
11 | SHA1 (patch-src_core_StelFileMgr.cpp) = fa54c05eddbb8db25a3aaa056f838e9e3a361596 | 12 | SHA1 (patch-src_core_StelFileMgr.cpp) = fa54c05eddbb8db25a3aaa056f838e9e3a361596 |
$NetBSD: patch-plugins_TelescopeControl_src_INDI_INDIConnection.cpp,v 1.1 2024/05/03 12:07:41 wiz Exp $
Port code to INDI 2.0.2
https://github.com/Stellarium/stellarium/pull/3269/files
--- plugins/TelescopeControl/src/INDI/INDIConnection.cpp.orig 2024-02-04 13:27:52.000000000 +0000
+++ plugins/TelescopeControl/src/INDI/INDIConnection.cpp
@@ -44,98 +44,96 @@ INDIConnection::Coordinates INDIConnecti
void INDIConnection::setPosition(INDIConnection::Coordinates coords)
{
std::lock_guard<std::mutex> lock(mMutex);
- if (!mTelescope)
+ if (!mTelescope.isValid())
return;
- if (!mTelescope->isConnected())
+ if (!mTelescope.isConnected())
{
qDebug() << "Error: Telescope not connected";
return;
}
// Make sure the TRACK member of switch ON_COORD_SET is set
- ISwitchVectorProperty *switchVector = mTelescope->getSwitch("ON_COORD_SET");
- if (!switchVector)
+ auto switchVector = mTelescope.getSwitch("ON_COORD_SET");
+ if (!switchVector.isValid())
{
qDebug() << "Error: unable to find Telescope or ON_COORD_SET switch...";
return;
}
// Note that confusingly there is a SLEW switch member as well that will move but not track.
// TODO: Figure out if there is to be support for it
- ISwitch *track = IUFindSwitch(switchVector, "TRACK");
+ auto track = switchVector.findWidgetByName("TRACK");
if (track->s == ISS_OFF)
{
- track->s = ISS_ON;
+ track->setState(ISS_ON);
sendNewSwitch(switchVector);
}
- INumberVectorProperty *property = nullptr;
- property = mTelescope->getNumber("EQUATORIAL_EOD_COORD");
- if (!property)
+ auto property = mTelescope.getNumber("EQUATORIAL_EOD_COORD");
+ if (!property.isValid())
{
qDebug() << "Error: unable to find Telescope or EQUATORIAL_EOD_COORD property...";
return;
}
- property->np[0].value = coords.RA;
- property->np[1].value = coords.DEC;
+ property[0].setValue(coords.RA);
+ property[1].setValue(coords.DEC);
sendNewNumber(property);
}
void INDIConnection::syncPosition(INDIConnection::Coordinates coords)
{
std::lock_guard<std::mutex> lock(mMutex);
- if (!mTelescope)
+ if (!mTelescope.isValid())
return;
- if (!mTelescope->isConnected())
+ if (!mTelescope.isConnected())
{
qDebug() << "Error: Telescope not connected";
return;
}
// Make sure the SYNC member of switch ON_COORD_SET is set
- ISwitchVectorProperty *switchVector = mTelescope->getSwitch("ON_COORD_SET");
- if (!switchVector)
+ auto switchVector = mTelescope.getSwitch("ON_COORD_SET");
+ if (!switchVector.isValid())
{
qDebug() << "Error: unable to find Telescope or ON_COORD_SET switch...";
return;
}
- ISwitch *track = IUFindSwitch(switchVector, "TRACK");
- ISwitch *slew = IUFindSwitch(switchVector, "SLEW");
- ISwitch *sync = IUFindSwitch(switchVector, "SYNC");
- track->s = ISS_OFF;
- slew->s = ISS_OFF;
- sync->s = ISS_ON;
+ auto track = switchVector.findWidgetByName("TRACK");
+ auto slew = switchVector.findWidgetByName("SLEW");
+ auto sync = switchVector.findWidgetByName("SYNC");
+ track->setState(ISS_OFF);
+ slew->setState(ISS_OFF);
+ sync->setState(ISS_ON);
sendNewSwitch(switchVector);
- INumberVectorProperty *property = nullptr;
- property = mTelescope->getNumber("EQUATORIAL_EOD_COORD");
- if (!property)
+ auto property = mTelescope.getNumber("EQUATORIAL_EOD_COORD");
+ if (!property.isValid())
{
qDebug() << "Error: unable to find Telescope or EQUATORIAL_EOD_COORD property...";
return;
}
- property->np[0].value = coords.RA;
- property->np[1].value = coords.DEC;
+ property[0].setValue(coords.RA);
+ property[1].setValue(coords.DEC);
sendNewNumber(property);
// And now unset SYNC switch member to revert to default state/behavior
- track->s = ISS_ON;
- slew->s = ISS_OFF;
- sync->s = ISS_OFF;
+ track->setState(ISS_ON);
+ slew->setState(ISS_OFF);
+ sync->setState(ISS_OFF);
sendNewSwitch(switchVector);
}
bool INDIConnection::isDeviceConnected() const
{
std::lock_guard<std::mutex> lock(mMutex);
- if (!mTelescope)
+ if (!mTelescope.isValid())
return false;
- return mTelescope->isConnected();
+ return mTelescope.isConnected();
}
const QStringList INDIConnection::devices() const
@@ -147,28 +145,28 @@ const QStringList INDIConnection::device
void INDIConnection::unParkTelescope()
{
std::lock_guard<std::mutex> lock(mMutex);
- if (!mTelescope || !mTelescope->isConnected())
+ if (!mTelescope.isValid() || !mTelescope.isConnected())
return;
- ISwitchVectorProperty *switchVector = mTelescope->getSwitch("TELESCOPE_PARK");
- if (!switchVector)
+ auto switchVector = mTelescope.getSwitch("TELESCOPE_PARK");
+ if (!switchVector.isValid())
{
qDebug() << "Error: unable to find Telescope or TELESCOPE_PARK switch...";
return;
}
- ISwitch *park = IUFindSwitch(switchVector, "PARK");
+ auto park = switchVector.findWidgetByName("PARK");
if (park->s == ISS_ON)
{
- park->s = ISS_OFF;
+ park->setState(ISS_OFF);
sendNewSwitch(switchVector);
}
// The telescope will work without running command below, but I use it to avoid undefined state for parking property.
- ISwitch *unpark = IUFindSwitch(switchVector, "UNPARK");
+ auto unpark = switchVector.findWidgetByName("UNPARK");
if (unpark->s == ISS_OFF)
{
- unpark->s = ISS_ON;
+ unpark->setState(ISS_ON);
sendNewSwitch(switchVector);
}
}
@@ -179,27 +177,27 @@ void INDIConnection::unParkTelescope()
void INDIConnection::parkTelescope()
{
std::lock_guard<std::mutex> lock(mMutex);
- if (!mTelescope || !mTelescope->isConnected())
+ if (!mTelescope.isValid() || !mTelescope.isConnected())
return;
- ISwitchVectorProperty *switchVector = mTelescope->getSwitch("TELESCOPE_PARK");
- if (!switchVector)
+ auto switchVector = mTelescope.getSwitch("TELESCOPE_PARK");
+ if (!switchVector.isValid())
{
qDebug() << "Error: unable to find Telescope or TELESCOPE_PARK switch...";
return;
}
- ISwitch *park = IUFindSwitch(switchVector, "PARK");
+ auto park = switchVector.findWidgetByName("PARK");
if (park->s == ISS_OFF)
{
- park->s = ISS_ON;
+ park->setState(ISS_ON);
sendNewSwitch(switchVector);
}
- ISwitch *unpark = IUFindSwitch(switchVector, "UNPARK");
+ auto unpark = switchVector.findWidgetByName("UNPARK");
if (unpark->s == ISS_ON)
{
- unpark->s = ISS_OFF;
+ unpark->setState(ISS_OFF);
sendNewSwitch(switchVector);
}
}
@@ -208,24 +206,24 @@ void INDIConnection::parkTelescope()
void INDIConnection::moveNorth(int speed)
{
std::lock_guard<std::mutex> lock(mMutex);
- if (!mTelescope || !mTelescope->isConnected())
+ if (!mTelescope.isValid() || !mTelescope.isConnected())
return;
- ISwitchVectorProperty *switchVector = mTelescope->getSwitch("TELESCOPE_MOTION_NS");
- if (!switchVector)
+ auto switchVector = mTelescope.getSwitch("TELESCOPE_MOTION_NS");
+ if (!switchVector.isValid())
{
qDebug() << "Error: unable to find Telescope or TELESCOPE_MOTION_NS switch...";
return;
}
- ISwitch *motion = IUFindSwitch(switchVector, "MOTION_NORTH");
+ auto motion = switchVector.findWidgetByName("MOTION_NORTH");
if (speed == SLEW_STOP)
- motion->s = ISS_OFF;
+ motion->setState(ISS_OFF);
else
{
setSpeed(speed);
- motion->s = ISS_ON;
+ motion->setState(ISS_ON);
}
sendNewSwitch(switchVector);
@@ -234,24 +232,24 @@ void INDIConnection::moveNorth(int speed
void INDIConnection::moveEast(int speed)
{
std::lock_guard<std::mutex> lock(mMutex);
- if (!mTelescope || !mTelescope->isConnected())
+ if (!mTelescope.isValid() || !mTelescope.isConnected())
return;
- ISwitchVectorProperty *switchVector = mTelescope->getSwitch("TELESCOPE_MOTION_WE");
- if (!switchVector)
+ auto switchVector = mTelescope.getSwitch("TELESCOPE_MOTION_WE");
+ if (!switchVector.isValid())
{
qDebug() << "Error: unable to find Telescope or TELESCOPE_MOTION_WE switch...";
return;
}
- ISwitch *motion = IUFindSwitch(switchVector, "MOTION_EAST");
+ auto motion = switchVector.findWidgetByName("MOTION_EAST");
if (speed == SLEW_STOP)
- motion->s = ISS_OFF;
+ motion->setState(ISS_OFF);
else
{
setSpeed(speed);
- motion->s = ISS_ON;
+ motion->setState(ISS_ON);
}
sendNewSwitch(switchVector);
@@ -260,24 +258,24 @@ void INDIConnection::moveEast(int speed)
void INDIConnection::moveSouth(int speed)
{
std::lock_guard<std::mutex> lock(mMutex);
- if (!mTelescope || !mTelescope->isConnected())
+ if (!mTelescope.isValid() || !mTelescope.isConnected())
return;
- ISwitchVectorProperty *switchVector = mTelescope->getSwitch("TELESCOPE_MOTION_NS");
- if (!switchVector)
+ auto switchVector = mTelescope.getSwitch("TELESCOPE_MOTION_NS");
+ if (!switchVector.isValid())
{
qDebug() << "Error: unable to find Telescope or TELESCOPE_MOTION_NS switch...";
return;
}
- ISwitch *motion = IUFindSwitch(switchVector, "MOTION_SOUTH");
+ auto motion = switchVector.findWidgetByName("MOTION_SOUTH");
if (speed == SLEW_STOP)
- motion->s = ISS_OFF;
+ motion->setState(ISS_OFF);
else
{
setSpeed(speed);
- motion->s = ISS_ON;
+ motion->setState(ISS_ON);
}
sendNewSwitch(switchVector);
@@ -286,24 +284,24 @@ void INDIConnection::moveSouth(int speed
void INDIConnection::moveWest(int speed)
{
std::lock_guard<std::mutex> lock(mMutex);
- if (!mTelescope || !mTelescope->isConnected())
+ if (!mTelescope.isValid() || !mTelescope.isConnected())
return;
- ISwitchVectorProperty *switchVector = mTelescope->getSwitch("TELESCOPE_MOTION_WE");
- if (!switchVector)
+ auto switchVector = mTelescope.getSwitch("TELESCOPE_MOTION_WE");
+ if (!switchVector.isValid())
{
qDebug() << "Error: unable to find Telescope or TELESCOPE_MOTION_WE switch...";
return;
}
- ISwitch *motion = IUFindSwitch(switchVector, "MOTION_WEST");
+ auto motion = switchVector.findWidgetByName("MOTION_WEST");
if (speed == SLEW_STOP)
- motion->s = ISS_OFF;
+ motion->setState(ISS_OFF);
else
{
setSpeed(speed);
- motion->s = ISS_ON;
+ motion->setState(ISS_ON);
}
sendNewSwitch(switchVector);
@@ -311,23 +309,24 @@ void INDIConnection::moveWest(int speed)
void INDIConnection::setSpeed(int speed)
{
- ISwitchVectorProperty *slewRateSP = mTelescope->getSwitch("TELESCOPE_SLEW_RATE");
+ auto slewRateSP = mTelescope.getSwitch("TELESCOPE_SLEW_RATE");
- if (!slewRateSP || speed < 0 || speed > slewRateSP->nsp)
+ if (!slewRateSP.isValid() || speed < 0 ||
+ static_cast<std::size_t>(speed) > slewRateSP.count())
return;
- IUResetSwitch(slewRateSP);
- slewRateSP->sp[speed].s = ISS_ON;
+ slewRateSP.reset();
+ slewRateSP[speed].setState(ISS_ON);
sendNewSwitch(slewRateSP);
}
-void INDIConnection::newDevice(INDI::BaseDevice *dp)
+void INDIConnection::newDevice(INDI::BaseDevice dp)
{
std::lock_guard<std::mutex> lock(mMutex);
if (!dp)
return;
- QString name(dp->getDeviceName());
+ QString name(dp.getDeviceName());
qDebug() << "INDIConnection::newDevice| New Device... " << name;
@@ -337,91 +336,54 @@ void INDIConnection::newDevice(INDI::Bas
emit newDeviceReceived(name);
}
-void INDIConnection::removeDevice(INDI::BaseDevice *dp)
+void INDIConnection::removeDevice(INDI::BaseDevice dp)
{
std::lock_guard<std::mutex> lock(mMutex);
if (!dp)
return;
- QString name(dp->getDeviceName());
+ QString name(dp.getDeviceName());
int index = mDevices.indexOf(name);
if (index != -1)
mDevices.removeAt(index);
- if (mTelescope == dp)
- mTelescope = nullptr;
+ if (mTelescope.isDeviceNameMatch(dp.getDeviceName()))
+ mTelescope.detach();
emit removeDeviceReceived(name);
}
-void INDIConnection::newProperty(INDI::Property *property)
+void INDIConnection::newProperty(INDI::Property property)
{
std::lock_guard<std::mutex> lock(mMutex);
- if (mTelescope != property->getBaseDevice())
+ if (!mTelescope.isDeviceNameMatch(
+ property.getBaseDevice().getDeviceName()))
return;
- QString name(property->getName());
+ QString name(property.getName());
qDebug() << "INDIConnection::newProperty| " << name;
if (name == "EQUATORIAL_EOD_COORD")
{
- mCoordinates.RA = property->getNumber()->np[0].value;
- mCoordinates.DEC = property->getNumber()->np[1].value;
+ mCoordinates.RA = property.getNumber()->np[0].value;
+ mCoordinates.DEC = property.getNumber()->np[1].value;
}
- if (!mTelescope->isConnected())
+ if (!mTelescope.isConnected())
{
- connectDevice(mTelescope->getDeviceName());
- if (mTelescope->isConnected())
+ connectDevice(mTelescope.getDeviceName());
+ if (mTelescope.isConnected())
qDebug() << "connected\n";
}
}
-void INDIConnection::removeProperty(INDI::Property *property)
+void INDIConnection::removeProperty(INDI::Property property)
{
Q_UNUSED(property)
}
-void INDIConnection::newBLOB(IBLOB *bp)
-{
- Q_UNUSED(bp)
-}
-
-void INDIConnection::newSwitch(ISwitchVectorProperty *svp)
-{
- std::lock_guard<std::mutex> lock(mMutex);
- QString name(svp->name);
- if (name == "TELESCOPE_SLEW_RATE")
- {
- int speed = IUFindOnSwitchIndex(svp);
- emit speedChanged(speed);
- }
-}
-
-void INDIConnection::newNumber(INumberVectorProperty *nvp)
-{
- std::lock_guard<std::mutex> lock(mMutex);
-
- QString name(nvp->name);
- if (name == "EQUATORIAL_EOD_COORD")
- {
- mCoordinates.RA = nvp->np[0].value;
- mCoordinates.DEC = nvp->np[1].value;
- }
-}
-
-void INDIConnection::newText(ITextVectorProperty *tvp)
-{
- Q_UNUSED(tvp)
-}
-
-void INDIConnection::newLight(ILightVectorProperty *lvp)
-{
- Q_UNUSED(lvp)
-}
-
-void INDIConnection::newMessage(INDI::BaseDevice *dp, int messageID)
+void INDIConnection::newMessage(INDI::BaseDevice dp, int messageID)
{
Q_UNUSED(dp)
Q_UNUSED(messageID)
@@ -1,37 +1,43 @@ | @@ -1,37 +1,43 @@ | |||
1 | $NetBSD: patch-plugins_TelescopeControl_src_INDI_INDIConnection.hpp,v 1.1 2024/05/03 11:28:27 wiz Exp $ | 1 | $NetBSD: patch-plugins_TelescopeControl_src_INDI_INDIConnection.hpp,v 1.2 2024/05/03 12:07:41 wiz Exp $ | |
2 | 2 | |||
3 | Compatibility with indi 2.0.7. | 3 | Port code to INDI 2.0.2 | |
4 | https://github.com/Stellarium/stellarium/pull/3269/files | |||
4 | 5 | |||
5 | --- plugins/TelescopeControl/src/INDI/INDIConnection.hpp.orig 2024-05-03 11:24:20.270404353 +0000 | 6 | --- plugins/TelescopeControl/src/INDI/INDIConnection.hpp.orig 2024-02-04 13:27:52.000000000 +0000 | |
6 | +++ plugins/TelescopeControl/src/INDI/INDIConnection.hpp | 7 | +++ plugins/TelescopeControl/src/INDI/INDIConnection.hpp | |
7 | @@ -69,18 +69,18 @@ private: | 8 | @@ -21,6 +21,7 @@ | |
9 | ||||
10 | #include <QObject> | |||
11 | #include "libindi/baseclient.h" | |||
12 | +#include <libindi/basedevice.h> | |||
13 | ||||
14 | #include <mutex> | |||
15 | #include <QStringList> | |||
16 | @@ -64,21 +65,16 @@ private: | |||
17 | void setSpeed(int speed); | |||
18 | ||||
19 | mutable std::mutex mMutex; | |||
20 | - INDI::BaseDevice* mTelescope = nullptr; | |||
21 | + INDI::BaseDevice mTelescope; | |||
22 | Coordinates mCoordinates; | |||
8 | QStringList mDevices; | 23 | QStringList mDevices; | |
9 | 24 | |||
10 | public: // from INDI::BaseClient | 25 | public: // from INDI::BaseClient | |
11 | - void newDevice(INDI::BaseDevice *dp) override; | 26 | - void newDevice(INDI::BaseDevice *dp) override; | |
12 | - void removeDevice(INDI::BaseDevice *dp) override; | 27 | - void removeDevice(INDI::BaseDevice *dp) override; | |
13 | - void newProperty(INDI::Property *property) override; | 28 | - void newProperty(INDI::Property *property) override; | |
14 | - void removeProperty(INDI::Property *property) override; | 29 | - void removeProperty(INDI::Property *property) override; | |
15 | - void newBLOB(IBLOB *bp) override; | 30 | - void newBLOB(IBLOB *bp) override; | |
16 | - void newSwitch(ISwitchVectorProperty *svp) override; | 31 | - void newSwitch(ISwitchVectorProperty *svp) override; | |
17 | - void newNumber(INumberVectorProperty *nvp) override; | 32 | - void newNumber(INumberVectorProperty *nvp) override; | |
18 | - void newText(ITextVectorProperty *tvp) override; | 33 | - void newText(ITextVectorProperty *tvp) override; | |
19 | - void newLight(ILightVectorProperty *lvp) override; | 34 | - void newLight(ILightVectorProperty *lvp) override; | |
20 | - void newMessage(INDI::BaseDevice *dp, int messageID) override; | 35 | - void newMessage(INDI::BaseDevice *dp, int messageID) override; | |
21 | - void serverConnected() override; | 36 | + void newDevice(INDI::BaseDevice dp) override; | |
22 | - void serverDisconnected(int exit_code) override; | 37 | + void removeDevice(INDI::BaseDevice dp) override; | |
23 | + void newDevice(INDI::BaseDevice *dp); | 38 | + void newProperty(INDI::Property property) override; | |
24 | + void removeDevice(INDI::BaseDevice *dp); | 39 | + void removeProperty(INDI::Property property) override; | |
25 | + void newProperty(INDI::Property *property); | 40 | + void newMessage(INDI::BaseDevice dp, int messageID) override; | |
26 | + void removeProperty(INDI::Property *property); | 41 | void serverConnected() override; | |
27 | + void newBLOB(IBLOB *bp); | 42 | void serverDisconnected(int exit_code) override; | |
28 | + void newSwitch(ISwitchVectorProperty *svp); | |||
29 | + void newNumber(INumberVectorProperty *nvp); | |||
30 | + void newText(ITextVectorProperty *tvp); | |||
31 | + void newLight(ILightVectorProperty *lvp); | |||
32 | + void newMessage(INDI::BaseDevice *dp, int messageID); | |||
33 | + void serverConnected(); | |||
34 | + void serverDisconnected(int exit_code); | |||
35 | void unParkTelescope(); | 43 | void unParkTelescope(); | |
36 | //void parkTelescope(); | |||
37 | }; |