mirror of
https://github.com/ggerganov/ggwave.git
synced 2026-03-23 20:31:00 +08:00
c-api : add toggleRxProtocol() (#60)
This function allows to enable/disable Rx protocols during the decoding process. This is useful when the Tx/Rx protocol is known in advance.
This commit is contained in:
@@ -17,3 +17,17 @@ res = ggwave.decode(instance, waveform)
|
||||
|
||||
if res != payload.encode():
|
||||
sys.exit(1)
|
||||
|
||||
# disable the Rx protocol - the decoding should fail
|
||||
ggwave.toggleRxProtocol(instance, rxProtocolId = 1, state = 0)
|
||||
res = ggwave.decode(instance, waveform)
|
||||
|
||||
if res != None:
|
||||
sys.exit(1)
|
||||
|
||||
# re-enable the Rx protocol - the decoding should succeed
|
||||
ggwave.toggleRxProtocol(instance, rxProtocolId = 1, state = 1)
|
||||
res = ggwave.decode(instance, waveform)
|
||||
|
||||
if res != payload.encode():
|
||||
sys.exit(1)
|
||||
|
||||
Reference in New Issue
Block a user