mirror of
https://github.com/ggerganov/ggwave.git
synced 2026-04-20 05:06:32 +08:00
@@ -78,4 +78,14 @@ EMSCRIPTEN_BINDINGS(ggwave) {
|
|||||||
|
|
||||||
return std::string();
|
return std::string();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
emscripten::function("disableLog", emscripten::optional_override(
|
||||||
|
[]() {
|
||||||
|
ggwave_setLogFile(NULL);
|
||||||
|
}));
|
||||||
|
|
||||||
|
emscripten::function("enableLog", emscripten::optional_override(
|
||||||
|
[]() {
|
||||||
|
ggwave_setLogFile(stderr);
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -47,3 +47,5 @@ cdef extern from "ggwave.h" nogil:
|
|||||||
const char * dataBuffer,
|
const char * dataBuffer,
|
||||||
int dataSize,
|
int dataSize,
|
||||||
char * outputBuffer);
|
char * outputBuffer);
|
||||||
|
|
||||||
|
void ggwave_setLogFile(void * fptr);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
cimport cython
|
cimport cython
|
||||||
|
|
||||||
|
from libc.stdio cimport stderr
|
||||||
from cpython.mem cimport PyMem_Malloc, PyMem_Free
|
from cpython.mem cimport PyMem_Malloc, PyMem_Free
|
||||||
|
|
||||||
import re
|
import re
|
||||||
@@ -62,3 +63,9 @@ def decode(instance, waveform):
|
|||||||
return coutput[0:rxDataLength]
|
return coutput[0:rxDataLength]
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def disableLog():
|
||||||
|
cggwave.ggwave_setLogFile(NULL);
|
||||||
|
|
||||||
|
def enableLog():
|
||||||
|
cggwave.ggwave_setLogFile(stderr);
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ import ggwave
|
|||||||
|
|
||||||
testFailed = False
|
testFailed = False
|
||||||
|
|
||||||
|
ggwave.disableLog()
|
||||||
|
ggwave.enableLog()
|
||||||
|
|
||||||
samples = ggwave.encode("hello python")
|
samples = ggwave.encode("hello python")
|
||||||
|
|
||||||
if not (samples):
|
if not (samples):
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
import sys
|
import sys
|
||||||
import ggwave
|
import ggwave
|
||||||
|
|
||||||
|
# optionally disable logging
|
||||||
|
#ggwave.disableLog()
|
||||||
|
|
||||||
# create ggwave instance with default parameters
|
# create ggwave instance with default parameters
|
||||||
instance = ggwave.init()
|
instance = ggwave.init()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user