goToMain / libosdp

Implementation of IEC 60839-11-5 OSDP (Open Supervised Device Protocol); provides a C library with support for C++, Rust and Python3
https://libosdp.sidcha.dev
Apache License 2.0
128 stars 69 forks source link

Continue normally on successful command callback on status commands #174

Closed KaiAmelung closed 2 months ago

KaiAmelung commented 2 months ago

Seems like this is just a typo to me, unless I do not understand. Not sure why we would want to "fail to decode" when the command callback returns successfully.

Was noticing this:

reading: ffffffff5300080006676ebc (this log is from SerialChannel)
OSDP: PD-0: [2024-04-12T22:55:12Z] [WARN ] vendor/src/osdp_phy.c:521: Packet scan skipped 3 bytes before SoM
command received (from command callback)
OSDP: PD-0: [2024-04-12T22:55:12Z] [ERROR] vendor/src/osdp_pd.c:661: Failed to decode command: CMD(67) Len:0 ret:-2
OSDP: PD-0: [2024-04-12T22:55:12Z] [DEBUG] vendor/src/osdp_pd.c:669: CMD: RSTAT(67) REPLY: NAK(41)
writing: ff5380090006410224fa (this log is from SerialChannel)

when using a basic command callback like this (in Python):

def handle_command(self, command):
        print('command received')
        return 0, None