Bi-monthly release with minor bug fixes and improvements
sudo apt-get install subversion libindi-dev python-dev swig
svn co http://pyindi-client.googlecode.com/svn/trunk/swig-indi/swig-indi-python
mkdir libindipython
cd libindipython
cmake ../swig-indi-python
make
sudo make install
indiserver -v indi_simulator_ccd
cd ../swig-indi-python/
python test-indiclient.py
2015-02-20 02:39:45,993 creating an instance of PyQtIndi.IndiClient
Connecting and waiting 2secs
Server connected (localhost:7624)
2015-02-20 02:39:45,993 new device CCD Simulator
2015-02-20 02:39:45,994 new property CONNECTION for device CCD Simulator
2015-02-20 02:39:45,994 new property DRIVER_INFO for device CCD Simulator
2015-02-20 02:39:45,994 new property DEBUG for device CCD Simulator
2015-02-20 02:39:45,994 new property CONFIG_PROCESS for device CCD Simulator
2015-02-20 02:39:45,994 new property SIMULATOR_SETTINGS for device CCD Simulator
2015-02-20 02:39:45,994 new property ON_TIME_FACTOR for device CCD Simulator
List of devices
CCD Simulator
List of Device Properties
-- CCD Simulator
> CONNECTION
CONNECT(Connect)= Off
DISCONNECT(Disconnect)= On
> DRIVER_INFO
DRIVER_NAME(Name)= CCD Simulator
DRIVER_EXEC(Exec)= indi_simulator_ccd
DRIVER_VERSION(Version)= 1.0
DRIVER_INTERFACE(Interface)= 22
> DEBUG
ENABLE(Enable)= Off
DISABLE(Disable)= On
> CONFIG_PROCESS
CONFIG_LOAD(Load)= Off
CONFIG_SAVE(Save)= Off
CONFIG_DEFAULT(Default)= Off
> SIMULATOR_SETTINGS
SIM_XRES(CCD X resolution)= 1280.0
SIM_YRES(CCD Y resolution)= 1024.0
SIM_XSIZE(CCD X Pixel Size)= 5.2
SIM_YSIZE(CCD Y Pixel Size)= 5.2
SIM_MAXVAL(CCD Maximum ADU)= 65000.0
SIM_BIAS(CCD Bias)= 10.0
SIM_SATURATION(Saturation Mag)= 1.0
SIM_LIMITINGMAG(Limiting Mag)= 17.0
SIM_NOISE(CCD Noise)= 10.0
SIM_SKYGLOW(Sky Glow (magnitudes))= 19.5
SIM_OAGOFFSET(Oag Offset (arcminutes))= 0.0
SIM_POLAR(PAE (arcminutes))= 0.0
SIM_POLARDRIFT(PAE Drift (minutes))= 0.0
> ON_TIME_FACTOR
1X(Actual Time)= On
10X(10x)= Off
100X(100x)= Off
Disconnecting
INDI server localhost/7624 disconnected.
2015-02-20 02:39:46,995 Server disconnected (exit code = 0,localhost:7624)
import sys, time, logging
import PyIndi
class IndiClient(PyIndi.BaseClient):
def __init__(self):
super(IndiClient, self).__init__()
self.logger = logging.getLogger('PyQtIndi.IndiClient')
self.logger.info('creating an instance of PyQtIndi.IndiClient')
def newDevice(self, d):
self.logger.info("new device " + d.getDeviceName())
#self.logger.info("new device ")
def newProperty(self, p):
self.logger.info("new property "+ p.getName() + " for device "+ p.getDeviceName())
#self.logger.info("new property ")
def removeProperty(self, p):
self.logger.info("remove property "+ p.getName() + " for device "+ p.getDeviceName())
def newBLOB(self, bp):
self.logger.info("new BLOB "+ bp.name.decode())
def newSwitch(self, svp):
self.logger.info ("new Switch "+ svp.name.decode() + " for device "+ svp.device.decode())
def newNumber(self, nvp):
self.logger.info("new Number "+ nvp.name.decode() + " for device "+ nvp.device.decode())
def newText(self, tvp):
self.logger.info("new Text "+ tvp.name.decode() + " for device "+ tvp.device.decode())
def newLight(self, lvp):
self.logger.info("new Light "+ lvp.name.decode() + " for device "+ lvp.device.decode())
def newMessage(self, d, m):
self.logger.info("new Message "+ d.messageQueue(m).decode())
def serverConnected(self):
print("Server connected ("+self.getHost()+":"+str(self.getPort())+")")
def serverDisconnected(self, code):
self.logger.info("Server disconnected (exit code = "+str(code)+","+str(self.getHost())+":"+str(self.getPort())+")")
logging.basicConfig(format='%(asctime)s %(message)s', level=logging.INFO)
# instantiate the client
indiclient=IndiClient()
# set indi server localhost and port 7624
indiclient.setServer("localhost",7624)
# connect to indi server
print("Connecting and waiting 2secs")
if (not(indiclient.connectServer())):
print("No indiserver running on "+indiclient.getHost()+":"+str(indiclient.getPort())+" - Try to run")
print(" indiserver indi_simulator_telescope indi_simulator_ccd")
sys.exit(1)
time.sleep(1)
# start endless loop, client works asynchron in background
while True:
time.sleep(1)
class IndiClient(PyIndi.BaseClient):
device = None
def newDevice(self, d):
self.logger.info("new device " + d.getDeviceName())
if d.getDeviceName() == "CCD Simulator":
self.logger.info("Set new device CCD Simulator!")
# save reference to the device in member variable
self.device = d
def newProperty(self, p):
self.logger.info("new property "+ p.getName() + " for device "+ p.getDeviceName())
if self.device is not None and p.getName() == "CONNECTION" and p.getDeviceName() == self.device.getDeviceName():
self.logger.info("Got property CONNECTION for CCD Simulator!")
# connect to device
self.connectDevice(self.device.getDeviceName())
# set BLOB mode to BLOB_ALSO
self.setBLOBMode(1, self.device.getDeviceName(), None)
if p.getName() == "CCD_EXPOSURE":
# take first exposure
self.takeExposure()
def takeExposure(self):
self.logger.info("<<<<<<<< Exposure >>>>>>>>>")
# get current exposure time
exp = self.device.getNumber("CCD_EXPOSURE")
# set exposure time to 5 seconds
exp[0].value = 5
# send new exposure time to server/device
self.sendNewNumber(exp)
def newBLOB(self, bp):
self.logger.info("new BLOB "+ bp.name.decode())
# get image data
img = bp.getblobdata()
import cStringIO
# write image data to StringIO buffer
blobfile = cStringIO.StringIO(img)
# open a file and save buffer to disk
with open("frame.fit", "wb") as f:
f.write(blobfile.getvalue())
# start new exposure for timelapse images!
self.takeExposure()
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
import sys, time, logging
import PyIndi
DEVICE_NAME = "QHY CCD QHY5-0-M-"
class IndiClient(PyIndi.BaseClient):
device = None
def __init__(self):
super(IndiClient, self).__init__()
self.logger = logging.getLogger('PyQtIndi.IndiClient')
self.logger.info('creating an instance of PyQtIndi.IndiClient')
def newDevice(self, d):
#self.logger.info("new device " + d.getDeviceName())
if d.getDeviceName() == DEVICE_NAME:
self.logger.info("Set new device %s!" % DEVICE_NAME)
# save reference to the device in member variable
self.device = d
def newProperty(self, p):
#self.logger.info("new property "+ p.getName() + " for device "+ p.getDeviceName())
if self.device is not None and p.getName() == "CONNECTION" and p.getDeviceName() == self.device.getDeviceName():
self.logger.info("Got property CONNECTION for %s!" % DEVICE_NAME)
# connect to device
self.connectDevice(self.device.getDeviceName())
# set BLOB mode to BLOB_ALSO
self.setBLOBMode(1, self.device.getDeviceName(), None)
if p.getName() == "CCD_EXPOSURE":
# take first exposure
self.takeExposure()
def removeProperty(self, p):
#self.logger.info("remove property "+ p.getName() + " for device "+ p.getDeviceName())
pass
def newBLOB(self, bp):
self.logger.info("new BLOB "+ bp.name.decode())
# get image data
img = bp.getblobdata()
import cStringIO
# write image data to StringIO buffer
blobfile = cStringIO.StringIO(img)
# open a file and save buffer to disk
with open("frame.fit", "wb") as f:
f.write(blobfile.getvalue())
# start new exposure for timelapse images!
# self.takeExposure()
# disconnect from server
self.disconnectServer()
def newSwitch(self, svp):
self.logger.info ("new Switch "+ svp.name.decode() + " for device "+ svp.device.decode())
def newNumber(self, nvp):
self.logger.info("new Number "+ nvp.name.decode() + " for device "+ nvp.device.decode())
def newText(self, tvp):
self.logger.info("new Text "+ tvp.name.decode() + " for device "+ tvp.device.decode())
def newLight(self, lvp):
self.logger.info("new Light "+ lvp.name.decode() + " for device "+ lvp.device.decode())
def newMessage(self, d, m):
#self.logger.info("new Message "+ d.messageQueue(m).decode())
pass
def serverConnected(self):
print("Server connected ("+self.getHost()+":"+str(self.getPort())+")")
self.connected = True
def serverDisconnected(self, code):
self.logger.info("Server disconnected (exit code = "+str(code)+","+str(self.getHost())+":"+str(self.getPort())+")")
# set connected to False
self.connected = False
def takeExposure(self):
self.logger.info("<<<<<<<< Exposure >>>>>>>>>")
#get current exposure time
exp = self.device.getNumber("CCD_EXPOSURE")
# set exposure time to 5 seconds
exp[0].value = 5
# send new exposure time to server/device
self.sendNewNumber(exp)
logging.basicConfig(format='%(asctime)s %(message)s', level=logging.INFO)
if __name__ == '__main__':
# instantiate the client
indiclient=IndiClient()
# set indi server localhost and port 7624
indiclient.setServer("localhost",7624)
# connect to indi server
print("Connecting and waiting 2secs")
if (not(indiclient.connectServer())):
print("No indiserver running on "+indiclient.getHost()+":"+str(indiclient.getPort())+" - Try to run")
print(" indiserver indi_simulator_telescope indi_simulator_ccd")
sys.exit(1)
time.sleep(1)
# start endless loop, client works asynchron in background, loop stops after disconnect
while indiclient.connected:
time.sleep(1)
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.