Hello Ken,
actual Information via testing:
Request Headers:
{‘Content-type’: ‘application/json’}
JSON Data:
b’{“ExposureLength”: 1, “Width”: 1, “FrameType”: “Light”, “Height”: 1, “Gain”: “High”, “Speed”: “HiSpeed”, “BinningMode”: 1, “X”: 0, "Y ": 0, “IsoMode”: 0, “Path”: “c:\\Users\\mw\\PycharmProjects\\mount\\test.fits”, “UseSubframe”: false}’
Full Url:
‘http://localhost:59590/json/reply/SgCaptureImage’
Python code from wrapper:
def SgCaptureImage(self, binningMode=1, isoMode=0, exposureLength=1,
gain=‘High’, speed=‘Normal’, frameType=‘Light’,
path=‘’, useSubframe=False, posX=0, posY=0,
width=1, height=1):
# reference {“BinningMode”:0,“IsoMode”:0,“ExposureLength”:0,“Gain”:“String”,“Speed”:“Normal”,“FrameType”:“Light”,
# reference “Path”:“String”,“UseSubframe”:false,“X”:0,“Y”:0,“Width”:0,“Height”:0}
data = {“BinningMode”: binningMode, “IsoMode”: isoMode, “ExposureLength”: exposureLength, “Gain”: gain,
“Speed”: speed,
“FrameType”: frameType, “Path”: path, “UseSubframe”: useSubframe, “X”: posX, "Y ": posY, “Width”: width,
“Height”: height}
try:
req = request.Request(self.ipSGPro + self.captureImagePath, data=bytes(json.dumps(data).encode(‘utf-8’)), method=‘POST’)
req.add_header(‘Content-Type’, ‘application/json’)
with request.urlopen(req) as f:
captureResponse = json.loads(f.read().decode(‘utf-8’))
# {“Success”:false,“Message”:“String”,“Receipt”:“00000000000000000000000000000000”}
return captureResponse[‘Success’], captureResponse[‘Message’], captureResponse[‘Receipt’]
except Exception as e:
return False, ‘Request failed’, ‘’
I don’t get any error message in ‘Message’ field and a ‘Success’ of True. So no hint what’s going wrong.
Attached the test I do:
print(cam.SgGetDeviceStatus(‘Camera’))
print(cam.SgGetDeviceStatus(‘PlateSolver’))
print(cam.SgGetCameraProps())
print(time.ctime())
success, message, receipt = cam.SgCaptureImage(1, 0, 1, ‘High’, ‘HiSpeed’, ‘Light’, ‘c:\Users\mw\PycharmProjects\mount\test.fits’)
print(success,message,receipt)
while True: # waiting for the image download before proceeding
success, imagepath = cam.SgGetImagePath(receipt)
if success:
break
else:
time.sleep(0.1)
print(success, imagepath)
print(time.ctime())
and the actual output to this:
(True, ‘CAPTURING’)
(True, ‘IDLE’)
(True, ‘Success’, 3388, 2712, True)
Mon Oct 3 15:08:35 2016
True Image capture started successfully. 9bbc794449f84b7e9bae63131953549a
True c:\Users\mw\PycharmProjects\mount\test-3.fit
Mon Oct 3 15:08:47 2016
So it takes about 22 seconds to get this image. The only point I can guess, that the key/value pairs are not written correctly for some reason. I try to check this out !
BTW: The camera status is also not correct all the time. Actually it says ‘CAPTURING’ which is definitely not true. If you do an image, you might get ‘IDLE’, which is the correct state. No imaging on GUI during that time.
Michel