mirror of
https://github.com/ggerganov/ggwave.git
synced 2026-03-31 01:26:49 +08:00
ggwave : big refactoring / renaming
This commit is contained in:
@@ -10,7 +10,7 @@ instance = ggwave.init()
|
||||
payload = 'hello python'
|
||||
|
||||
# generate audio waveform for string "hello python"
|
||||
waveform = ggwave.encode(payload, txProtocolId = 1, volume = 20, instance = instance)
|
||||
waveform = ggwave.encode(payload, protocolId = 1, volume = 20, instance = instance)
|
||||
|
||||
# decode the audio waveform back to text
|
||||
res = ggwave.decode(instance, waveform)
|
||||
@@ -19,15 +19,23 @@ 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)
|
||||
ggwave.rxToggleProtocol(protocolId = 1, state = 0)
|
||||
instanceTmp = ggwave.init()
|
||||
|
||||
res = ggwave.decode(instanceTmp, 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)
|
||||
ggwave.free(instanceTmp);
|
||||
|
||||
# re-enable the Rx protocol - the decoding should succeed
|
||||
ggwave.rxToggleProtocol( protocolId = 1, state = 1)
|
||||
instanceTmp = ggwave.init()
|
||||
|
||||
res = ggwave.decode(instance, waveform)
|
||||
if res != payload.encode():
|
||||
sys.exit(1)
|
||||
|
||||
ggwave.free(instanceTmp);
|
||||
|
||||
ggwave.free(instance);
|
||||
|
||||
Reference in New Issue
Block a user