Instrument Neutral Distributed Interface INDI 2.2.5
MathPluginManagerClient.cpp
Go to the documentation of this file.
2
3#include <iostream>
4
5#include <cstring>
6#include <sstream>
7
8using namespace INDI::AlignmentSubsystem;
9
10MathPluginManagerClient::MathPluginManagerClient() : DeviceName("skywatcherAPIMount")
11{
12 //ctor
13}
14
19
20// Public methods
21
22void MathPluginManagerClient::Initialise(int argc, char *argv[])
23{
24 std::string HostName("localhost");
25 int Port = 7624;
26
27 if (argc > 1)
28 DeviceName = argv[1];
29 if (argc > 2)
30 HostName = argv[2];
31 if (argc > 3)
32 {
33 std::istringstream Parameter(argv[3]);
34 Parameter >> Port;
35 }
36
37 AlignmentSubsystemForClients::Initialise(DeviceName.c_str(), this);
38
39 setServer(HostName.c_str(), Port);
40
41 watchDevice(DeviceName.c_str());
42
44
45 setBLOBMode(B_ALSO, DeviceName.c_str(), nullptr);
46}
47
49{
50 MathPluginsList AvailableMathPlugins;
51
52 cout << "Testing Enumerate available plugins\n";
53
54 if (EnumerateMathPlugins(AvailableMathPlugins))
55 {
56 cout << "Success - List of plugins follows\n";
57 for (MathPluginsList::const_iterator iTr = AvailableMathPlugins.begin(); iTr != AvailableMathPlugins.end();
58 iTr++)
59 cout << *iTr << '\n';
60 }
61 else
62 cout << "Failure\n";
63
64 cout << "Testing select plugin\n";
65
66 if (SelectMathPlugin(AvailableMathPlugins[AvailableMathPlugins.size() - 1]))
67 cout << "Success\n";
68 else
69 cout << "Failure\n";
70
71 cout << "Testing reinitilialise plugin\n";
72
74 cout << "Success\n";
75 else
76 cout << "Failure\n";
77}
78
79// Protected methods
80
85
90
void setServer(const char *hostname, unsigned int port)
Set the server host name and port.
void setBLOBMode(BLOBHandling blobH, const char *dev, const char *prop=nullptr)
Set Binary Large Object policy mode.
void watchDevice(const char *deviceName)
Add a device to the watch list.
void ProcessNewProperty(INDI::Property *PropertyPointer)
Process new property message from driver. This routine should be called from within the newProperty h...
void Initialise(const char *DeviceName, INDI::BaseClient *BaseClient)
This routine should be called before any connections to devices are made.
void ProcessNewSwitch(ISwitchVectorProperty *SwitchVectorPropertyPointer)
Process new switch message from driver. This routine should be called from within the newSwitch handl...
void ProcessNewDevice(INDI::BaseDevice *DevicePointer)
Process new device message from driver. This routine should be called from within the newDevice handl...
bool EnumerateMathPlugins(MathPluginsList &AvailableMathPlugins)
Return a list of the names of the available math plugins.
bool SelectMathPlugin(const std::string &MathPluginName)
Selects, loads and initialises the named math plugin.
bool connectServer() override
Connect to INDI server.
Class to provide basic INDI device functionality.
Definition basedevice.h:52
Provides generic container for INDI properties.
virtual void newSwitch(ISwitchVectorProperty *svp)
Emmited when a new switch value arrives from INDI server.
virtual void newProperty(INDI::Property *property)
Emmited when a new property is created for an INDI driver.
virtual void newDevice(INDI::BaseDevice *dp)
Emmited when a new device is created from INDI server.
void Initialise(int argc, char *argv[])
@ B_ALSO
Definition indidevapi.h:269
Namespace to encapsulate the INDI Alignment Subsystem classes. For more information see "INDI Alignme...
Switch vector property descriptor.
Definition indiapi.h:365