Instrument Neutral Distributed Interface INDI  2.0.2
MathPluginManagerClient.cpp
Go to the documentation of this file.
2 
3 #include <iostream>
4 
5 #include <cstring>
6 #include <sstream>
7 
8 using namespace INDI::AlignmentSubsystem;
9 
10 MathPluginManagerClient::MathPluginManagerClient() : DeviceName("skywatcherAPIMount")
11 {
12  //ctor
13 }
14 
16 {
17  //dtor
18 }
19 
20 // Public methods
21 
22 void 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 
43  connectServer();
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 
82 {
83  ProcessNewDevice(dp);
84 }
85 
87 {
88  ProcessNewProperty(property);
89 }
90 
92 {
93  ProcessNewSwitch(svp);
94 }
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 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.
Definition: baseclient.cpp:308
Class to provide basic INDI device functionality.
Definition: basedevice.h:52
Provides generic container for INDI properties.
Definition: indiproperty.h:48
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:268
Namespace to encapsulate the INDI Alignment Subsystem classes. For more information see "INDI Alignme...
Switch vector property descriptor.
Definition: indiapi.h:367