×

INDI Library v1.9.7 Released (29 Jul 2022)

Bi-monthly INDI Library released with new drivers and bug fixes.

Switch rules

  • Posts: 18
  • Thank you received: 14

Switch rules was created by Romain Fafet

Hi,

I'm working on an INDI client for android. It uses the INDI for java library which behaves differently with the switch vectors and this causes different bugs. I'm trying to correct the Indi for Java behavior but I don't understand some things in the INDI API.

Here is an extract of the communication between Ekos and an indiserver running indi_lx200classic in simulation mode. I switch on and off the north button.

Sent by the client (switching on):
<newSwitchVector device="LX200 Classic" name="TELESCOPE_MOTION_NS">
    <oneSwitch name="MOTION_NORTH">
On
    </oneSwitch>
</newSwitchVector>

Answer from the driver:
<setSwitchVector device="LX200 Classic" name="TELESCOPE_MOTION_NS" state="Busy" timeout="60" timestamp="2014-08-06T20:12:53" message="Moving toward North.">
    <oneSwitch name="MOTION_NORTH">
On
    </oneSwitch>
    <oneSwitch name="MOTION_SOUTH">
Off
    </oneSwitch>
</setSwitchVector>

Then I switch off the north button:
<newSwitchVector device="LX200 Classic" name="TELESCOPE_MOTION_NS">
    <oneSwitch name="MOTION_NORTH">
On
    </oneSwitch>
</newSwitchVector>
<setSwitchVector device="LX200 Classic" name="TELESCOPE_MOTION_NS" state="Idle" timeout="60" timestamp="2014-08-06T20:12:56" message="Movement toward North halted.">
    <oneSwitch name="MOTION_NORTH">
Off
    </oneSwitch>
    <oneSwitch name="MOTION_SOUTH">
Off
    </oneSwitch>
</setSwitchVector>
It seems a bit strange to send the command newSwitchVector with the value On to turn Off the switch. An other strange thing I noticed is that all the switch vectors are defined with the OneOfMany rule even if all the switchs are off in normal operation (ie. north/south, west/east, abort motion). The AtMostOne rule seems more appropriated for those.

Why it is like this ? What should be the correct implementation for the driver and the client ?

Romain
Last edit: 8 years 2 days ago by Romain Fafet. Reason: Solved
8 years 1 week ago #1703

Please Log in or Create an account to join the conversation.

Replied by Jasem Mutlaq on topic Switch rules

You are correct, they should be defined as AtMostOne in the driver. However, most clients treat AtMostOne and OneOfMany as the same thing in the GUI (i.e. buttons) and they are set as the driver reports them (on/off). But the driver does indeed need to define such switches as AtMostOne to be protocol-compliant.

EDIT: I'm working on making libindi/kstars more complaint with respect to this regard.
Jasem Mutlaq
Support INDI & Ekos; Get StellarMate Astrophotography Gadget.
How to Submit Logs when you have problems?
Add your observatory info
Last edit: 8 years 1 week ago by Jasem Mutlaq.
8 years 1 week ago #1704

Please Log in or Create an account to join the conversation.

Replied by Jasem Mutlaq on topic Switch rules

Ok, both KStars & INDI are now compliant with ISR_ATMOST1 switch rule. Good luck in your Android client, let us know how it goes!
Jasem Mutlaq
Support INDI & Ekos; Get StellarMate Astrophotography Gadget.
How to Submit Logs when you have problems?
Add your observatory info
The following user(s) said Thank You: Romain Fafet
8 years 6 days ago #1708

Please Log in or Create an account to join the conversation.

  • Posts: 18
  • Thank you received: 14

Replied by Romain Fafet on topic Switch rules

Thanks, it solves my problem. I hope I will be able to release the client in a few weeks. To keep you waiting, here are a few screenshots.







The following user(s) said Thank You: Jasem Mutlaq
8 years 2 days ago #1725
Attachments:

Please Log in or Create an account to join the conversation.

Replied by Jasem Mutlaq on topic Switch rules

Very nice!! Would love to test it after your done! I guess it will be available in Google Play?
Jasem Mutlaq
Support INDI & Ekos; Get StellarMate Astrophotography Gadget.
How to Submit Logs when you have problems?
Add your observatory info
8 years 2 days ago #1727

Please Log in or Create an account to join the conversation.

Time to create page: 0.433 seconds