Hello Community,
I'm a noob to rust and still finding my feet in development so please go easy on me.
I'm using gstreamer-rs bindings and receiving a bus message from an element 'dtmfdetect' in a simple appsrc pipeline.
The bus message is called dtmf-event
where the message is a char 0-15 decimal which corresponds to the DTMF tone detected in the audio stream. my dtmf array ('0,1,2,3,4,5,6,7,8,9,A,B,C,D,#,*')
I'd use a u8 however, I need to send so call dtmf digit as a u8 via a socket across a local network to a server app to process concatenate each u8 into a dtmf message buffer and on a 'VALID' message do something.
More detail:-
Each digit is added to a dtmf buffer and matched to see if there is a matching DTMF command. Once one is matched, a corresponding function fn(?) is executed.
The dtmf can be any thing from '#' clear buffer to xxx# through to xxxxxxx# hence message are acted apon with once receiving the '#' at the end of the buffer.
To make things a little more difficult, I need to have an inter dtmf digit timer to time-out and clear the buffer if the full dtmf command isn't received by (x seconds) assume 10 seconds?
- Has anyone done anything like this before and willing to show me how?
2.. Should I use a Vec<_> (vector) and slice as the dtmf buffer or should I opted with the dequeue crate to allow working with a buffer over threads?
Any comments welcome?
Sonny