TCL and C++ module development

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

TCL and C++ module development

alan-55
Hi Guys,

I'm looking at writing a module for controlling a radio and I'm just trying to understand the tie up between the cpp files and the tcl files.

Why the two different languages?? What is the best way of seperating the different parts of the code for module, ie which bits in c++ and which in TCL??

Thanks

Alan



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Svxlink-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/svxlink-devel
Reply | Threaded
Open this post in threaded view
|

Re: TCL and C++ module development

Tobias Blomberg
On Wednesday 30 August 2006 05:16, [hidden email] wrote:
> Hi Guys,
>
> I'm looking at writing a module for controlling a radio and I'm just trying
> to understand the tie up between the cpp files and the tcl files.
>
> Why the two different languages?? What is the best way of seperating the
> different parts of the code for module, ie which bits in c++ and which in
> TCL??

I introduced TCL as an advanced way of configuring SvxLink. I wanted the user
to have a way to configure the way the application behave on the radio
channel,  mostly in which order audio clips/tones should be played at a
certain event. It's an event handling subsystem. From the beginning, all
events was handled in C++ and the user had no way of affecting how events was
handled.

Later I introduced a way to write modules entirely in TCL. An example of this
is the voice mail module. This make it much easier to write modules for
SvxLink. Not all modules are suitable to write in TCL. Especially modules
that handle streaming audio (like EchoLink) cannot be written in TCL. Modules
that play sound clips, record sound clips and act on DTMF commands are very
suitable to write in TCL.

If you're going to write a C++ module, start with the template code in
svxlink/modules/template. A C++ module consists of the compiled C++ code and
a TCL event handling script. Event handlers in TCL are invoked from C++ using
the processEvent method. If you're going to control your radio via a serial
port there is a Async::Serial class that hide all the ugly details of Linux
serial port access.

For TCL modules you need only one file since the playFile, playTone etc
functions can be called directly. I plan to change this so that TCL modules
also require a separate event handling script. This will make the concept
cleaner and clearly indicate what is the module logic and what is the events.
This becomes especially important when a language pack (translation to
another language) is going to be created. Other languages might want to place
audio clips in another order. To write a TCL-module find the template at
svxlink/modules/tcl/Tcl.tcl.example or on an installed system
under /usr/share/svxlink/sounds/events.d. Of course, the ".example" extension
should be removed for the file to load.

A good place to start if you don't know any TCL is:

        http://www.tcl.tk/

and especially:

        http://www.tcl.tk/man/tcl8.5/tutorial/tcltutorial.html

Good luck!

73 de SM0SVX / Tobias

>
> Thanks
>
> Alan
>
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier Download IBM WebSphere Application Server v.1.0.1 based on Apache
> Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Svxlink-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/svxlink-devel

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Svxlink-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/svxlink-devel
Reply | Threaded
Open this post in threaded view
|

Re: TCL and C++ module development

alan-55
In reply to this post by alan-55
Thanks Tobias,

I did notice the serial port access, i can see how to write the data but not
quite sure on reading stuff back. I can see it's tied up with the async library
somehow. Could you give me a pointer??

Thanks

Alan

On Wednesday 30 August 2006 05:16, [hidden email] wrote:
> Hi Guys,
>
> I'm looking at writing a module for controlling a radio and I'm just trying
> to understand the tie up between the cpp files and the tcl files.
>
> Why the two different languages?? What is the best way of seperating the
> different parts of the code for module, ie which bits in c++ and which in
> TCL??

I introduced TCL as an advanced way of configuring SvxLink. I wanted the user
to have a way to configure the way the application behave on the radio
channel,  mostly in which order audio clips/tones should be played at a
certain event. It's an event handling subsystem. From the beginning, all
events was handled in C++ and the user had no way of affecting how events was
handled.

Later I introduced a way to write modules entirely in TCL. An example of this
is the voice mail module. This make it much easier to write modules for
SvxLink. Not all modules are suitable to write in TCL. Especially modules
that handle streaming audio (like EchoLink) cannot be written in TCL. Modules
that play sound clips, record sound clips and act on DTMF commands are very
suitable to write in TCL.

If you're going to write a C++ module, start with the template code in
svxlink/modules/template. A C++ module consists of the compiled C++ code and
a TCL event handling script. Event handlers in TCL are invoked from C++ using
the processEvent method. If you're going to control your radio via a serial
port there is a Async::Serial class that hide all the ugly details of Linux
serial port access.

For TCL modules you need only one file since the playFile, playTone etc
functions can be called directly. I plan to change this so that TCL modules
also require a separate event handling script. This will make the concept
cleaner and clearly indicate what is the module logic and what is the events.
This becomes especially important when a language pack (translation to
another language) is going to be created. Other languages might want to place
audio clips in another order. To write a TCL-module find the template at
svxlink/modules/tcl/Tcl.tcl.example or on an installed system
under /usr/share/svxlink/sounds/events.d. Of course, the ".example" extension
should be removed for the file to load.

A good place to start if you don't know any TCL is:

        http://www.tcl.tk/

and especially:

        http://www.tcl.tk/man/tcl8.5/tutorial/tcltutorial.html

Good luck!

73 de SM0SVX / Tobias

>
> Thanks
>
> Alan
>



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Svxlink-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/svxlink-devel
Reply | Threaded
Open this post in threaded view
|

Re: TCL and C++ module development

Tobias Blomberg
On Wednesday 30 August 2006 12:40, [hidden email] wrote:
> Thanks Tobias,
>
> I did notice the serial port access, i can see how to write the data but
> not quite sure on reading stuff back. I can see it's tied up with the async
> library somehow. Could you give me a pointer??

Start here:

        http://svxlink.sourceforge.net/doc/async/html/index.html

The serial class is documented here:

        http://svxlink.sourceforge.net/doc/async/html/classAsync_1_1Serial.html

/ Tobias

>
> Thanks
>
> Alan
>
> On Wednesday 30 August 2006 05:16, [hidden email] wrote:
> > Hi Guys,
> >
> > I'm looking at writing a module for controlling a radio and I'm just
> > trying to understand the tie up between the cpp files and the tcl files.
> >
> > Why the two different languages?? What is the best way of seperating the
> > different parts of the code for module, ie which bits in c++ and which in
> > TCL??
>
> I introduced TCL as an advanced way of configuring SvxLink. I wanted the
> user to have a way to configure the way the application behave on the radio
> channel,  mostly in which order audio clips/tones should be played at a
> certain event. It's an event handling subsystem. From the beginning, all
> events was handled in C++ and the user had no way of affecting how events
> was handled.
>
> Later I introduced a way to write modules entirely in TCL. An example of
> this is the voice mail module. This make it much easier to write modules
> for SvxLink. Not all modules are suitable to write in TCL. Especially
> modules that handle streaming audio (like EchoLink) cannot be written in
> TCL. Modules that play sound clips, record sound clips and act on DTMF
> commands are very suitable to write in TCL.
>
> If you're going to write a C++ module, start with the template code in
> svxlink/modules/template. A C++ module consists of the compiled C++ code
> and a TCL event handling script. Event handlers in TCL are invoked from C++
> using the processEvent method. If you're going to control your radio via a
> serial port there is a Async::Serial class that hide all the ugly details
> of Linux serial port access.
>
> For TCL modules you need only one file since the playFile, playTone etc
> functions can be called directly. I plan to change this so that TCL modules
> also require a separate event handling script. This will make the concept
> cleaner and clearly indicate what is the module logic and what is the
> events. This becomes especially important when a language pack (translation
> to another language) is going to be created. Other languages might want to
> place audio clips in another order. To write a TCL-module find the template
> at svxlink/modules/tcl/Tcl.tcl.example or on an installed system
> under /usr/share/svxlink/sounds/events.d. Of course, the ".example"
> extension should be removed for the file to load.
>
> A good place to start if you don't know any TCL is:
>
> http://www.tcl.tk/
>
> and especially:
>
> http://www.tcl.tk/man/tcl8.5/tutorial/tcltutorial.html
>
> Good luck!
>
> 73 de SM0SVX / Tobias
>
> > Thanks
> >
> > Alan
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier Download IBM WebSphere Application Server v.1.0.1 based on Apache
> Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Svxlink-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/svxlink-devel

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Svxlink-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/svxlink-devel