LionelDarras / PySimpleBGC

PySimpleBGC is a python project which aims to allow communication with Basecam Simple-BGC coontroller board
GNU General Public License v3.0
7 stars 8 forks source link

outgoing commands #3

Open maiermic opened 5 years ago

maiermic commented 5 years ago

There are no outgoing commands specified yet. How are they supposed to be specified?

All current commands have cmdbodysize of 0 and cmdfmt of ''. The property cmdfmt is never used. Further, setcmd takes cmddata as a string or at least the default value is ''. What is the format of this string? Shouldn't that be a request object that should be specified similar to respfields?

lweingart commented 3 years ago

Hello,

Apart from the setcmd command given in the examples here https://pysimplebgc.readthedocs.io/en/latest/ I can't get any other result. What I mean is, I can only make this command to work when the second argument is an empty string "". device.setcmd(SOMETHING, "") That means that I need to parse the result for each and every specific result I would need.

Isn't there any way to get a more specific result than getting each time the whole list of dictionaries ?

If someone has found how to use this more specifically, I would gladly hear how.

Thank you for your help

Best

maiermic commented 3 years ago

@lweingart FYI, I started implementing my own library in this project. Here is a code snippet on how to use it:

class Gimbal:
    # ...
    def send_message(self, message: Message):
        logger.debug(f'send message: {message}')
        self._connection.write(pack_message(message))
    # ...
    def get_angles(self) -> GetAnglesInCmd:
        self.send_message(create_message(CMD_GET_ANGLES))
        cmd = read_cmd(self._connection)
        assert cmd.id == CMD_GET_ANGLES
        return parse_cmd(cmd)
lweingart commented 3 years ago

Hey @maiermic, thank you very much for your link and for your work, I'll give it a try :-)

Cheers