Staff Assigned: Adam Robichaud Integrating dlapi in .NET application

Discussion in 'Scripting and Programming' started by Elizabeth, May 11, 2020.

  1. Elizabeth

    Elizabeth Standard User

    Joined:
    Mar 11, 2015
    Messages:
    30
    Location:
    Chantilly, VA
    Hello,

    I am using (referencing) the DLAPIWrapperLib in my .net application. Would you have an example on how to integrate dlapi into a Visual Studio .net project?

    So far, I was doing the following. I got to load dlapi.dll and get a handle to the getGateway process. Not sure what kind of type of object should I expect after getting an address by calling getGateway. According to sample application in cpp, I should get IGatewayPtr. These pointers need some marshaling technique and I am not finding the right one, getting exception error on the attempts I tried.

    Thank you,
    Elizabeth
     
  2. Colin Haig

    Colin Haig Staff Member

    Joined:
    Oct 27, 2014
    Messages:
    3,453
  3. Adam Robichaud

    Adam Robichaud Staff Member

    Joined:
    Sep 29, 2014
    Messages:
    775
    Location:
    Ottawa
    I don't have an example handy. We only developed DLAPIWrapper as a shim between DLAPI and the ASCOM driver, and as the ASCOM Platform is fully documented we never intended to document it. That said, in a .NET environment, you would make a new DLGateway instance, use the DLGateway::QueryCameras() method to perform camera discovery, then use the various DLGateway::Get[USB/Net]Camera() methods to retrieve the DLCamera instance of your choice, and DLGateway::[USB/Net]CameraCount properties to find out how many of the cameras were discovered. Much of the DLAPI interface classes are reflected one-to-one (though we serialized the interface so all the queryProperty() methods are called in their respective accessor). You should be able to reverse engineer the rest given that—but advise either writing your own .NET wrapper (if you need a custom interface), or making use of the ASCOM driver since the platform is very well documented.
     
  4. Elizabeth

    Elizabeth Standard User

    Joined:
    Mar 11, 2015
    Messages:
    30
    Location:
    Chantilly, VA
    Thank you, Adam. I will use your input and see how I'll get on with it.
     

Share This Page