LowellObservatory / CCD-INDI

Prototyping area for testing the use of the INDI Protocol to communicate with ARC cameras/controllers.
0 stars 0 forks source link

Construct DTD, XML Skeleton File, Property Reader for LoCam. #1

Open dyerlytle opened 5 years ago

dyerlytle commented 5 years ago

We need a way to construct a set of properties for an ARC Camera Server/Driver using the INDI protocol. The example DTD contained in Elwood Downy's document, "INDI: Instrument-Neutral Distributed Interface" will not work as written with a DTD (I am using "lxml" in python to read, validate, and interpret a test XML skeleton file). This "issue" will provide a place to document progress on this issue as well a place for possible discussion.

astrobokonon commented 5 years ago

Take a look at https://github.com/LowellObservatory/Camelot/blob/master/IWalkTheLine/interloper.py and specifically the constructCMDPacket function to see if that is suitable for now. The gist of it is that I generate the packet by specifying the root/base tag, and then generate an (ordered) dict of the actual contents. That ordered dict is then magically un-dicted and turned into an XML object via xmltodict.unparse() which is then sent across the broker.

On the other side, I parse the packet from the broker using a custom listener (https://github.com/LowellObservatory/Camelot/blob/master/IWalkTheLine/listener.py) that routes the topic to a parser, which unpacks it using the python package xmlschema using the schema at https://github.com/LowellObservatory/ligmos/blob/master/ligmos/schemas/MrFreeze.cmd.xsd.

I actually made the unparsed packet, then used https://github.com/wiztools/xsd-gen/releases to generate the schema and adjust it as needed, mostly because I'm super lazy.