ASCOM Remote - Alpaca Camera - Base64 Handoff

Post Reply
Behoolder
Posts: 4
Joined: Sun Jan 02, 2022 9:56 pm

ASCOM Remote - Alpaca Camera - Base64 Handoff

#1

Post by Behoolder »

Hi there,

I am currently using Sharpcap Pro version 4.0.9478.

I was trying to develop camera driver with ASCOM remote - Alpaca REST API.
It goes great for most of functions except maybe most important: ImageArray

I can see that - after some initial setup of camera - Sharpcap is sending ImageArray GET request with header including 'BASE64HANDOFF': 'true'.
That means - according to what I understand from this document:
https://github.com/ASCOMInitiative/ASCO ... ration.pdf
- it is ready to accept special two step procedure in which I should first response with something like that (example values)

Code: Select all

                
                "Type": 2,
                "Rank": 2,
                "Dimension0Length": 1280,
                "Dimension1Length": 960,
                "Dimension2Length": 0,
                "ClientTransactionID": 321,
                "ServerTransactionID": 123,
                "ErrorNumber": 0
                "ErrorMessage": ""
                
Response should also have BASE64HANDOFF = true header set, so I set it.

After that I would except Sharpcap should request another GET for endpoint imagearraybase64.

Now what I see is that I do not get this second call for imagearraybase64, but after sending my response Sharpcap is giving me error:

Code: Select all

System.NullReferenceException: 
   in ASCOM.DriverAccess.MemberFactory.CallMember(Int32 memberCode, String memberName, Type[] parameterTypes, Object[] parms) in C:\ASCOM Build\Export\ASCOM.DriverAccess\MemberFactory.cs
   in ASCOM.DriverAccess.Camera.get_ImageArray()
It seems like it whines about missing Value parameter, but if I provide it (in any way) then there is still an error:

Code: Select all

ASCOM.DriverException: CheckDotNetExceptions ASCOM.Remote1.Camera ImageArray Get System.Exception: Unexpected token when deserializing multidimensional array: Integer. Path 'Value[0]', line 1, position 202. (See Inner 
Now I would expect that it should not need or use Value argument according to ASCOM documents, because I used BASE64HANDOFF header, and response like I posted should suffice. From my observation however Sharpcap acts like it is ignoring it and trying to obtain image with old, slow, json-serialized array of integers.
Can you help me? I think I may be missing something...
User avatar
admin
Site Admin
Posts: 13347
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: ASCOM Remote - Alpaca Camera - Base64 Handoff

#2

Post by admin »

Hi,

SharpCap 4.0 has no direct support for Alpaca in it, so everything that you see is a translation (by ASCOM, I guess) of normal ASCOM camera requests that SharpCap is sending. That means that I'm afraid I've never even heard of the BASE64HANDOFF or the request for imageArrayBase64 - as far as my code is concerned, I just ask an ASCOM driver for the ImageArray (which should come back as an array of integers).

However...

SharpCap 4.1 beta now includes the new ASCOM client libraries, which do include support for Alpaca. SharpCap will detect both local ASCOM cameras and Alpaca servers running the normal discovery port of 32227. Alpaca devices should show up in SharpCap for all supported device types (Camera,Mount,Wheel, Focuser, Rotator). I've personally only tested with a local test Alpaca server, but it seemed to work fine.

You can find the beta downloads here : https://www.sharpcap.co.uk/sharpcap/sha ... p-4-1-beta

cheers,

Robin
Behoolder
Posts: 4
Joined: Sun Jan 02, 2022 9:56 pm

Re: ASCOM Remote - Alpaca Camera - Base64 Handoff

#3

Post by Behoolder »

Oh, OK, now I see.
After some more investigation I've found that the header "base64handoff" was not added by Sharpcap, but somehow it is amended into request by Alpaca Remote Server itself. So please forgive me my false accusations :)

Now, while we are at it, it could be more than beneficial to introduce this as a feature to SharpCap. It gives about 8x faster image download time for ASCOM cameras handling that. Even faster is newest Alpaca standard - ImageBytes:
https://www.ascom-standards.org/Develop ... eBytes.pdf
, but seems to be bleeding edge rigth now - I mean, as for ASCOM, because it is around for over 1.5years now :)
User avatar
admin
Site Admin
Posts: 13347
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: ASCOM Remote - Alpaca Camera - Base64 Handoff

#4

Post by admin »

Hi,

hopefully even that should happen at a level below SharpCap in the Alpaca client libraries - this is the library I am using in SharpCap 4.1, and hopefully it will use the most efficient way to transfer (and if not, I expect the ASCOM devs will fix it in time) : https://github.com/ASCOMInitiative/ASCO ... ca.Clients

cheers,

Robin
Post Reply